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-get-brightness-linux < prev    next >
Text File  |  2010-05-09  |  2KB  |  71 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.     value="`hal-system-power-pmu getlcd`"
  12.     if [ $? -ne 0 ]; then
  13.         echo "org.freedesktop.Hal.Device.LaptopPanel.NotSupported" >&2
  14.         echo "hal-system-power-pmu getlcd returned != 0" >&2
  15.         exit 1
  16.     fi
  17.     exit ${value}
  18. elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "sonypi" ]; then
  19.     value="`hal-system-sonypic getlcd`"
  20.     if [ $? -ne 0 ]; then
  21.         echo "org.freedesktop.Hal.Device.LaptopPanel.NotSupported" >&2
  22.         echo "hal-system-sonypic getlcd returned != 0" >&2
  23.         exit 1
  24.     fi
  25.     exit ${value}
  26. fi
  27.  
  28. # Check for file existance and that it's readable
  29. if [ ! -r $HAL_PROP_LINUX_ACPI_PATH ]; then
  30.     echo "org.freedesktop.Hal.Device.LaptopPanel.NotSupported" >&2
  31.     echo "$HAL_PROP_LINUX_ACPI_PATH not readable!" >&2
  32.     exit 1
  33. fi
  34.  
  35. if [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "toshiba" ]; then
  36.     # cat /proc/acpi/toshiba/lcd
  37.     #  brightness:              5
  38.     #  brightness_levels:       8
  39.     value="`cat $HAL_PROP_LINUX_ACPI_PATH | grep brightness: | awk '{print $2;}'`"
  40. elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "asus" ]; then
  41.     # cat /proc/acpi/asus/brn
  42.     #  5
  43.     value="`cat $HAL_PROP_LINUX_ACPI_PATH`"
  44. elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "panasonic" ]; then
  45.     # cat /proc/acpi/pcc/brightness
  46.     #  5
  47.     read value < $HAL_PROP_LINUX_ACPI_PATH
  48.     value=$[($value-51)/13]
  49. elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "ibm" ]; then
  50.     # cat /proc/acpi/ibm/brightness
  51.     #  level:          5
  52.     #  commands:       up, down
  53.     #  commands:       level <level> (<level> is 0-7)
  54.     value="`cat $HAL_PROP_LINUX_ACPI_PATH | grep level: | awk '{print $2;}'`"
  55. elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "sony" ]; then
  56.     # cat /proc/acpi/sony/brightness
  57.     #  5
  58.     value="`cat $HAL_PROP_LINUX_ACPI_PATH`"
  59.     value=$(($value-1))
  60. elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "omnibook" ]; then
  61.     # cat /proc/omnibook/lcd
  62.     #  LCD brightness:  7
  63.     value="`cat $HAL_PROP_LINUX_ACPI_PATH | awk '{print $3;}'`"
  64. else
  65.     echo "org.freedesktop.Hal.Device.LaptopPanel.NotSupported" >&2
  66.     echo "No ACPI method found" >&2
  67.     exit 1
  68. fi
  69.  
  70. exit ${value}
  71.