Linux : How to detect if USB keyboard is plugged and unplugged

后端 未结 3 1529
走了就别回头了
走了就别回头了 2020-12-29 00:04

Is there any daemon/tool which will trigger some signal/event when usb keyboard is plugged and unplugged from pc ? I need to know in my program when usb keyboard is plugged

3条回答
  •  失恋的感觉
    2020-12-29 00:46

    udevadm monitor (the udev administration binary) or udev_monitor (in libudev).

    Alternately, if you're running in X11 with input hotplugging, you can listen for the XI extension event DevicePresenceNotify.

提交回复
热议问题