我正在尝试使用python库PyUSB将数据发送到USB记忆棒.我使用的代码如下:
import usb.core
import usb.util
# find our devices
#dev = usb.core.find(idVendor=0xfffe, idProduct=0x0001)
dev = usb.core.find(idVendor=0x090c, idProduct=0x1000)
# was it found?
if dev is None:
raise ValueError('Device not found')
# set the active configuration. With no arguments, the first
# configuration will be the active one
dev.set_configuration()
# get an endpoint instance
cfg = dev.get_active_configuration()
interface_number = cfg[(0,0)].bInterface_number
alternate_setting = usb.control.get_interface(interface_number)
intf = usb.util.find_descriptor(
cfg, bTnerfaceNumber = interface_number,
bAlternateSettings = alternate_setting
)
ep = usb.util.find_descriptor(