Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working on Anne Pro 2 #8

Closed
tim-hilt opened this issue Feb 19, 2021 · 6 comments
Closed

Not working on Anne Pro 2 #8

tim-hilt opened this issue Feb 19, 2021 · 6 comments

Comments

@tim-hilt
Copy link

Hi there! I just got my Anne Pro 2 today and it looks like interception-k2k doesn't work. I use KDE as my DE. It works, when i set up capslock to act as another ctrl-key in KDEs settings.

I already tried to run xev to see the difference a keypress makes. Pressing capslock on the Anne Pro 2 registers as:

KeyPress event, serial 40, synthetic NO, window 0x9e00001,
    root 0x7c9, subw 0x0, time 893793, (-130,-199), root:(1061,432),
    state 0x10, keycode 66 (keysym 0xffe5, Caps_Lock), same_screen YES,
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyRelease event, serial 40, synthetic NO, window 0x9e00001,
    root 0x7c9, subw 0x0, time 893945, (-130,-199), root:(1061,432),
    state 0x12, keycode 66 (keysym 0xffe5, Caps_Lock), same_screen YES,
    XLookupString gives 0 bytes:
    XFilterEvent returns: False

Whereas on my Logitech K800 or integrated Laptop keyboard (Thinkpad x1 Carbon 5th gen) it looks like this:

KeyPress event, serial 40, synthetic NO, window 0x9e00001,
    root 0x7c9, subw 0x0, time 973512, (-171,149), root:(1020,780),
    state 0x10, keycode 9 (keysym 0xff1b, Escape), same_screen YES,
    XLookupString gives 1 bytes: (1b) "
mbLookupString gives 1 bytes: (1b) "
FilterEvent returns: False

KeyRelease event, serial 40, synthetic NO, window 0x9e00001,
    root 0x7c9, subw 0x0, time 973512, (-171,149), root:(1020,780),
    state 0x10, keycode 9 (keysym 0xff1b, Escape), same_screen YES,
    XLookupString gives 1 bytes: (1b) "
FilterEvent returns: False

When i systemctl stop udevmon and press capslock again on the Logitech-keyboard, it looks like this:

KeyPress event, serial 42, synthetic NO, window 0x7200001,
    root 0x7c9, subw 0x0, time 1052591, (318,205), root:(1509,836),
    state 0x12, keycode 66 (keysym 0xffe5, Caps_Lock), same_screen YES,
    XLookupString gives 0 bytes:
    XmbLookupString gives 0 bytes:
    XFilterEvent returns: False

KeyRelease event, serial 42, synthetic NO, window 0x7200001,
    root 0x7c9, subw 0x0, time 1052691, (318,205), root:(1509,836),
    state 0x12, keycode 66 (keysym 0xffe5, Caps_Lock), same_screen YES,
    XLookupString gives 0 bytes:
    XFilterEvent returns: False

Can you help me out there? I don't know if this is a bug that should be fixed or just an issue on my side.

I will happily provide additional information when needed. Thanks for a great tool.

@zsugabubus
Copy link
Owner

  1. Are you sure that your keyboard is really getting intercepted (by interception-tools)?
    • Map rules are very simple so if they are really there, I cannot think of any circumstance that they would not work.
  2. Try using xinput to get device ids then evtest /dev/input/event{id}, press CapsLock and watch for differences. If you get identical output, that should indicate (1).

@tim-hilt
Copy link
Author

tim-hilt commented Feb 20, 2021

TL;DR: systemctl status udevmon doesn't show event27 to be active, which is the event associated with the new keyboard (if I understood correctly). How can I add this device to also be grabbed by interception-tools?


Ok, I made two traces:

  1. Here's the one for the Anne Pro 2
  2. Here's the one for my integrated Laptop-keyboard.

I stopped the interception-process beforehand to see differences more clearly. However, when I keep it running and try to evtest my integrated keyboard, I see an evtest output like this:

Testing ... (interrupt to exit)
***********************************************
  This device is grabbed by another process.
  No events are available to evtest while the
  other grab is active.
  In most cases, this is caused by an X driver,
  try VT-switching and re-run evtest again.
  Run the following command to see processes with
  an open fd on this device
 "fuser -v /dev/input/event3"
***********************************************

To me, this indicates, that the interception-tool does his job for the integrated keyboard, but not for the Anne Pro 2. Here's my udevmon.yaml:

~ λ cat /etc/interception/udevmon.yaml
---
- JOB: "intercept -g $DEVNODE | interception-k2k | uinput -d $DEVNODE"
  DEVICE:
    EVENTS:
      EV_KEY: [KEY_CAPSLOCK, KEY_ESC]

And here's the output of systemctl status udevmon:

~ λ systemctl status udevmon
● udevmon.service - Monitor input devices for launching tasks
     Loaded: loaded (/usr/lib/systemd/system/udevmon.service; enabled; vendor preset: disabled)
     Active: active (running) since Sat 2021-02-20 11:47:22 CET; 3min 6s ago
       Docs: man:udev(7)
   Main PID: 12443 (udevmon)
      Tasks: 17 (limit: 18886)
     Memory: 5.7M
     CGroup: /system.slice/udevmon.service
             ├─12443 /usr/bin/udevmon -c /etc/interception/udevmon.yaml
             ├─12453 sh -c intercept -g $DEVNODE | interception-k2k | uinput -d $DEVNODE
             ├─12454 sh -c intercept -g $DEVNODE | interception-k2k | uinput -d $DEVNODE
             ├─12455 intercept -g /dev/input/event24
             ├─12456 interception-k2k
             ├─12457 uinput -d /dev/input/event24
             ├─12458 intercept -g /dev/input/event22
             ├─12459 interception-k2k
             ├─12460 uinput -d /dev/input/event22
             ├─12494 sh -c intercept -g $DEVNODE | interception-k2k | uinput -d $DEVNODE
             ├─12495 intercept -g /dev/input/event3
             ├─12496 interception-k2k
             ├─12497 uinput -d /dev/input/event3
             ├─12504 sh -c intercept -g $DEVNODE | interception-k2k | uinput -d $DEVNODE
             ├─12505 intercept -g /dev/input/event19
             ├─12506 interception-k2k
             └─12507 uinput -d /dev/input/event19

Feb 20 11:47:22 arch systemd[1]: Started Monitor input devices for launching tasks.

I don't see event27 there, which represents the Anne Pro 2. How can I add that device?

@zsugabubus
Copy link
Owner

How can I add this device to also be grabbed by interception-tools?

Whew! According to https://gitlab.com/interception/linux/tools#how-it-works you can explicitly specify devices you would like to intercept, like:

# /etc/interception/udevmon.toml
# ...
  DEVICE:
    LINK: /dev/input/by-id/...

@tim-hilt
Copy link
Author

tim-hilt commented Feb 20, 2021

Ok, first of all: Thanks for your help!

I have now modified my /etc/interception/udevmon.yaml to look like this:

---
- JOB: "intercept -g $DEVNODE | interception-k2k | uinput -d $DEVNODE"
  DEVICE:
    LINK: /dev/input/by-id/usb-OBINS_OBINS_AnnePro2_SN0000000001-event-kbd
    EVENTS:
      EV_KEY: [KEY_CAPSLOCK, KEY_ESC]

The identifier is correct. When I pass the event it links to to evtest I can see it react to keypresses. However the device still isn't grabbed. With udevmon activated, I don't see the warning banner in evtest. Also the output of systemctl status udevmon now looks like this, indicating (to me), that no event has been grabbed correctly, even though the correct config-file is used by the service:

~ λ systemctl status udevmon
● udevmon.service - Monitor input devices for launching tasks
     Loaded: loaded (/usr/lib/systemd/system/udevmon.service; enabled; vendor preset: disabled)
     Active: active (running) since Sat 2021-02-20 17:06:21 CET; 5min ago
       Docs: man:udev(7)
   Main PID: 988 (udevmon)
      Tasks: 1 (limit: 18886)
     Memory: 3.4M
     CGroup: /system.slice/udevmon.service
             └─988 /usr/bin/udevmon -c /etc/interception/udevmon.yaml

Feb 20 17:06:21 arch systemd[1]: Started Monitor input devices for launching tasks.

Do you see, where I went wrong?

@zsugabubus
Copy link
Owner

zsugabubus commented Feb 20, 2021

To be honest I'm (absolutely) not an expert in interception-tools, but I would try deleting EVENTS: (and lines below it) because if you pass LINK: I see no reason why devices should be filtered by EVENTS. Maybe this is why your keyboard not selected, because udevmon unable to detect these keys... it would also explain why we do not see any errors.

In addition, to make sure systemd does not swallow any error messages, you could try running udevmon from terminal.

Another stuff: What about LINK: *-event-kbd?

@tim-hilt
Copy link
Author

Again: Thanks for the answer. Unfortunately that also didn't work. I think I might address this issue on the interception-tools-GitLab and come back to this issue, when I have news.

I'll close this issue for now. Thanks for all your help and insight!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants