libusb-win32 icon indicating copy to clipboard operation
libusb-win32 copied to clipboard

usb_open() failed sometimes

Open hellomanyi opened this issue 1 year ago • 1 comments

Hello, I found that there is a low probability that usb_open() cannot be opened when using libusb-win32. After analyzing libusb-1.0 and libusbK, I initially judged that the opening mode of CreateFile may cause it to fail to open; libusb-win32 uses exclusive mode; both libusb-1.0 and libusbK are opened in shared mode; why we open it in this way ? can we modify it to shared mode?

libusb-win32: CreateFile(dev_name, 0, 0, NULL, OPEN_EXISTING,FILE_FLAG_OVERLAPPED, NULL);

libusb-1.0 handle = CreateFileA(path, access, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL);

Libusbk CreateFileA(DevicePathStrA, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL)

hellomanyi avatar Aug 26 '24 05:08 hellomanyi