Hi all,
I have (for now) an usb-disk connected to an usb-host and is being used as "backing file" for the mass storage gadget. The host PC detects this and is able to read/write to this storage.
To be absolutely safe I want to "connect" the mass_storage gadget only when a connection to a host is detected and "disconnect" the gadget when the connection to the host is lost.
The reason I want this, is that I want to mount the usb-disk when not connected to a host and use it as internal storage to log some sensors data and stop the process when the connection to a host is established so I can use it as a "backing file" to collect that data on any host.
Is there a way to make this possible using the existing modules within linux (using Linux am437x-evm 4.1)?
To be fair, this is my first adventure using linux as host and device, so if someone could point me to some useful resources I would appreciate that greatly.
Thanks,
Khasyk