Skip to content

Device buttons get released when keyboard keys are pressed #78

@docelic

Description

@docelic

Hey,

As discussed on IRC:

Device: SpaceMouse Enterprise
Spacenav components compiled from today's git source.
Daemon recognizes the device, config program works (i.e. setting LED, watching axes and button presses works fine).

I tried mapping 3 buttons to keys: Tab, Shift, and Control, while using XTEST.

In programs, Tab works fine (like a tab does on a keyboard).
But Shift and Ctrl on the device appear to be released too early, so e.g. Ctrl+c doesn't send term, and/or Shift+a doesn't result in uppercase A. As seen from the logs below, Shift_L release event gets triggered when 'a' is pressed on the keyboard, causing 'a' to be seen without shift.

Here are some logs from spacenavd and from xev:

Spacenavd log:

sudo /usr/local/bin/spacenavd -d -v 
Spacenav daemon v1.2-2-gd186c5d
reading config file: /etc/spnavrc
found usb device [256f:c633]: "3Dconnexion SpaceMouse Enterprise" (/dev/input/event1) 
adding device (id: 0).
device name: 3Dconnexion SpaceMouse Enterprise
  Number of axes: 6 (6a 0r)
Device 256f:c633 reports 255 buttons before disjointed button remapping
  Number of buttons: 31 (evdev offset: 256)
  Axis 0 value range: -350 - 350 (fuzz: 0)
  Axis 1 value range: -350 - 350 (fuzz: 0)
  Axis 2 value range: -350 - 350 (fuzz: 0)
  Axis 3 value range: -350 - 350 (fuzz: 0)
  Axis 4 value range: -350 - 350 (fuzz: 0)
  Axis 5 value range: -350 - 350 (fuzz: 0)
using device: 3Dconnexion SpaceMouse Enterprise (/dev/input/event1)
  device flags: swap y-z invert y-z
trying to open X11 display ":0"
   XAUTHORITY=/root/.Xauthority
Using XTEST to send key events
mapping ``Shift_L'' to keysym 65505
mapping ``Control_L'' to keysym 65507

Pressing Shift+a on the keyboard produces the following xev log:

KeyPress event, serial 54, synthetic NO, window 0x1e00001,
    root 0x3aa, subw 0x0, time 341907179, (158,112), root:(912,546),
    state 0x10, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyPress event, serial 54, synthetic NO, window 0x1e00001,
    root 0x3aa, subw 0x0, time 341909651, (158,112), root:(912,546),
    state 0x11, keycode 38 (keysym 0x41, A), same_screen YES,
    XLookupString gives 1 bytes: (41) "A"
    XmbLookupString gives 1 bytes: (41) "A"
    XFilterEvent returns: False

KeyRelease event, serial 54, synthetic NO, window 0x1e00001,
    root 0x3aa, subw 0x0, time 341909745, (158,112), root:(912,546),
    state 0x11, keycode 38 (keysym 0x41, A), same_screen YES,
    XLookupString gives 1 bytes: (41) "A"
    XFilterEvent returns: False

KeyRelease event, serial 54, synthetic NO, window 0x1e00001,
    root 0x3aa, subw 0x0, time 341910517, (158,112), root:(912,546),
    state 0x11, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

Pressing Shift on the device and a on the keyboard produces the following xev log:

# Device button press+hold results in:

MappingNotify event, serial 54, synthetic NO, window 0x0,
    request MappingKeyboard, first_keycode 8, count 248

KeyPress event, serial 54, synthetic NO, window 0x1e00001,
    root 0x3aa, subw 0x0, time 341962743, (134,88), root:(888,522),
    state 0x10, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

# Pressing and releasing 'a' on keyboard results in:

KeyRelease event, serial 55, synthetic NO, window 0x1e00001,
    root 0x3aa, subw 0x0, time 341963347, (134,88), root:(888,522),
    state 0x11, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyPress event, serial 55, synthetic NO, window 0x1e00001,
    root 0x3aa, subw 0x0, time 341963347, (134,88), root:(888,522),
    state 0x10, keycode 38 (keysym 0x61, a), same_screen YES,
    XLookupString gives 1 bytes: (61) "a"
    XmbLookupString gives 1 bytes: (61) "a"
    XFilterEvent returns: False

KeyRelease event, serial 55, synthetic NO, window 0x1e00001,
    root 0x3aa, subw 0x0, time 341963425, (134,88), root:(888,522),
    state 0x10, keycode 38 (keysym 0x61, a), same_screen YES,
    XLookupString gives 1 bytes: (61) "a"
    XFilterEvent returns: False

# And finally releasing the button on the device results in:

MappingNotify event, serial 55, synthetic NO, window 0x0,
    request MappingKeyboard, first_keycode 8, count 248

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions