Skip to content

Seeing 2 devices when there's only 1 connected on windows/linux+libusb #39

Open
qdot opened this Issue Nov 1, 2012 · 5 comments

5 participants

@qdot
OpenYou member
qdot commented Nov 1, 2012

Whenever we run hid_enumerate on windows or linux using libusb, we get a device count of 2 even when there's only one device available. This means that if we try to connect to device index 0 instead of device index 1, we don't actually read anything (epocd example hangs on "Starting read").

CURRENT WORKAROUND:

If you are seeing 2 devices in count when you only have 1 connected, try changing emokit_open's device index (the last argument of the function) to 1 instead of 0. Opening the 2nd device that we see tends to make emokit work. That said, we're still looking to fix this so that doesn't need to happen.

@ozancaglayan

That is because there are two interfaces in the dongle (They appear as hidraw0, hidraw1 for example). Looking to your udev rule it seems that you are interested in the first one which is called "Emotiv RAW DATA". So we can filter out all other interfaces except that. Am I wrong?

@qdot
OpenYou member
qdot commented Nov 30, 2012

The udev rule is broken in multiple ways right now. It's set up for the first python libraries we had, which assumed daemons and what not to exist on the system. Even so, we should be able to do something smarter now that we're on hidapi.

@wijjj
wijjj commented Jul 4, 2013

I guess this is not 100% the same issue, but still...

Using ubuntu11 (installed all dependencies, mcrypt, cmake, hidapi w/o problems) I get two devices, but running e.g. contact I get CANNOT CONNECT: -3 (E_EMOKIT_NOT_OPENED). I added some output within emokit_open for now. This shows up when I run contact now:

Current epoc devices conneted: 2

opening dev: 1 (device_index)
path: /dev/hidraw0 (device_cur->path)
path: /dev/hidraw1

opening dev: 0
path: /dev/hidraw0
CANNOT CONNECT: -3

BTW: everything works fine in windows, using emokit-java.

@olorin
OpenYou member
olorin commented Jul 7, 2013

I have a working version of the udev rules working with epocd on my other laptop; now that epocd's been incorporated into master I'll look into integrating my changes and getting device selection working (I'm at pyconau at the moment, so it'll be a couple of days).

@soltanmm
soltanmm commented Aug 3, 2013

I realize that I'm perpetuating an off-topic discussion, but...

@wijjj: have you checked that you have read permissions on hidraw? I had the same problem, stepped through the debugger, and found I lacked permissions for a call to open() in the hid library. Try cat-ting on the /dev/hidraw file as a check or run with sudo... might help.

@qdot qdot was assigned by bschumacher Jun 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.