LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-02-2006, 02:25 PM   #1
Odyssey1942
Member
 
Registered: Jul 2006
Posts: 316

Rep: Reputation: 32
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

Last edited by Odyssey1942; 12-02-2006 at 04:30 PM.
 
Old 12-02-2006, 03:20 PM   #2
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
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).
 
Old 12-03-2006, 11:25 PM   #3
Odyssey1942
Member
 
Registered: Jul 2006
Posts: 316

Original Poster
Rep: Reputation: 32
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.
 
Old 12-04-2006, 08:54 AM   #4
Odyssey1942
Member
 
Registered: Jul 2006
Posts: 316

Original Poster
Rep: Reputation: 32
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.
 
Old 12-05-2006, 03:27 PM   #5
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
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.
 
  


Reply

Tags
usb



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
MDK 10.2: No USB at all (/proc/bus/usb/devices missing) shrodi Mandriva 5 07-01-2005 11:28 AM
No USB at all (/proc/bus/usb/devices missing) shrodi Linux - Hardware 1 05-26-2005 04:07 AM
reluctant USB mouse response apchar Linux - Hardware 0 05-20-2005 04:40 PM
reluctant alsamixer pauloref Linux - Newbie 4 10-09-2004 06:31 PM
slackware 9.1 USB mouse and other usb devices not working jimMC Linux - Hardware 11 01-24-2004 10:58 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:53 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration