This project requires being able to plug in A on the host and B on our instrument and have a file-system on the instrument available to the host. As I understand it, this is a common behaviour / usage of devices, and I can certainly do something similar when I plug in my Nook to my Linux machine to add .PDFs and .EPUBs.
I've tried to get this working for a very long time, starting with a 2.6.32 kernel and now up to 3.16.3. I was able to get it working with my Linux machine on the 2.6.32 kernel, but not with a Windows machine (using NTFS). With 3.16.3, I have had no success.
This is a list of all the enabled USB configs:
CONFIG_MFD_OMAP_USB_HOST=y
CONFIG_SND_USB=y
CONFIG_USB_HID=y
CONFIG_USB_OHCI_LITTLE_ENDIAN=y
CONFIG_USB_SUPPORT=y
CONFIG_USB_COMMON=y
CONFIG_USB_ARCH_HAS_HCD=y
CONFIG_USB=y
CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
CONFIG_USB_DEFAULT_PERSIST=y
CONFIG_USB_OTG=y
CONFIG_USB_OTG_FSM=y
CONFIG_USB_MON=y
CONFIG_USB_EHCI_HCD=y
CONFIG_USB_EHCI_ROOT_HUB_TT=y
CONFIG_USB_EHCI_HCD_OMAP=y
CONFIG_USB_STORAGE=y
CONFIG_USB_STORAGE_DEBUG=y
CONFIG_USB_MUSB_HDRC=y
CONFIG_USB_MUSB_GADGET=y
CONFIG_USB_MUSB_OMAP2PLUS=y
CONFIG_USB_INVENTRA_DMA=y
CONFIG_USB_PHY=y
CONFIG_NOP_USB_XCEIV=y
CONFIG_USB_GADGET=y
CONFIG_USB_GADGET_VBUS_DRAW=2
CONFIG_USB_GADGET_STORAGE_NUM_BUFFERS=2
CONFIG_USB_LIBCOMPOSITE=m
CONFIG_USB_F_MASS_STORAGE=m
CONFIG_USB_MASS_STORAGE=m
CONFIG_TWL4030_USB=y
After
modprobe g_mass_storage file=/dev/mmcblk3
and plugging in the B connector, I have this on the host:
usb 2-5.3.4: new full-speed USB device number 89 using ehci-pci
usb 2-5.3.4: device descriptor read/64, error -32
usb 2-5.3.4: device descriptor read/64, error -32
usb 2-5.3.4: new full-speed USB device number 90 using ehci-pci
usb 2-5.3.4: device descriptor read/64, error -32
usb 2-5.3.4: device descriptor read/64, error -32
usb 2-5.3.4: new full-speed USB device number 91 using ehci-pci
usb 2-5.3.4: device not accepting address 91, error -32
usb 2-5.3.4: new full-speed USB device number 92 using ehci-pci
usb 2-5.3.4: device not accepting address 92, error -32
hub 2-5.3:1.0: unable to enumerate USB device on port 4
On the instrument side, in keeps resetting (calls to musb_g_reset, musb_g_disconnect, etc.). The sequence of interrupts (i modified 'omap2430_musb_interrupt' to log this)
usb tx rx
1 0 0
4 0 0
4 0 0
4 0 0
4 0 0
4 0 0
4 0 0
4 0 0
5 0 0
1 0 0
The '1' (appearing in both '1' and '5') indicates 'suspend' (see linux-3.16.3/drivers/usb/musb/musb_regs.h) and '4' (appearing in '4' and '5') indicates 'babble'.
I'm at a loss at this point. Any suggestions?