LIBUSB_ERROR_ACCESS

Firmware/software/electronics
etlabs
Beginner
Posts: 2
Joined: Wed Dec 09, 2015 9:59 pm

LIBUSB_ERROR_ACCESS

Post by etlabs »

Hi all -
I'm attempting to run the crazyflie-cylon demo code and believe I have all the dependencies installed correctly; when I do, I get the following error:

Code: Select all

/node_modules/aerogel/node_modules/usb/usb.js:168
    this.device.__claimInterface(this.id)
                ^

Error: LIBUSB_ERROR_ACCESS
    at Error (native)
    at Interface.claim (/Users/etlab/Desktop/rise-of-the-machines/node_modules/aerogel/node_modules/usb/usb.js:168:14)
    at Crazyradio.setupRadio (/Users/etlab/Desktop/rise-of-the-machines/node_modules/aerogel/lib/crazyradio.js:111:17)
    at CrazyDriver.connect (/Users/etlab/Desktop/rise-of-the-machines/node_modules/aerogel/lib/crazydriver.js:136:20)
    at Copter.connect (/Users/etlab/Desktop/rise-of-the-machines/node_modules/aerogel/lib/copter.js:53:21)
    at Adaptor.doConnect (/Users/etlab/Desktop/rise-of-the-machines/node_modules/cylon-crazyflie/lib/adaptor.js:47:15)
    at Adaptor.connect (/Users/etlab/Desktop/rise-of-the-machines/node_modules/cylon-crazyflie/lib/adaptor.js:42:10)
    at Robot.startConnection (/Users/etlab/Desktop/rise-of-the-machines/node_modules/cylon/lib/robot.js:317:22)
    at Robot.<anonymous> (/Users/etlab/Desktop/rise-of-the-machines/node_modules/cylon/lib/robot.js:288:19)
    at /Users/etlab/Desktop/rise-of-the-machines/node_modules/cylon/lib/utils/helpers.js:237:36
which I've been able to trace back to essentially my user not having permission to access the Crazyradio PA dongle. The Python client is able to read data from the dongle just fine, so it seems to be connecting to my Mac just fine, but it doesn't come up anywhere in my file system as far as I can tell (not in /Volume as should be the default on OS X) so I can't figure out how to change the permissions on it. Has anybody faced this problem before? How did you solve it? Support?

Any help anybody could provide here would be much appreciated - I'm totally unable to send commands to the copter for now.

Thanks!
chad
Expert
Posts: 555
Joined: Sun Sep 28, 2014 12:54 am
Location: New York, USA
Contact:

Re: LIBUSB_ERROR_ACCESS

Post by chad »

You mentioned that the Python client can "talk" to the Crazyradio. I'm assuming this is the Bitcraze crazyflie-python-client... Did you use Brew to install the dependencies for the client to run? If you have, then it sounds like you have 'libusb' needed to communicate with the dongle. Maybe the cylon code is looking for that library in the wrong place? When you run the cylon code is libusb available in any paths cylon knows about? I've never used this cylon library so I'm kinda guessing here. In any case, if you are running the Bitcraze python client and the cylon code as the same user and the Python client is working, it's not likely a permission problem.

Also, the Crazyradio will not be found in /Volumes because that's only where mounted storage goes. You can verify the Crazyradio is connected by inserting it, then running

Code: Select all

system_profiler SPUSBDataType
in a Terminal window, which is somewhat analogous to the Linux "lsusb" command. You can get this same information running "/Applications/Utilities/System Information.app" and clicking the "USB" section in the "Hardware" section of the left-hand column.

Sorry I'm not much more help than this. If I get a chance to fiddle with Cylon in the next couple days, I'll let you know what I find.
Crazyflier - my CF journal...
4x Crazyflie Nano (1.0) 10-DOF + NeoPixel Ring mod.
3x Crazyflie 2.0 + Qi Charger and LED Decks.
Raspberry Pi Ground Control.
Mac OS X Dev Environment.
Walkera Devo7e, ESky ET6I, PS3 and iOS Controllers.
chad
Expert
Posts: 555
Joined: Sun Sep 28, 2014 12:54 am
Location: New York, USA
Contact:

Re: LIBUSB_ERROR_ACCESS

Post by chad »

Well, I started to install node and cylon this evening and hit my own errors... Did you happen to see this thread and do you think it might be part of the problem? Indeed both aerogel and cylon are "older" projects in that the latest commits are over two years ago. I wouldn't be surprised if there are incompatibilities in the node-aerogel-cylon stack that may be contributing to the problem...

Also
- What version of node are you running?
- What Crazyflie are you using (CF1, CF2)?
- What Mac OS are you on?

That way we can do an apples-to-apple comparison?
Crazyflier - my CF journal...
4x Crazyflie Nano (1.0) 10-DOF + NeoPixel Ring mod.
3x Crazyflie 2.0 + Qi Charger and LED Decks.
Raspberry Pi Ground Control.
Mac OS X Dev Environment.
Walkera Devo7e, ESky ET6I, PS3 and iOS Controllers.
etlabs
Beginner
Posts: 2
Joined: Wed Dec 09, 2015 9:59 pm

Re: LIBUSB_ERROR_ACCESS

Post by etlabs »

Hi chad -

Thanks for the quick response; I've continued to look into it as well and agree with you that it's probably a versioning issue around the usb package, but it's super unclear how to go about resolving it (the Cylon guys know about it but don't seem to have a solution.

I did indeed mean that the crazyflie-python-client is able to receive data from the crazyradio PA. I used brew to install it but I don't think it's a paths issue, as the particular error (LIBUSB_ERROR_ACCESSS) is itself a libusb error - I think I'd be seeing 'no such thing as libusb' if it wasn't finding it. The crazyradio does show up under system_profiler, there just doesn't seem to be any way to set permissions (although I now also agree that it's probably not a permissions thing)

I'm using:
- node 4.2.1
- CF2
- OSX 10.5 (Yosemite)

Tough problem - we may just have to move to a different drone :?
chad
Expert
Posts: 555
Joined: Sun Sep 28, 2014 12:54 am
Location: New York, USA
Contact:

Re: LIBUSB_ERROR_ACCESS

Post by chad »

Well, I checked out the issue thread you linked and that's the exact error I'm getting. I'm not really familiar with nodejs, as I mentioned, and I've got only passing experience with Javascript but I decided to dig a bit deeper. It is definitely an incompatibility between the aerogel usb stream wrapper and what's available in current releases of node-usb

In fact, cylon-crazyflie calls (through aerogel) startStream and stopStream routines that were pulled out of node-usb after the 0.3.11 version mentioned in the thread you linked. In the next commit they rename start/stopStream to start/stopPoll. I tried to simply replace these in the aerogel module and rebuild it (had to quickly read-up on node modules and npm - then uninstall cylon-crazyflie and aerogel, install my own aerogel build, then reinstall cylon-crazyflie) and it actually got past the error and went to a "starting telemetry" state, but now it just sits there not doing anything so I'm sure those aerogel usb stream wrappers likely need a bit of a rewrite.

I also tried to simply install an earlier version of node-usb but that cause npm to throw a bunch of errors I didn't want to look into. I don't think that's a viable option unless you downgrade node as well, which is likely a non-starter as well.

I don't think I have the time to learn it and I certainly don't have any knowledge of usb streams so, I'm not the guy to handle this. It looks like either cylon needs to abandoned the aged and neglected aerogel and handle things themselves or some quick engineer needs to bring aerogel up to speed and hope that the owner sees the pull request and takes action. I'll probably keep poking around (time permitting) until I get bored, frustrated, or actually fix something (the latter not likely to happen).

Anyway, I gave it shot. But still, that doesn't address your error at all... Though this guy's problem looks similar (but not the same). It'd be a shame for you to have to change hardware for a software issue...

I'm using:
node: 4.2.3
CF2
Mac OS X El Capitan (10.11.2)
MacPorts install of both libusb and nodejs.
Crazyflier - my CF journal...
4x Crazyflie Nano (1.0) 10-DOF + NeoPixel Ring mod.
3x Crazyflie 2.0 + Qi Charger and LED Decks.
Raspberry Pi Ground Control.
Mac OS X Dev Environment.
Walkera Devo7e, ESky ET6I, PS3 and iOS Controllers.
chad
Expert
Posts: 555
Joined: Sun Sep 28, 2014 12:54 am
Location: New York, USA
Contact:

Re: LIBUSB_ERROR_ACCESS

Post by chad »

Oh, and I did log an issue on the aerogel repos. Feel free to comment and add your two cents. BTW, I also found some other people getting stuck at the "starting telemetry" state. They raised issues about it almost two years ago now. The aerogel project might be abandoned...
Crazyflier - my CF journal...
4x Crazyflie Nano (1.0) 10-DOF + NeoPixel Ring mod.
3x Crazyflie 2.0 + Qi Charger and LED Decks.
Raspberry Pi Ground Control.
Mac OS X Dev Environment.
Walkera Devo7e, ESky ET6I, PS3 and iOS Controllers.
tobias
Bitcraze
Posts: 2339
Joined: Mon Jan 28, 2013 7:17 pm
Location: Sweden

Re: LIBUSB_ERROR_ACCESS

Post by tobias »

Nice find and analyzes @chad!
natekicksa
Beginner
Posts: 6
Joined: Mon Dec 21, 2015 11:48 pm

Re: LIBUSB_ERROR_ACCESS

Post by natekicksa »

How did you run the cylon js demo code for the crazyflie? please reply asap so i can see if it still works, thank you @chad and @etlabs
chad
Expert
Posts: 555
Joined: Sun Sep 28, 2014 12:54 am
Location: New York, USA
Contact:

Re: LIBUSB_ERROR_ACCESS

Post by chad »

natekicksa wrote:How did you run the cylon js demo code for the crazyflie? please reply asap so i can see if it still works, thank you @chad and @etlabs
Hi natekicksa,
I simply installed the 4.2.3 nodejs and npm from the stable distro on the nodejs website (and later after removing them, installed the same versions through MacPorts), then, since I already had libusb installed through MacPorts, I simply installed cylon and cylon-crazyflie using npm:

Code: Select all

npm install cylon cylon-crazyflie
Then I pasted the Crazyflie example on the cylonjs.com site into a text file, saved it as "cylon_cf_example.js", and ran it via the command-line with:

Code: Select all

node ~/Desktop/cylon_cf_example.js
Regards!
Crazyflier - my CF journal...
4x Crazyflie Nano (1.0) 10-DOF + NeoPixel Ring mod.
3x Crazyflie 2.0 + Qi Charger and LED Decks.
Raspberry Pi Ground Control.
Mac OS X Dev Environment.
Walkera Devo7e, ESky ET6I, PS3 and iOS Controllers.
natekicksa
Beginner
Posts: 6
Joined: Mon Dec 21, 2015 11:48 pm

Re: LIBUSB_ERROR_ACCESS

Post by natekicksa »

oh i have mac osx lion 10.7.5, i download everything but everytime i try to put the file extension into the terminal, it says shows password, then i type in my password and then it says error, this command does not exist. what do you think is going on? @chad
Last edited by natekicksa on Wed Dec 23, 2015 1:34 am, edited 1 time in total.
Post Reply