[keymap] high scan codes don't work on 32 bit platforms

Bug #1247676 reported by Stanislav German-Evtushenko
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
systemd (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

In Ubuntu 12.04 64-bit I used the following udev rules to make Plantrinics buttons work:

**************************************************
ACTION!="add|change", GOTO="xorg_plantronics_end"
KERNEL!="event*", GOTO="xorg_plantronics_end"

ENV{ID_VENDOR_ID}=="047f", ENV{ID_MODEL_ID}=="c013", ENV{ID_INPUT_KEY}="1"
ENV{ID_VENDOR_ID}=="047f", ENV{ID_MODEL_ID}=="c013", RUN+="keymap $name 0xFFA000B1 volumeup 0xFFA000B2 volumedown 0xffa000b5 micmute 0xffa000b7 phone 0xffa000ab unknown"

LABEL="xorg_plantronics_end"
**************************************************

However there is no keymap (systemd ) since Saucy anymore and setkeycodes can't map such codes as: 0xFFA000B1, 0xFFA000B2, 0xffa000b5, 0xffa000b7, and 0xffa000ab

Debian still has keymap even in sid (unstable). Changelog of systemd package in Ubuntu has the following note:

**************************************************
systemd (204-0ubuntu10) saucy; urgency=low

...
    - debian/rules: Configure with --disable-keymap to not build/install the
      old keymap stuff any more.
...
**************************************************

So keymap is dropped and there is no equivalent replacement yet.
Any ideas how to make these buttons work again?

Revision history for this message
Stanislav German-Evtushenko (giner) wrote :

It seems to work in 64-bit Ubuntu however doesn't work in 32-bit Ubuntu, neither 12.04 nor 13.10. I made some investigation and found problem in strtol function behaves differently on 32-bit and 64-bit systems.

For example:
64-bit strtol("fffffff0", &endptr, 16), result is 4294967280
32-bit strtol("fffffff0", &endptr, 16), result is 2147483647

Sources to check:
Ubuntu 12.04: udev-175/extras/keymap/keymap.c
Ubuntu 13.10: systemd-204/src/udev/udev-builtin-keyboard.c

summary: - Plantronics .Audio 648 buttons doesn't in Ubuntu Saucy
+ Plantronics .Audio 648 buttons doesn't in Ubuntu Saucy 32-bit
description: updated
Revision history for this message
Martin Pitt (pitti) wrote : Re: Plantronics .Audio 648 buttons doesn't in Ubuntu Saucy 32-bit

Stanislav, there is an equivalent in saucy, the rules are now in /lib/udev/hwdb.d/60-keyboard.hwdb. If you modify this, run "sudo dpkg-reconfigure udev" and reboot to activate. (You can also "udevadm trigger --action=add --subsystem-match=input" a change event on the keyboard device, but that might not always work).

Revision history for this message
Martin Pitt (pitti) wrote :

Fixed the strtol issue upstream in http://cgit.freedesktop.org/systemd/systemd/commit/?id=b151ca993 . Thanks for pointing out!

Now, to add the actual keymap for your device, can you please do

  udevadm info --export-db > /tmp/udev.txt

with the device connected and attach /tmp/udev.txt here?

Changed in systemd (Ubuntu):
status: New → Incomplete
Revision history for this message
Stanislav German-Evtushenko (giner) wrote :

Martin,
> Stanislav, there is an equivalent in saucy, the rules are now in /lib/udev/hwdb.d/60-keyboard.hwdb.
I've just found out, thank you. I though problem was in replacement but actually it was about bug in source code. Thank you for the quick reply.

udev.txt is attached.

I've managed to get this device work in Ubuntu 12.04.3 64-bit and 13.10 64-bit.

*** Udev rules for 12.04 ***

/etc/udev/rules.d/70-plantronics.rules:
*********************************************************************
ACTION!="add|change", GOTO="xorg_plantronics_end"
KERNEL!="event*", GOTO="xorg_plantronics_end"

ENV{ID_VENDOR_ID}=="047f", ENV{ID_MODEL_ID}=="c013", ENV{ID_INPUT_KEY}="1", RUN+="keymap $name 0xFFA000B1 volumeup 0xFFA000B2 volumedown 0xffa000b5 micmute 0xffa000b7 phone 0xffa000ab unknown"

LABEL="xorg_plantronics_end"
*********************************************************************

*** Udev and hwdb rules for Ubuntu 13.10 ***

/etc/udev/rules.d/59-plantronics.rules:
*********************************************************************
ACTION!="add|change", GOTO="xorg_plantronics_end"
KERNEL!="event*", GOTO="xorg_plantronics_end"

SUBSYSTEMS=="usb", ENV{ID_BUS}=="", IMPORT{builtin}="usb_id"

ENV{ID_VENDOR_ID}=="047f", ENV{ID_MODEL_ID}=="c013", ENV{ID_INPUT_KEY}="1"

LABEL="xorg_plantronics_end"
*********************************************************************

/etc/udev/hwdb.d/60-keyboard.hwdb:
*********************************************************************
# Plantronics .Audio 648 USB
keyboard:usb:v047FpC013*
 KEYBOARD_KEY_ffa000b1=volumeup
 KEYBOARD_KEY_ffa000b2=volumedown
 KEYBOARD_KEY_ffa000b5=micmute
 KEYBOARD_KEY_ffa000b7=phone
 KEYBOARD_KEY_ffa000ab=unknown
*********************************************************************

Revision history for this message
Stanislav German-Evtushenko (giner) wrote :

Need to add: if we don't remap all the buttons and don't add ID_INPUT_KEY=1 then this device is recognized as mouse and causes keyboard and mouse instability in X.

summary: - Plantronics .Audio 648 buttons doesn't in Ubuntu Saucy 32-bit
+ Plantronics .Audio 648 buttons don't work in Ubuntu Saucy 32-bit
Revision history for this message
Launchpad Janitor (janitor) wrote : Re: Plantronics .Audio 648 buttons don't work in Ubuntu Saucy 32-bit

[Expired for systemd (Ubuntu) because there has been no activity for 60 days.]

Changed in systemd (Ubuntu):
status: Incomplete → Expired
Martin Pitt (pitti)
Changed in systemd (Ubuntu):
status: Expired → New
Revision history for this message
Sergey R (rozserg) wrote :

I have the same buttons issue with Plantronics Audio 628 in Ubuntu 13.10 32-bit. The only difference with Plantronics 648 is model ID that is c012. Looks like the above solution works for 64-bit, but not for 32-bit. When I put UDEV files as above the audio buttons works as mouse. Any idea ?

Revision history for this message
Stanislav German-Evtushenko (giner) wrote :

Sergey,

The solution mentioned above doesn't work in Ubuntu 13.10 due to the bug in keymap code (fixed in upstream).
Also you can check if you remapped all of buttons using evtest. You need to evtest and click all buttons one by one to get all of key-codes.
In addition to this I need to say that the solution mentioned above doesn't work in Ubuntu 14.04. I will post an update within the next message.

Stanislav

Revision history for this message
Stanislav German-Evtushenko (giner) wrote :

*** Udev and hwdb rules for Ubuntu 14.04 LTS ***

/etc/udev/rules.d/59-plantronics.rules:
*********************************************************************
ACTION!="add|change", GOTO="xorg_plantronics_end"
KERNEL!="event*", GOTO="xorg_plantronics_end"

SUBSYSTEMS=="usb", ENV{ID_BUS}=="", IMPORT{builtin}="usb_id"

ENV{ID_VENDOR_ID}=="047f", ENV{ID_MODEL_ID}=="c013", ENV{ID_INPUT_KEY}="1", ENV{ID_INPUT_KEYBOARD}="1"

LABEL="xorg_plantronics_end"
*********************************************************************

/etc/udev/hwdb.d/60-keyboard.hwdb:
*********************************************************************
# Plantronics .Audio 648 USB
keyboard:usb:v047FpC013*
 KEYBOARD_KEY_ffa000b1=volumeup
 KEYBOARD_KEY_ffa000b2=volumedown
 KEYBOARD_KEY_ffa000b5=micmute
 KEYBOARD_KEY_ffa000b7=phone
 KEYBOARD_KEY_ffa000ab=unknown
*********************************************************************

Revision history for this message
Sergey R (rozserg) wrote :

Hi Stanislav,

The events of Plantronics c013 as in your example and mine c012 are identical.
When I put the configuration for Ubuntu 14.04 then the headset works fine, but at the same time it interfere with the mouse. For example volume up button in addition to volume increase also works as left mouse button and volume decrease as right button.
I am on Ubuntu 14.04 LTS
Below is my evtest header for the headset:
 Available devices:
/dev/input/event0: Power Button
/dev/input/event1: Power Button
/dev/input/event2: Plantronics Plantronics .Audio 628 USB
/dev/input/event3: LITE-ON Technology USB NetVista Full Width Keyboard.
/dev/input/event4: Logitech USB Laser Mouse
/dev/input/event5: UVC Camera (046d:0808)
Select the device event number [0-5]: 2
Input driver version is 1.0.1
Input device ID: bus 0x3 vendor 0x47f product 0xc012 version 0x100
Input device name: "Plantronics Plantronics .Audio 628 USB"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 256 (BTN_0)
    Event code 257 (BTN_1)
    Event code 258 (BTN_2)
    Event code 259 (BTN_3)
    Event code 260 (BTN_4)
  Event type 4 (EV_MSC)
    Event code 4 (MSC_SCAN)
Properties:
Testing ... (interrupt to exit)

Revision history for this message
Stanislav German-Evtushenko (giner) wrote :

Try this:
sudo udevadm info /dev/input/event2 | grep ID_INPUT

and you should get this:
E: ID_INPUT=1
E: ID_INPUT_KEY=1
E: ID_INPUT_KEYBOARD=1

If not then check udev rules in /etc/udev/rules.d/59-plantronics.rules

Revision history for this message
Sergey R (rozserg) wrote :

Hi Stanislav,

The issue is how to separate Plantronics headset and mouse, see below the udevadm results for event2 and event4
**************
sudo evtest
No device specified, trying to scan all of /dev/input/event*
Available devices:
/dev/input/event0: Power Button
/dev/input/event1: Power Button
/dev/input/event2: Plantronics Plantronics .Audio 628 USB
/dev/input/event3: LITE-ON Technology USB NetVista Full Width Keyboard.
/dev/input/event4: Logitech USB Laser Mouse
/dev/input/event5: UVC Camera (046d:0808)
*************
sudo udevadm info /dev/input/event2
sudo udevadm info /dev/input/event2P: /devices/pci0000:00/0000:00:1a.0/usb3/3-1/3-1:1.3/input/input20/event2
N: input/event2
S: input/by-id/usb-Plantronics_Plantronics_.Audio_628_USB-event-if03
S: input/by-path/pci-0000:00:1a.0-usb-0:1:1.3-event
E: DEVLINKS=/dev/input/by-id/usb-Plantronics_Plantronics_.Audio_628_USB-event-if03 /dev/input/by-path/pci-0000:00:1a.0-usb-0:1:1.3-event
E: DEVNAME=/dev/input/event2
E: DEVPATH=/devices/pci0000:00/0000:00:1a.0/usb3/3-1/3-1:1.3/input/input20/event2
E: ID_BUS=usb
E: ID_INPUT=1
E: ID_MODEL=Plantronics_.Audio_628_USB
E: ID_MODEL_ENC=Plantronics\x20.Audio\x20628\x20USB
E: ID_MODEL_ID=c012
E: ID_PATH=pci-0000:00:1a.0-usb-0:1:1.3
E: ID_PATH_TAG=pci-0000_00_1a_0-usb-0_1_1_3
E: ID_REVISION=0243
E: ID_SERIAL=Plantronics_Plantronics_.Audio_628_USB
E: ID_TYPE=hid
E: ID_USB_DRIVER=usbhid
E: ID_USB_INTERFACES=:010100:010200:030000:
E: ID_USB_INTERFACE_NUM=03
E: ID_VENDOR=Plantronics
E: ID_VENDOR_ENC=Plantronics
E: ID_VENDOR_ID=047f
E: MAJOR=13
E: MINOR=66
E: SUBSYSTEM=input
E: USEC_INITIALIZED=17615327

**************
sudo udevadm info /dev/input/event4 | grep ID_INPUT
E: ID_INPUT=1
E: ID_INPUT_MOUSE=1
**************
As soon as I add to /etc/udev/rules.d/59-plantronics.rules
ENV{ID_INPUT_KEY}="1" then it works as a mouse.

If I remove ID_INPUT_KEY=1 and check for another ENV then it doesn't recognize it at all.
I tested for example with ENV{ID_MODEL}="Plantronics_.Audio_628_USB"

Revision history for this message
Stanislav German-Evtushenko (giner) wrote :

Both ID_INPUT_KEY and ID_INPUT_KEYBOARD should have been enabled for Plantronics. ID_INPUT_KEY is not enough.

Revision history for this message
Sergey R (rozserg) wrote :

Hi Stanislav,

Unfortunately it doesn't work as in this case it messed with the mouse.
Not sure if it may help, but I am running Gnome, see below.
if not I guess I will just forget about these buttons as the rest works fine.

*****************
lsb_release -a
LSB Version: core-2.0-ia32:core-2.0-noarch:core-3.0-ia32:core-3.0-noarch:core-3.1-ia32:core-3.1-noarch:core-3.2-ia32:core-3.2-noarch:core-4.0-ia32:core-4.0-noarch:core-4.1-ia32:core-4.1-noarch:security-4.0-ia32:security-4.0-noarch:security-4.1-ia32:security-4.1-noarch
Distributor ID: Ubuntu
Description: Ubuntu 14.04 LTS
Release: 14.04
Codename: trusty
****************
gnome-shell --version
GNOME Shell 3.10.4
***************

Thanks again

Revision history for this message
Stanislav German-Evtushenko (giner) wrote :

You should get this:
E: ID_INPUT=1
E: ID_INPUT_KEY=1
E: ID_INPUT_KEYBOARD=1

if you run "sudo udevadm info /dev/input/eventX | grep ID_INPUT" for your Platronics.

If you don't have all three then Platronics will interfere with a mouse. In the log you posted above there is only "ID_INPUT=1". That means or you have not created 59-plantronics.rules either not restarted udev.

Revision history for this message
Sergey R (rozserg) wrote :

Hi Stanislav,

It works finally.

The order of event to fix it in my case was the following:
1. Put 2 files as per above
2. Restart udev
3. Disconnect and reconnect headset

Thanks
Sergey

Revision history for this message
Martin Pitt (pitti) wrote :

The scan code side is fixed upstream, not in Ubuntu yet.

summary: - Plantronics .Audio 648 buttons don't work in Ubuntu Saucy 32-bit
+ [keymap] high scan codes don't work on 32 bit platforms
Changed in systemd (Ubuntu):
status: New → Fix Committed
Revision history for this message
Martin Pitt (pitti) wrote :

This is fixed in utopic.

Changed in systemd (Ubuntu):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.