openyou / emokit

Open source driver for accessing raw data from the Emotiv EPOC EEG headset
http://www.openyou.org
Other
521 stars 235 forks source link

Can't get emokit to work on Ubuntu 13.04 Device: 1234:ed02 #94

Closed guysoft closed 8 years ago

guysoft commented 10 years ago

Hello, I compiled emokit and ran emokitd which returns no output, it just runs and exists.

When I try executing example.py I get:

Traceback (most recent call last):
  File "/home/guy/bci/local/lib/python2.7/site-packages/gevent/greenlet.py", line     390, in run
    result = self._run(*self.args, **self.kwargs)
  File "/home/guy/workspace/bci/emokit/python/emokit/emotiv.py", line 353, in setup
    self.setupPosix()
  File "/home/guy/workspace/bci/emokit/python/emokit/emotiv.py", line 452, in setupPosix
    self.serialNum = setup[0]
TypeError: 'NoneType' object has no attribute '__getitem__'
<Greenlet at 0x10917d0: <bound method Emotiv.setup of <emokit.emotiv.Emotiv     object at 0x7f3206543810>>> failed with TypeError

lsusb output: Bus 003 Device 006: ID 1234:ed02 Brain Actuated Technologies Emotiv EPOC Developer Headset Wireless Dongle

dmesg output:

[20494.658070] usb 3-1: new full-speed USB device number 6 using xhci_hcd
[20494.679106] usb 3-1: New USB device found, idVendor=1234, idProduct=ed02
[20494.679120] usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[20494.679122] usb 3-1: Product: Receiver Dongle L01
[20494.679124] usb 3-1: Manufacturer: Emotiv Systems Pty Ltd
[20494.679125] usb 3-1: SerialNumber: SN20110425000016
[20494.681473] hid-generic 0003:1234:ED02.0006: hidraw1: USB HID v1.11 Device [Emotiv Systems Pty Ltd Receiver Dongle L01] on usb-0000:00:14.0-1/input0
[20494.684135] hid-generic 0003:1234:ED02.0007: hidraw2: USB HID v1.11 Device [Emotiv Systems Pty Ltd Receiver Dongle L01] on usb-0000:00:14.0-1/input1
olorin commented 10 years ago

Hi,

emokitd isn't expected to produce any output. Anything in your syslog? What happens when you run strace -f -e read=all emokitd?

guysoft commented 10 years ago

Here is the output of strace -f -e read=all emokitd (too long to paste in a comment). running as root. http://nopaste.dk/p62653

Does this tell you anything?

olorin commented 10 years ago

Indeed. Please ensure emokitd runs with privileges sufficient to access a) /var/run/emokitd.pid b) log to syslog c) access the relevant USB device. (I usually just run it as root, though that shouldn't be necessary).

guysoft commented 10 years ago

Its running as root. Is there anything else I should set? (Note the comment was updated, first time was indeed without root)

olorin commented 10 years ago

Thanks; that does look odd. Which version of hidraw did you install? Which distro/kernel are you running? Developer or consumer headset?

guysoft commented 10 years ago

Hey, I followed this install manual. Kernel: Linux 3.8.0-27-generic #40-Ubuntu SMP Tue Jul 9 00:17:05 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux Hidraw is a kernel driver so I assume it has the same version number as the kernel?

olorin commented 10 years ago

Indeed, sorry, I meant hidapi, not hidraw. In the hidapi source tree there's a a directory called 'test_gui' or something like that; are you able to run it, see the two epoc devices, and request a feature report?

isovic commented 10 years ago

Hi,

I have the same problem, for some reason I get the traceback from the gevent library. I tried to run the Hidapi test gui (hidapi-hidraw-testgui), and two Epoc devices are listed.

What is the version of the library used in development? Perhaps they changed the API in the meanwhile.

Do you have any other ideas of what could cause this?

olorin commented 10 years ago

Most recent tested version of hidapi is 0.7.0, git commit 776ec62dfc2cd394a298f03dbf27a96506544410[0].

I'll spin up an Ubuntu VM at some point and try and reproduce this; let me know if you have any luck.

[0] https://github.com/signal11/hidapi/commit/776ec62dfc2cd394a298f03dbf27a96506544410

isovic commented 10 years ago

Thanks for the quick reply!

I tried checking-out your version, but still no luck (the same problem). Why do you suspect the problem is in Hidapi? The stack trace (both mine and from other users) is referring to gevent and greenlet libraries.

Although, from the same traceback I would probably conclude that the 'setup[0]' object is equal to None, and that greenlet.py does not efficiently handle this case (why it's None in the first place, I got no clue since I haven't looked at the code).

In case it's useful, I am running Ubuntu 13.10, 64bit.

Thanks again. It would be cool to see this functioning :-)

