文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>x86 asus brightness

x86 asus brightness

时间:2009-07-23  来源:fewlife

by tangke <[email protected]> 2009-07-23

1.lshal |grep backlight
udi = '/org/freedesktop/Hal/devices/computer_backlight'
  info.addons = {'hald-addon-generic-backlight'} (string list)
  info.subsystem = 'backlight'  (string)
  info.udi = '/org/freedesktop/Hal/devices/computer_backlight'  (string)
  linux.subsystem = 'backlight'  (string)
  linux.sysfs_path = '/sys/devices/virtual/backlight/asus-laptop'  (string)

2.get the whole information of '/org/freedesktop/Hal/devices/computer_backlight'

udi = '/org/freedesktop/Hal/devices/computer_backlight'
  info.addons = {'hald-addon-generic-backlight'} (string list)
  info.capabilities = {'laptop_panel'} (string list)
  info.category = 'laptop_panel'  (string)
  info.interfaces = {'org.freedesktop.Hal.Device.LaptopPanel'} (string list)
  info.parent = '/org/freedesktop/Hal/devices/computer'  (string)
  info.product = 'Generic Backlight Device'  (string)
  info.subsystem = 'backlight'  (string)
  info.udi = '/org/freedesktop/Hal/devices/computer_backlight'  (string)
  laptop_panel.access_method = 'general'  (string)
  laptop_panel.num_levels = 16  (0x10)  (int)
  linux.hotplug_type = 2  (0x2)  (int)
  linux.subsystem = 'backlight'  (string)
  linux.sysfs_path = '/sys/devices/virtual/backlight/asus-laptop'  (string)

3./usr/share/hal/fdi/policy/10osvendor/10-laptop-panel-mgmt-policy.fdi

<?xml version="1.0" encoding="UTF-8"?>

<deviceinfo version="0.2">

  <device>
    <match key="info.category" string="laptop_panel">
      <!-- only set if the laptop_panel.access_method is not custom -->
      <match key="laptop_panel.access_method" compare_ne="custom">
    <!-- for the generic sysfs interfaces -->
    <match key="linux.sysfs_path" exists="true">
      <append key="info.addons" type="strlist">hald-addon-generic-backlight</append>
    </match>
    <!-- for all the procfs related brightness interfaces -->
    <match key="linux.sysfs_path" exists="false">
          <append key="info.interfaces" type="strlist">org.freedesktop.Hal.Device.LaptopPanel</append>

          <append key="org.freedesktop.Hal.Device.LaptopPanel.method_names" type="strlist">SetBrightness</append>
          <append key="org.freedesktop.Hal.Device.LaptopPanel.method_signatures" type="strlist">i</append>
          <append key="org.freedesktop.Hal.Device.LaptopPanel.method_argnames" type="strlist">brightness_value</append>
          <append key="org.freedesktop.Hal.Device.LaptopPanel.method_execpaths" type="strlist">hal-system-lcd-set-brightness</append>

          <append key="org.freedesktop.Hal.Device.LaptopPanel.method_names" type="strlist">GetBrightness</append>
          <append key="org.freedesktop.Hal.Device.LaptopPanel.method_signatures" type="strlist"></append>
          <append key="org.freedesktop.Hal.Device.LaptopPanel.method_argnames" type="strlist"></append>
      <append key="org.freedesktop.Hal.Device.LaptopPanel.method_execpaths" type="strlist">hal-system-lcd-get-brightness</append>
        </match>
      </match>
    </match>
  </device>

</deviceinfo>
可以发现LaptopPanel的建立是在这里建立的,当hal检测到从udev发过来的信息知道有devices插入之后,并且已经处理完preprobe和information目录的内容之后才开始执行这个文件.

4.将 <append key="info.addons" type="strlist">hald-addon-generic-backlight</append>屏蔽掉,看了一些hal的source code hald/linux/addon/hald-addon-generic-backlight.c代码,发现它就是实现了SetBrightness和GetBrightness的两个接口。这两个接口就是实现了往/sys/devices/virtual/asus_laptop/brightness里面写数据和读书据。

5.我将这段代码屏蔽掉,然后重新启动,发现通过kpowersave里面的brightness adjust已经不起作用了,因为dbus-send已经不起作用了,因为接口已经没有了,但是我直接绕过SetBrightness和GetBrightness直接往/sys/devices/virtual/asus_laptop/brightness里面写数据或者读数据都是可以的。

echo 10 > /sys/devices/virtual/asus_laptop/brightness

cat /sys/devices/virtual/asus_laptop/brightness

以前的做法是
dbus-send --system --type=method_call --dest=org.freedesktop.Hal /org/freedesktop/Hal/devices/computer_backlight org.freedesktop.Hal.Device.LaptopPanel.SetBrightness int32:$1

dbus-send --system --print-reply --type=method_call --dest=org.freedesktop.Hal /org/freedesktop/Hal/devices/computer_backlight org.freedesktop.Hal.Device.LaptopPanel.GetBrightness

参考文档:
http://ubuntuforums.org/showthread.php?t=907188
http://ubuntuforums.org/showthread.php?t=1048309
http://ubuntuforums.org/archive/index.php/t-922401.html
http://www.nabble.com/Brightness-Applet---%22Cannot-get-laptop-panel-brightness%22-td10237351.html
https://bugs.launchpad.net/ubuntu/+source/gnome-power-manager/+bug/250067
http://ubuntuforums.org/archive/index.php/t-922401.html
相关阅读 更多 +
排行榜 更多 +
终极街头格斗

终极街头格斗

休闲益智 下载
大炮轰飞机

大炮轰飞机

飞行射击 下载
像素打僵尸

像素打僵尸

飞行射击 下载