Jump to content

USB gadget built for H3 processor on top of GadgetFS


Recommended Posts

Hi, in case somebody is looking for working example of USB gadget built for H3 processor (Orange Pi PC) on top of GadgetFS, please look at the link:

 

https://github.com/prife/ptp-gadget

 

The only adaptation required for Orange Pi PC is in autoconfig() function:

 

    else if (stat(DEVNAME = "sunxi_usb_udc", &statb) == 0) {
        HIGHSPEED = 1;

        fs_source_desc.bEndpointAddress
            = hs_source_desc.bEndpointAddress
            = USB_DIR_IN | 1;
        EP_IN_NAME = "ep1in-bulk";
        fs_sink_desc.bEndpointAddress = hs_sink_desc.bEndpointAddress
            = USB_DIR_OUT | 1;
        EP_OUT_NAME = "ep1out-bulk";

        source_sink_intf.bNumEndpoints = 3;
        fs_status_desc.bEndpointAddress
            = hs_status_desc.bEndpointAddress
            = USB_DIR_IN | 2;
        EP_STATUS_NAME = "ep2in-bulk";
    /* Orange Pi PC H3 processor */
 

The Armbian kernel (v.3.4) configuration should be changed to include USB gadget and GadgetFS items.

 

I would suggest to add this to the default kernel configuration.

Link to comment
Share on other sites

@perfstr Good to know you had this working. By any chance do you still have the .config? My Windows host gets as far as installing the driver then fails trying to get a device descriptor. Device side (H3 powered NanoPi Air) reports below

 

TAIA

 

```

@nanopiair:/test/gadget_usb$ sudo gadget_usb -v
/dev/gadget/sunxi_usb_udc ep0 configured
serial="mjqebex15vip4cq2dptcpzak8f508n36z1ulgiqmwe5lgfborb0a5sj4x4xb40a"

** Mon Sep 18 14:01:55 2017
CONNECT high speed
SETUP 80.06 v03ee i0000 18
... protocol stall 80.06
SETUP 80.06 v0303 i0409 255
SETUP 80.06 v0300 i0000 255
SETUP 80.06 v0300 i0000 257
read 2 ep0 events
DISCONNECT
SUSPEND
CONNECT high speed
read 2 ep0 events
DISCONNECT
SUSPEND
```

Link to comment
Share on other sites

Hello, we have a working Armbian system that runs the user mode USB device and Windows application that uses LIBUSB to connect to device. Once we used another hardware platform for the device firmware. Now, when we switched to Orange Pi PC, I had to change the Windows part in order to adapt it for the USB OTG driver limitation. We used USB sniffer program in order to get USB traces of old and new devices. This way we were able to solve some startup problems.

Please explain what .config file you mean - kernel configuration?

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines