home *** CD-ROM | disk | FTP | other *** search
/ tusportal.tus.k12.pa.us / tusportal.tus.k12.pa.us.tar / tusportal.tus.k12.pa.us / Wyse / latest-image.raw / 0.img / usr / lib / hal / scripts / linux / hal-system-lcd-set-brightness-linux < prev    next >
Text File  |  2010-05-09  |  2KB  |  65 lines

  1. #!/bin/sh
  2. #
  3. # Copyright (C) 2005 Richard Hughes <richard@hughsie.com>
  4. #
  5. # This program is free software; you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation; either version 2 of the License, or
  8. # (at your option) any later version.
  9.  
  10. if [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "pmu" ]; then
  11.     hal-system-power-pmu setlcd $value
  12.     if [ $? -ne 0 ]; then
  13.         echo "org.freedesktop.Hal.Device.LaptopPanel.NotSupported" >&2
  14.         echo "hal-system-power-pmu setlcd returned != 0" >&2
  15.         exit 1
  16.     fi
  17.     exit 0
  18. elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "sonypi" ]; then
  19.     hal-system-sonypic setlcd $value
  20.     if [ $? -ne 0 ]; then
  21.         echo "org.freedesktop.Hal.Device.LaptopPanel.NotSupported" >&2
  22.         echo "hal-system-sonypic setlcd returned != 0" >&2
  23.         exit 1
  24.     fi
  25.     exit 0
  26. fi
  27.  
  28. # Check for file existance and that it's writable
  29. if [ ! -w $HAL_PROP_LINUX_ACPI_PATH ]; then
  30.     echo "org.freedesktop.Hal.Device.LaptopPanel.NotSupported" >&2
  31.     echo "$1 not writable!" >&2
  32.     exit 1
  33. fi
  34.  
  35. if [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "toshiba" ]; then
  36.     # echo "brightness: {0..x}" >/proc/acpi/toshiba/lcd
  37.     echo "brightness: $value" > $HAL_PROP_LINUX_ACPI_PATH
  38. elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "asus" ]; then
  39.     # echo {0..15} > /proc/acpi/asus/brn
  40.     # http://www.taupro.com/wiki/ChemBook/LCDdisplayPowerConfiguration
  41.     echo "$value" > $HAL_PROP_LINUX_ACPI_PATH
  42. elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "panasonic" ]; then
  43.     # echo {0..15} > /proc/acpi/pcc/brightness
  44.     # http://readlist.com/lists/vger.kernel.org/linux-kernel/7/36405.html
  45.     echo "$[($value*136)/10+51]" > $HAL_PROP_LINUX_ACPI_PATH
  46. elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "ibm" ]; then
  47.     # echo "level {0..7}" > /proc/acpi/ibm/brightness
  48.     # http://ibm-acpi.sourceforge.net/README
  49.     echo "level $value" > $HAL_PROP_LINUX_ACPI_PATH
  50. elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "sony" ]; then
  51.     # echo "{1..8}" > /proc/acpi/sony/brightness
  52.     # http://popies.net/sonypi/2.6-sony_acpi4.patch
  53.     echo "$((value + 1))" > $HAL_PROP_LINUX_ACPI_PATH
  54. elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "omnibook" ]; then
  55.     # echo "{0..7} || {0...11}" > /proc/omnibook/lcd
  56.     # http://bugzilla.gnome.org/show_bug.cgi?id=331458
  57.     echo "$value" > $HAL_PROP_LINUX_ACPI_PATH
  58. else
  59.     echo "org.freedesktop.Hal.Device.LaptopPanel.NotSupported" >&2
  60.     echo "No ACPI method found" >&2
  61.     exit 1
  62. fi
  63.  
  64. exit 0
  65.