Comments (4)
@c1728p9 thanks for the patch!
The patch looks safe, but I'd like to know more details about the bug for my testing (I'll merge the patch but refresh PyPi once I do my own testing):
- Confirmed windows version (e.g. Windows 8, Windows 7 64 bits, etc).
- Python version (also if 32 or 64 bits)
from pywinusb.
I have seen this problem on Windows 7 64 bit on 2 different computers. One was running 32 bit python version 2.7.8 and the other was running 64 bit python version 2.7.10. @geky also saw this problem on a 64 bit windows 7 machine. I haven't tested this on a 32 bit machine, but I would imagine it would have the same problem.
This problem is also very timing specific, at least for the hid devices we are using - mbed boards. The boards receive a 64 byte command on the interrupt out endpoint and then send a response on the interrupt in endpoint. The response on interrupt in comes 1-2ms after the write to the out endpoint. If just a few ms of delay is added after WaitForSingleObject in InputReportReaderThread there is enough time for the read to complete and the problem goes away. Adding a debugging print statements here was enough of a delay to make the errors go away. The crash also goes away if the buffers used by winapi.ReadFile are added to a global list to prevent them from being freed after the call (although this causes the memory to never be freed).
Me and @geky saw this problem when running pyOCD tests which try to stress the system by repeatedly opening a hid device, performing a series of reads/writes and then closing the hid device.
If you want to reproduce this problem it would probably be easiest to do with a HID device that continuously sends data to the pc on the interrupt in endpoint. If a packet is sent while the read is in progress but the buffers have been released then the crash will occur.
Let me know if you have any more questions or need more details. Thanks for the quick response on this issue.
from pywinusb.
Re-open due pending side effects verification.
from pywinusb.
Re-merged after regression fixes.
from pywinusb.
Related Issues (20)
- hid.core.show_hids() fails under Python 2 if there is a Unicode character in the device name HOT 1
- Freeze when closing handle from __del__ during python exit HOT 12
- Fail to run simple_feature.py example
- filtering devices by serial number HOT 1
- cx_Freeze can't find module pywinusb HOT 2
- Not reading mouse usb HOT 1
- get_usages() with usage ranges returns one less than what is in descriptor's range
- Running show_hids.py - A USB HID not showing in the list HOT 10
- Question about get input and send output from my custom USB device. HOT 5
- pywinusb vs pyusb HOT 2
- Options to get input reports
- InputReportProcessingThread is never closed
- Can't see all the HID devices connected to the PC HOT 1
- How do I send a simple feature report? HOT 2
- Set Feature Report data last byte corrupted HOT 4
- WinError 2 HOT 1
- Can I use this library to emulate HID mouse drivers without additional hardware? HOT 1
- PNP for tkinter HOT 4
- USB device isn't found
- HID RFID Tag Reading Issue HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pywinusb.