"I am trying to write a bash script to detect if USB device is plugged into a 
device and post a message with a device name that is plugged to stdout.

Complications are USB webcams, USB controllers, and this is going to be used on 
large number of systems, so I can't customize to each system."

I don't how familiar you're with usb related commands, but there's a variety of 
them to use in a simple loop script. 

Here's a good place to start. 
https://www.baeldung.com/linux/check-for-usb-devices

One problem you're very likely to run into is that if you've a large variety of 
usb devices being detected, you're very likely to get a large variety of 
information back. Some probably more useful and relevant than others. 

For example, my internal wifi card and smart car reader shows up under lsusb 
because it's connected to the Universal Serial Bus, but it's not plugged in 
externally.

It might be easier to tail /var/log/messages and then grep on "new usb device 
found"

Reply via email to