netevent icon indicating copy to clipboard operation
netevent copied to clipboard

Logitech MX Keys with Unifying receiver does not provides a /dev/input/by-id entry

Open frague59 opened this issue 4 years ago • 4 comments

Hi,

I've recently received a Logitech MX Keys keyboard (I'm a lucky man...), but this keyboard does not set any entry in the /dev/input/by-id, so I can not set a device in the netevent configuration file.

Have you any idea on how I can use netevent with this device ?

Thanks !

frague59 avatar Jun 08 '20 07:06 frague59

Additional infos:

I can see it here:

cat /proc/bus/input/devices
I: Bus=0003 Vendor=046d Product=408a Version=0111
N: Name="Logitech MX Keys"
P: Phys=usb-0000:00:14.0-8.2/input2:1
S: Sysfs=/devices/pci0000:00/0000:00:14.0/usb1/1-8/1-8.2/1-8.2:1.2/0003:046D:C52B.0003/0003:046D:408A.0004/input/input20
U: Uniq=408a-4f-b5-e2-0d
H: Handlers=sysrq kbd leds mouse0 event4 
B: PROP=0
B: EV=12001f
B: KEY=3f000301ff 0 0 483ffff17aff32d bfd4444600000000 ffff0001 130ff38b17c007 ffff7bfad941dfff ffbeffdfffefffff fffffffffffffffe
B: REL=1943
B: ABS=100000000
B: MSC=10
B: LED=1f

frague59 avatar Jun 08 '20 09:06 frague59

I've set directly the /dev/input/event4 into the netevent.n2e file, it works for now, but I'm not sure this event device handler is static (maybe it'll change after a reboot...)

Thanks for this great soft !

frague59 avatar Jun 08 '20 15:06 frague59

I use netevent into an home-made remote desktop script i made. https://github.com/kokoko3k/ssh-rdp

And i faced your same issue; i tried that way:

events_from_name(){
    #es: events_from_name "Logitech G203 Prodigy Gaming Mouse"
    #event13
    #event2
    grep 'Name=\|Handlers' /proc/bus/input/devices|grep -A1 "$1"|cut -d "=" -f 2 |grep -o '[^ ]*event[^ ]*'
}

...yes, multiple events could be bound to a "single" device, i just forward every event it returns.

and yes, it is a bit hacky, but since the kernel does not break userspace, i think it will work in the future too. If you find a better way, please, ping me back ;-)

kokoko3k avatar Jun 08 '20 15:06 kokoko3k

Sorry for the late reply. Have you looked at https://github.com/Blub/netevent/blob/master/examples/laptop-and-vm-with-systemd/70-input-names.rules ? The N: Name="Logitech MX Keys" portion should be usable in an udev rule the same way as the linked file matches for vm-*. You may need to change up the /dev/input/by-name part to filter out unwanted characters (which could be handled in the PROGRAM line already I think. And with the TAG+="systemd" you also get a .device systemd unit you can use to depend on in case you want to start netevent via a service.

Blub avatar Aug 20 '20 07:08 Blub