mcuee / libusb-win32

libusb-win32 project official github repo
172 stars 45 forks source link

Allow ZLP control writes #22

Closed tormodvolden closed 2 years ago

tormodvolden commented 2 years ago

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

dontech commented 2 years ago

Hi there!

Thanks for contributing with a patch and the input!

1) Instead of removing the check, i have updated the check to allow for zero length data.

2) Apart from that, i like it.

Please review/test my change, and i will apply it.

tormodvolden commented 2 years ago

Your updates make absolutely sense, thanks. I have squashed them in and repushed.

dontech commented 2 years ago

Good show. Merging...