My first attempt was ls -l /dev/input/by-path and grep mouse and kbd to get event# and then readlink of event# in /sys/class/input. Works only on 2 of 3 machines. So not reliable...
Gave /var/log/messages a try.
I was able to grep -E -i 'keyboard as|mouse as|touchpad as'¹ from my default keyboard and mouse and another wireless touchpad keyboard, which is also detected as mouse. But adding another wireless mouse detection failed due to device naming. In the latter case device identifies as 'Telink Wireless Receiver', so no match on keyboard|mouse|touchpad with grep.
¹) Depending on kernel i get different output for Keyboard...
Code: Select all
# grep -E -i 'keyboard|mouse|touchpad' /var/log/messages
Feb 20 21:52:55 OptiPlex kern.info kernel: mousedev: PS/2 mouse device common for all mice
Feb 20 21:52:55 OptiPlex kern.info kernel: usb 5-1: Product: USB Keyboard
Feb 20 21:52:55 OptiPlex kern.info kernel: input: USB Keyboard as /devices/pci0000:00/0000:00:1a.2/usb5/5-1/5-1:1.0/0003:1241:1503.0001/input/input5
Feb 20 21:52:55 OptiPlex kern.info kernel: hid-generic 0003:1241:1503.0001: input,hidraw0: USB HID v1.10 Keyboard [ USB Keyboard] on usb-0000:00:1a.2-1/input0
Feb 20 21:52:55 OptiPlex kern.info kernel: input: USB Keyboard System Control as /devices/pci0000:00/0000:00:1a.2/usb5/5-1/5-1:1.1/0003:1241:1503.0002/input/input6
Feb 20 21:52:55 OptiPlex kern.info kernel: input: USB Keyboard Consumer Control as /devices/pci0000:00/0000:00:1a.2/usb5/5-1/5-1:1.1/0003:1241:1503.0002/input/input7
Feb 20 21:52:55 OptiPlex kern.info kernel: hid-generic 0003:1241:1503.0002: input,hidraw1: USB HID v1.10 Device [ USB Keyboard] on usb-0000:00:1a.2-1/input1
Feb 20 21:52:55 OptiPlex kern.info kernel: usb 5-2: Product: USB Optical Mouse
Feb 20 21:52:55 OptiPlex kern.info kernel: input: USB Optical Mouse as /devices/pci0000:00/0000:00:1a.2/usb5/5-2/5-2:1.0/0003:1BCF:0005.0003/input/input8
Feb 20 21:52:55 OptiPlex kern.info kernel: hid-generic 0003:1BCF:0005.0003: input,hidraw2: USB HID v1.10 Mouse [USB Optical Mouse] on usb-0000:00:1a.2-2/input0
#
BTW and maybe OT: what's different between USB Keyboard, USB Keyboard System Control and USB Keyboard Consumer Control?
No luck with evtest. Seems like slackware based Puppies don't have evtest. lsinput also not in (my) Puppy.
Most promising was to search for mouse and keyboard in /sys/devices/ with find.
Mouse is found by -name 'mouse*' but keyboard doesn't match. So i tried searching for -name '*numlock' with success.
From these results i am able to determine whether it's pci<la/lala>/usb (and bus) or platform/i8042.
Another problem with the afore mentioned script is that if your hardware has less usb busses, the more devices share the same interrupt (ex: my desktop has 8 busses with max. 2 devices on one bus, my laptop has 2 busses with 6 devices on bus 1 (without usb keyboard attached)). So detection of idle time may get inaccurate.