Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a hp pavilion g6 laptop. My keyboard has stopped working so I cannot use laptop keyboard to change the brightness. The issue is my brightness is set at 0 so I cannot see anything once ubuntu loads. I have attached an external keyboard via usb, I was wondering how can I change the brightness using the external keyboard. Is there a way. I cannot login or see anything once ubuntu is loaded its total dark on the login screen.

Any help is appreciated.

share|improve this question

migrated from stackoverflow.com Sep 23 '12 at 21:33

This question came from our site for professional and enthusiast programmers.

1 Answer 1

I would recommend that you create a script that changes the brightness and sets up Gnome keyboard shortcuts (assuming that you are using Gnome/Cinnamon) that will activate that script for you.

I have my script set like this:

#!/bin/bash
echo $1 > /sys/class/backlight/acpi_video0/brightness

It will get the number called when the script is executed as root/sudo/gksu and set it as the brightness. The number can vary from 0 to 15, but I think this can vary from display to display if my memory is not misleading me.

For setting the brightness, you can either call the scripts with different numbers and many keys on the keyboard (lazy way \o/) or implement two for loops (smarter way).

These for loops could be called by the $1 parameter that inside a switch case will redirect to the for loop that increase or decrease the brightness (going from 0 to 15 and 15 to 0). Then you just set on keyboard shortcuts two keys that will call the parameter to each for in the switch/if case.


If you need more control to the "brightness" you can use this command instead, in the same way as above:

/sys/class/backlight/intel_backlight/brightness

This varies from 0 to 4000 (or something near that) and actually controls the back-light, putting your display with really no light when set to zero.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.