Share

PyUSB

Tracker: Bugs

1 usb.USBError: No error - ID: 2021235
Last Update: Comment added ( wander_lairson )

[ Forwarded from
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=476796 ]

I recently acquired a USB device from Atmel, the Raven kit and am playing
around with that, including trying to get it to interface with my Linux
system.
http://code.rancidbacon.com/LearningAboutAtmelRZRAVEN has some code on
it (http://code.rancidbacon.com/files/test_raven_usb.py). While
running this code, I get a traceback, which looks just bogus:

Traceback (most recent call last):
File "test_raven_usb.py", line 69, in <module>
print hex(handle.bulkRead(0x84, 1)[0])
usb.USBError: No error

please don't raise exceptions when all you have to report is that no error
occured.


Bernd Zeimetz ( zeimetz ) - 2008-07-18 07:24

1

Closed

Fixed

Wander Lairson

Running

None

Public


Comments ( 6 )

Date: 2009-04-06 17:43
Sender: wander_lairsonProject Admin

Fixed on revision 1.26.
All return calls were fixed, and I also added defensive code by checking
against "No Error" messages. Thank you for the help.


Date: 2009-02-15 21:30
Sender: zeimetz

Talking to the libusb maintainer resulted in the following statement:

-----------------------------------------------------------------------------------
It [the error] comes from libusb because pyusb calls usb_strerror() when
there is no
error. Quoting the libusb Developers Guide:

| Chapter 7. Return values
| There are two types of return values used in libusb v0.1. The first
| is a handle returned by usb_open. The second is an int. In all cases
| where an int is returned, >= 0 is a success and < 0 is an error
| condition.

On the other side pyusb checks for a value != 0, so it thinks some
returned values are error while they are not.
------------------------------------------------------------------------------



Date: 2009-01-23 01:32
Sender: nobody

No, it hasn't.


Date: 2009-01-22 13:09
Sender: mkburza

I came across the same problem with a different device and I have a
question:
Has this been forwarded as a bug to libusb guys?

With kind regards,
Marek


Date: 2008-07-22 22:20
Sender: zeimetz


Then I'd suggest to return something like 'No errormessage', so it is
obvious to the User. Just 'No error' is confusing, definitely.


Date: 2008-07-22 20:29
Sender: wander_lairsonProject Admin


PyUSB just replicates the error reported by the underline libusb library.
This is caused because a libusb function has returned with error but hasn't
set a error message.


Attached File

No Files Currently Attached

Changes ( 12 )

Field Old Value Date By
status_id Open 2009-04-06 17:43 wander_lairson
close_date - 2009-04-06 17:43 wander_lairson
allow_comments 1 2009-04-06 17:43 wander_lairson
resolution_id Rejected 2009-04-06 17:43 wander_lairson
status_id Closed 2009-02-15 21:30 zeimetz
close_date 2008-07-22 20:29 2009-02-15 21:30 zeimetz
status_id Open 2008-07-22 20:29 wander_lairson
resolution_id None 2008-07-22 20:29 wander_lairson
assigned_to nobody 2008-07-22 20:29 wander_lairson
priority 5 2008-07-22 20:29 wander_lairson
category_id None 2008-07-22 20:29 wander_lairson
close_date - 2008-07-22 20:29 wander_lairson