Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

usb_open() failed sometimes #72

Open
hellomanyi opened this issue Aug 26, 2024 · 1 comment
Open

usb_open() failed sometimes #72

hellomanyi opened this issue Aug 26, 2024 · 1 comment
Labels

Comments

@hellomanyi
Copy link

hellomanyi commented Aug 26, 2024

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)

@mcuee mcuee added the question label Sep 11, 2024
@mcuee
Copy link
Owner

mcuee commented Sep 11, 2024

What is the device in question?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants