LinuxQuestions.org
Visit Jeremy's Blog.
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 11-22-2007, 08:08 PM   #1
lin2winwin
LQ Newbie
 
Registered: Nov 2007
Posts: 26

Rep: Reputation: 15
locating device in /dev


Hi,
Can anyone guide me how to locate which device correcponds to which in /dev? I find that there are numerous entries in the /dev file system. For example, in mandriva control center, I get these details

Bus: ‎PCI
Bus PCI #: ‎2
PCI device #: ‎0
PCI function #: ‎0
Vendor ID: ‎0x14e4
Device ID: ‎0x1677
Sub vendor ID: ‎0x1028
Sub device ID: ‎0x0179

Can I use these to locate the device in /dev ?

Thanks in advance!
 
Old 11-22-2007, 10:34 PM   #2
Bruce Hill
HCL Maintainer
 
Registered: Jun 2003
Location: McCalla, AL, USA
Distribution: Arch, Gentoo
Posts: 6,940

Rep: Reputation: 129Reputation: 129
Welcome to LQ!

Maybe I don't understand your question, but when I issue in a terminal:
Code:
mingdao@wired_silas:~$ ls -l /dev/
it's pretty clear to me.

Maybe the disk drives?
Code:
mingdao@wired_silas:~$ ls -l /dev/disk/by-
by-id/    by-label/ by-name/  by-path/  by-uuid/
mingdao@wired_silas:~$ ls -l /dev/disk/by-id/
total 0
lrwxrwxrwx 1 root root  9 2007-11-23 07:13 ata-WDC_WD740GD-00FLC0_WD-WMAKE2225466 -> ../../sda
lrwxrwxrwx 1 root root 10 2007-11-23 07:13 ata-WDC_WD740GD-00FLC0_WD-WMAKE2225466-part1 -> ../../sda1
lrwxrwxrwx 1 root root 10 2007-11-23 07:13 ata-WDC_WD740GD-00FLC0_WD-WMAKE2225466-part2 -> ../../sda2
lrwxrwxrwx 1 root root 10 2007-11-23 07:13 ata-WDC_WD740GD-00FLC0_WD-WMAKE2225466-part3 -> ../../sda3
lrwxrwxrwx 1 root root 10 2007-11-23 07:13 ata-WDC_WD740GD-00FLC0_WD-WMAKE2225466-part4 -> ../../sda4
lrwxrwxrwx 1 root root 10 2007-11-23 07:13 ata-WDC_WD740GD-00FLC0_WD-WMAKE2225466-part5 -> ../../sda5
lrwxrwxrwx 1 root root 10 2007-11-23 07:13 ata-WDC_WD740GD-00FLC0_WD-WMAKE2225466-part6 -> ../../sda6
lrwxrwxrwx 1 root root 10 2007-11-23 07:13 ata-WDC_WD740GD-00FLC0_WD-WMAKE2225466-part7 -> ../../sda7
lrwxrwxrwx 1 root root 10 2007-11-23 07:13 ata-WDC_WD740GD-00FLC0_WD-WMAKE2225466-part8 -> ../../sda8
lrwxrwxrwx 1 root root 22 2007-11-23 07:13 dm-name-crypthome -> ../../mapper/crypthome
lrwxrwxrwx 1 root root 22 2007-11-23 07:13 dm-name-cryptroot -> ../../mapper/cryptroot
lrwxrwxrwx 1 root root 22 2007-11-23 07:13 dm-name-cryptswap -> ../../mapper/cryptswap
lrwxrwxrwx 1 root root  9 2007-11-23 07:13 scsi-SATA_WDC_WD740GD-00FWD-WMAKE2225466 -> ../../sda
lrwxrwxrwx 1 root root 10 2007-11-23 07:13 scsi-SATA_WDC_WD740GD-00FWD-WMAKE2225466-part1 -> ../../sda1
lrwxrwxrwx 1 root root 10 2007-11-23 07:13 scsi-SATA_WDC_WD740GD-00FWD-WMAKE2225466-part2 -> ../../sda2
lrwxrwxrwx 1 root root 10 2007-11-23 07:13 scsi-SATA_WDC_WD740GD-00FWD-WMAKE2225466-part3 -> ../../sda3
lrwxrwxrwx 1 root root 10 2007-11-23 07:13 scsi-SATA_WDC_WD740GD-00FWD-WMAKE2225466-part4 -> ../../sda4
lrwxrwxrwx 1 root root 10 2007-11-23 07:13 scsi-SATA_WDC_WD740GD-00FWD-WMAKE2225466-part5 -> ../../sda5
lrwxrwxrwx 1 root root 10 2007-11-23 07:13 scsi-SATA_WDC_WD740GD-00FWD-WMAKE2225466-part6 -> ../../sda6
lrwxrwxrwx 1 root root 10 2007-11-23 07:13 scsi-SATA_WDC_WD740GD-00FWD-WMAKE2225466-part7 -> ../../sda7
lrwxrwxrwx 1 root root 10 2007-11-23 07:13 scsi-SATA_WDC_WD740GD-00FWD-WMAKE2225466-part8 -> ../../sda8
If you're looking for devices on the PCI bus, issue:
Code:
mingdao@wired_silas:~$ /sbin/lspci
00:00.0 Host bridge: VIA Technologies, Inc. VT8385 [K8T800 AGP] Host Bridge (rev 01)
00:01.0 PCI bridge: VIA Technologies, Inc. VT8237 PCI bridge [K8T800/K8T890 South]
00:0a.0 Ethernet controller: Marvell Technology Group Ltd. 88E8001 Gigabit Ethernet Controller (rev 13)
00:0c.0 Multimedia audio controller: Creative Labs SB Audigy (rev 03)
00:0c.1 Input device controller: Creative Labs SB Audigy Game Port (rev 03)
00:0f.0 RAID bus controller: VIA Technologies, Inc. VIA VT6420 SATA RAID Controller (rev 80)
00:0f.1 IDE interface: VIA Technologies, Inc. VT82C586A/B/VT82C686/A/B/VT823x/A/C PIPC Bus Master IDE (rev 06)
00:10.0 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev 81)
00:10.1 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev 81)
00:10.2 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev 81)
00:10.3 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev 81)
00:10.4 USB Controller: VIA Technologies, Inc. USB 2.0 (rev 86)
00:11.0 ISA bridge: VIA Technologies, Inc. VT8237 ISA bridge [KT600/K8T800/K8T890 South]
00:11.5 Multimedia audio controller: VIA Technologies, Inc. VT8233/A/8235/8237 AC97 Audio Controller (rev 60)
00:11.6 Communication controller: VIA Technologies, Inc. AC'97 Modem Controller (rev 80)
00:18.0 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] HyperTransport Technology Configuration
00:18.1 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] Address Map
00:18.2 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] DRAM Controller
00:18.3 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] Miscellaneous Control
01:00.0 VGA compatible controller: nVidia Corporation GeForce 7300 GT (rev a2)
If you're looking for devices on the USB bus, issue:
Code:
root@wired_silas:~# lsusb
Bus 5 Device 1: ID 0000:0000
Bus 2 Device 3: ID 046d:c512 Logitech, Inc.
Bus 2 Device 2: ID 045e:00e1 Microsoft Corp.
Bus 2 Device 1: ID 0000:0000
Bus 4 Device 1: ID 0000:0000
Bus 3 Device 1: ID 0000:0000
Bus 3 Device 2: ID 03f0:1504 Hewlett-Packard DeskJet 920c
Bus 1 Device 1: ID 0000:0000
If this doesn't help clear it up, maybe you can give a little more detail what you're after.

