LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Reluctant USB devices (https://www.linuxquestions.org/questions/linux-newbie-8/reluctant-usb-devices-506901/)

Odyssey1942 12-02-2006 02:25 PM

Reluctant USB devices
 
I have yet to plug a USB device into any of our Ubuntu machines and have the computer immediately recognize it and put up an icon.

I would like to better understand what is happening within Linux with USB devices. If one gives the terminal command lsusb -v , a lot of information comes up (example quoted from such output for 'Bus 001 Device 001...below) but I am unsure what much of it means. I assume that some of it refers to the bus whether something is plugged in or not, and other of it refers to the device that is plugged in.

I also assume that at bootup Linux first sets up some sort of communications with the USB ports so that if anything gets plugged in, the presence of the device should be recognized.

Then presumeably Linux tries to figure out what it is, and if successful, somehow allow user accessability/use of the device.

So if a user wants to confirm that Linux:

-is aware of the device presence, and
-has or has not identified the device
regardless of whether the device is a flash memory (thumbdrive sort of thing), hard disk drive, CD or DVD reader or reader-writer:

what are the various things going on inside Linux so that these things can be consistently determined?

So is anyone able to explain in relatively simple terms what goes on from bootup differentiating between bus and device, especially including any commands that lead one to the information?

Resource referral is welcome, but most of what I have googled up is in pretty deep technical language and I am looking for something more oriented toward newbies. TIA.

Excerpted from lsusb -v
Code:

Bus 001 Device 001: ID 0000:0000
Device Descriptor:
  bLength                18
  bDescriptorType        1
  bcdUSB              1.10
  bDeviceClass            9 Hub
  bDeviceSubClass        0 Unused
  bDeviceProtocol        0
  bMaxPacketSize0        8
  idVendor          0x0000
  idProduct          0x0000
  bcdDevice            2.06
  iManufacturer          3
  iProduct                2
  iSerial                1
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                9
    bDescriptorType        2
    wTotalLength          25
    bNumInterfaces          1
    bConfigurationValue    1
    iConfiguration          0
    bmAttributes        0xe0
      Self Powered
      Remote Wakeup
    MaxPower                0mA
    Interface Descriptor:
      bLength                9
      bDescriptorType        4
      bInterfaceNumber        0
      bAlternateSetting      0
      bNumEndpoints          1
      bInterfaceClass        9 Hub
      bInterfaceSubClass      0 Unused
      bInterfaceProtocol      0
      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    0x0002  1x 2 bytes
      Self Powered
      Remote Wakeup
    MaxPower                0mA
    Interface Descriptor:
      bLength                9
      bDescriptorType        4
      bInterfaceNumber        0
      bAlternateSetting      0
      bNumEndpoints          1
      bInterfaceClass        9 Hub
      bInterfaceSubClass      0 Unused
      bInterfaceProtocol      0
      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    0x0002  1x 2 bytes
        bInterval            255


Mara 12-02-2006 03:20 PM

Well...bus is bus. Like USB. Devices: thumbdrive, cd drive etc.

The identification of USB device is a part of USB standard (which is more complicated than it looks). In short, Linux gets the info as a part of the initialization of that device (when it's plugged in or at bootup), from an exchange of messages with the device. What may be interesting to you, it has vendor and product ids. If it can recegnize the device, it can load the right driver, notify the right app and so on (using the hotplug feature).

Odyssey1942 12-03-2006 11:25 PM

I am unable to find or use any USB devices that don't self-activate, so I want to learn how to manually locate and activate them. Thanks.

Odyssey1942 12-04-2006 08:54 AM

To further refine my question, I assume that all distros operate the same way, but please advise if not. I am using Ubuntu 6.06.

First is the layer of hardware that the USB ports are connected to. Does Linux always use the same directory to place files that "connect" the motherboard to these ports? If so, which directory? If possible to say, what files? (is it correct to call this "bus" info?)

Then when a USB device is plugged in, Linux must record the event. Where? In what files?

Assuming that it recognizes the device, Linux must make a file or record in a file the details of the device. Where and how does one see it?

Many thanks.

Mara 12-05-2006 03:27 PM

Quote:

Originally Posted by Odyssey1942
To further refine my question, I assume that all distros operate the same way, but please advise if not. I am using Ubuntu 6.06.

You can quite safely assume they all do it in the same way.

Quote:

First is the layer of hardware that the USB ports are connected to. Does Linux always use the same directory to place files that "connect" the motherboard to these ports? If so, which directory? If possible to say, what files? (is it correct to call this "bus" info?)
The connection takes place inside the kernel, in the kernel data structures. You don't have direct access to them. The kernel gives you an interface, however. One part of the interface is /proc/usb directory (look especially into /proc/usb/devices). Another part is /sys/bus/usb (newer, may not be available everywhere)

Quote:

Then when a USB device is plugged in, Linux must record the event. Where? In what files?
Inside the kernel, again. It may not lead to any changes in the /proc or /sys files. It may, however, cause hotplug to run. For hotplug data, look into /etc/init.d/hotplug (in your case /etc/init.d/hotplug/usb* files). Using hotplug you can have an action made after the device is connected/disconnected/has state change.

Quote:

Assuming that it recognizes the device, Linux must make a file or record in a file the details of the device. Where and how does one see it?
If you mean a /dev file, it's driver's job to create it. It may choose not to. In /proc or /sys, however, you have data on every USB device in the system.


All times are GMT -5. The time now is 01:53 PM.