daisyUniverse / Keebie

Easy Second Keyboard support in Linux (With layers!)
84 stars 17 forks source link

second keyboard only activating after a first keypress #33

Open sfranky opened 3 years ago

sfranky commented 3 years ago

The second keyboard I've set up works, but if it has been a while since I used it, the first keypress presses something else alltogether. From the log e.g. i get this:

KEY_KPMINUS: xdotool key 'Control_L+Shift_L+Meta_L+t'
^[^TKEY_KPMINUS: xdotool key 'Control_L+Shift_L+Meta_L+t'
KEY_KP9: xdotool key 'Super_L+9'

the second line reflects what happens when I haven't pressed it in a while. Am I doing something wrong? or is this a bug? Thanks for the excellent software, i'm enjoying it a lot !!!!

Michael-E-B commented 3 years ago

If ^[^TKEY_KPMINUS: xdotool key 'Control_L+Shift_L+Meta_L+t' gets printed on a key press it seems the key is being recorded successfully and the command is being found in the layer, meaning the ^[^T section is not actually part of the keycode Keebie is processing. This looks like what would occur if you focused the terminal window and pressed ctrl+[ then ctrl+T on your main keyboard. Odd.

sfranky commented 3 years ago

bah I'm afraid I gave you the wrong input, it's just

KEY_KPMINUS: xdotool key 'Control_L+Shift_L+Meta_L+t'

What i had sent initially is what occurs when I have keebie's terminal output window open. The point is, ctrl+shift+alt+t does not work on the first attempt if i press kpminus on the other keyboard, whereas it works on the first attempt if i just press ctrl+shift+alt+t on my first keyboard.

Any ideas?

my keys are these:


   "KEY_SPACE": "xdotool key 'Control_L+F10'",
   "leds": [], 
   "KEY_T": "xdotool key 'Super_L+t'",
   "KEY_KPSLASH": "xdotool key 'Control_L+F9'",
   "KEY_KPASTERISK": "xdotool key 'Control_L+F10'",
   "KEY_KP1": "xdotool key 'Super_L+1'",
   "KEY_KP2": "xdotool key 'Super_L+2'",
   "KEY_KP3": "xdotool key 'Super_L+3'",
   "KEY_KP4": "xdotool key 'Super_L+4'",
   "KEY_KP5": "xdotool key 'Super_L+5'",
   "KEY_KP6": "xdotool key 'Super_L+6'",
   "KEY_KP7": "xdotool key 'Super_L+7'",
   "KEY_KP8": "xdotool key 'Super_L+8'",
   "KEY_KP9": "xdotool key 'Super_L+9'",
   "KEY_KPENTER": "xdotool key 'Control_L+Shift_L+O'",
   "KEY_KPMINUS": "xdotool key 'Control_L+Shift_L+Meta_L+t'",
   "KEY_KPPLUS": "xdotool key 'Control_L+Shift_L+Meta_L+e'",
   "KEY_KP0": "xdotool key 'Control_L+grave'",
   "KEY_KPDOT": "xdotool type --window 209715207 key 'Super_L+t'",
   "KEY_COMPOSE": "xdotool key 'Multi_key'",
   "KEY_F1": "xdotool key 'Multi_key+Alt_R'",
   "KEY_F2": "xdotool key 'F13+Alt_R'",
   "KEY_F3": "xdotool key 'F14+Alt_R'",
   "KEY_RIGHTALT": "xdotool key 'alt_R'",
   "KEY_S": "xdotool keydown ctrl keydown x keyup x keydown s keyup s keyup ctrl",
   "KEY_DOWN": "xdotool keydown ctrl keydown c keyup c keydown f keyup f keyup ctrl",
   "KEY_UP": "xdotool keydown ctrl keydown c keyup c keydown b keyup b keyup ctrl",
   "KEY_1": "layer:emacs",
   "KEY_2": "layer:secondary",
   "KEY_3": "layer:remoteDesktop",
   "KEY_F": "a" 
}
Michael-E-B commented 3 years ago

Ok i think I understand, could you run Keebie with --verbose and replicate the issue, then post that output?

sfranky commented 3 years ago

eeeeeer sorry to ask this, but i run keebie with python3 keebie.py, and i can't put --verbose in there... is there another way !?

Michael-E-B commented 3 years ago

Keebie has a shebash so you dont need to set an interpreter, just run keebie --verbose (or ./keebie.py --verbose if not installed).

sfranky commented 3 years ago
  Keebie-master ./keebie.py --verbose
usage: keebie.py [-h] [--layers] [--device DEVICE] [--detect] [--add] [--settings] [--edit [layer]]
keebie.py: error: unrecognized arguments: --verbose
sfranky commented 3 years ago

hmm i just dloaded the latest version, mine was from april. Let me give it a go and i'll get back to soonish. Thanks a lot for the immediate help !!

Michael-E-B commented 3 years ago

Ah sorry, I guess I should have established what version was being used. By the way the latest version will be majorly incompatible with a version that old.

Michael-E-B commented 3 years ago

You're welcome for the immediate help, Vivaldi notifies me of emails and I have no life! :)

Michael-E-B commented 3 years ago

Heads up: Starting tomorrow (20th) I will be out of contact until Monday.

sfranky commented 3 years ago

Thanks for the heads up, but I never expect an answer so no worries ;)

I managed to install and run the latest version, same problem, the first attempt doesn't work, although i get the same results in the log:

event19) > rising with new keys KEY_KPMINUS
event19) < falling with lost keys KEY_KPMINUS
event19) added KEY_KPMINUS to history
event19) flushing KEY_KPMINUS
event19) popping KEY_KPMINUS
event19 is processing KEY_KPMINUS in layer default.json
KEY_KPMINUS: xdotool key 'Control_L+Shift_L+Meta_L+t'
event19) > rising with new keys KEY_KPMINUS
event19) < falling with lost keys KEY_KPMINUS
event19) added KEY_KPMINUS to history
event19) flushing KEY_KPMINUS
event19) popping KEY_KPMINUS
event19 is processing KEY_KPMINUS in layer default.json
KEY_KPMINUS: xdotool key 'Control_L+Shift_L+Meta_L+t'
sfranky commented 3 years ago