You can add the verbose switch to those commands to get more output:
Code:
root@wired_silas:~# lsusb -v

Bus 5 Device 1: ID 0000:0000
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            9 Hub
  bDeviceSubClass         0 Unused
  bDeviceProtocol         0 Full speed (or root) hub
  bMaxPacketSize0        64
  idVendor           0x0000
  idProduct          0x0000
  bcdDevice            2.06
  iManufacturer           3 Linux 2.6.21.5-smp uhci_hcd
  iProduct                2 UHCI Host Controller
  iSerial                 1 0000:00:10.3
  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 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     0x0002  1x 2 bytes
        bInterval             255
Hub Descriptor:
  bLength               9
  bDescriptorType      41
  nNbrPorts             2
  wHubCharacteristic 0x000a
    No power switching (usb 1.0)
    Per-port overcurrent protection
  bPwrOn2PwrGood        1 * 2 milli seconds
  bHubContrCurrent      0 milli Ampere
  DeviceRemovable    0x00
  PortPwrCtrlMask    0xff
 Hub Port Status:
   Port 1: 0000.0300 lowspeed power
   Port 2: 0000.0100 power
Device Status:     0x0003
  Self Powered
  Remote Wakeup Enabled

Bus 2 Device 3: ID 046d:c512 Logitech, Inc.
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0         8
  idVendor           0x046d Logitech, Inc.
  idProduct          0xc512
  bcdDevice           30.07
  iManufacturer           1 Logitech
  iProduct                2 USB Receiver
  iSerial                 0
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           59
    bNumInterfaces          2
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0xa0
      (Bus Powered)
      Remote Wakeup
    MaxPower               98mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         3 Human Interface Devices
      bInterfaceSubClass      1 Boot Interface Subclass
      bInterfaceProtocol      1 Keyboard
      iInterface              0
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.10
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      63
         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 Devices
      bInterfaceSubClass      1 Boot Interface Subclass
      bInterfaceProtocol      2 Mouse
      iInterface              0
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.10
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength     201
         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)

Bus 2 Device 2: ID 045e:00e1 Microsoft Corp.
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0         8
  idVendor           0x045e Microsoft Corp.
  idProduct          0x00e1
  bcdDevice            0.07
  iManufacturer           1 Microsoft
  iProduct                2 Microsoft Wireless Optical Mouse� 1.00
  iSerial                 0
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           34
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0xa0
      (Bus Powered)
      Remote Wakeup
    MaxPower              100mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         3 Human Interface Devices
      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     274
         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     0x0006  1x 6 bytes
        bInterval              10
Device Status:     0x0000
  (Bus Powered)

Bus 2 Device 1: ID 0000:0000
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            9 Hub
  bDeviceSubClass         0 Unused
  bDeviceProtocol         0 Full speed (or root) hub
  bMaxPacketSize0        64
  idVendor           0x0000
  idProduct          0x0000
  bcdDevice            2.06
  iManufacturer           3 Linux 2.6.21.5-smp uhci_hcd
  iProduct                2 UHCI Host Controller
  iSerial                 1 0000:00:10.0
  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 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     0x0002  1x 2 bytes
        bInterval             255
Hub Descriptor:
  bLength               9
  bDescriptorType      41
  nNbrPorts             2
  wHubCharacteristic 0x000a
    No power switching (usb 1.0)
    Per-port overcurrent protection
  bPwrOn2PwrGood        1 * 2 milli seconds
  bHubContrCurrent      0 milli Ampere
  DeviceRemovable    0x00
  PortPwrCtrlMask    0xff
 Hub Port Status:
   Port 1: 0000.0303 lowspeed power enable connect
   Port 2: 0000.0303 lowspeed power enable connect
Device Status:     0x0003
  Self Powered
  Remote Wakeup Enabled

Bus 4 Device 1: ID 0000:0000
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            9 Hub
  bDeviceSubClass         0 Unused
  bDeviceProtocol         0 Full speed (or root) hub
  bMaxPacketSize0        64
  idVendor           0x0000
  idProduct          0x0000
  bcdDevice            2.06
  iManufacturer           3 Linux 2.6.21.5-smp uhci_hcd
  iProduct                2 UHCI Host Controller
  iSerial                 1 0000:00:10.2
  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 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     0x0002  1x 2 bytes
        bInterval             255
