1
votes

I am pretty new to Linux so I apologize if I will ask some really simple stuff. I am working on a custom board with SAM9G25 and Angstrom distribution as operating system.

The board as to act as a USB Device (Mass storage device), when will be connected to a Host computer. Right now I am simply enabling and removing the g_mass_storage module and the things are working fine. In the final version, I need to manage the g_mass_storage module according to the connection and disconnection of a USB cable. I tought to use VBUS as an interrupt (also polling will be fine).

Here it comes my problem.

Since the VBUS GPIO is handled by the USB driver i cannot read it's status from userspace. I only see an interrupt count in /proc/interrupt. I am asking if there is a way to get an interrupt (from the Driver) or to be able to read the VBUS GPIO value when the usb cable is connected/disconnected from the system.

I apreciate any kind of help.

1

1 Answers

0
votes

I know this is a bit old, but I found the same problem, and found from userspace you can view the connection status from the udc sys class device. For example, on my architecture the status of USB can be viewed from:

/sys/class/udc/ci_hdrc.0/status

PC connection: configured
Power adapter: powered
Disconnected: not attached

I've read the AM335x architecture can be observed from:

/sys/class/udc/musb-hdrc.0.auto/current_speed

Best of luck