Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

How can I obtain information about the amount of current negotiated by a device attached to a USB port?

I am looking for information similar to this presented by OS X in terms of current available and current required.

share|improve this question
    
What OS are you looking for this info in particular? Which distros? –  slm Jan 24 '13 at 5:30
    
debian based OS -- specifically raspbian wheezy for raspberry pi but general information would be great if possible –  arcyqwerty Jan 24 '13 at 5:33

1 Answer 1

up vote 6 down vote accepted

Take a look at the command lsusb. Specifically lsusb -v or lsusb -vv. Check the man page for it as well.

For example here's a wireless mouse on my laptop (Fedora 14):

% sudo lsusb -v
Bus 002 Device 003: ID 046d:c521 Logitech, Inc. Cordless Mouse Receiver
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0         8
  idVendor           0x046d Logitech, Inc.
  idProduct          0xc521 Cordless Mouse Receiver
  bcdDevice           57.01
  iManufacturer           1 Logitech
  iProduct                2 USB Receiver
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           59
    bNumInterfaces          2
    bConfigurationValue     1
    iConfiguration          4 RR57.01_B0023
    bmAttributes         0xa0
      (Bus Powered)
      Remote Wakeup
    MaxPower               98mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      1 Boot Interface Subclass
      bInterfaceProtocol      2 Mouse
      iInterface              0 
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.11
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      67
         Report Descriptors: 
           ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0008  1x 8 bytes
        bInterval              10
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0 No Subclass
      bInterfaceProtocol      0 None
      iInterface              0 
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.11
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      79
         Report Descriptors: 
           ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0008  1x 8 bytes
        bInterval              10
Device Status:     0x0000
  (Bus Powered)
share|improve this answer
    
I think I was able to query similar information from /sys/bus/usb/devices/usb1/1-1/bMaxPower, however, can I find how much power a device is currently receiving? –  arcyqwerty Jan 25 '13 at 4:29
    
Yes that is the information from the kernel that lsusb is pulling to display. BTW, I search for a while and wasn't able to find anyway to get the power draw of device. –  slm Jan 25 '13 at 15:03
    
ah okay. thanks. strange that its possible to find on windows/mac but not linux... –  arcyqwerty Jan 27 '13 at 2:23
    
I agree. I'm not convinced the info being displayed in windows is actually any more accurate. I think it's just showing the amount of power the device is reporting it wants/needs, which is the same thing that lsusb is showing as MaxPower. See this post for more: superuser.com/questions/297959/… –  slm Jan 27 '13 at 2:30
    
so MaxPower is the amount of power requested by the device... ok. It would be nice to have how much power is available too, but it's better than nothing I guess –  arcyqwerty Jan 28 '13 at 5:58

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.