i.MX6q - Cannot send data using gadgetfs enpoint.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

i.MX6q - Cannot send data using gadgetfs enpoint.

680 Views
doancuong
Contributor I

Dear NXP Support,

I am using i.MX6q that is installed kernel 3.10.17.

I want to send data using gadgets endpoint. My endpoints:

# ls -l /dev/gadget/

total 0

-rw-------    1 root     root             0 Jan  1 00:00 ci_hdrc_imx

-rw-------    1 root     root             0 Jan  1 01:23 ep1in

-rw-------    1 root     root             0 Jan  1 01:23 ep1out

-rw-------    1 root     root             0 Jan  1 01:23 ep2in

-rw-------    1 root     root             0 Jan  1 01:23 ep2out

-rw-------    1 root     root             0 Jan  1 01:23 ep3in

-rw-------    1 root     root             0 Jan  1 01:23 ep3out

-rw-------    1 root     root             0 Jan  1 01:23 ep4in

-rw-------    1 root     root             0 Jan  1 01:23 ep4out

-rw-------    1 root     root             0 Jan  1 01:23 ep5in

-rw-------    1 root     root             0 Jan  1 01:23 ep5out

-rw-------    1 root     root             0 Jan  1 01:23 ep6in

-rw-------    1 root     root             0 Jan  1 01:23 ep6out

-rw-------    1 root     root             0 Jan  1 01:23 ep7in

-rw-------    1 root     root             0 Jan  1 01:23 ep7out

I am using example in: http://www.linux-usb.org/gadget/usb.c (and also need:usbstring.c-- http://www.linux-usb.org/gadget/usbstring.c and usbstring.h---http://www.linux-usb.org/gadget/usbstring.h).

I already added init code for "ci_hdrc_imx" at autoconfig() in usb.c:

else if (stat (DEVNAME = "ci_hdrc_imx", &statb) == 0)

{

        HIGHSPEED = 1;

        device_desc.bcdDevice = __constant_cpu_to_le16 (0x0109);

        fs_source_desc.bEndpointAddress

            = hs_source_desc.bEndpointAddress

            = USB_DIR_IN | 7;

        EP_IN_NAME = "ep7in";

        fs_sink_desc.bEndpointAddress

            = hs_sink_desc.bEndpointAddress

            = USB_DIR_OUT | 2;

        EP_OUT_NAME = "ep2out";

        source_sink_intf.bNumEndpoints = 3;

        fs_status_desc.bEndpointAddress

            = hs_status_desc.bEndpointAddress

            = USB_DIR_IN | 3;

        EP_STATUS_NAME = "ep3in";

  }

However, when I run the example to send data, the write()(status = write (source_fd, buf, len);) method in simple_source_thread() return negative number. I don't know why.

The example already opened "source_fd" successfully.

Can somebody give me some suggestions? Thanks you in advance.

Best Regards,

Cuong.

Labels (1)
0 Kudos
2 Replies

570 Views
igorpadykov
NXP Employee
NXP Employee

Hi Cuong

one can look at gadget examples in unit tests (..test/mxc_usb_test)

Index of /buildsources/i/imx-test/imx-test-3.10.17-1.0.0

Best regards

igor

-----------------------------------------------------------------------------------------------------------------------

Note: If this post answers your question, please click the Correct Answer button. Thank you!

-----------------------------------------------------------------------------------------------------------------------

0 Kudos

570 Views
doancuong
Contributor I

Thanks igor for your response,

How can I test this example? I don't see any executable file in this folder.

Could you please let me know?

Best Regards,

Cuong

0 Kudos