Simple way to query connected USB devices info in Python?

后端 未结 6 2147
独厮守ぢ
独厮守ぢ 2020-11-28 03:17

How can we query connected USB devices info in Python? I want to get UID Device Name (ex: SonyEricsson W660), path to device (ex: /dev/ttyACM0)

And also what would b

6条回答
  •  离开以前
    2020-11-28 03:46

    For linux, I wrote a script called find_port.py which you can find here: https://github.com/dhylands/usb-ser-mon/blob/master/usb_ser_mon/find_port.py

    It uses pyudev to enumerate all tty devices, and can match on various attributes.

    Use the --list option to show all of the know USB serial ports and their attributes. You can filter by VID, PID, serial number, or vendor name. Use --help to see the filtering options.

    find_port.py prints the /dev/ttyXXX name rather than the /dev/usb/... name.

提交回复
热议问题