我正在设法在Raspberry Pi上迭代所有USB设备,并打印出供应商ID、产品ID、制造商名称和设备节点;通过如下帖子:
..。我知道我可以使用PyUSB --但我遇到了很多麻烦,类似于:
..。但那篇文章没有回答。
下面是我的测试案例--我在Raspberry Pi Raspbian拉伸上有这样的例子:
pi@raspberry:~ $ apt-show-versions -r libusb
libusb-0.1-4:armhf/stretch 2:0.1.12-30 uptodate
libusb-1.0-0:armhf/stretch 2:1.0.21-1 uptodate
libusbmuxd4:armhf/stretch 1.0.10-3 uptodate
我安装PyUSB时:
sudo pip3 install pyusb
作为一个例子,我已经将一个Arduino UNO连接到了Raspberry Pi;tail -f /var/log/syslog
在USB连接上打印了这个:
...
Jun 23 09:35:01 raspberry kernel: [71431.582554] usb 1-1.2: new full-speed USB device number 7 using dwc_otg
Jun 23 09:35:01 raspberry kernel: [71431.726403] usb 1-1.2: New USB device found, idVendor=2341, idProduct=0043, bcdDevice= 0.01
Jun 23 09:35:01 raspberry kernel: [71431.726420] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=220
Jun 23 09:35:01 raspberry kernel: [71431.726431] usb 1-1.2: Manufacturer: Arduino (www.arduino.cc)
Jun 23 09:35:01 raspberry kernel: [71431.726440] usb 1-1.2: SerialNumber: 64131383231351C03272
Jun 23 09:35:01 raspberry mtp-probe: checking bus 1, device 7: "/sys/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.2"
Jun 23 09:35:01 raspberry mtp-probe: bus: 1, device: 7 was not an MTP device
Jun 23 09:35:01 raspberry kernel: [71431.778630] cdc_acm 1-1.2:1.0: ttyACM0: USB ACM device
Jun 23 09:35:01 raspberry kernel: [71431.779553] usbcore: registered new interface driver cdc_acm
Jun 23 09:35:01 raspberry kernel: [71431.779562] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
...
因此,我知道供应商ID是0x2341 (显然是十六进制),产品ID是0x0043 (显然是十六进制),制造商名是Arduino (www.arduino.cc)
,设备节点/文件是/dev/ttyACM0
;我只想打印出通过PyUSB连接到系统的所有USB设备。
现在,网上有点混乱,因为很明显,您可以用两种方式在PyUSB设备上进行迭代:旧的“遗留”方式和“新的”方式/API。所以,我制作了一个测试脚本来测试它们,我称之为test-usb.py
。
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import usb.core
import usb.util
print("This is 'old' PyUSB style iteration - uses legacy:")
busses = usb.busses() # SO:8110310
for bus in busses:
print(type(bus)) # <class 'usb.legacy.Bus'>
devices = bus.devices
for dev in devices:
if dev != None:
try:
xdev = usb.core.find(idVendor=dev.idVendor, idProduct=dev.idProduct)
if xdev._manufacturer is None:
xdev._manufacturer = usb.util.get_string(xdev, xdev.iManufacturer)
if xdev._product is None:
xdev._product = usb.util.get_string(xdev, xdev.iProduct)
stx = "USB VID: 0x{:04X} PID: 0x{:04X} Mfr name '{}' Product '{}'".format(dev.idVendor, dev.idProduct, str(xdev._manufacturer).strip(), str(xdev._product).strip(), dev.filename)
print( stx )
try:
print("xdev.filename: '{}'".format(xdev.filename))
except Exception as e:
print("xdev.filename exception: {}".format(e))
try:
print("dev.filename: '{}'".format(dev.filename))
except Exception as e:
print("dev.filename exception: {}".format(e))
except Exception as e:
print("Exception: {}".format(e))
print()
def print_internals(dev): # SO: 18224189
for attrib in dir(dev):
if not attrib.startswith('_') and not attrib == 'configurations':
try:
x=getattr(dev, attrib)
print( " ", attrib, x)
except Exception as e:
print("Exception for attrib '{}': {}".format(attrib, e))
try:
for config in dev.configurations:
for attrib in dir(config):
if not attrib.startswith('_'):
try:
x=getattr(config, attrib)
print( " ", attrib, x)
except Exception as e:
print("Exception for attrib '{}': {}".format(attrib, e))
except Exception as e:
print("Exception config in dev.configurations: {}".format(e))
print("This is 'new' PyUSB style iteration - does not use legacy:")
for xdev in usb.core.find(find_all=True): # SO:9577601
print(type(xdev)) # <class 'usb.core.Device'>
try:
if xdev._manufacturer is None:
xdev._manufacturer = usb.util.get_string(xdev, xdev.iManufacturer)
except Exception as e:
print("Exception: {}".format(e))
try:
if xdev._product is None:
xdev._product = usb.util.get_string(xdev, xdev.iProduct)
except Exception as e:
print("Exception: {}".format(e))
stx = "USB VID: 0x{:04X} PID: 0x{:04X} Mfr name '{}' Product '{}'".format(xdev.idVendor, xdev.idProduct, str(xdev._manufacturer).strip(), str(xdev._product).strip())
print( stx )
try:
print("xdev.filename: '{}'".format(xdev.filename))
except Exception as e:
print("xdev.filename exception: {}".format(e))
print_internals(xdev)
上面的脚本输出:
pi@raspberry:~ $ python3 test-usb.py
This is 'old' PyUSB style iteration - uses legacy:
<class 'usb.legacy.Bus'>
Exception: The device has no langid
USB VID: 0x0424 PID: 0x7800 Mfr name 'None' Product 'None'
xdev.filename exception: 'Device' object has no attribute 'filename'
dev.filename: ''
USB VID: 0x0424 PID: 0x2514 Mfr name 'None' Product 'None'
xdev.filename exception: 'Device' object has no attribute 'filename'
dev.filename: ''
USB VID: 0x0424 PID: 0x2514 Mfr name 'None' Product 'None'
xdev.filename exception: 'Device' object has no attribute 'filename'
dev.filename: ''
Exception: The device has no langid
This is 'new' PyUSB style iteration - does not use legacy:
<class 'usb.core.Device'>
Exception: The device has no langid
Exception: The device has no langid
USB VID: 0x2341 PID: 0x0043 Mfr name 'None' Product 'None'
xdev.filename exception: 'Device' object has no attribute 'filename'
address 7
attach_kernel_driver <bound method Device.attach_kernel_driver of <DEVICE ID 2341:0043 on Bus 001 Address 007>>
bDescriptorType 1
bDeviceClass 2
bDeviceProtocol 0
bDeviceSubClass 0
bLength 18
bMaxPacketSize0 8
bNumConfigurations 1
backend <usb.backend.libusb1._LibUSB object at 0x7680f510>
bcdDevice 1
bcdUSB 272
bus 1
clear_halt <bound method Device.clear_halt of <DEVICE ID 2341:0043 on Bus 001 Address 007>>
ctrl_transfer <bound method Device.ctrl_transfer of <DEVICE ID 2341:0043 on Bus 001 Address 007>>
default_timeout 1000
detach_kernel_driver <bound method Device.detach_kernel_driver of <DEVICE ID 2341:0043 on Bus 001 Address 007>>
finalize <bound method AutoFinalizedObject.finalize of <DEVICE ID 2341:0043 on Bus 001 Address 007>>
get_active_configuration <bound method Device.get_active_configuration of <DEVICE ID 2341:0043 on Bus 001 Address 007>>
iManufacturer 1
iProduct 2
iSerialNumber 220
idProduct 67
idVendor 9025
is_kernel_driver_active <bound method Device.is_kernel_driver_active of <DEVICE ID 2341:0043 on Bus 001 Address 007>>
langids ()
Exception for attrib 'manufacturer': The device has no langid
port_number 2
port_numbers (1, 2)
Exception for attrib 'product': The device has no langid
read <bound method Device.read of <DEVICE ID 2341:0043 on Bus 001 Address 007>>
reset <bound method Device.reset of <DEVICE ID 2341:0043 on Bus 001 Address 007>>
Exception for attrib 'serial_number': The device has no langid
set_configuration <bound method Device.set_configuration of <DEVICE ID 2341:0043 on Bus 001 Address 007>>
set_interface_altsetting <bound method Device.set_interface_altsetting of <DEVICE ID 2341:0043 on Bus 001 Address 007>>
speed 2
write <bound method Device.write of <DEVICE ID 2341:0043 on Bus 001 Address 007>>
Exception config in dev.configurations: 'method' object is not iterable
<class 'usb.core.Device'>
USB VID: 0x0424 PID: 0x7800 Mfr name 'None' Product 'None'
xdev.filename exception: 'Device' object has no attribute 'filename'
address 4
attach_kernel_driver <bound method Device.attach_kernel_driver of <DEVICE ID 0424:7800 on Bus 001 Address 004>>
bDescriptorType 1
bDeviceClass 255
bDeviceProtocol 255
bDeviceSubClass 0
bLength 18
bMaxPacketSize0 64
bNumConfigurations 1
backend <usb.backend.libusb1._LibUSB object at 0x7680f510>
bcdDevice 768
bcdUSB 528
bus 1
clear_halt <bound method Device.clear_halt of <DEVICE ID 0424:7800 on Bus 001 Address 004>>
ctrl_transfer <bound method Device.ctrl_transfer of <DEVICE ID 0424:7800 on Bus 001 Address 004>>
default_timeout 1000
detach_kernel_driver <bound method Device.detach_kernel_driver of <DEVICE ID 0424:7800 on Bus 001 Address 004>>
finalize <bound method AutoFinalizedObject.finalize of <DEVICE ID 0424:7800 on Bus 001 Address 004>>
get_active_configuration <bound method Device.get_active_configuration of <DEVICE ID 0424:7800 on Bus 001 Address 004>>
iManufacturer 0
iProduct 0
iSerialNumber 0
idProduct 30720
idVendor 1060
is_kernel_driver_active <bound method Device.is_kernel_driver_active of <DEVICE ID 0424:7800 on Bus 001 Address 004>>
langids ()
manufacturer None
port_number 1
port_numbers (1, 1, 1)
product None
read <bound method Device.read of <DEVICE ID 0424:7800 on Bus 001 Address 004>>
reset <bound method Device.reset of <DEVICE ID 0424:7800 on Bus 001 Address 004>>
serial_number None
set_configuration <bound method Device.set_configuration of <DEVICE ID 0424:7800 on Bus 001 Address 004>>
set_interface_altsetting <bound method Device.set_interface_altsetting of <DEVICE ID 0424:7800 on Bus 001 Address 004>>
speed 3
write <bound method Device.write of <DEVICE ID 0424:7800 on Bus 001 Address 004>>
Exception config in dev.configurations: 'method' object is not iterable
<class 'usb.core.Device'>
USB VID: 0x0424 PID: 0x2514 Mfr name 'None' Product 'None'
xdev.filename exception: 'Device' object has no attribute 'filename'
address 3
attach_kernel_driver <bound method Device.attach_kernel_driver of <DEVICE ID 0424:2514 on Bus 001 Address 003>>
bDescriptorType 1
bDeviceClass 9
bDeviceProtocol 2
bDeviceSubClass 0
bLength 18
bMaxPacketSize0 64
bNumConfigurations 1
backend <usb.backend.libusb1._LibUSB object at 0x7680f510>
bcdDevice 2995
bcdUSB 512
bus 1
clear_halt <bound method Device.clear_halt of <DEVICE ID 0424:2514 on Bus 001 Address 003>>
ctrl_transfer <bound method Device.ctrl_transfer of <DEVICE ID 0424:2514 on Bus 001 Address 003>>
default_timeout 1000
detach_kernel_driver <bound method Device.detach_kernel_driver of <DEVICE ID 0424:2514 on Bus 001 Address 003>>
finalize <bound method AutoFinalizedObject.finalize of <DEVICE ID 0424:2514 on Bus 001 Address 003>>
get_active_configuration <bound method Device.get_active_configuration of <DEVICE ID 0424:2514 on Bus 001 Address 003>>
iManufacturer 0
iProduct 0
iSerialNumber 0
idProduct 9492
idVendor 1060
is_kernel_driver_active <bound method Device.is_kernel_driver_active of <DEVICE ID 0424:2514 on Bus 001 Address 003>>
langids ()
manufacturer None
port_number 1
port_numbers (1, 1)
product None
read <bound method Device.read of <DEVICE ID 0424:2514 on Bus 001 Address 003>>
reset <bound method Device.reset of <DEVICE ID 0424:2514 on Bus 001 Address 003>>
serial_number None
set_configuration <bound method Device.set_configuration of <DEVICE ID 0424:2514 on Bus 001 Address 003>>
set_interface_altsetting <bound method Device.set_interface_altsetting of <DEVICE ID 0424:2514 on Bus 001 Address 003>>
speed 3
write <bound method Device.write of <DEVICE ID 0424:2514 on Bus 001 Address 003>>
Exception config in dev.configurations: 'method' object is not iterable
<class 'usb.core.Device'>
USB VID: 0x0424 PID: 0x2514 Mfr name 'None' Product 'None'
xdev.filename exception: 'Device' object has no attribute 'filename'
address 2
attach_kernel_driver <bound method Device.attach_kernel_driver of <DEVICE ID 0424:2514 on Bus 001 Address 002>>
bDescriptorType 1
bDeviceClass 9
bDeviceProtocol 2
bDeviceSubClass 0
bLength 18
bMaxPacketSize0 64
bNumConfigurations 1
backend <usb.backend.libusb1._LibUSB object at 0x7680f510>
bcdDevice 2995
bcdUSB 512
bus 1
clear_halt <bound method Device.clear_halt of <DEVICE ID 0424:2514 on Bus 001 Address 002>>
ctrl_transfer <bound method Device.ctrl_transfer of <DEVICE ID 0424:2514 on Bus 001 Address 002>>
default_timeout 1000
detach_kernel_driver <bound method Device.detach_kernel_driver of <DEVICE ID 0424:2514 on Bus 001 Address 002>>
finalize <bound method AutoFinalizedObject.finalize of <DEVICE ID 0424:2514 on Bus 001 Address 002>>
get_active_configuration <bound method Device.get_active_configuration of <DEVICE ID 0424:2514 on Bus 001 Address 002>>
iManufacturer 0
iProduct 0
iSerialNumber 0
idProduct 9492
idVendor 1060
is_kernel_driver_active <bound method Device.is_kernel_driver_active of <DEVICE ID 0424:2514 on Bus 001 Address 002>>
langids ()
manufacturer None
port_number 1
port_numbers (1,)
product None
read <bound method Device.read of <DEVICE ID 0424:2514 on Bus 001 Address 002>>
reset <bound method Device.reset of <DEVICE ID 0424:2514 on Bus 001 Address 002>>
serial_number None
set_configuration <bound method Device.set_configuration of <DEVICE ID 0424:2514 on Bus 001 Address 002>>
set_interface_altsetting <bound method Device.set_interface_altsetting of <DEVICE ID 0424:2514 on Bus 001 Address 002>>
speed 3
write <bound method Device.write of <DEVICE ID 0424:2514 on Bus 001 Address 002>>
Exception config in dev.configurations: 'method' object is not iterable
<class 'usb.core.Device'>
Exception: The device has no langid
Exception: The device has no langid
USB VID: 0x1D6B PID: 0x0002 Mfr name 'None' Product 'None'
xdev.filename exception: 'Device' object has no attribute 'filename'
address 1
attach_kernel_driver <bound method Device.attach_kernel_driver of <DEVICE ID 1d6b:0002 on Bus 001 Address 001>>
bDescriptorType 1
bDeviceClass 9
bDeviceProtocol 1
bDeviceSubClass 0
bLength 18
bMaxPacketSize0 64
bNumConfigurations 1
backend <usb.backend.libusb1._LibUSB object at 0x7680f510>
bcdDevice 1049
bcdUSB 512
bus 1
clear_halt <bound method Device.clear_halt of <DEVICE ID 1d6b:0002 on Bus 001 Address 001>>
ctrl_transfer <bound method Device.ctrl_transfer of <DEVICE ID 1d6b:0002 on Bus 001 Address 001>>
default_timeout 1000
detach_kernel_driver <bound method Device.detach_kernel_driver of <DEVICE ID 1d6b:0002 on Bus 001 Address 001>>
finalize <bound method AutoFinalizedObject.finalize of <DEVICE ID 1d6b:0002 on Bus 001 Address 001>>
get_active_configuration <bound method Device.get_active_configuration of <DEVICE ID 1d6b:0002 on Bus 001 Address 001>>
iManufacturer 3
iProduct 2
iSerialNumber 1
idProduct 2
idVendor 7531
is_kernel_driver_active <bound method Device.is_kernel_driver_active of <DEVICE ID 1d6b:0002 on Bus 001 Address 001>>
langids ()
Exception for attrib 'manufacturer': The device has no langid
port_number 0
port_numbers None
Exception for attrib 'product': The device has no langid
read <bound method Device.read of <DEVICE ID 1d6b:0002 on Bus 001 Address 001>>
reset <bound method Device.reset of <DEVICE ID 1d6b:0002 on Bus 001 Address 001>>
Exception for attrib 'serial_number': The device has no langid
set_configuration <bound method Device.set_configuration of <DEVICE ID 1d6b:0002 on Bus 001 Address 001>>
set_interface_altsetting <bound method Device.set_interface_altsetting of <DEVICE ID 1d6b:0002 on Bus 001 Address 001>>
speed 3
write <bound method Device.write of <DEVICE ID 1d6b:0002 on Bus 001 Address 001>>
Exception config in dev.configurations: 'method' object is not iterable
所以,我唯一能得到的是USB VID: 0x2341 PID: 0x0043;例外情况The device has no langid
阻止了对制造商和产品名称的检索(还有很多其他的例外)。
没有人知道设备节点/路径在哪里:很显然,在“遗留”模式中曾经有一个dev.filename
,在过去的某个时候,它可能包含了设备节点/文件/dev/ttyACM0
--但是现在似乎不再包含了,因为它是空的;而且我找不到任何关于这些信息驻留在“新”API中的地方(如果它存在的话)。
所以-如何在Linux中迭代Python 3中的所有USB设备,并打印出供应商ID、产品ID、制造商名称和设备节点文件名?如果这在PyUSB中是不可能的--我在Python方面还有哪些其他选项(我希望避免手动解析/var/log/syslog
或/dev/bus
)?
发布于 2020-06-23 10:23:52
好吧,我想我找到什么地方了。
首先,不再可能通过PyUSB获得设备节点(文件):
文件名不起作用,也没有列出所有附加usb·发#165·pyusb/pyusb·GitHub的设备。
文件名不再受支持:遗留API返回空字符串( libusb-compat伪造它们的地址号)。
其次,像Arduino UNO 那样的设备节点只存在于公开USB 串行端口的USB设备上(换句话说,对于操作系统加载USB串行内核驱动程序的设备);不同的USB类(我想,就像大容量存储设备一样)可能不会公开类似的设备节点。
第三,就"langid“的问题而言:
ValueError:该设备没有langid·发#139·pyusb/pyusb·GitHub
但是,在其他一些注释中,这是一个权限问题:如果您没有权限,则无法检索langid或序列号/制造商/产品字符串。 ..。
ValueError: The device has no langid
最常见的原因就是缺乏访问设备的权限。尝试使用sudo
运行您的程序,如果这有效,请考虑使用udev规则将对设备的访问权限授予非特权用户。
因此,由于我不想以sudo
的身份运行我的脚本,而且我也不想编写udev规则--检索我找到的这些信息的唯一方法是使用PyUSB来迭代VendorID和ProductID;然后将它传递到pyudev
,在那里我们可以找到设备节点,如果它是USB串行设备--在这种情况下,我们还可以检索制造商和产品字符串。
这是一个脚本--再次称为test-usb.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import usb.core # sudo pip3 install pyusb
import usb.util
import pyudev # sudo pip3 install pyudev
import inspect
pyudev_context = pyudev.Context() # SO:8110310 -> github.com/dhylands/usb-ser-mon (find_port.py)
#for device in pyudev_context.list_devices(subsystem='tty'):
# print( device.device_node )
# # note: device.properties['ID_VENDOR_ID'] is a string, hex representation of the ID number, without "0x" prefix
# try:
# print( type( device.properties['ID_VENDOR_ID'] ) )
# except Exception as e:
# print( e )
# try:
# print( device.properties['ID_MODEL_ID'] )
# except Exception as e:
# print( e )
for xdev in usb.core.find(find_all=True):
langids_str = ""
try:
langids_str = usb.util.get_langids(xdev)
except Exception as e:
langids_str = e
## trying to set _langids without sudo, will get rid of the 'ValueError: The device has no langid',
## however, mostly we'll just get '[Errno 13] Access denied (insufficient permissions)' instead
#if xdev._langids is None:
# xdev._langids = (1033,)
try:
mfr_str = usb.util.get_string(xdev, xdev.iManufacturer)
except Exception as e:
mfr_str = e
try:
prod_str = usb.util.get_string(xdev, xdev.iProduct)
except Exception as e:
prod_str = e
# check if it is USB serial device, with a device node/filename
devnode_str = "No device node"
vidhex_str = "{:04X}".format(xdev.idVendor)
pidhex_str = "{:04X}".format(xdev.idProduct)
for device in pyudev_context.list_devices(subsystem='tty'):
try:
if ( (vidhex_str.lower() == device.properties['ID_VENDOR_ID'].lower() ) and (pidhex_str.lower() == device.properties['ID_MODEL_ID'].lower()) ):
devnode_str = "{} ({} ; {})".format(device.device_node, device.properties['ID_VENDOR'], device.properties['ID_MODEL_FROM_DATABASE'] )
#for ikey in device.properties.keys(): print(ikey)
except:
pass
out_str = "VID: 0x{}, PID: 0x{}, devnode: {}, langids: '{}', Mfr: '{}', Prod: '{}'".format(
vidhex_str, pidhex_str, devnode_str, langids_str, mfr_str, prod_str
)
print(out_str)
## for ikey in device.properties.keys(): print(ikey):
# DEVLINKS
# DEVNAME
# DEVPATH
# ID_BUS
# ID_MODEL
# ID_MODEL_ENC
# ID_MODEL_FROM_DATABASE
# ID_MODEL_ID
# ID_PATH
# ID_PATH_TAG
# ID_REVISION
# ID_SERIAL
# ID_SERIAL_SHORT
# ID_TYPE
# ID_USB_CLASS_FROM_DATABASE
# ID_USB_DRIVER
# ID_USB_INTERFACES
# ID_USB_INTERFACE_NUM
# ID_VENDOR
# ID_VENDOR_ENC
# ID_VENDOR_FROM_DATABASE
# ID_VENDOR_ID
# MAJOR
# MINOR
# SUBSYSTEM
# TAGS
# USEC_INITIALIZED
下面是脚本输出的Raspberry Pi/拉伸与Arduino UNO连接-与sudo
连接
pi@raspberry:~ $ sudo python3 test-usb.py
VID: 0x2341, PID: 0x0043, devnode: /dev/ttyACM0 (Arduino__www.arduino.cc_ ; Uno R3 (CDC ACM)), langids: '(1033,)', Mfr: 'Arduino (www.arduino.cc)', Prod: '[Errno 32] Pipe error'
VID: 0x0424, PID: 0x7800, devnode: No device node, langids: '[Errno 32] Pipe error', Mfr: 'None', Prod: 'None'
VID: 0x0424, PID: 0x2514, devnode: No device node, langids: '[Errno 32] Pipe error', Mfr: 'None', Prod: 'None'
VID: 0x0424, PID: 0x2514, devnode: No device node, langids: '[Errno 32] Pipe error', Mfr: 'None', Prod: 'None'
VID: 0x1D6B, PID: 0x0002, devnode: No device node, langids: '(1033,)', Mfr: 'Linux 4.19.66-v7+ dwc_otg_hcd', Prod: 'DWC OTG Controller'
下面是它在没有sudo
时输出的内容
pi@raspberry:~ $ python3 test-usb.py
VID: 0x2341, PID: 0x0043, devnode: /dev/ttyACM0 (Arduino__www.arduino.cc_ ; Uno R3 (CDC ACM)), langids: '[Errno 13] Access denied (insufficient permissions)', Mfr: 'The device has no langid', Prod: 'The device has no langid'
VID: 0x0424, PID: 0x7800, devnode: No device node, langids: '[Errno 13] Access denied (insufficient permissions)', Mfr: 'None', Prod: 'None'
VID: 0x0424, PID: 0x2514, devnode: No device node, langids: '[Errno 13] Access denied (insufficient permissions)', Mfr: 'None', Prod: 'None'
VID: 0x0424, PID: 0x2514, devnode: No device node, langids: '[Errno 13] Access denied (insufficient permissions)', Mfr: 'None', Prod: 'None'
VID: 0x1D6B, PID: 0x0002, devnode: No device node, langids: '[Errno 13] Access denied (insufficient permissions)', Mfr: 'The device has no langid', Prod: 'The device has no langid'
注意,Arduino Uno似乎没有通过USB公开的产品字符串描述,相应地,在pyudev中,用于它的device.properties['ID_MODEL']
只打印0043
,但是device.properties['ID_MODEL_FROM_DATABASE']
打印实际的模型名。
https://stackoverflow.com/questions/62530554
复制相似问题