We’re building a device based on Raspberry Pi. And we’d like to add an option to detect plugged USB drive on when the device boots, to e.g. perform a firmware update.
There’s a problem that the USB drive is often not mountable immediately after Linux starts (and it differs between different USB drives).
Ideally I’d like a way to tell that some USB device is plugged in, as it may be worth delaying the boot procedure to let it mount, and I’d like to know how long should I wait before mounting the USB drive or giving up.
I know there’s /sys/module/usb_storage/parameters/delay_use parameter, but I don’t know if just waiting for the time specified there would solve all my problems?
I’ve also looked at libudev to enumerate available devices, and add a monitor but I don’t seem to get any events before the device is actually mountable.
Thanks in advance!
Piotr