Hub Descriptor:
  bLength               9
  bDescriptorType      41
  nNbrPorts             2
  wHubCharacteristic 0x000a
    No power switching (usb 1.0)
    Per-port overcurrent protection
  bPwrOn2PwrGood        1 * 2 milli seconds
  bHubContrCurrent      0 milli Ampere
  DeviceRemovable    0x00
  PortPwrCtrlMask    0xff
 Hub Port Status:
   Port 1: 0000.0100 power
   Port 2: 0000.0100 power
Device Status:     0x0003
  Self Powered
  Remote Wakeup Enabled

Bus 3 Device 1: ID 0000:0000
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            9 Hub
  bDeviceSubClass         0 Unused
  bDeviceProtocol         0 Full speed (or root) hub
  bMaxPacketSize0        64
  idVendor           0x0000
  idProduct          0x0000
  bcdDevice            2.06
  iManufacturer           3 Linux 2.6.21.5-smp uhci_hcd
  iProduct                2 UHCI Host Controller
  iSerial                 1 0000:00:10.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 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     0x0002  1x 2 bytes
        bInterval             255
Hub Descriptor:
  bLength               9
  bDescriptorType      41
  nNbrPorts             2
  wHubCharacteristic 0x000a
    No power switching (usb 1.0)
    Per-port overcurrent protection
  bPwrOn2PwrGood        1 * 2 milli seconds
  bHubContrCurrent      0 milli Ampere
  DeviceRemovable    0x00
  PortPwrCtrlMask    0xff
 Hub Port Status:
   Port 1: 0000.0103 power enable connect
   Port 2: 0000.0100 power
Device Status:     0x0003
  Self Powered
  Remote Wakeup Enabled

Bus 3 Device 2: ID 03f0:1504 Hewlett-Packard DeskJet 920c
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0         8
  idVendor           0x03f0 Hewlett-Packard
  idProduct          0x1504 DeskJet 920c
  bcdDevice            1.00
  iManufacturer           1 Hewlett-Packard
  iProduct                2 DeskJet 920C
  iSerial                 3 CN21R1C0BPIS
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           32
    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         7 Printer
      bInterfaceSubClass      1 Printer
      bInterfaceProtocol      2 Bidirectional
      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     0x0040  1x 64 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
Device Status:     0x0001
  Self Powered

Bus 1 Device 1: ID 0000:0000
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            9 Hub
  bDeviceSubClass         0 Unused
  bDeviceProtocol         1 Single TT
  bMaxPacketSize0        64
  idVendor           0x0000
  idProduct          0x0000
  bcdDevice            2.06
  iManufacturer           3 Linux 2.6.21.5-smp ehci_hcd
  iProduct                2 EHCI Host Controller
  iSerial                 1 0000:00:10.4
  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 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     0x0004  1x 4 bytes
        bInterval              12
Hub Descriptor:
  bLength              11
  bDescriptorType      41
  nNbrPorts             8
  wHubCharacteristic 0x000a
    No power switching (usb 1.0)
    Per-port overcurrent protection
    TT think time 8 FS bits
  bPwrOn2PwrGood       10 * 2 milli seconds
  bHubContrCurrent      0 milli Ampere
  DeviceRemovable    0x00 0x00
  PortPwrCtrlMask    0xff 0xff
 Hub Port Status:
   Port 1: 0000.0100 power
   Port 2: 0000.0100 power
   Port 3: 0000.0100 power
   Port 4: 0000.0100 power
   Port 5: 0000.0100 power
   Port 6: 0000.0100 power
   Port 7: 0000.0100 power
   Port 8: 0000.0100 power
Device Status:     0x0003
  Self Powered
  Remote Wakeup Enabled

Last edited by Bruce Hill; 11-22-2007 at 10:36 PM.
 
Old 11-23-2007, 11:18 AM   #3
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 78
Also, not each device has an entry in “/dev” (e.g., most graphics cards, etc.). If you want to use the type of info you got from the Mandriva control center, look under /sys.
 
Old 11-23-2007, 12:27 PM   #4
b0uncer
LQ Guru
 
Registered: Aug 2003
Distribution: CentOS, OS X
Posts: 5,131

Rep: Reputation: Disabled
Also /proc has some information (provided by your kernel), and in addition you may get information about your hardware with
Code:
lspci
for example.
 
Old 11-25-2007, 10:23 AM   #5
lin2winwin
LQ Newbie
 
Registered: Nov 2007
Posts: 26

Original Poster
Rep: Reputation: 15
yeah. I tried that. But, what I needed was which device is mapped to which one. After a search, I found evrouter, that does the thing for me. It's output is like this

Quote:
device 0: /dev/input/event0: Macintosh mouse button emulation
device 1: /dev/input/event1: AT Translated Set 2 keyboard
device 2: /dev/input/event2: SynPS/2 Synaptics TouchPad
device 3: /dev/input/event3: eGalax INC. USB TouchController
device 4: /dev/input/event4: Power Button (FF)
device 5: /dev/input/event5: Power Button (CM)
device 6: /dev/input/event6: Sleep Button (CM)
device 7: /dev/input/event7: Lid Switch
But, if there is any other way to get the information, I am glad to hear. Sorry if I am sounding dumb

BTW, with great help from the linux community (and google), I installed Mandriva in my new HP Pavilion tx 1000 notebook. Seeing the compiz work with the touch screen, now, couple of my friends are queuing up to get linux installed Windows Vista terribly screws up the system's memory and it thinks that its users are absolute dumbos. I used it for less than 2 hrs in total now. Same with my friends. Wonder how they manage to sell those crap!

Cheers!!!
 
Old 11-25-2007, 10:40 AM   #6
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Sorry, I entered a post in the wrong browser window. Please ignore.

Last edited by jschiwal; 11-26-2007 at 08:45 AM.
 
Old 11-25-2007, 01:42 PM   #7
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 78
Quote:
Originally Posted by lin2winwin View Post
But, if there is any other way to get the information, I am glad to hear. Sorry if I am sounding dumb
Your method (evrouter) uses specific ioctls on the input devices. The advantages of your method is that it will work with older kernels (2.4) as well as newer ones (2.6). The disadvantage of your method is that it will not work with other types of devices (i.e., it works only on input device nodes). Additionally, it usually requires root privileges.

A more general method is to use the information provided in /sys. For example, suppose I am considering /dev/input/event0 on my system. First, I find the major/minor numbers:
Code:
ls -l /dev/input/event0
crw------- 1 root root 13, 64 2007-11-25 13:48 /dev/input/event0
The numbers are 13 and 64. Now, I find the matching device path in /sys. It happens to be /sys/class/input/input0/event0. We can verify this with
Code:
cat /sys/class/input/input0/event0/dev
13:64
So now, you can go through the directories under that directory (/sys/class/input/input0/event0), looking for files named “description” or similar. You’ll end up finding something like this:
Code:
cat /sys/class/input/input0/event0/device/input:input0/name
AT Translated Set 2 keyboard
cat /sys/class/input/input0/event0/device/description
i8042 KBD port
Now, you may be saying, “Gee, that seems a lot more complicated than a simple ‘evrouter -D /dev/input/event0’”, and you’d be absolutely correct. It is very tedious to search through /sys manually. Luckily, there is a wonderful system called udev. This is used by most modern distros to manage device naming and other things. Moreover, udev maintains a cache of such information, so you don’t have to actually search for anything. All you have to do is:
  1. Ask udev the device path corresponding to a device node.
  2. Ask udev to show all the attributes by walking up the chain of devices starting at that path.
You can accomplish this succinctly with:
Code:
udevinfo -ap `udevinfo -q path -n /dev/input/event0`
Notice that this method (usually) does not require root privileges, and it should work on devices besides input devices. The only downside is that it won’t work with older kernels (i.e., those which don’t use udev).
 
Old 11-25-2007, 07:32 PM   #8
lin2winwin
LQ Newbie
 
Registered: Nov 2007
Posts: 26

Original Poster
Rep: Reputation: 15
Wonderful!! I was trying to find out which one of the device is my touch screen. But, this info lets me to really explore what are the devices the kernel actually identifies.

Just a query. If the device is present, and the driver is not installed, will it still be listed in the /dev or /sys subsystem?
I have a bluetooth device. How will I find out where it is listed? Should I use grep in all the descriptions? Mandriva control center doesnot list it.

Thanks for your info.
 
Old 11-25-2007, 09:57 PM   #9
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 78
Quote:
Originally Posted by lin2winwin View Post
Just a query. If the device is present, and the driver is not installed, will it still be listed in the /dev or /sys subsystem?
Yes and no. The answer of course depends on what “the device is present” means (since there is usually more than one layer of “driver”). Also, remember that the non-presence of a device node (i.e., a file under /dev) in no way represents a device’s usability since not all drivers provide or need to provide device nodes (for example, neither my graphics card nor my ethernet device provide device nodes, yet both are fully functional). Also, since a device node is usually created by the highest (i.e., most abstract) level of driver, when the highest driver is not loaded, it is usually the case that if there were to be a device node, it would not exist. As opposed to /dev, the /sys directory has entries for pretty much all devices (and even modules without devices). In this case, a device will appear without its highest-level driver if it is present on a lower level and if the driver for the lower level is loaded into the kernel.

Here’s an example. Consider a run-of-the-mill Intel Pro/100 PCI ethernet card. Now to use this on a linux PC, you have to have a few “drivers” for your kernel. First of all, you’ll have to have a driver for the PCI bus. Then, you’ll have to have enable the networking subsystem. Last (and in the “highest” level of abstraction that we’ll be considering), you’ll have to have a driver for the ethernet controller itself. The last driver will use the physical device from the pci bus and provide an interface for use by the networking subsystem.

You plug your ethernet card into an empty slot. Now, suppose your kernel has the PCI bus driver compiled in (as is the case of a typical kernel), but has the ethernet controller driver compiled as a module, which happens not to be loaded. The highest level of loaded driver for the device is that of the PCI bus. Therefore, PCI information will be provided in /sys. PCI bus information is usually pretty crude. For example, you have the bus number, the device number, and so on. Then you have some numbers that all PCI devices are supposed to provide (e.g., Vendor ID, Product ID, Subproduct ID, etc.). Luckily, there is a lovely little program (mentioned by Bruce in post 2) called lspci which searches through /sys/bus/pci/devices and looks at all the entries. It then compares the various attributes to a database (which may itself be periodically updated using update-pciids). That’s what lets it tell me what kind of card I have.
Quote:
Originally Posted by lin2winwin View Post
I have a bluetooth device. How will I find out where it is listed? Should I use grep in all the descriptions? Mandriva control center doesnot list it.
Well, it depends on how your bluetooth device is connected to your machine. Most bluetooth devices will be through the USB interface. So the drivers for that (from lowest to highest in abstraction) look like this:
Code:
PCI bus -> USB-HCD -> OHCI/UHCI -> EHCI -> USB -> HCI
(HCI means host controller interface for bluetooth. It has nothing to do with the various usb host controller interfaces.)

So in that case, the easiest way to see it (assuming “modprobe hci_usb” did not work) would be through lsusb.

If your bluetooth device is through PCI (or PCMCIA) directly (and if the relevant module could not be loaded), it is very similar to the ethernet card example, and you would use lspci.

If the highest level driver for your device is loaded, then you will be able to see the device directly (e.g., /sys/class/bluetooth/hci0).
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
using flash drive changes device /dev/sr0 to /dev/sr1 for mapping to /dev/pktcdvd/0? lugoteehalt Linux - Software 3 10-24-2007 10:27 AM
Question on locating the instance of a device installed? 1jnike SUSE / openSUSE 2 07-26-2007 04:09 PM
Locating touchscreen in /dev/ General Linux - Laptop and Netbook 5 05-25-2007 11:13 PM
modprobe isn't locating device modules n_logo Linux - Newbie 1 12-06-2003 02:58 PM
Locating drives in your /dev bkeating Linux - Newbie 1 08-31-2002 04:20 AM

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

All times are GMT -5. The time now is 03:00 PM.

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