usb 3-2: can't set config #1, error -110

Using USB 2.0 as device mode through GadgetFS for bulk transmission. After enable gadgetFS in .config, build and run on TX2. Connect TX2 as device with PC as host. Getting log on host PC:

usb 3-2: new high-speed USB device number 10 using xhci_hcd
usb 3-2: New USB device found, idVendor=0955, idProduct=7020
usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 3-2: can’t set config #2, error -110

what is the reason of getting error at host side?

Could you share what you have added to the config?

Below is USB descriptor settings:

device_descriptor.bLength = USB_DT_DEVICE_SIZE;
device_descriptor.bDescriptorType = USB_DT_DEVICE;
device_descriptor.bDeviceClass = USB_CLASS_COMM;
device_descriptor.bDeviceSubClass = 2;//0;
device_descriptor.bDeviceProtocol = 1;//0;
//device_descriptor.bMaxPacketSize0 = 255; Set by driver
device_descriptor.idVendor = 0x0955; // My own id
device_descriptor.idProduct = 0x7020; // My own id
device_descriptor.bcdDevice = 0x0200; // Version
// Strings
device_descriptor.iManufacturer = STRINGID_MANUFACTURER;
device_descriptor.iProduct = STRINGID_PRODUCT;
device_descriptor.iSerialNumber = STRINGID_SERIAL;
device_descriptor.bNumConfigurations = 1; // Only one configuration

ep_descriptor_in.bLength = USB_DT_ENDPOINT_SIZE;
ep_descriptor_in.bDescriptorType = USB_DT_ENDPOINT;
ep_descriptor_in.bEndpointAddress = USB_DIR_IN | 1;
ep_descriptor_in.bmAttributes = USB_ENDPOINT_XFER_BULK;
ep_descriptor_in.wMaxPacketSize = 512; // HS size

ep_descriptor_out.bLength = USB_DT_ENDPOINT_SIZE;
ep_descriptor_out.bDescriptorType = USB_DT_ENDPOINT;
ep_descriptor_out.bEndpointAddress = USB_DIR_OUT | 2;
ep_descriptor_out.bmAttributes = USB_ENDPOINT_XFER_BULK;
ep_descriptor_out.wMaxPacketSize = 512; // HS size

if_descriptor.bLength = sizeof(if_descriptor);
if_descriptor.bDescriptorType = USB_DT_INTERFACE;
if_descriptor.bInterfaceNumber = 0;
if_descriptor.bAlternateSetting = 0;
if_descriptor.bNumEndpoints = 2;
if_descriptor.bInterfaceClass = USB_CLASS_COMM;
if_descriptor.bInterfaceSubClass = 2;//0;
if_descriptor.bInterfaceProtocol = 255;//0;
if_descriptor.iInterface = STRINGID_INTERFACE;

config_hs.bLength = sizeof(config_hs);
config_hs.bDescriptorType = USB_DT_CONFIG;
config_hs.wTotalLength = config_hs.bLength +
    if_descriptor.bLength + ep_descriptor_in.bLength + ep_descriptor_out.bLength;
config_hs.bNumInterfaces = 1;
config_hs.bConfigurationValue = CONFIG_VALUE;
config_hs.iConfiguration = STRINGID_CONFIG_HS;
config_hs.bMaxPower = 1;

config.bLength = sizeof(config);
config.bDescriptorType = USB_DT_CONFIG;
config.wTotalLength = config.bLength +
    if_descriptor.bLength + ep_descriptor_in.bLength + ep_descriptor_out.bLength;
config.bNumInterfaces = 1;
config.bConfigurationValue = CONFIG_VALUE;
config.iConfiguration = STRINGID_CONFIG_LS;
config.bMaxPower = 1;

Sorry, I meant "After enable gadgetFS in .config, build and run on TX2. ". Where did you enable gadgetFS?

What you mentioned in #3 is the config from usb devices,right?

Ok, using “make O=$TEGRA_KERNEL_OUT tegra18_defconfig” we get default .config file and set “y” to “CONFIG_USB_GADGETFS” manually.

I haven’t understand second point. What is #3 and where can I get this?