You're welcome for the immediate help, Vivaldi notifies me of emails and I have no life! :)

having a life is overrated :P
I use Vivaldi, too, and love its features, but its slowness is killing me :(

Michael-E-B commented 3 years ago

Alright, no obvious failures in Keebie here (as I'm sure you figured out), at this point I can only assume that it's an issue with your keyboard not sending events, or evdev not reading them.

A few tests:

First here is stupidly barebones test script, put this code into a python file, make it executable, and run it. See if it prints lines like key event at 1629476850.384745, 74 (KEY_KPMINUS), down when it should. If not then evdev isn't getting events and there's likely nothing we can do about it.

#!/usr/bin/env python3

import evdev

device = evdev.InputDevice("/dev/input/event19")
device.grab()

for event in device.read_loop():
    print(event)
    if event.type == evdev.ecodes.EV_KEY:
        print()
        print()
        print(evdev.categorize(event))
        print()
        print()

If evdev isn't getting events it may be interesting (though futile) to see if the event file is getting events. To do so run cat /dev/input/event19 and see if it spews nonsense onto the terminal when you press keys.

Michael-E-B commented 3 years ago

You're welcome for the immediate help, Vivaldi notifies me of emails and I have no life! :)

having a life is overrated :P I use Vivaldi, too, and love its features, but its slowness is killing me :(

Vivaldi is pretty good for me, but maybe it's just being covered for by my terrible internet.

Michael-E-B commented 3 years ago

Just to poke a little, any news?

sfranky commented 3 years ago

Hello hello! First day of vacation, will be back in a few days! No luck though. I also need to set the device again after each restart, so will be coming back with requests for help :D Thanks a lot!!

On Fri, Aug 27, 2021, 19:54 Michael-E-B @.***> wrote:

Just to poke a little, any news?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/robinuniverse/Keebie/issues/33#issuecomment-907339754, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALVTE3PK3RBPROJJI265YTT667MPANCNFSM5COCR7LQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.