user171780
user171780

Reputation: 3115

How to find USB device port in Linux?

I have a USB device connected to my computer, it is this one:

enter image description here

I want to use it in Python according to the example in this link. How do I know what to put for port (instead of 'COM1') in the line with ShdlcSerialPort(port='COM1', baudrate=460800) as port:?

Upvotes: 1

Views: 13504

Answers (1)

HackerDev-Felix
HackerDev-Felix

Reputation: 236

In linux, lsusb is a tool used to display information about the USB bus in the system and connected to the system. lsusb will display the drivers and internal devices connected to your system, including PID and VID, as well as simple device descriptions.

$ lsusb -v |grep -Ei ‘(idVendor|Mass\ Storage)’
idVendor 0×1005 Apacer Technology, Inc.
bInterfaceClass 8 Mass Storage

Output very detailed information, including the current of the device and so on. With the grep command to specify specific information, the mass storage device will have a vendor name and ID.

Bus 008: Indicate where the device is connected (which bus) Device 002: Indicates that this is the second device connected to the bus ID: ID of the device Broadcom Corp. Bluetooth Controller: Manufacturer name and device name

$ lsusb -t

/: Bus 08.Port 1: Dev 1, Class=root\_hub, Driver=uhci_hcd/2p, 12M
/: Bus 07.Port 1: Dev 1, Class=root\_hub, Driver=uhci_hcd/2p, 12M
/: Bus 06.Port 1: Dev 1, Class=root\_hub, Driver=uhci_hcd/2p, 12M
/: Bus 05.Port 1: Dev 1, Class=root\_hub, Driver=uhci_hcd/2p, 12M
/: Bus 04.Port 1: Dev 1, Class=root\_hub, Driver=uhci_hcd/2p, 12M
/: Bus 03.Port 1: Dev 1, Class=root\_hub, Driver=uhci_hcd/2p, 12M
/: Bus 02.Port 1: Dev 1, Class=root\_hub, Driver=ehci_hcd/6p, 480M
|__ Port 1: Dev 4, If 0, Class=stor., Driver=usb-storage, 480M
|__ Port 6: Dev 3, If 0, Class=’bInterfaceClass 0x0e not yet handled’, Driver=uvcvideo, 480M
|__ Port 6: Dev 3, If 1, Class=’bInterfaceClass 0x0e not yet handled’, Driver=uvcvideo, 480M
/: Bus 01.Port 1: Dev 1, Class=root\_hub, Driver=ehci_hcd/6p, 480M

12M means that the speed of USB 1.0 / 1.1 is 12Mbit/s

480M means that the speed of USB 2.0 is 480Mbit/s

If you find 5.0G, it means you have a USB 3.0 type interface. It has a transmission rate of 5.0Gbit/s. Linux recognizes the detailed information of USB devices from /var/lib/usbutils/usb.ids. Or you can visit Linux-USB.org to get the latest USB ID list.

Upvotes: 2

Related Questions