eclipse / mraa

Linux Library for low speed IO Communication in C with bindings for C++, Python, Node.js & Java. Supports generic io platforms, as well as Intel Edison, Intel Joule, Raspberry Pi and many more.
http://mraa.io
MIT License
1.37k stars 613 forks source link

issue with Gpio on Edison with ubilinux #572

Open mogar opened 7 years ago

mogar commented 7 years ago

Hi,

We installed mraa onto ubilinux using the SparkFun instructions here: https://learn.sparkfun.com/tutorials/installing-libmraa-on-ubilinux-for-edison

Now when we try to use any gpio, we get an error:

edison@edison-ti ~/src/915MHzEdisonExplorer_SW/CC_Debug $ python
Python 2.7.9 (default, Mar  1 2015, 18:22:53)
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import mraa as m
>>> rst = m.Gpio(36)
Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
 File "/usr/local/lib/python2.7/dist-packages/mraa.py", line 592, in __init__
   this = _mraa.new_Gpio(*args)
ValueError: Invalid GPIO pin specified

We've tried this with a few different pins (which all work under yocto) and still get this error.

Any ideas?

arfoll commented 7 years ago

Check /var/log/messages and past the mraa related output here are you running under root?

On 27 Aug 2016 23:00, "Morgan Redfield" notifications@github.com wrote:

Hi,

We installed mraa onto ubilinux using the SparkFun instructions here: https://learn.sparkfun.com/tutorials/installing-libmraa- on-ubilinux-for-edison

Now when we try to use any gpio, we get an error:

edison@edison-ti ~/src/915MHzEdisonExplorer_SW/CC_Debug $ python Python 2.7.9 (default, Mar 1 2015, 18:22:53) [GCC 4.9.2] on linux2 Type "help", "copyright", "credits" or "license" for more information.

import mraa as m rst = m.Gpio(36) Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python2.7/dist-packages/mraa.py", line 592, in init this = _mraa.new_Gpio(*args) ValueError: Invalid GPIO pin specified

We've tried this with a few different pins (which all work under yocto) and still get this error.

Any ideas?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/intel-iot-devkit/mraa/issues/572, or mute the thread https://github.com/notifications/unsubscribe-auth/AAfZZrbIRHRVawOzyoaaUn5P2ZLR8QZmks5qkLN_gaJpZM4Juyz1 .

mogar commented 7 years ago

I'm not running under root (and wouldn't like to).

/var/log/messages has the following, repeated many times

Aug 27 15:08:32 edison-ti libmraa[2377]: libmraa initialised for platform 'Intel Edison' of type 2
Aug 27 15:08:33 edison-ti libmraa[2386]: libmraa version v1.2.3-7-gbdbbfd0 initialised by user 'edison' with EUID 1002
Aug 27 15:08:33 edison-ti libmraa[2386]: edison: Arduino board not detected, assuming Intel Edison Miniboard
mogar commented 7 years ago

Oh, if I run it with sudo it works. Is there something I can do to get this working with a non-root user?

arfoll commented 7 years ago

So if you don't want to run as root you'll have to fix the permissions in sysfs to let you do that. Imraa was made for that purpose but it doesn't quite function like that yet so easiest way is probably udev.

On 27 Aug 2016 23:09, "Morgan Redfield" notifications@github.com wrote:

I'm not running under root (and wouldn't like to).

/var/log/messages has the following, repeated many times

Aug 27 15:08:32 edison-ti libmraa[2377]: libmraa initialised for platform 'Intel Edison' of type 2 Aug 27 15:08:33 edison-ti libmraa[2386]: libmraa version v1.2.3-7-gbdbbfd0 initialised by user 'edison' with EUID 1002 Aug 27 15:08:33 edison-ti libmraa[2386]: edison: Arduino board not detected, assuming Intel Edison Miniboard

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/intel-iot-devkit/mraa/issues/572#issuecomment-242943635, or mute the thread https://github.com/notifications/unsubscribe-auth/AAfZZjPNvoTHStWucjp_h4fUlTi1eGV3ks5qkLWvgaJpZM4Juyz1 .

alext-mkrs commented 7 years ago

@mogar, check out https://github.com/intel-iot-devkit/mraa/issues/380, there was some work done by @tingleby on enabling exactly this.

RudyAramayo commented 7 years ago

I ran the install mraa script and it worked after this... had same error for intel joule

sudo was also necessary to run this code

nikitshah commented 7 years ago

@RudyAramayo which mraa script?