Discussion:
[pyusb-users] Access Denied Error on Windows 7
Richard Bryan
2014-11-11 17:22:19 UTC
Permalink
I'm frequently running into an "Access Denied (insufficient permissions)"
errors on Windows 7 (with libusb1 backend) during long-running usb sessions
with a device. When this happens, I call reset() and dispose_resources()
on the usb handle and then attempt to reenumerate it using usb.core.find(),
but the Access Denied error keeps occurring until I unplug and replug the
device. Restarting the program alone doesnt fix it.

I have a multithreaded program, but interaction with pyusb is only ever
done in the same, single thread.

Anyone have any ideas what's going on? Or is this something I should ask
the libusb list about?

Richard
Wander Lairson Costa
2014-11-13 11:54:31 UTC
Permalink
Post by Richard Bryan
I'm frequently running into an "Access Denied (insufficient permissions)"
errors on Windows 7 (with libusb1 backend) during long-running usb sessions
with a device. When this happens, I call reset() and dispose_resources() on
the usb handle and then attempt to reenumerate it using usb.core.find(), but
the Access Denied error keeps occurring until I unplug and replug the
device. Restarting the program alone doesnt fix it.
iirc, libusb reset operation is problematic under Windows, so better
to avoid it.
Post by Richard Bryan
I have a multithreaded program, but interaction with pyusb is only ever done
in the same, single thread.
This should not cause problems...
Post by Richard Bryan
Anyone have any ideas what's going on? Or is this something I should ask
the libusb list about?
Could you please run you program with the environment variable
PYUSB_DEBUG=debug defined and report the logs?
Post by Richard Bryan
Richard
------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://pubads.g.doubleclick.net/gampad/clk?id=154624111&iu=/4140/ostg.clktrk
_______________________________________________
pyusb-users mailing list
https://lists.sourceforge.net/lists/listinfo/pyusb-users
--
Best Regards,
Wander Lairson Costa
Xiaofan Chen
2014-11-14 07:58:24 UTC
Permalink
Post by Richard Bryan
I'm frequently running into an "Access Denied (insufficient permissions)"
errors on Windows 7 (with libusb1 backend) during long-running usb sessions
with a device. When this happens, I call reset() and dispose_resources() on
the usb handle and then attempt to reenumerate it using usb.core.find(), but
the Access Denied error keeps occurring until I unplug and replug the
device. Restarting the program alone doesnt fix it.
libusb under Windows do not support libusb_reset() since WinUSB
driver does not support reset.

BTW, what is the libusb version you are using? You should use the latest
libusb-1.0.19 version.
Post by Richard Bryan
I have a multithreaded program, but interaction with pyusb is only ever done
in the same, single thread.
Anyone have any ideas what's going on? Or is this something I should ask
the libusb list about?
You can follow Wander's advice to turn on PYUSB_DEBUG=debug for pyusb
debug message. If that is not good enough, you can turn on libusb
debug by setting env variable LIBUSB_DEBUG=4 for libusb debug messages.

And when this happen, you can check if your USB device is still recognized
by Windows in Device Manager? If not, then libusb will fail and most likely
your device has a HW/FW stability problem.
--
Xiaofan
Loading...