Open czhang03 opened 1 year ago
Yes I think it would be possible that mouseless simply detects all keyboards at start, I already experimented with it some time ago, but still need to put some work into it.
This seems kind of flawed in that if you change the keyboard after startup, it won't notify mouseless to detect these keyboards. I wonder if there is any OS trigger that mouseless can subscribe to.
You're right, that would be much better, I will have a look how it can be done.
Now it detects all keyboard devices at start, if one has not specified any in the config file. But I have not yet looked into how it can detect new keyboards while running.
(1) I have a bluetooth keyboard and a usb mouse connecting to my computer. When I launch mouseless
without specifying a keyboard in config file, mouseless
will grab all devices' signal(including my usb mouse). As a result, my usb mouse was disabled, until I kill the mouseless
process. Is it possible to detect all keyboard but exclude mouse device?
(2) When I want to specify a keyboard device in config file, I failed to find out my bluetooth keyboard in /dev/input/by-id
, seems it can only show the keyboards which was linked via usb. Fortunately, I can find the event number of my keyboard from /proc/bus/input/devices
and add the related device into mouseless
's config file. Is it possible to specify keyboard device in commandline option instead of config file?
Hi @zerobikappa, it was not intended that mouseless grabs the mouse devices as well, it only grabs the devices that have an a
key or a 1
numpad key. Does your mouse have any special/configurable buttons?
Otherwise there is not a command line option to specify the device, but you could replace it in the config file like this:
sed -i 's_- "/dev/input/event[0-9]*"_- "'"$device"'"_' ~/.config/mouseless/config.yaml
It assumes that there is exactly one device in the config file of the form /dev/input/eventX
. But it would definitely make sense to add a command line option for this.
@jbensmann My mouse device was Logitech G304 but I did not change any mouse buttons. So it has below event codes: Event code 272 (BTN_LEFT) Event code 273 (BTN_RIGHT) Event code 274 (BTN_MIDDLE) Event code 275 (BTN_SIDE) Event code 276 (BTN_EXTRA)
When I pressed the left/right button of my mouse, mouseless
showed below error message in console:
WARN[0735] Keyboard: failed to press the key 273: failed to perform KeyDown. Code 273 is not in range
WARN[0735] Keyboard: failed to release the key 273: failed to perform KeyUp. Code 273 is not in range
WARN[0736] Keyboard: failed to press the key 272: failed to perform KeyDown. Code 272 is not in range
WARN[0736] Keyboard: failed to release the key 272: failed to perform KeyUp. Code 272 is not in range
Thanks, mouseless is consuming the buttons but cannot process them correctly, the best would probably be if mouseless does not read from mouse devices in the first place. I will have to do some research why it detects some mice as a keyboard, and whether there is a better way to do it.
Currently mouseless want you to specify which keyboard it can work with using the config file (the first item in sample config). Is it possible to make it work with all keyboard regardless of its id/path?