-
Notifications
You must be signed in to change notification settings - Fork 14
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
masquerade_as
option to allow output device to resemble input
#42
Comments
masquerade_as
option to allow output device to resemble input
masquerade_as
option to allow output device to resemble inputmasquerade_as
option to allow output device to resemble input
Until this is officially supported I think one could hack this in their config by redefining Output's _uinput themselves. Roughly: from keyszer import output
# close the existing device
output._uinput.close()
# create a new device with the exact options you want to mimic
output._uinput = UInput(...) |
@zw963 If you switch to keyszer you should give that a try and report back if it works or not. |
i try to this package get running on my laptop now, but it seem not working, no key can input, even, when i pressing Ctrl+C, could not stop it.
Following is code i add to my config: output._uinput.close()
_keyboard_codes = ecodes.keys.keys() - ecodes.BTN
output._uinput = UInput(events={ecodes.EV_KEY: _keyboard_codes,
ecodes.EV_REL: set([0,1,6,8,9]),
},
name="mykeyboarddevice",
phys="isa0060/serio0/input0",
vendor=1,
product=1,
version=43841,
bustype=17,
input_props=[]) Following is the ouput of --list-devices ╰─ $ 1 keyszer --list-devices
keyszer v0.5.0
-------------------------------------------------------------------------------------
Device Name Phys
-------------------------------------------------------------------------------------
/dev/input/event0 Sleep Button PNP0C0E/button/input0
/dev/input/event1 Lid Switch PNP0C0D/button/input0
/dev/input/event2 Power Button LNXPWRBN/button/input0
/dev/input/event3 AT Translated Set 2 keyboard isa0060/serio0/input0
/dev/input/event4 MOSART Semi. wireless dongle usb-0000:00:14.0-6.1/input0
/dev/input/event5 MOSART Semi. wireless dongle Mouse usb-0000:00:14.0-6.1/input1
/dev/input/event6 MOSART Semi. wireless dongle Consumer Control
usb-0000:00:14.0-6.1/input1
/dev/input/event7 MOSART Semi. wireless dongle System Control
usb-0000:00:14.0-6.1/input1
/dev/input/event8 MOSART Semi. wireless dongle usb-0000:00:14.0-6.1/input1
/dev/input/event9 MOSART Semi. wireless dongle usb-0000:00:14.0-6.1/input1
/dev/input/event10 Wireless hotkeys hpq6001/input0
/dev/input/event11 PC Speaker isa0061/input0
/dev/input/event12 ST LIS3LV02DL Accelerometer lis3lv02d/input0
/dev/input/event13 HP HD Webcam: HP HD Webcam usb-0000:00:14.0-7/button
/dev/input/event14 HP WMI hotkeys wmi/input0
/dev/input/event15 HDA NVidia HDMI/DP,pcm=3 ALSA
/dev/input/event16 HDA NVidia HDMI/DP,pcm=7 ALSA
/dev/input/event17 HDA NVidia HDMI/DP,pcm=8 ALSA
/dev/input/event18 HDA NVidia HDMI/DP,pcm=9 ALSA
/dev/input/event19 HDA NVidia HDMI/DP,pcm=10 ALSA
/dev/input/event20 HDA NVidia HDMI/DP,pcm=11 ALSA
/dev/input/event21 HDA Intel PCH Mic ALSA
/dev/input/event22 HDA Intel PCH Headphone ALSA
/dev/input/event23 PS/2 Generic Mouse isa0060/serio2/input0
/dev/input/event24 SynPS/2 Synaptics TouchPad isa0060/serio3/input0
/dev/input/event25 Video Bus LNXVIDEO/video/input0
/dev/input/event26 Video Bus LNXVIDEO/video/input0
Following is my config: ╰─ $ python show_event_info.py
device.phys: isa0060/serio0/input0
device.info.vendor: 1
device.info.product: 1
device.info.version: 43841
device.info.bustype: 17
device.input_props(): [] |
Your double grabbing... if the name of the device doesn't matter you should use the same suffix we use to prevent this: IE:
|
Sorry, it still not working. ╰─ $ /home/zw963/utils/xkeysnail/bin/keyszer --watch -c /home/zw963/utils/xkeysnail/config_new.py
keyszer v0.5.0
(--) WATCH: Watching for new devices to hot-plug.
(--) Ready to process input.
(+K) Grabbing AT Translated Set 2 keyboard (/dev/input/event3)
(+K) Grabbing MOSART Semi. wireless dongle (/dev/input/event4)
(+K) Grabbing mykeyboarddevice (/dev/input/event28) e.g. following mapping in config, it works on xkeysnail, but not keyszer.
|
Please report other issues in a separate issue. This is only for discussion of masquerade. |
You still haven't added the suffix/prefix... |
The string must be exact and match the one in the source:
|
Sorry, i am really don't understood what you stand for. i am quite idiot in linux keyboard device, uinput ... those things. Could you please give me a full config sample? if any place need changes in source code, please point it out too. i thought i was sent all my device info. |
It would be easier if you copied actual code snippets instead of screen shots which I cannot edit to correct... Refering to: #42 (comment) |
import re
from xkeysnail.transform import *
from evdev import ecodes
from keyszer import output
from evdev.uinput import UInput
# close the existing device
output._uinput.close()
# device.phys: isa0060/serio0/input0
# device.info.vendor: 1
# device.info.product: 1
# device.info.version: 43841
# device.info.bustype: 17
# device.input_props(): []
_keyboard_codes = ecodes.keys.keys() - ecodes.BTN
# create a new device with the exact options you want to mimic
output._uinput = UInput(events={ecodes.EV_KEY: _keyboard_codes,
ecodes.EV_REL: set([0,1,6,8,9]),
},
name="mykeyboarddeviceKeyszerVIRTUAL",
phys="isa0060/serio0/input0",
vendor=1,
product=1,
version=43841,
bustype=17,
input_props=[])
# this map capslock to left ctrl, then, map right alt to capslock
# but it not work in keyszer.
define_modmap({
Key.CAPSLOCK: Key.LEFT_CTRL,
Key.RIGHT_ALT: Key.CAPSLOCK
}) |
With the correct spacing:
|
Still not work for my config. it should map C-f to C-right in my firefox, but not work. (above log is when i pressing Ctrl+f) following is my config: define_keymap(lambda wm_class: wm_class not in ("Emacs" "konsole" "alacritty" "kitty" "Hyper" "Bcompare4"), {
K("M-f"): with_mark(K("C-right")),
}) |
The fact that it keeps saying this means you have NOT modified your config properly to add the prefix even if you think you have... |
Wired, but, the code in for the purpose of evidence, please see following command: ╰─ $ cat /home/zw963/utils/xkeysnail/config_new.py |dpaste
http://dpaste.com/AGB6C6BR7 you can open http://dpaste.com/AGB6C6BR7 for check it. |
You're missing something because the name in your output isn't matching the name in your config:
Maybe you have two config files or are using the wrong one, I dunno.. |
No. you saw my command.
|
I dunno what to tell you... if the output has the old name (without the prefix), as you showed, then it's not getting updated somewhere.
|
so, that means the config code is wrong? what is the correct code to hack this? |
I've given you the correct code #42 (comment) If you say it's still not working i dunno what to tell you. 🙁 Maybe start with a fresh install/ fresh config/ double/triple/quadruple check everything... |
I just realized you could also use --device to list your devices manually as well:
You'd have to use the correct device paths of course. |
|
Okay, it can run now, thank you. ╰─ $ keyszer --device /dev/input/event3
keyszer v0.5.0
(--) Ready to process input.
(+K) Grabbing AT Translated Set 2 keyboard (/dev/input/event3)
What is the next step? |
If you were running into other bugs or issues you should open an issue for them... |
Please open a separate issue as I've already asked you previously - this issue is ONLY for discussion of |
Miss the context again ... How should i test on this? Following is my current config:
If i can replace above config with only one line Thank you. |
There is no PR for this yet. |
Sometimes the device details matter - like when libinput/Gnome is deciding if a keyboard/trackpad are "paired" for it's "ignore trackpad when typing" option... the virtual keyboard we present breaks this since it doesn't look like an "internal" paired keyboard... this can be fixed if we "masquerade" as the internal keyboard by copying all it's details and making our virtual keyboard look as similar as possible.
It seems reasonable to allow someone to do this in the config file. Proposed:
The name would be the name of the device in
--list-devices
.Original Title: Not respect GNOME touchpad disable-while-typing settings
This issue come from original xkeysnail discuss.
mooz/xkeysnail#144 (comment)
Maybe there exist some improvement, let us discuss here.
Thank you.
The text was updated successfully, but these errors were encountered: