You are not logged in.

#1 2012-08-02 16:18:35

C5OK5Y
Member
Registered: 2010-07-04
Posts: 48

Map scancodes to keycodes & udev rules

I followed the wiki here and here. My keymap file /usr/lib/udev/keymaps/chicony-kb-9805:

0xA0 www          # 158 XF86WWW
0xA3 close        # 214 XF86Close
0xB2 f13          # 191 XF86Tools
0x92 f14          # 192 XF86Launch5
0xB0 f15          # 193 XF86Launch6
0xA1 f16          # 194 XF86Launch7
0xAE previoussong # 173 XF86AudioPrev
0xA4 stopcd       # 174 XF86AudioStop
0xA2 playpause    # 172 XF86AudioPlay
0x99 nextsong     # 171 XF86AudioNext
0xA6 volumeup     # 123 XF86AudioRaiseVolume
0x9E volumedown   # 122 XF86AudioLowerVolume
0x97 mute         # 121 XF86AudioMute
0xA5 sleep        # 150 XF86Sleep

I found my keyboard with $ /lib/udev/findkeyboards:

AT keyboard: input/event0

Then the command udevadm info -a -p $(udevadm info -q path -n /dev/input/event0) returns:

Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.

  looking at device '/devices/platform/i8042/serio0/input/input0/event0':
    KERNEL=="event0"
    SUBSYSTEM=="input"
    DRIVER==""

  looking at parent device '/devices/platform/i8042/serio0/input/input0':
    KERNELS=="input0"
    SUBSYSTEMS=="input"
    DRIVERS==""
    ATTRS{name}=="AT Translated Set 2 keyboard"
    ATTRS{phys}=="isa0060/serio0/input0"
    ATTRS{uniq}==""
    ATTRS{properties}=="0"

  looking at parent device '/devices/platform/i8042/serio0':
    KERNELS=="serio0"
    SUBSYSTEMS=="serio"
    DRIVERS=="atkbd"
    ATTRS{description}=="i8042 KBD port"
    ATTRS{bind_mode}=="auto"
    ATTRS{extra}=="0"
    ATTRS{force_release}=="369-370"
    ATTRS{scroll}=="0"
    ATTRS{set}=="2"
    ATTRS{softrepeat}=="0"
    ATTRS{softraw}=="1"
    ATTRS{err_count}=="0"

  looking at parent device '/devices/platform/i8042':
    KERNELS=="i8042"
    SUBSYSTEMS=="platform"
    DRIVERS=="i8042"

  looking at parent device '/devices/platform':
    KERNELS=="platform"
    SUBSYSTEMS==""
    DRIVERS==""

I can successfully load the keymap with # /lib/udev/keymap input/event0 chicony-kb-9805 but I can't get it loaded automatically with an udev rule. When I try to apply the keymap to device '/devices/platform/i8042/serio0/input/input0/event0' , It doesn't load (/etc/udev/rules.d/98-kb-9805.rules):

SUBSYSTEM=="input", KERNEL=="event0",  RUN+="/lib/udev/keymap input/$name chicony-kb-9805"

Nor does it load when trying to apply to device '/devices/platform/i8042/serio0/input/input0':

SUBSYSTEMS=="input", ATTRS{name}=="AT Translated Set 2 keyboard", RUN+="/lib/udev/keymap input/$name chicony-kb-9805"

How should the udev rule file look like for it to work? Thanks.

Offline

Board footer

Powered by FluxBB