python-libusb1 icon indicating copy to clipboard operation
python-libusb1 copied to clipboard

UsbDK support

Open wynwxst opened this issue 9 months ago • 3 comments

Dear vpelletier, Is there any way to force usbDK support? I've seen the pyusb conversation about it here However, when I use python-libusb1 to set option to 1: image I understand UsbDK is unstable but I need to use it for the project I'm working on.

EDIT: libusb_set_option returns -5 and the device I am trying to access is under libusbK

Code:

        mayRaiseUSBError(libusb1.libusb_init(byref(self.__context_p)))
        self.set_option = libusb1.libusb_set_option(self.__context_p,1)
        print(self.set_option)

EDIT: it seems to suddenly now return 0 instead of -5, perhaps because the device isn't connected, I'll check

EDIT: Now it works but at parts requiring libusb_reset_device and then device.close() #usb1.USBDevice, the code randomly breaks off with a chance of moving to the next step ctx.close() # usb1.USBContext before breaking off. Code:

        mayRaiseUSBError(libusb1.libusb_init(byref(self.__context_p)))

        self.set_option = libusb1.libusb_set_option(self.__context_p,1,3)
        assert self.set_option == 0

Threading seems to be somewhat effective if done in a daemon form

wynwxst avatar May 10 '24 08:05 wynwxst