RE: [xhci-host] change device configuration assistance

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Sarah,

First of all thank you very much for the prompt response!
Please see comments bellow.


> > I'm trying to switch to the second configuration using sysfs (by
> writing to
> > bConfigurationValue in /sys/bus/usb/devices/10-1/).
> 
> Oh, interesting, I wasn't aware users could do that.

I found it out myself just recently :) I was looking for whoever calls
usb_set_configuration() and found out that it's called from sysfs.c -
set_bConfigurationValue().
This works with dummy_hcd() but there it's all much simpler. 

> > [   65.694680] xhci_hcd 0000:01:00.0: Wrote link toggle flag to
> segment ffff880122acc460 (virtual), 0xc5021000 (DMA)
> > [   65.694683] xhci_hcd 0000:01:00.0: WARN no SS endpoint bMaxBurst
> 
> Do you have a SuperSpeed Endpoint Companion descriptor for all your
> endpoints?  Because this message seems to indicate you don't.  Can you
> send me the lsusb -vvv for your device?

Lsusb log is attached. We do have SS Endpoint Companion descriptor, I think
the warning here is because the bMaxBurst field of the Endpoint Companion
descriptor is 0.

> > [  108.742142] xhci_hcd 0000:01:00.0: Wrote link toggle flag to
> segment ffff880037bde560 (virtual), 0x37a93400 (DMA)
> > [  108.742146] xhci_hcd 0000:01:00.0: WARN no SS endpoint bMaxBurst
> 
> More issues with the SuperSpeed Endpoint Companion descriptors here.

Is it a problem that we report that bMaxBurst is 0?

> 
> > [  108.742216] xhci_hcd 0000:01:00.0: add ep 0x2, slot id 1, new drop
> flags = 0x0, new add flags = 0x3c, new slot info = 0x28400000
> 
> I'm a bit surprised that the endpoints from the previous configuration
> weren't dropped before this new configuration was added.  But drivers
> usually go through usb_set_configuration(), and maybe the sysfs
> interface hits a different path?  I'll have to look into the code flow.

Nope, the same. Here is the code from sysfs.c that handles this:
static ssize_t
set_bConfigurationValue(struct device *dev, struct device_attribute *attr,
		const char *buf, size_t count)
{
	struct usb_device	*udev = to_usb_device(dev);
	int			config, value;

	if (sscanf(buf, "%d", &config) != 1 || config < -1 || config > 255)
		return -EINVAL;
	usb_lock_device(udev);
	value = usb_set_configuration(udev, config);
	usb_unlock_device(udev);
	return (value < 0) ? value : count;
}

> Ok, I'll take a look into fixing this tomorrow.  I'll probably send you
> two patches: one to add an additional check in xhci_add_endpoint(), and
> another once I figure out the root cause of why the first configuration
> isn't getting removed.  Can you test with just the first patch, to make
> sure the check works?

No problem. Thank you very much! Waiting for the patches...

Thanks,
Tanya Brokhman
---
Sent by an consultant of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.



Bus 010 Device 003: ID 0525:a4a5 Netchip Technology, Inc. Linux-USB File Storage Gadget
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               3.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0         9
  idVendor           0x0525 Netchip Technology, Inc.
  idProduct          0xa4a5 Linux-USB File Storage Gadget
  bcdDevice            0.00
  iManufacturer           2 Linux 2.6.39+ with pcd
  iProduct                3 Mass Storage Gadget
  iSerial                 0 
  bNumConfigurations      2
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           44
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0xc0
      Self Powered
    MaxPower                2mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         8 Mass Storage
      bInterfaceSubClass      6 SCSI
      bInterfaceProtocol     80 Bulk (Zip)
      iInterface              1 Mass Storage
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0400  1x 1024 bytes
        bInterval               0
        ** UNRECOGNIZED:  06 30 00 00 00 00
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0400  1x 1024 bytes
        bInterval               0
        ** UNRECOGNIZED:  06 30 00 00 00 00
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           86
    bNumInterfaces          1
    bConfigurationValue     2
    iConfiguration          0 
    bmAttributes         0xc0
      Self Powered
    MaxPower                2mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           4
      bInterfaceClass         8 Mass Storage
      bInterfaceSubClass      6 SCSI
      bInterfaceProtocol     98 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0400  1x 1024 bytes
        bInterval               0
        ** UNRECOGNIZED:  06 30 00 10 00 00
        INTERFACE CLASS:  04 24 03 00
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0400  1x 1024 bytes
        bInterval               0
        ** UNRECOGNIZED:  06 30 00 10 00 00
        INTERFACE CLASS:  04 24 04 00
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0400  1x 1024 bytes
        bInterval               0
        ** UNRECOGNIZED:  06 30 00 10 00 00
        INTERFACE CLASS:  04 24 02 00
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0400  1x 1024 bytes
        bInterval               0
        ** UNRECOGNIZED:  06 30 00 10 00 00
        INTERFACE CLASS:  04 24 01 00
Device Status:     0x0001
  Self Powered

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux