Results 1 to 2 of 2
Hi, I want to test automatically if the USB ports are in use. I want to test it in a bash script I found some information about ttyUSB0 in the ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 01-05-2010 #1
- Join Date
- Jan 2010
Test usb ports
I want to test automatically if the USB ports are in use.
I want to test it in a bash script
I found some information about ttyUSB0 in the /dev/
The problem is, there is usb hub between the system and the mouse/keyboard. The other USB port is in use for the Ubuntu live usb.
When I open the /dev/ map virtual and pull out the usb keyboard the hidraw1 diappears, same for the keyboard.
When both are out and I pull out the usb hub, nothing happens.
Do anyone know how to test it?
Thank you very much!
- 01-05-2010 #2
- Join Date
- Apr 2009
- I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
Run the command 'lsusb'. You should get output something like this:
Bus 001 Device 003: ID 04b8:0005 Seiko Epson Corp. Stylus D88+ Bus 001 Device 001: ID 0000:0000 Bus 003 Device 001: ID 0000:0000 Bus 004 Device 001: ID 0000:0000 Bus 005 Device 001: ID 0000:0000 Bus 002 Device 001: ID 0000:0000
Bus 002 Device 001: 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.18-164.9.1.el5 uhci_hcd iProduct 2 UHCI Host Controller iSerial 1 0000:00:1d.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 0x80 Hub Port Status: Port 1: 0000.0100 power Port 2: 0000.0100 power
I hope this clarifies stuff for you. You can grep the nNbrPorts from the output of "lsusb -v" in a script easily enough. Also, each hub listing, such as that shown above, will tell you if any of its ports are powered or not, as well as a lot of other information you probably don't need as yet.Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!