home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2006 November (DVD) / PCWELT_11_2006.ISO / casper / filesystem.squashfs / etc / init.d / hotkey-setup < prev    next >
Encoding:
Text File  |  2006-04-29  |  2.2 KB  |  122 lines

  1. #!/bin/bash
  2.  
  3. manufacturer=`dmidecode --string system-manufacturer`
  4. name=`dmidecode --string system-product-name`
  5. version=`dmidecode --string system-version`
  6.  
  7. SAVED_STATE=/var/run/hotkey-setup
  8. THINKPAD_LOCKFILE=$SAVED_STATE.thinkpad-keys
  9.  
  10. # This is here because it needs to be executed both if we have a
  11. # Lenovo that also IDs as a ThinkPad, or if we have a real IBM one.
  12. do_thinkpad () {
  13.     . /usr/share/hotkey-setup/ibm.hk
  14.     if [ -x /usr/sbin/thinkpad-keys ]; then
  15.     if [ ! -c /dev/input/uinput ]; then
  16.         modprobe uinput
  17.     fi
  18.     if [ ! -b /dev/nvram ]; then
  19.         modprobe nvram
  20.     fi
  21.     /usr/sbin/thinkpad-keys && touch $THINKPAD_LOCKFILE
  22.     fi
  23. }
  24.  
  25. case "$1" in
  26.     start)
  27.  
  28.     /usr/sbin/dumpkeycodes >$SAVED_STATE
  29.     
  30.     if [ $? -gt 0 ]; then
  31.     rm -f $SAVED_STATE
  32.     fi
  33.  
  34.     . /usr/share/hotkey-setup/key-constants
  35.  
  36.     case "$manufacturer" in
  37.     Acer*)
  38.     . /usr/share/hotkey-setup/acer.hk
  39.     case "$name" in
  40.         Aspire\ 16*)
  41.         . /usr/share/hotkey-setup/acer-aspire-1600.hk
  42.         ;;
  43.     esac
  44.     ;;
  45.  
  46.     ASUS*)
  47.     . /usr/share/hotkey-setup/asus.hk
  48.     ;;
  49.  
  50.     Compaq*)
  51.     case "$name" in
  52.         Armada*E500*)
  53.         . /usr/share/hotkey-setup/compaq.hk
  54.         ;;
  55.     esac
  56.     ;;
  57.  
  58.     Dell*)
  59.     . /usr/share/hotkey-setup/dell.hk
  60.     ;;
  61.  
  62.     Hewlett-Packard*)
  63.     # Load this _first_, so that it can be overridden
  64.     . /usr/share/hotkey-setup/hp.hk
  65.     case "$name" in
  66.         # Please open a bug if uncommenting these "Presario" entries works for you...
  67.         #*Presario\ V2000*)
  68.         #. /usr/share/hotkey-setup/hp-v2000.hk
  69.         #;;
  70.         *Tablet*)
  71.         . /usr/share/hotkey-setup/hp-tablet.hk
  72.         ;;
  73.     esac
  74.     ;;
  75.  
  76.     IBM*)
  77.     do_thinkpad
  78.     ;;
  79.  
  80.     LENOVO*)
  81.     case "$version" in
  82.         *ThinkPad*)
  83.         do_thinkpad
  84.         ;;
  85.     esac
  86.     ;;
  87.     
  88.     MEDION*)
  89.     case "$name" in
  90.         *FID2060*)
  91.         . /usr/share/hotkey-setup/medion-md6200.hk
  92.         ;;
  93.     esac
  94.     ;;
  95.  
  96.     Samsung*)
  97.     . /usr/share/hotkey-setup/samsung.hk
  98.     ;;
  99.  
  100.     Sony*)
  101.     modprobe sonypi; # Needed to get hotkey events
  102.     ;;
  103.  
  104.     *)
  105.     . /usr/share/hotkey-setup/default.hk    
  106.     esac
  107.     . /usr/share/hotkey-setup/generic.hk
  108.     ;;
  109.     stop)
  110.     if [ -f $THINKPAD_LOCKFILE ]; then
  111.         kill `pidof thinkpad-keys` && rm -f $THINKPAD_LOCKFILE
  112.     fi
  113.     if [ -f $SAVED_STATE ]; then
  114.         setkeycodes $(cat $SAVED_STATE)
  115.     fi
  116.     ;;
  117.     restart|force-reload)
  118.     $0 stop || true
  119.     $0 start
  120.     ;;
  121. esac
  122.