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

#16 allow zero length control transfer (without buffer) #21

Closed
mcuee opened this issue Oct 13, 2021 · 4 comments
Closed

#16 allow zero length control transfer (without buffer) #21

mcuee opened this issue Oct 13, 2021 · 4 comments
Labels

Comments

@mcuee
Copy link
Owner

mcuee commented Oct 13, 2021

https://sourceforge.net/p/libusb-win32/patches/16/

Using for instance libusbk.dll 3.0.7.0 (the version currently installed with Zadig) a control transfer with zero length will fail (see libusb/libusb#1006). I suspect this is due to the check on transfer_buffer_mdl in src/driver/ioctl.c since the same check for bulk transfer write is explicitly not done. The second patch changes the control transfer check to be consistent to the bulk transfer check.

The first patch just adds missing debug tags. The second patch applies on top.

I don't have the setup to rebuild and test libusb0.sys so I can only assume this is correct without verification by own testing. BTW this issue doesn't show when using the recently released libusbk.dll 3.0.8.0 because the control transfers are done differently here.

Driver error message caught with DebugView:
libusb0-sys:err [dispatch_ioctl] (null): invalid transfer request
patches.zip

@mcuee
Copy link
Owner Author

mcuee commented Oct 13, 2021

@tormodvolden Thanks a lot for the patches.
Please help to create a pull request here instead as we no longer use Sourceforge for development. Thanks.

@mcuee
Copy link
Owner Author

mcuee commented Oct 13, 2021

Reference: libusb/libusb#1006

Comments from @tormodvolden

I have been chasing this far into the woods of Windows dll's and drivers, and I believe to have found a bug in in libusb0.sys where it rejects zero-sized control writes in some cases where it shouldn't have to, and I have sent (https://sourceforge.net/p/libusb-win32/patches/16/) a patch upstream. But all this only to discover that libusk.dll 3.0.8.0 has changed its way of doing control transfer (thanks to mcuee/libusbk#15) so this bug doesn't surface any longer.

tormodvolden added a commit to tormodvolden/libusb-win32 that referenced this issue Oct 13, 2021
Closes mcuee#21

Signed-off-by: Tormod Volden <[email protected]>
@tormodvolden
Copy link
Contributor

tormodvolden commented Oct 13, 2021

Merge request in #22.
No problem, I didn't know it was moved to git and github. Can you please add a link on the SF page?

@mcuee
Copy link
Owner Author

mcuee commented Oct 14, 2021

Thanks. Updated the following page:
https://sourceforge.net/projects/libusb-win32/
https://sourceforge.net/p/libusb-win32/wiki/Home/

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