小编sma*_*ers的帖子

使用PyUSB获取字符串描述符usb.util.get_string()

我无法获取USB设备的字符串描述符.我正在寻找的是人性化的制造商和产品名称.我使用libusb-1.0作为后端,并且能够使用提供的libusb测试程序获取制造商名称,所以我知道它存在.

PyUSB帮助文件说你可以使用以下方法访问usb_get_string_simple(来自libusb后端):

get_string(dev,length,index,langid = None)

   Retrieve a string descriptor from the device.
   dev is the Device object to which the request will be sent to.

   length is the length of string in number of characters.

   index is the string descriptor index and langid is the Language
   ID of the descriptor. If langid is omitted, the string descriptor
   of the first Language ID will be returned.

   The return value is the unicode string present in the descriptor.
Run Code Online (Sandbox Code Playgroud)
import usb …
Run Code Online (Sandbox Code Playgroud)

python windows pyusb libusb-1.0

4
推荐指数
2
解决办法
1万
查看次数

标签 统计

libusb-1.0 ×1

python ×1

pyusb ×1

windows ×1