Why write/read once, I need replug the usb device ? #464
-
I use the bulk endpoint to read/write.
THE FULL CODE: self.__dev = usb.core.find(idVendor=self.__USB_VID, idProduct=self.__USB_PID)
for i in self.__dev[0].interfaces():
if self.__dev.is_kernel_driver_active(i.bInterfaceNumber):
self.__dev.detach_kernel_driver(i.bInterfaceNumber)
self.__dev.set_configuration(1)
cfg = self.__dev.get_active_configuration()
interface = cfg[(1, 0)]
self.__epi = usb.util.find_descriptor(
interface,
custom_match=lambda e: usb.util.endpoint_direction(e.bEndpointAddress) == usb.util.ENDPOINT_IN
)
self.__epo = usb.util.find_descriptor(
interface,
custom_match=lambda e: usb.util.endpoint_direction(e.bEndpointAddress) == usb.util.ENDPOINT_OUT
)
//...
return self.__epi.read(size_or_buffer) |
Beta Was this translation helpful? Give feedback.
Answered by
jonasmalacofilho
Oct 30, 2022
Replies: 1 comment
-
Most likely because your program doesn't comply with the protocol and device specs/requirements (e.g. missing messages or delay). You could also have hit a firmware bug. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
mcuee
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Most likely because your program doesn't comply with the protocol and device specs/requirements (e.g. missing messages or delay).
You could also have hit a firmware bug.