I'm building a small camera with my raspberry pi zero. As part of this I've made an enclosure with an external USB port, which is hardwired onto the pi.
I would like to add an if statement to the start of my python script to ensure that a USB device is plugged in. The port will never change as it is hardwired, and I am not trying to detect a specific USB stick. Just that the port is occupied.
Further, is there any way to ensure it is a USB storage device?
lsusb(8)
- which suggests the information may also be available from the/proc
or/sys
parts of the file-system...