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

Linux: better error handling when USB permissions problem #2

Open
doegox opened this issue Sep 18, 2019 · 0 comments
Open

Linux: better error handling when USB permissions problem #2

doegox opened this issue Sep 18, 2019 · 0 comments

Comments

@doegox
Copy link

doegox commented Sep 18, 2019

On Linux, if someone forgets to install or update his /etc/udev/rules.d/99-newae.rules to include the ballisticgel VID:PID (hey what did you expect? ;) ), the python script fails with:

ValueError: The device has no langid

The error is not really helpful for someone to understand the root of the problem and the solution.
Example:

--- a/ballisticgel/naeusb.py
+++ b/ballisticgel/naeusb.py
@@ -109,7 +109,10 @@ class NAEUSB(object):
         """
 
         devlist = self.get_possible_devices(idProduct)
-        snlist = [d.serial_number + " (" + d.product + ")\n" for d in devlist]
+        try:
+            snlist = [d.serial_number + " (" + d.product + ")\n" for d in devlist]
+        except ValueError:
+            raise IOError("Check permissions to access the USB device")
         snlist = "".join(snlist)
 
$ 
python ballisticgel.py 
 CW521 Ballistic Gel Example Script 
  by NewAE Technology Inc
 This script will continue until you exit with Ctrl-C
Traceback (most recent call last):
  File "ballisticgel.py", line 306, in <module>
    cw521.con()
  File "ballisticgel.py", line 51, in con
    self.usb.con(idProduct=[usb_pid])
  File "/home/qb/00hardware_guilde/haqerspace/tools/chipshouter/ChipSHOUTER/ChipSHOUTER-ballisticgel/ballisticgel/naeusb.py", line 115, in con
    raise IOError("Check permissions to access the USB device")
IOError: Check permissions to access the USB device
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant