How to detect when USB device is being connected/disconnected?

前端 未结 2 1971
谎友^
谎友^ 2021-02-04 21:50

I don\'t feel comfortable harnessing USB device with Delphi and have a next to nothing knowledge of the details of writing device driver (though I\'ve come accross some when le

2条回答
  •  醉梦人生
    2021-02-04 22:19

    You can use some shell script to do so. when device is connected command lsusb shows this and removes from list after the device gets disconnected. So in your shell script you need to find the difference between old list and current list. Finally you need to run this script as a cron job, which checks in frequent interval.

    Regards, Barun Parichha

提交回复
热议问题