How can the Pi detect if a host device has been connected, and gather information about that device, when being used as a gadget (such as mass storage). It would be useful if I could detect this within a python script.

As an example, if the Pi is to be used as a mass storage device, and I have a python script that's supposed to set that up, it would be useful if I could trigger certain behaviour when a device is actually connected, but not before. Further, it would be useful if the behaviour could depend on certain information about that device. For instance, if the data needed to be refreshed when a host was connected, or if a certain type of host needed a different set of data than another type of host.

  • I have made an answer but it was wrong. I was only on the g_ether path and checked network connection. So I deleted it. – Ingo Apr 4 '19 at 21:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.