This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM437xEVM detecting a connection to a host (PC)

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

  • Hi Khasyk,

    The surest way to detecting the connectivity between your board and host PC is to ping the PC from the board but you should write implementation of this operation in your application.

    BR
    Tsvetolin Shulev
  • Tsvetolin,

    Thank you for your reply.

    But connecting VBus from USB to an GPIO ( with protection circuitry ), sacrificing an gpio as interrupt source. And using this interrupt within my application would allow me to wait for an interrupt and then act on it instead of polling for a connecting or am I mistaken in this thought?

    Khasyk