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.

USB Gadget ZERO

Hello every1,

I am using MV5. My aim is to set up bulk as well as control USB communication between DM355 & Workstation, where DM355 will be slave.

I have enabled GADGET-ZERO driver in MV-5 through xconfig...now wt should I do to test it with my LINUX/Windows based workstation, can you suggest me some utils ?

and GADGET ZERO will provide wt kind of features ?

Thank you.

 

 

 

 

 

 

 

  • Gadget zero has to be used with Linux host and it communicate to USBTEST on linux host.

    You can use File storage gadget instead to test USB Mass Storage Class (MSC) with XP/Linux or configure DM35x as USB ethernet gadget (RNDIS for Windows host) to use

    DM35x as network interface.

    Regards,
    Ajay

  •  

    Thank you Ajay.

    But I didn't get you here on GADGET ZERO.

    "Gadget zero has to be used with Linux host and it communicate to USBTEST on linux host."

    can't I use GADGET ZERO on DM355 to kick start USB development ?

    Specifically  I want DM355 to be recognized on Windows/Linux based workstation and want it to send one file from file-system to workstation.

    The USB seems little complected to me ...ur help will be appreciated...

     

  • Like Ajay said, the Gadget Zero is really only used for USB testing when connected to a host.

    For a network like interface, build the Ethernet Gadget driver.  This gives you a network interface over USB.  You use ifconfig to configure the interface and then any standard network  programs (ftp, ssh, telnet, nfs, etc.) to transfer files.

    For a storage like interface, build the File-backed Storage Gadget. When you connect the EM355 to your host computer it will show up like a USB disk drive where you can copy files.

    Steve K.

  • If you choose gadget zero on DM35x then it has to be connected to only Linux host with USBTEST driver so that they both can communicate.

    To transfer a file from DM35x to Host (Linux/Windows) then best is to use file storage gadget (MSC).

    Regards,

    Ajay

  • Thank you for your replies,

    I have added support for all USB_GADGET and got modules for the same.

    They are g_ether.ko, g_file_storage.ko , g_serial.ko,  g_zero.ko, and  gadgetfs.ko.

    Now, as you know I want to test these gadgets with my LINUX workstation running UBUNTU 10.4.

    I have tried loading all the modules one by one but I couldn't able to get anything on dmesg of my host workstation.

    During following tests I have kept my DM355 board and host workstation connected via USB cable.

    for eg.

    First I did, 

    insmod g_zero.ko

    zero gadget: Gadget Zero, version: St Patrick's4
    zero gadget: using dummy_udc, OUT ep-b IN ep-a
    usb 1-1: new high speed USB device using dummy_hcd and address 2
    usb 1-1: configuration #3 chosen from 2 choices
    zero gadget: high speed config #3: source and sink data

    then,

    insmod g_ether.ko

    ether gadget: using random self ethernet address
    ether gadget: using random host ethernet address
    usb0: Ethernet Gadget, version: May Day 2005
    usb0: using dummy_udc, OUT ep-b IN ep-a STATUS ep-c
    usb0: MAC 7e:82:16:64:29:85
    usb0: HOST MAC 32:d3:1e:b2:89:64
    usb0: RNDIS ready
    usb 1-1: new high speed USB device using dummy_hcd and address 3
    usb 1-1: rejected 2 configurations due to insufficient available busr
    usb 1-1: no configuration chosen from 2 choices
    usb 1-1: 100mA is over 8mA budget for port 1!
    hub 1-0:1.0: 92mA over power budget!

    after this I tried

    insmod g_file_storage.ko file=/home/BitScope2.bmp

    g_file_storage gadget-lun0: unable to open backing file: B
    g_file_storage gadget: File-backed Storage Gadget, version: 28 Novem5
    g_file_storage gadget: Number of LUNs=1
    g_file_storage gadget-lun0: ro=0, file: /home/BitScope2.bmp
    usb 1-1: new high speed USB device using dummy_hcd and address 4
    usb 1-1: configuration #1 chosen from 1 choice
    g_file_storage gadget: high speed config #1
    scsi0 : SCSI emulation for USB Mass Storage devices
      Vendor: Linux     Model: File-Stor Gadget  Rev: 0302
      Type:   Direct-Access                      ANSI SCSI revision: 02
    SCSI device sda: 4762 512-byte hdwr sectors (2 MB)
    sda: Write Protect is off
    sda: assuming drive cache: write through
    SCSI device sda: 4762 512-byte hdwr sectors (2 MB)
    sda: Write Protect is off
    sda: assuming drive cache: write through
     sda:<7>usb-storage: queuecommand called
     unknown partition table
    sd 0:0:0:0: Attached scsi disk sda
    sd 0:0:0:0: Attached scsi generic sg0 type 0

    ---------------x---------------

    In addition to these trials I also tried USBTEST on my host pc as shown here,

    But unfortunately It kept on saying USBFS missing error. Because there is no directory named "usb" present in /proc/bus .

    I think the problem is because of  the testusb.c and USBTEST drivers, they are obsolete.

    In new linux distro, the USBFS and  /proc/bus/usb/xx/yy entries are no longer used.

    The valid USB devices are located under /dev/bus/usb/xx/yy.

    Is there anyother way where I can test my DM355's GADGET drivers on my HOST LINUX Workstation instead of dummy-hcd on Dm355 ??

     

    Thank you.

     

     

     

     

     

     

  • Please find my comments inline.

    >I have tried loading all the modules one by one but I couldn't able to get anything on dmesg of my host workstation.

    [Ajay] You need to insert all the modules at a time. Just load one module and test the functionality. for example just load g_file_storage.ko for MSC gadget test.

    Here you can provide "file" parameter as any storage media on DM355 (SD card /dev/mmcblkp1 or flash memory). You should have copied the files to this storage media (SD card) so that it can be transferred to host pc.

    >In addition to these trials I also tried USBTEST on my host pc as shown here,

    >But unfortunately It kept on saying USBFS missing error. Because there is no directory named "usb" present in /proc/bus .

    You need to enable CONFIG_USB_DEVICEFS on host PC side. Its available in menuconfig at  Drivers->USB support->USB device filesystem

    >Is there anyother way where I can test my DM355's GADGET drivers on my HOST LINUX Workstation instead of dummy-hcd on Dm355 ??

    Enable MSC gadget as explained above and keep your files inside storage media (say SD card). Host PC will recognise it as MSC device and would make /dev/sda1 or /dev/sdb1 which can be mounted and then you can perform read/write on it.

    $ mount -t msdos /dev/sda1 /mnt

    $ cd /mnt

    -Ajay

  • Thank you Ajay this worked..I can now test all gadgets.

    Now my intrest is I want to control my application(VPFE+VPBE based) running on LEOPARD board using a remote windows based PC connected to it over USB.

    Which gadget should I use ?

  • Digant,

    The selction of gadget driver depends on your use case and data pattern. If you think any of current available gadget  data protocol matches with your requiremnt then you can use it otherwise you may be required to write your own custom driver for both host and device side.

    Regards,
    Ajay

  • Hi,

    I am new to device drivers, I want to know how to test usb. I found a link where usb testing is explained (www.linux-usb.org/usbtest). here they have mentioned to build and run testusb.c, I have buit and ran(./testusb -a)--- for all devices I getting error of "usbfs files are missing" it is due to missing file "/proc/bus/usb/devcies" my linux kernel version is "3.16.0-37-generic", most of the people tested this testusb in 2.6 kernel.. Can any one explian how to do this usb testing. Also I want to know if I run this test case will it cover all the classes of usb like Communications Device Class, Common Class etc? If not may I know how to cover all the classes testing. For ethernet USB class I am using sockets for testing the usb driver, so please tell me how to test usb completely(all classes).

    Regards,
    Narendra Kumar.
  • Narendra,

    For USB test, please go to USB-IF site for more information.

    Narendra Kumar Chepuri said:
    for all devices I getting error of "usbfs files are missing" it is due to missing file "/proc/bus/usb/devcies"

    The USBFS is deprecated in newer kernels, so please use testusb.c from your kernel source tree under tools/usb/.

  • Thanks for the reply but whcih kind of devcies I need to connect to my PC fort testing the USB drive because I just connect one serial cable it created one file "/dev/bus/usb/002/010" if I am testing that device it is showing following error

    /dev/bus/usb/002/010 test 0 --> 25 (Inappropriate ioctl for device)
    /dev/bus/usb/002/010 test 1 --> 25 (Inappropriate ioctl for device)
    /dev/bus/usb/002/010 test 2 --> 25 (Inappropriate ioctl for device)
    /dev/bus/usb/002/010 test 3 --> 25 (Inappropriate ioctl for device)
    /dev/bus/usb/002/010 test 4 --> 25 (Inappropriate ioctl for device)
    /dev/bus/usb/002/010 test 5 --> 25 (Inappropriate ioctl for device)
    /dev/bus/usb/002/010 test 6 --> 25 (Inappropriate ioctl for device)
    /dev/bus/usb/002/010 test 7 --> 25 (Inappropriate ioctl for device)
    /dev/bus/usb/002/010 test 8 --> 25 (Inappropriate ioctl for device)
    /dev/bus/usb/002/010 test 9 --> 25 (Inappropriate ioctl for device)
    /dev/bus/usb/002/010 test 10 --> 25 (Inappropriate ioctl for device)
    /dev/bus/usb/002/010 test 11 --> 25 (Inappropriate ioctl for device)
    /dev/bus/usb/002/010 test 12 --> 25 (Inappropriate ioctl for device)
    /dev/bus/usb/002/010 test 13 --> 25 (Inappropriate ioctl for device)
    /dev/bus/usb/002/010 test 14 --> 25 (Inappropriate ioctl for device)
    /dev/bus/usb/002/010 test 15 --> 25 (Inappropriate ioctl for device)
    /dev/bus/usb/002/010 test 16 --> 25 (Inappropriate ioctl for device)
    /dev/bus/usb/002/010 test 17 --> 25 (Inappropriate ioctl for device)
    /dev/bus/usb/002/010 test 18 --> 25 (Inappropriate ioctl for device)
    /dev/bus/usb/002/010 test 19 --> 25 (Inappropriate ioctl for device)
    /dev/bus/usb/002/010 test 20 --> 25 (Inappropriate ioctl for device)
    /dev/bus/usb/002/010 test 21 --> 25 (Inappropriate ioctl for device)
    /dev/bus/usb/002/010 test 22 --> 25 (Inappropriate ioctl for device)
    /dev/bus/usb/002/010 test 23 --> 25 (Inappropriate ioctl for device)
    /dev/bus/usb/002/010 test 24 --> 25 (Inappropriate ioctl for device)
    /dev/bus/usb/002/010 test 25 --> 25 (Inappropriate ioctl for device)
    /dev/bus/usb/002/010 test 26 --> 25 (Inappropriate ioctl for device)
    /dev/bus/usb/002/010 test 27 --> 25 (Inappropriate ioctl for device)
    /dev/bus/usb/002/010 test 28 --> 25 (Inappropriate ioctl for device)
    /dev/bus/usb/002/010 test 29 --> 25 (Inappropriate ioctl for device)


    but if I am running ./testusb -a then it is resulting "no test devices recognized".

    Thanks & regards,
    Narendra Kumar.
  • I recommend you ask this question to the Linux kernel mailing lists.