Skip to content

Instantly share code, notes, and snippets.

@smathot
Created January 1, 2012 15:23
Show Gist options
  • Select an option

  • Save smathot/1547591 to your computer and use it in GitHub Desktop.

Select an option

Save smathot/1547591 to your computer and use it in GitHub Desktop.
Script to fix backlight issue (dark screen) for HP g62 laptop on Ubuntu 11.10
#!/bin/bash
# Fix the backlight issue on Ubuntu 11.10 for
# a HP G62 laptop. Add this script to the startup
# applications. In addition, make sure to make
# /sys/class/backlight/intel_backlight
# world-writable (chmod 777), for example
# in /etc/rc.local
#
# Examples:
#
# Set backlight to max:
# ./backlight
#
# Sleep for 10 seconds before setting backlight
# to max:
# ./backlight sleep 10
#
# Turn up backlight:
# ./backlight up
#
# Turn down backlight:
# ./backlight down
LOC=/sys/class/backlight/intel_backlight
if [ $# == 0 ]; then
echo 'MAX'
cat $LOC/max_brightness > $LOC/brightness
elif [ $1 == 'sleep' ]; then
sleep $2
echo 'MAX'
cat $LOC/max_brightness > $LOC/brightness
elif [ $1 == 'up' ]; then
echo $[ `cat $LOC/brightness` + 256 ] > $LOC/brightness
echo 'UP'
elif [ $1 == 'down' ]; then
echo $[ `cat $LOC/brightness` - 256 ] > $LOC/brightness
echo 'DOWN'
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment