I'm working on a Linux embedded system that can draw its power from two distinct sources:
- a dedicated power supply
- power supply through USB (connected to an external USB host)
I must know when the device is unplugged, so I can do an emergency shutdown.
I know how to detect when my dedicated power supply disappears.
But I don't know when the USB power supply is unplugged.
How would you detect when a USB cable is unplugged from an USB device under Linux ?
Thanks in advance for your insights.