AnsweredAssumed Answered

i.MX6q - Cannot send data using gadgetfs enpoint.

Question asked by Doan Cuong on Jul 6, 2016
Latest reply on Jul 7, 2016 by Doan Cuong

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.

Outcomes