Identify which USB device is /dev/ttyUSB0
Since you mentioned that you want to do it from Python, pyudev
has the following example code to access everything udev
knows about a device identified by a device file:
from pyudev import Context, Device
context = Context()
device = Devices.from_device_file(context, '/dev/sda')
I believe that should work very nicely with /dev/ttyUSB0
as well.
See https://pyudev.readthedocs.io/en/latest/api/pyudev.html#pyudev.Devices.from_device_file
Once you have the device udev instance in Python, you can access device.attributes
and device.properties
to get a wealth of information including VID, PID, string descriptors, and so on. The documentation says that
all well-known dictionary methods and operators (e.g.
.keys()
,.items()
,in
) are available to access device properties.
Read test results from /dev/ttyUSB0 in gradle
The solution was to write a separate program that reads the port. My colleague wrote simply 8 line of python code.
Related Topics
Pg_Dump Not Been Killed Inside Script with Kill Command
Listening for New Processes in Linux Kernel Module
How to Get The User's Domain Information in Samba
Skip Successfully Downloaded Files Using Wget
Kernel Module Build Fails: Sys/Types.H: No Such File or Directory
Hugo Version Not Updating to Latest
Visual Studio - X11: The Display Environment Variable Is Missing
Munin Dynamic Graph Zoom (Dynazoom) Not Working (Centos6,Nginx,PHP-Fpm)
How to Run 16 Bit Code on 32 Bit Linux
Cannot Compile Mergevec.Cpp from Haartraining Tutorial
Autostart Javafx Application on Raspberrypi
Linux Mail Adding Content Type Headers Not Working
How to Get The Interrupt Vector Number on Linux
Cvs Tab Completion for Modules Under Linux