Comments (4)
I figured out a solution to avoid the noise in the journal.
The following patch first checks the id or the user. If it's root, the "sudo -A" is removed from the various "bash -c "echo ..." commands. If the if is non-root, the "sudo -A" is used.
Regards
--- config-pin.orig 2018-05-08 09:05:19.399629072 -0700
+++ config-pin 2018-05-08 09:11:12.341035364 -0700
@@ -1,5 +1,11 @@
#!/bin/dash
+if ! id | grep -q root; then
- SUDO="sudo -A"
+else - SUDO=
+fi
Some important directories for use later
OCPDIR=/sys/devices/ocp.*
GPIODIR=/sys/class/gpio
@@ -879,7 +885,7 @@
# Expand filename using shell globbing
for FILE in $SLOTS ; do
echo_std Loading $DTBO overlay
-
sudo -A bash -c "echo $DTBO > $SLOTS" || (echo_err "Error loading device tree overlay file: $DTBO" && exit 1)
-
$SUDO bash -c "echo $DTBO > $SLOTS" || (echo_err "Error loading device tree overlay file: $DTBO" && exit 1) sleep 1 done fi
@@ -1014,7 +1020,7 @@
eval GPIO="$${PIN}_GPIO"
FILE="$GPIODIR/gpio$GPIO/direction"
if [ -e $FILE ] ; then
-
sudo -A bash -c "echo $DIR > $FILE" || (echo_err "Cannot write gpio direction file: $FILE" && exit 1)
-
$SUDO bash -c "echo $DIR > $FILE" || (echo_err "Cannot write gpio direction file: $FILE" && exit 1) else echo_err "WARNING: GPIO pin not exported, cannot set direction or value!" fi
@@ -1024,13 +1030,13 @@
# Expand filename using shell globbing
for FILE in
echo_dbg "echo $MODE > $FILE"
-
sudo -A bash -c "echo $MODE > $FILE" || (echo_err "Cannot write pinmux file: $FILE" && exit 1)
-
$SUDO bash -c "echo $MODE > $FILE" || (echo_err "Cannot write pinmux file: $FILE" && exit 1) done else # Expand filename using shell globbing for FILE in $OCPDIR/${PIN}_pinmux.*/state ; do echo_dbg "echo $MODE > $FILE"
-
sudo -A bash -c "echo $MODE > $FILE" || (echo_err "Cannot write pinmux file: $FILE" && exit 1)
-
fi
$SUDO bash -c "echo $MODE > $FILE" || (echo_err "Cannot write pinmux file: $FILE" && exit 1) done fi
from beaglebone-universal-io.
Well... that did't post well... Not sure how this Markdown stuff works...
from beaglebone-universal-io.
Maybe this will work...
`--- config-pin.orig 2018-05-08 09:05:19.399629072 -0700
+++ config-pin 2018-05-08 09:11:12.341035364 -0700
@@ -1,5 +1,11 @@
#!/bin/dash
+if ! id | grep -q root; then
- SUDO="sudo -A"
+else - SUDO=
+fi
Some important directories for use later
OCPDIR=/sys/devices/ocp.*
GPIODIR=/sys/class/gpio
@@ -879,7 +885,7 @@
# Expand filename using shell globbing
for FILE in $SLOTS ; do
echo_std Loading $DTBO overlay
-
sudo -A bash -c "echo $DTBO > $SLOTS" || (echo_err "Error loading device tree overlay file: $DTBO" && exit 1)
-
$SUDO bash -c "echo $DTBO > $SLOTS" || (echo_err "Error loading device tree overlay file: $DTBO" && exit 1) sleep 1 done fi
@@ -1014,7 +1020,7 @@
eval GPIO="$${PIN}_GPIO"
FILE="$GPIODIR/gpio$GPIO/direction"
if [ -e $FILE ] ; then
-
sudo -A bash -c "echo $DIR > $FILE" || (echo_err "Cannot write gpio direction file: $FILE" && exit 1)
-
$SUDO bash -c "echo $DIR > $FILE" || (echo_err "Cannot write gpio direction file: $FILE" && exit 1) else echo_err "WARNING: GPIO pin not exported, cannot set direction or value!" fi
@@ -1024,13 +1030,13 @@
# Expand filename using shell globbing
for FILE in
echo_dbg "echo $MODE > $FILE"
-
sudo -A bash -c "echo $MODE > $FILE" || (echo_err "Cannot write pinmux file: $FILE" && exit 1)
-
$SUDO bash -c "echo $MODE > $FILE" || (echo_err "Cannot write pinmux file: $FILE" && exit 1) done else # Expand filename using shell globbing for FILE in $OCPDIR/${PIN}_pinmux.*/state ; do echo_dbg "echo $MODE > $FILE"
-
sudo -A bash -c "echo $MODE > $FILE" || (echo_err "Cannot write pinmux file: $FILE" && exit 1)
-
fi
$SUDO bash -c "echo $MODE > $FILE" || (echo_err "Cannot write pinmux file: $FILE" && exit 1) done fi
`
from beaglebone-universal-io.
Nope... If you need the patch please let me know and I will email it to you.
from beaglebone-universal-io.
Related Issues (20)
- loading firmware HOT 5
- Loading cape-univ-audio and univ-hdmi HOT 6
- make install not working HOT 2
- Loading cape-universala HOT 1
- changing SPI1 D0 as output HOT 5
- Extending wiki - how to automate "config-pin P9.28 spi" command HOT 3
- Could not find symbol 'gpio4' HOT 6
- enabling eQEP pins in kernel 4.4.x HOT 1
- Missing pinmux state file when using am335x-boneblack-overlay.dtb on 4.4.52-ti-r91
- Wait for cape to appear instead of sleep
- CAN doesn't work HOT 1
- trouble with mapping P8.40
- Beaglebone Black pad control for P9_24 and P9_26 with pruin setting
- w1-gpio
- enabling eQEP1 pins in kernel 3.8.13-xenomai-r83 HOT 1
- No gpio devices with enable_uboot_cape_universal=1
- config-pin P9_28 pwm doesn't start eCAP2_in_PWM2_out
- Config-pin Pull-up for GPIO HIGH+ appears inverted
- Error, Invalid mode: in HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from beaglebone-universal-io.