Search

Technical Discussion Group Forum

This forum is provided for user discussion. While Beacon EmbeddedWorks support staff and engineers participate, Beacon EmbeddedWorks does not guarantee the accuracy of all information within in the Technical Discussion Group (TDG).

The "Articles" forums provide brief Articles written by Beacon EmbeddedWorks engineers that address the most frequently asked technical questions.

To receive email notifications when updates are posted for a Beacon EmbeddedWorks product download, please subscribe to the TDG Forum of interest.

TDG Forum

PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 31 Mar 2006 02:51 PM by  Abraham
how to use usb gadget in linux
 2 Replies
Sort:
You are not authorized to post a reply.
Author Messages
zhouwang@sitek.cn
New Member
New Member
Posts:


--
22 Feb 2006 11:47 PM
    How can I make lpd7a404 as a u-disk by using it's usb device controller in linux.

    My platform is lpd7a404-SDK/linux/BSP-sharpLH7-1.2.8. I want to make lpd7a404 as a u-disk,
    so I can format or copy file from PC(OS:WinXP) to lpd7a404 via usb (PC is host, and lpd7a404-SDK is device).

    I have configured linux's kernel with "usb gadget" & "usb file storage" support, like this:

    #
    # USB Gadget Support
    #
    CONFIG_USB_GADGET=y
    CONFIG_USB_GADGET_DEBUG_FILES=y
    # CONFIG_USB_GADGET_NET2280 is not set
    # CONFIG_USB_GADGET_PXA2XX is not set
    # CONFIG_USB_GADGET_GOKU is not set
    CONFIG_USB_GADGET_LH7A40X=y
    CONFIG_USB_LH7A40X=y
    # CONFIG_USB_GADGET_OMAP is not set
    # CONFIG_USB_GADGET_DUMMY_HCD is not set
    # CONFIG_USB_GADGET_DUALSPEED is not set
    # CONFIG_USB_ZERO is not set
    # CONFIG_USB_ETH is not set
    CONFIG_USB_GADGETFS=m
    CONFIG_USB_FILE_STORAGE=m
    # CONFIG_USB_FILE_STORAGE_TEST is not set
    # CONFIG_USB_G_SERIAL is not set

    After "make modules", I get module g_file_storage.ko, then I test after linux booted:

    / # dd if=/dev/zero of=udisk.img bs=1k count=4096
    4096+0 records in
    4096+0 records out
    / # insmod /usr/modules/g_file_gadget.ko file=udisk.img
    Using usr/modules/g_file_storage.ko
    g_file_storage gadget: File-backed Storage Gadget, version: 20 October 2004
    g_file_storage gadget: Number of LUNs=1
    g_file_storage gadget-lun0: ro=0, file: /udisk.img
    lh7a40x_udc: registered gadget driver 'g_file_storage'

    ======= now I connect lpd7a404-SDK to PC(WinXP) via usb cable ========

    / # g_file_storage gadget: full speed config #1

    Now WinXP show a u-disk driver is usable, but it's capability is 0 MB, and I cannot format u-disk or copy file to u-disk.

    Is there any suggestion to me?


    Best regards,
    Alex Zhou

    Sitek Hengke Co., ltd.
    E-Mail: zhouwang@sitek.cn
    Address: GuangBao Road No.1, New District, WuXi, JiangSu, China
    Anonymous
    Posts:


    --
    01 Mar 2006 12:33 PM
    Since this is a third party BSP for the LH7A404 card engine it isn't supported directly by Logic as standard product. For this reason these types of questions would need to be handled under a support contract. We have developers in house that are familiar with this BSP and could help you with this and other questions.

    Another good place to check for more Linux information would be on Sharp's forums:

    http://forum.sharpsma.com/

    Thanks,
    Abraham
    New Member
    New Member
    Posts:


    --
    31 Mar 2006 02:51 PM
    check out

    http://www.linux-usb.org/...et/file_storage.html

    reading your summary of commands, I did not see where you partitioned the backing file (assigning sectors, cylinders, and heads). Try doing that before loading the module.

    I have to use the stall=no option when I load the module:
    insmod g_file_storage file=/backing_file stall=no

    otherwise the host doesn't recognize the device.

    -Abraham
    You are not authorized to post a reply.