List USB ports in linux

17,749

The lsusb command will yield the list of recognised usb devices. Here is an example:

$ lsusb
Bus 002 Device 003: ID 1c7a:0801 LighTuning Technology Inc. 
Bus 002 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 004: ID 04ca:f01c Lite-On Technology Corp. 
Bus 001 Device 003: ID 064e:a219 Suyin Corp. 
Bus 001 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

You can note that the information provided include the bus path as well as the vendorId/deviceId. I'm not sure what "the ports that are currently used" actually means.

Edit
To write a message to the device on bus 1 device 2 you must access the device

$ ls -l /dev/bus/usb/001/002  
crw-rw-r-- 1 root root 189, 1 2011-06-04 03:11 /dev/bus/usb/001/002
Share:
17,749

Related videos on Youtube

Deepak
Author by

Deepak

Updated on September 18, 2022

Comments

  • Deepak
    Deepak over 1 year

    I want to list usb ports in linux and then send a message to the printer connected to it. That message is sensed by the printer to open the cash drawer. I know I can use echo - e and a port name, but my difficulty is finding the port name. How can I list the available ports or the ports that are currently used?

  • Deepak
    Deepak almost 13 years
    yes i can see this but now if i have to write a message to the port what do i do ?
  • Deepak
    Deepak almost 13 years
    and i used echo -e /dev/bus/usb/001/001 > "message" but nothing happens