home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / etc / init.d / hotkey-setup < prev    next >
Encoding:
Text File  |  2009-04-06  |  917 b   |  56 lines

  1. #!/bin/sh
  2. ### BEGIN INIT INFO
  3. # Provides:          hotkey-setup
  4. # Required-Start:    $remote_fs $syslog
  5. # Required-Stop:     $remote_fs $syslog
  6. # Default-Start:     2 3 4 5
  7. # Default-Stop:      1
  8. # Short-Description: Set up laptop keys to generate keycodes.
  9. ### END INIT INFO
  10.  
  11. test -x /usr/sbin/dumpkeycodes || exit 0
  12.  
  13. xorg_driver() {
  14.     vendor=$(lspci | grep VGA | head -1)
  15.     case $vendor in
  16.     *Intel*)
  17.         driver=intel
  18.         ;;
  19.     *AMD*|*ATI*)
  20.         driver=ati
  21.         ;;
  22.     esac
  23.     echo $driver
  24. }
  25.  
  26. do_video () {
  27.     VIDEO=`xorg_driver`
  28.     case $VIDEO in
  29.     intel|ati)
  30.         for x in /proc/acpi/video/*/DOS; do
  31.         if [ -e "$x" ]; then
  32.             echo -n 7 >$x;
  33.         fi
  34.         done
  35.     ;;
  36.     esac
  37. }
  38.  
  39. case "$1" in
  40.     start)
  41.  
  42. # This entire block does nothing on desktops right now
  43.     if laptop-detect; then
  44.  
  45.     do_video
  46.  
  47.     fi
  48.     ;;
  49.     restart|force-reload)
  50.     $0 stop || true
  51.     $0 start
  52.     ;;
  53. esac
  54.  
  55. exit 0
  56.