Re: [beagleboard] Use GPIO as non-root user?

2016-02-11 Thread John Stoner
Thanks, I appreciate your efforts. Please read that with zero sarcasm. I've been there too, thinking I knew what would save someone time and effort and not realizing I was in a different situation. I have a large application to build. I'm not sure how much of the complexity is going to be running

Re: [beagleboard] Use GPIO as non-root user?

2016-02-10 Thread William Hermans
I've often given thought to running two processes in this context, and using inter process communications( shared memory seemed the most attractive to me ). How I envisioned this though, is that you have one process running as root, that is the main "supervisor" part of the application. Then a regu

Re: [beagleboard] Use GPIO as non-root user?

2016-02-10 Thread ybeagle3
You might want think more about this then the peep hole approach. Rather then running things in userland and relying on user id isolation; a better way is to write a kernel driver that exposes a very specific and limited interface. GPIOs are directly toggling hardware which means there are more

Re: [beagleboard] Use GPIO as non-root user?

2016-02-09 Thread TJF
libpruio is PRUSS assembler code to control the subsystems GPIO, ADC, PWM/CAP. An API is available to control that assembler part from host CPU (ARM), written in FreeBASIC. Also a C wrapper is shipped in the package. When you say Python fits well, why do you think FreeBASIC doesn't? It combines

Re: [beagleboard] Use GPIO as non-root user?

2016-02-09 Thread John Stoner
So libpruio looks like it wraps calls to interface with the GPIOs via the PRU with Freebasic or C calls, yes? We are committed to building this application in a language that is 1. High level and 2. Prevalent in the job market--we need to be able to find people who know it reasonably well. (also

Re: [beagleboard] Use GPIO as non-root user?

2016-02-09 Thread TJF
A bunch of code for a single GPIO pin (in order to get slow sysfs access). Keep in mind that you've to maintain all that code for each pin you use in your project. For libpruio it is chgrp pruio /dev/uio5 chmod g+rw /dev/uio5 and you're done for all GPIO, CAP and PWM pins (and you'll get much

Re: [beagleboard] Use GPIO as non-root user?

2016-02-09 Thread John Stoner
Yes, they are. And I think my partially-successful solution is udev based. I copied this rule from the robot project I linked to before: # Install in: /etc/udev/rules.d/ # from cnobile2012@ github # KERNEL=="gpio*", SUBSYSTEM=="gpio", ACTION=="add", PROGRAM="/bin/fix_udev_gpio.sh" and this scrip

Re: [beagleboard] Use GPIO as non-root user?

2016-02-08 Thread William Hermans
It seems as though their using sysfs: https://github.com/adafruit/adafruit-beaglebone-io-python/blob/master/source/c_pwm.c#L68-L77 On Mon, Feb 8, 2016 at 6:23 PM, William Hermans wrote: > OK, so assuming your issue doing the above - only works as root, and you'd > like it to work as a regular us

Re: [beagleboard] Use GPIO as non-root user?

2016-02-08 Thread William Hermans
OK, so assuming your issue doing the above - only works as root, and you'd like it to work as a regular user too . . . You need to figure out how the Adafruit_BBIO library accesses the pins, and go from there. Does it use sysfs, or /dev/mem/ ? If the library uses sysfs. Then I would think you'd n

Re: [beagleboard] Use GPIO as non-root user?

2016-02-08 Thread John Stoner
and when I do the above as root it blinks as it should. On Mon, Feb 8, 2016 at 4:44 PM John Stoner wrote: > (env) app@beaglebone:/opt/reactor_controller/src$ uname -a > Linux beaglebone 3.8.13-bone70 #1 SMP Fri Jan 23 02:15:42 UTC 2015 armv7l > GNU/Linux > (env) app@beaglebone:/opt/reactor_contr

Re: [beagleboard] Use GPIO as non-root user?

2016-02-08 Thread John Stoner
(env) app@beaglebone:/opt/reactor_controller/src$ uname -a Linux beaglebone 3.8.13-bone70 #1 SMP Fri Jan 23 02:15:42 UTC 2015 armv7l GNU/Linux (env) app@beaglebone:/opt/reactor_controller/src$ cat /etc/dogtag BeagleBoard.org Debian Image 2015-03-01 (env) app@beaglebone:/opt/reactor_controller/src$

Re: [beagleboard] Use GPIO as non-root user?

2016-02-08 Thread William Hermans
> > *I call my success partial because I can get a test LED to turn on, but I > can't get it to flash using PWM.* > > *Any ideas why that would be?* > No . . . Because you've given no pertinent details. We'd need to know a few things, but kernel version used, method used for attempting to control

Re: [beagleboard] Use GPIO as non-root user?

2016-02-08 Thread john
This is John, the guy with the question Drew to above on the Adafruit board. (Thanks Drew for starting this conversation here.) The problem is, this is part of a commercial application. My code will be reading and writing to the GPIOs and doing various things, communicating data to remote syste

Re: [beagleboard] Use GPIO as non-root user?

2016-02-07 Thread Mike
On 02/06/2016 12:51 AM, Brian Anderson wrote: My comments are really to do with what I perceive as best practices on how one would approach building systems that are "security conscious". Of course, "convenience" may direct us in different directions during development. I am not sure what y

Re: [beagleboard] Use GPIO as non-root user?

2016-02-05 Thread Brian Anderson
My comments are really to do with what I perceive as best practices on how one would approach building systems that are "security conscious". Of course, "convenience" may direct us in different directions during development. I am not sure what you are trying to imply by "safe" as in protecti

Re: [beagleboard] Use GPIO as non-root user?

2016-02-05 Thread William Hermans
> > *Using sudo seems much less secure as it exposes the application to being > exploited for security flaws. And since the application is running as root, > it has access to everything.* > So, we have a device on a system that can potentially cause physical damage to external hardware when someth

Re: [beagleboard] Use GPIO as non-root user?

2016-02-05 Thread Brian Anderson
Err, why? Groups are frequently used to restrict access to resources. Android exploits groups for permissions and to sandbox applications. And the kernel enforces access. Using sudo seems much less secure as it exposes the application to being exploited for security flaws. And since the appli

Re: [beagleboard] Use GPIO as non-root user?

2016-02-05 Thread William Hermans
Drew, FYI, that is just a character device based on /dev/mem/ which could very easily be done for the Beaglebones as well. In fact, porting their code would be potentially as simple as redefining pin constants in code, plus adding an additional 60+ for beaglebones ;) On Fri, Feb 5, 2016 at 4:47 PM

Re: [beagleboard] Use GPIO as non-root user?

2016-02-05 Thread William Hermans
> > *This is why Unix/Linux has groups. Do the following:* > Using groups is not necessarily the safest way to go about things John. But I do agree it is a possibility. The only real contention that I have with using groups. Is . . . my sudo example can be used on a very specific command, only all

Re: [beagleboard] Use GPIO as non-root user?

2016-02-05 Thread John Syne
This is why Unix/Linux has groups. Do the following: ls -la /dev You will see groups such as i2c, dialout, tty, etc. If you want to access these devices from a regular user account, add your user to those groups. If you need to use a device that has root:root, then change the group and add your

[beagleboard] Use GPIO as non-root user?

2016-02-05 Thread Drew Fustini
I noticed that the Raspberry Pi kernel adopted /dev/gpiomem to provide a way for non-root users to access GPIO: Add /dev/gpiomem device for rootless user GPIO access: https://github.com/raspberrypi/linux/pull/1112 Is there anything comparable for BeagleBone? Anyone have ideas/plans? I