isovic commented 10 years ago

Ok, solved it. Here's what you do.


For the C version: The same thing as in Issue #63 (https://github.com/openyou/emokit/issues/63). Open up the include/emokit/emokit.h file, and change EMOKIT_VID and EMOKIT_PID variables to the correct Vendor and Product IDs. For some reason, it appears that Epoc changed this numbers at some point. In my case, I used: const static uint32_t EMOKIT_VID = 0x1234; const static uint32_t EMOKIT_PID = 0xed02;

You can check if you have the same or different VID and PID e.g. by using hidapi/testgui/hidapi-hidraw-testgui (download from github and compile). In my case, I had 2 devices listed: 1234:ed02 - Emotiv Systems Pty Ltd Receiver Dongle L01 (usage...) 1234:ed02 - Emotiv Systems Pty Ltd Receiver Dongle L01 (usage...)

If it still doesn't work, there are two more things to do: 1) Open emokit.c file, and find the line: int r = emokit_open(d, EMOKIT_VID, EMOKIT_PID, 0); Change the zero to one, like so: int r = emokit_open(d, EMOKIT_VID, EMOKIT_PID, 1); This means that we are trying to use the wrong one of the two listed devices.

2) Use sudo to allow for required privileges.


For the Python version: It appears that not only have they changed the VID and PID, but also the string of the company name. Open file python/emotiv.py, and find the function: getLinuxSetup There is a line: if "Emotiv Systems Inc." in manufacturer: From the device listing, you can see that the name of the manufacturer is now "Emotiv Systems Pty Ltd" (try printing it to stdout). So, to fix the problem, change the above line to something like: if "Emotiv Systems" in manufacturer:

Thats it! :)

aponxi commented 9 years ago

Thanks to @isovic I am able to confirm that his solution also works on Ubuntu 14.04.

dracog71 commented 8 years ago

Thanks to @isovic, as update, it doesn't full work in Raspberry, the modules "Ctype" for C programming cannot be installed, also "Psyco" :

"Could not find a version that satisfies the requierements psyco/ctypes"

But in /python "example.py" works great with those changes.

Another problem in Raspberry Pi is, when you want to get info from the EPOC it says "NoneType object has no attribute gyroX"

I know that its becasue "gyroX" return 'None'

It's something with "emotiv.py" when it starts

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/gevent/greenlet.py", line 327, in run
    result = self._run(*self.args, **self.kwargs)
  File "/usr/local/lib/python2.7/dist-packages/emokit-0.0.1-py2.7.egg/emokit/emotiv.py", line 353, in setup
    self.setupPosix()
  File "/usr/local/lib/python2.7/dist-packages/emokit-0.0.1-py2.7.egg/emokit/emotiv.py", line 456, in setupPosix
    self.serialNum = setup[0]
TypeError: 'NoneType' object has no attribute '__getitem__'
<Greenlet at 0xd3b5d0: <bound method Emotiv.setup of <emokit.emotiv.Emotiv object at 0xc04770>>> failed with TypeError

if someone know how to fix it!

ghost commented 8 years ago

Psyco not required. Pull the latest version @dracog71. Seems like the initial problem was fixed and latest version weakened those requirements so closing.