I meant the number 3(#3) comment on this thread.

Yes, that is configuration for usb device which is used for gadgetFS.

So what is the issue for this “usb 3-2: can’t set config #2, error -110”?

There is some wrong configuration setting or what?
device.c (11.8 KB)

It needs to trace the kernel source to find out cause.

Could you enable or just print some logs inside

kernel/kernel-4.4/drivers/usb/core/message.c -> usb_set_configuration?

Also, what device are you using? A camera?

Ok, i’ll include logs in function “usb_set_configuration”.

There is no other device, actually we are trying to use TX2 as device for bulk transmission so wants to set it into gadgetFS.

In later releases there is sample gadget device setup located here:


If that is running at the same time as your code, then I’d expect there might be some issues. Are you running your code from editing this, or is your code doing something different at the same time as the “/opt” version?

Yes, if you want to set tegra as usb device, please refer to the script under /opt/nvidia/l4t-usb-device-mode.

We tried that also, script given at /opt/nvidia/l4t-usb-device-mode is commented and then run example code to set TX2 as device in gadgetFS. When example code is run on TX2 then it is stuck into ep0 configuration. It means ep0 configuration is not completed and after some time TX2 rebooted.

At the same time on host PC we get below log:

usb 3-2: new high-speed USB device number 10 using xhci_hcd
usb 3-2: New USB device found, idVendor=0955, idProduct=7020
usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 3-2: can’t set config #2, error -110
usb 3-2: USB disconnect, device number 10

Because of TX2 is stuck after code execution we can’t able to take log included into “kernel/kernel-4.4/drivers/usb/core/message.c -> usb_set_configuration”.


Not pretty sure what you have done. As I know, the script provided by Jetpack should run automatically by systemd during boot up and tegra should be detected as device mode once you connect a usb cable to the micro AB port.

I would suggest put your app away at this moment and try our script. Do you mean you can see the error log from kernel even if running our own script? Did you modify our script?

Using script /opt/nvidia/l4t-usb-device-mode we are able to use USB in classes ACM/UMS, and USB Driver should be set as configFS in menuconfig, but we don’t want to work at classes. We tried to USB commmunication through bulk transfer type using gadgetFS base driver api using in above example code “device.c”.

So is it possible on TX2 to use gadgetFS? If yes, then is there some step missing? If not, then is there any technical reason to not able to use gadgetFS?

Yes using that script we are able to communication TX2 in device mode with ACM-CDC & Mass storage class. That trial is completed. In that case USB configFS is used.

But now we are trying to use gadgetFS without any usb class. And trying to simple bulk transmission.

Error log is not seen because of your script, first we disabled your script and run our example code then got error log on kernel.

USB must use a class, there is no exception. Bulk storage is a standard class, and this is how the script works. For anything to appear as bulk storage it must have an interface compatible with a disk partition…a block device. For anything other than a standard class you must have a custom class (known as a “Vendor Specific Class”) and a custom driver.

Gadget only works with standard classes. On a Jetson this is also limited to classes which are not isochronous (not a problem for this case). If you wish to create something using bulk transfer protocol, but which is not an interface to a storage device with block access similar to a disk partition, then you must give up gadget and build it from scratch.

Do you want this to be a disk partition emulation, or must it be something else which simply uses bulk transfer mode? The former is easy, the latter is involved and with a bigger learning curve.

Yes, we are trying to do latter case which is data is transfer in bytes through bulk transfer type to host PC.

Actually we are trying for this using example code attached in previous comment in which simple bulk transmission approch is used. During execution of that example code we are getting error “usb 3-2: can’t set config #1, error -110”.

Is that example is right approach or how can we start to do that?

We have to test feasibility of communication between TX2 and host PC using bulk transfer type.

Gadget was designed only for standard classes. You won’t be able to use it as a framework for bulk transmission. You can study the code and learn from it, but you will be writing your driver from scratch. That implies the driver at both sides will be custom.

I do not know about the error, but likely that if you are trying to use gadget, then this error is because it is missing a configuration step…the one turning it into mass storage.

A question arises as to whether the nature of your data requires custom drivers, or if you could treat this like a partition (where the data partition might be VFAT or ext4 or even some custom file system type…maybe a binary unformatted partition) and simply allow the other end to look at a partition.

Partitions can be used with and without formatting. Partitions can be read or written at any offset for any span of bytes. Partitions can be marked read only or even write only. Knowing more about your use of the data, and how the data might change would help. Otherwise the only possibility is to write everything from scratch for both sides of the USB connection.

Per checked this issue, it turns our we don’t guarantee the function of GadgetFS in k4.4.

There is bug in kernel source file related to gadgetfs. After patch that bug using below update usb communication for gadgetfs between device and host with bulk transfer type is working.