bus powered hub reported as self powered

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

 



Hi all,

I'm on USB certification of a vendor SoC, and there's a case called
"Bus powered hub power exceeded test" in the compliance plan defined
by the usb.org. It requires an error message when a device (Max power
descriptor >100mA) is attached to an external bus powered hub.

But when I attached the bus powered hub to Linux (Ubuntu 14.04), I
found that it always reported as self powered

Bus 002 Device 026: ID 1a40:0801 Terminus Technology Inc.
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            9 Hub
  bDeviceSubClass         0 Unused
  bDeviceProtocol         1 Single TT
  bMaxPacketSize0        64
  idVendor           0x1a40 Terminus Technology Inc.
  idProduct          0x0801
  bcdDevice            1.00
  iManufacturer           0
  iProduct                1 USB 2.0 Hub
  iSerial                 0
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           25
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0xe0
      Self Powered
      Remote Wakeup
    MaxPower              100mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         9 Hub
      bInterfaceSubClass      0 Unused
      bInterfaceProtocol      0 Full speed (or root) hub
      iInterface              0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0001  1x 1 bytes
        bInterval              12
Hub Descriptor:
  bLength               9
  bDescriptorType      41
  nNbrPorts             4
  wHubCharacteristic 0x0000
    Ganged power switching
    Ganged overcurrent protection
    TT think time 8 FS bits
  bPwrOn2PwrGood       50 * 2 milli seconds
  bHubContrCurrent    100 milli Ampere
  DeviceRemovable    0x00
  PortPwrCtrlMask    0xff
 Hub Port Status:
   Port 1: 0000.0100 power
   Port 2: 0000.0100 power
   Port 3: 0000.0100 power
   Port 4: 0000.0100 power
Device Qualifier (for other device speed):
  bLength                10
  bDescriptorType         6
  bcdUSB               2.00
  bDeviceClass            9 Hub
  bDeviceSubClass         0 Unused
  bDeviceProtocol         0 Full speed (or root) hub
  bMaxPacketSize0        64
  bNumConfigurations      1
Device Status:     0x0001
  Self Powered

And I've checked the source code in drivers/usb/core/hub.c
1521         if (hdev == hdev->bus->root_hub) {
1522                 if (hcd->power_budget > 0)
1523                         hdev->bus_mA = hcd->power_budget;
1524                 else
1525                         hdev->bus_mA = full_load * maxchild;
1526                 if (hdev->bus_mA >= full_load)
1527                         hub->mA_per_port = full_load;
1528                 else {
1529                         hub->mA_per_port = hdev->bus_mA;
1530                         hub->limited_power = 1;
1531                 }
1532         } else if ((hubstatus & (1 << USB_DEVICE_SELF_POWERED))
== 0) {
1533                 int remaining = hdev->bus_mA -
1534                         hub->descriptor->bHubContrCurrent;
1535
1536                 dev_dbg(hub_dev, "hub controller current
requirement: %dmA\n",
1537                         hub->descriptor->bHubContrCurrent);
1538                 hub->limited_power = 1;
1539
1540                 if (remaining < maxchild * unit_load)
1541                         dev_warn(hub_dev,
1542                                         "insufficient power
available "
1543                                         "to use all downstream
ports\n");
1544                 hub->mA_per_port = unit_load;   /* 7.2.1 */
1545
1546         } else {        /* Self-powered external hub */
1547                 /* FIXME: What about battery-powered external
hubs that
1548                  * provide less current per port? */
1549                 hub->mA_per_port = full_load;
1550         }

The hub->mA_per_port is always set as full_load (500mA for usb 2.0
hub) since reported as self powered hub.
So when I attach a usb device with ( 100mA < Max power descriptor <=
500mA), linux won't show error messages.

I'm wondering why the bus powered hub reported as self powered? And is
any switch to make it bus powered?

Thanks!

Regards
Rong
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




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

  Powered by Linux