Git Product home page Git Product logo

Comments (4)

bigguiness avatar bigguiness commented on August 20, 2024

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 $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)
    
  •   		$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)
    
  •   		$SUDO bash -c "echo $MODE > $FILE" || (echo_err "Cannot write pinmux file: $FILE" && exit 1)
      	done
      fi
    
    fi

from beaglebone-universal-io.

bigguiness avatar bigguiness commented on August 20, 2024

Well... that did't post well... Not sure how this Markdown stuff works...

from beaglebone-universal-io.

bigguiness avatar bigguiness commented on August 20, 2024

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 $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)
    
  •   		$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)
    
  •   		$SUDO bash -c "echo $MODE > $FILE" || (echo_err "Cannot write pinmux file: $FILE" && exit 1)
      	done
      fi
    
    fi
    `

from beaglebone-universal-io.

bigguiness avatar bigguiness commented on August 20, 2024

Nope... If you need the patch please let me know and I will email it to you.

from beaglebone-universal-io.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.