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.

Multiple Device/Gadget USB Instances in PSP 3.01?

The PSP 3.01 Release Notes suggest that USB device/gadget/slave mode is supported and it looks like there are a few possible gadget devices in the kernel configuration. I was wondering if the USB stack allows for multiple gadget instances, for example having a device (DM365) with a gadget mass storage instance and a serial gadget at the same time over the single USB physical link?

If this is supported is there any documentation or examples on starting these gadget drivers? The PSP examples don't seem to have any USB examples and the User's Guide does not mention USB either.

  • Bernie,

    As I understand we do not test for the use case that you have mentioned here - MSC + Serial Gadget.  Yet it is a configuration that DM365 can support when in Device(Gadget) mode.

    I believe you would have to write a new gadget app to support such a gadget.

    regards

    swami

  • I tried doing this from the command line and it failed, I can start one gadget or the other, but the second modprobe fails with a 'Device or resource busy' error.

    With the file storage first:

    DM365EVM said:
    root@dm365-evm:~# depmod -a
    root@dm365-evm:~# modprobe g_file_storage file=/backing_file
    g_file_storage gadget: File-backed Storage Gadget, version: 20 November 2008
    g_file_storage gadget: Number of LUNs=1
    g_file_storage gadget-lun0: ro=0, file: /backing_file
    g_file_storage gadget: high speed config #1
    root@dm365-evm:~# modprobe g_serial
    FATAL: Error inserting g_serial (/lib/modules/2.6.32-rc2-davinci1/kernel/drivers/usb/gadget/g_serial.ko): Device or resource busy
    root@dm365-evm:~#

    With the gadget serial first:

    DM365EVM said:
    root@dm365-evm:~# modprobe g_serial
    g_serial gadget: Gadget Serial v2.4
    g_serial gadget: g_serial ready
    root@dm365-evm:~# modprobe g_file_storage file=/backing_file
    FATAL: Error inserting g_file_storage (/lib/modules/2.6.32-rc2-davinci1/kernel/drivers/usb/gadget/g_file_storage.ko): Device or resource busy
    root@dm365-evm:~#

    swami said:
    I believe you would have to write a new gadget app to support such a gadget.

    When you say this might require a new gadget app, do you mean this is something that could be done from a user space application using the out of the box PSP, if so do you have any pointers to any documentation on the subject?

    Alternatively I assume you mean this would require writing a new gadget driver in the kernel that would combine the two?

  • Bernie,

    The default gadget apps in the Linux kernel cannot work side by side.  They need exclusive access to the underlying usb controller module.  "Device or resource busy" is the error that will be generated if the usb controller is already owned by another gadget driver.

    When I mentioned "I believe you would have to write a new gadget app to support such a gadget" I meant that it might be that such a gadget driver (msc+serial) might be available already from other open source projects (I am not aware of any links/projects).  If not then you/customer would have to develop it.  Pl. follow the Linux gadget API documentation on how to use the gadget framework and use serial gadget as the reference to develop the custom gadget app in the kernel.

    Alternate option would be to use the gadgetfs infrastructure to develop such a custom app in the user space.  Pl. note that gadgetfs infrastructure is not tested with any psp solution as I understand.

    regards

    swami

  • Bernie,

    I don't know anything about the Linux kernel for DM365, but have a look at the AM37x/OMAP35x kernel source. There is a multifunction composite gadget driver that can be either:  RNDIS + CDC Serial + Storage or CDC Ethernet + CDC Serial + Storage. I tried one of them a few weeks ago and had a kernel panic. This could be something for you to start with or look at.

    Steve K.

  • Thanks Steve, the experimental implementation from the OMAP kernel may be handy in developing a composite serial/storage driver. Unfortunately in the DM365 kernel menuconfig I only see one composite device, a CDC device with Ethernet and ACM, nothing combining storage with serial/ACM, the multifunction gadget driver is not available.

  • My steps of operation are as follows:

    Step 1 : I acquire some data on beagle board on angstromlinux and send to SD Card by mounting it on Beagle Board. Now I unmount the card from beagle board and use gadget driver to mount the sd card on host.

    Step2 : Now after Host acquires the data from the sd card, Then i want to remove driver & mount it on Beagleboard and use storage again on B.Board.

    But How will the beagle board know when to again unmount the gadget driver and again mount sd card on beagle board....that is 

    How do BB capture the event of usb eject from host ?? for that i need some way to send event from host to device ....

    If I use beagle board as USB mass stroage device I might face a problem. In order to avoid a file system crash on sd card, only one i.e. host or beagle board can read or write sd card at one time. Other one cannot read or write at the same time. Now this causes problem in my operation:

    Is there some concept of composite driver where mass storage class can be used along side say : uart interface using the same physical usb communication path to send commands from host to beagle board which can aid the above operation. Please help me if I am thinking wrong. Please suggest.

    I found this...

    http://lxr.free-electrons.com/source/drivers/usb/gadget/multi.c

    But am not getting any document which tells how to use this...

    Have you been successful in your attempt of using usb multi gadget ..please reply 

    thanks

    pl cc your reply on    nidhimittal19@gmail.com

     

  • Normal 0 false false false MicrosoftInternetExplorer4

    You can use /sys/devices/platform/i2c_omap.1/i2c-1/1-0048/twl4030_usb/vbus

    Entry for this purpose.

    $ cat /sys/devices/platform/i2c_omap.1/i2c-1/1-0048/twl4030_usb/vbus

    If it’s “on” then cable is still connected and if it’s “off” then cable is

    Disconnected.

    Regards,
    Ajay