Adafruit BBIO library error in Ubuntu 13.10

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
chrisisbd
 
Posts: 3
Joined: Thu Mar 06, 2014 3:44 pm

Adafruit BBIO library error in Ubuntu 13.10

Post by chrisisbd »

I'm running Ubuntu 13.10 with a 3.8.13-bone40 kernel on my BBB.

I have installed the Adafruit BBIO library, all went OK without incident.

However when I try and run a program to read the ADC I get an error, the program is pretty trivial:-

#!/usr/bin/python
import os
import sys
import Adafruit_BBIO.ADC as ADC
#
#
# Read A2D using Adafruit libraries
#
ADC.setup()

... and when I run it:-


chris@beaglebone$ bt.py
Traceback (most recent call last):
File "/home/chris/bin/bt.py", line 9, in <module>
ADC.setup()
RuntimeError: Unable to setup ADC system. Possible causes are:
- A cape with a conflicting pin mapping is loaded
- A device tree object is loaded that uses the same name for a fragment: helper


So what's wrong?

chrisisbd
 
Posts: 3
Joined: Thu Mar 06, 2014 3:44 pm

Re: Adafruit BBIO library error in Ubuntu 13.10

Post by chrisisbd »

I've found the problem! It's down to permissions. The program worked in the Angstrom distribution because one always runs as root there.

It failed for me because I was running as an ordinary user, running as root it works.

While it's not a problem at the moment I don't really think one should need to be root to read the ADC! :-)

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Adafruit BBIO library error in Ubuntu 13.10

Post by adafruit_support_mike »

Access controls are a standard feature of all Unix-based operating systems. It makes more sense when you think in terms of being the system administrator for a server cluster at a college where several hundred students might be logged in at any given moment.

IIRC, the traditional solution for small devices like the RasPi and BBB is to add your user account to the 'console' or 'dialup' group. That group has permission to control various IO ports.

chrisisbd
 
Posts: 3
Joined: Thu Mar 06, 2014 3:44 pm

Re: Adafruit BBIO library error in Ubuntu 13.10

Post by chrisisbd »

> Access controls are a standard feature of all Unix-based operating systems. It makes more sense when you think in terms of being the system administrator for a server cluster at a college where several hundred students might be logged in at any given moment.

Er, yes, I've been programming on Unix/Linux since the 1980s so I have come across this before! :-)

> IIRC, the traditional solution for small devices like the RasPi and BBB is to add your user account to the 'console' or 'dialup' group. That group has permission to control various IO ports.

That doesn't work. I'm pretty sure the issue is that you have to be root to do things to the device tree. It warns at the top of the Ubuntu installation instructions:-
The majority of this library will need to be run as sudo in Ubuntu.

As I said it's not a big issue at the moment but it does feel as if it ought to be addressed some time.

User avatar
adafruit_support_mike
 
Posts: 67446
Joined: Thu Feb 11, 2010 2:51 pm

Re: Adafruit BBIO library error in Ubuntu 13.10

Post by adafruit_support_mike »

The device tree per se is restricted to boot-time configuration, but I'm pretty sure the `capemgr` system makes it possible to manipulate DTOs from user space: http://elinux.org/Capemgr

User avatar
wwhalljr
 
Posts: 15
Joined: Fri Feb 06, 2015 8:38 pm

Re: Adafruit BBIO library error in Ubuntu 13.10

Post by wwhalljr »

Wanted to jump in here too. I had the exact same error message trying to run the Adafruit photoresistor example code for the BBB. I've got the rev C board with Debian pre-installed. I just needed to run the code as root, so "sudo Python [fileneme]" did it for me.

User avatar
ARES_XL
 
Posts: 1
Joined: Sat Jun 13, 2015 7:59 am

Re: Adafruit BBIO library error in Ubuntu 13.10

Post by ARES_XL »

Hi, I'am French (just to excuse my English limitations).

I'm working on BBB with Debian 7.xx on MachineKit environment (a BBB version of LinuxCNC).
I'm working at interfacing the I/Os of the BBB with the HAL (Hardware Abstraction Layer) environment of LinuxCNC.
It's strongly recommended to program in Python.
The need to work the python program in admin mode is a little problem because the HAL runtime environment is working in user mode (and refuse to work in admin mode). So to integrate the python program, I need to send a "sudo" command at the HAL command prompt ! And happily it works fine.

for those interested by the HAL command line:

Code: Select all

halcmd: loadusr sudo my_program.py
But after all this adventure, what i need to say is at first the error message really need to be completed for all the noobs like me that need to pass hours on the net to understand why a pseudo CAPE (witch is not there) is using the I/Os they are needing and witch is free !

SO THE ERROR MESSAGE SHOULD INTEGRATE THE NEED OF THE ADMIN MODE for the I/Os Access. as a possible source at first before the CAPE conflicts.

Locked
Please be positive and constructive with your questions and comments.

Return to “Beagle Bone & Adafruit Beagle Bone products”