HAL and ASUS ACPI

Nicolas Trangez eikke at eikke.com
Mon Aug 13 16:50:13 PDT 2007


Hija,

I wanted to get my ASUS W3J laptop's "multimedia keys" to work without
using acpid. I checked out the latest acpi4asus sources and found out
there is no code yet to deliver key presses of ACPI buttons to the
kernel INPUT layer, so I implemented this.

I started by using an in-driver key mapping table [1]. This did work,
somewhat. The keys were delivered to the HAL addon listening to the
input device and DBus messages with the correct parameters
("play-pause", "nexttrack" etc) were generated, but when trying xev I
didn't get good results.

Then I decided to rework the driver and not to use in-driver mapping
tables, but instead use HAL to remap the keys based on an FDI file. The
driver branch is here[2].

Here's the output of lshal:
udi = '/org/freedesktop/Hal/devices/computer_logicaldev_input_4'
  button.has_state = false  (bool)
  info.addons.singleton = {'hald-addon-input'} (string list)
  info.callouts.add = {'hal-setup-keymap'} (string list)
  info.capabilities = {'input', 'button', 'input.keymap'} (string list)
  info.category = 'input'  (string)
  info.parent = '/org/freedesktop/Hal/devices/computer'  (string)
  info.product = 'Asus Extra Buttons'  (string)
  info.udi = '/org/freedesktop/Hal/devices/computer_logicaldev_input_4'
(string)
  input.device = '/dev/input/event8'  (string)
  input.keymap.data = {'0x041:nextsong'} (string list)
  input.product = 'Asus Extra Buttons'  (string)
  linux.device_file = '/dev/input/event8'  (string)
  linux.hotplug_type = 2  (0x2)  (int)
  linux.subsystem = 'input'  (string)
  linux.sysfs_path = '/sys/class/input/input23/event8'  (string)

Now when running the run-hald.sh script from hal-git, I see this passing
by when insmod'ing the driver:
01:31:53.824 [I] util.c:1049: Add callouts for
udi=/org/freedesktop/Hal/devices/computer_logicaldev_input_4
Run started hal-setup-keymap (10000) (0) 
!  full path is
'/home/nicolas/Projects/jhbuild/SoC/hal/hal/hald/../tools/hal-setup-keymap', program_dir is '/home/nicolas/Projects/jhbuild/SoC/hal/hal/hald/../tools'
01:31:53.853 [I] hald_dbus.c:5223: ***************************
01:31:53.853 [I] hald_dbus.c:5224: ********* got a connection 80c6e10
01:31:53.853 [I] hald_dbus.c:5225: ***************************
01:31:53.854 [D] hald_dbus.c:3194:
udi=/org/freedesktop/Hal/devices/computer_logicaldev_input_4
01:31:53.854 [E] device.c:1622: In hal_device_inc_num_ready_addons for
udi=/org/freedesktop/Hal/devices/computer_logicaldev_input_4 but all
addons are already ready!
01:31:53.854 [I] hald_dbus.c:3220: AddonIsReady on udi
'/org/freedesktop/Hal/devices/computer_logicaldev_input_4'
hal-setup-keymap: Using device /dev/input/event8
hal-setup-keymap: parsed 0x041:nextsong to (0x41, 163)
01:31:53.856 [I] hald_dbus.c:5166: ************************
01:31:53.856 [I] hald_dbus.c:5167: Client to local_server was
disconnected for 80c6e10
01:31:53.856 [I] hald_dbus.c:5168: ************************
01:31:53.856 [I] hald_dbus.c:5209: ***************************
01:31:53.856 [I] hald_dbus.c:5210: ********* unregistered 80c6e10
01:31:53.856 [I] hald_dbus.c:5211: ***************************
/home/nicolas/Projects/jhbuild/SoC/hal/hal/hald/../tools/hal-setup-keymap exited

To me this looks like the code 0x41 (which is the event generated when I
press the next-button, as shown in dmesg by the asus-laptop driver) is
mapped to KEY_NEXTSONG.
But: when strace'ing the hal-addon-input process, I do get some output
when I press this key, but no DBus-message-sending lines. dbus-monitor
shows no activity at all, neither does xev.

So I'm somewhat puzzles. Maybe I'm doing something terribly wrong in the
driver, I know some people on this list worked on other hardware
drivers, maybe they can tell me what I'm doing wrong...
I might be doing something wrong on the HAL-side of things too, don't
really know :s

Thanks for any help,

Nicolas

[1]
http://git.nicolast.be/?p=acpi4asus.git;a=shortlog;h=acpi_keys_to_input_layer
[2]
http://git.nicolast.be/?p=acpi4asus.git;a=shortlog;h=acpi_keys_to_input_layer_no_internal_mapping
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.freedesktop.org/archives/hal/attachments/20070814/059a0dd5/attachment.pgp 


More information about the hal mailing list