# HG changeset patch # User Christophe Lincoln # Date 1400182805 -7200 # Node ID 8d67f2277f55dc624cfd22dc48789e1d9b16d7f2 # Parent ad488d58318be91ad48fe6686afa879c32d6065e Add Pibrella utility diff -r ad488d58318b -r 8d67f2277f55 rpi/piborg/piborg --- a/rpi/piborg/piborg Thu May 15 18:57:11 2014 +0200 +++ b/rpi/piborg/piborg Thu May 15 21:40:05 2014 +0200 @@ -5,6 +5,11 @@ . /lib/libtaz.sh check_root +# TurtleBorg.py must be installed manually or via spk +if [ ! -x "/usr/bin/TurtleBorg.py" ]; then + echo "Missing: TurtleBorg.py" && exit 1 +fi + usage() { cat << EOT diff -r ad488d58318b -r 8d67f2277f55 rpi/pibrella --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rpi/pibrella Thu May 15 21:40:05 2014 +0200 @@ -0,0 +1,72 @@ +#!/bin/sh +# +# Pibrella - SliTaz Raspberry Pibrella SHell utility +# +# (C) 2014 SliTaz GNU/Linux - BSD License +# +. /lib/libtaz.sh +check_root + +sysfs="/sys/class/gpio" + +# Pibrella Pins +led_red=27 +led_yellow=17 +led_green=4 + +buzzer=18 + +usage() { + cat << EOT + +$(boldify 'Usage:') $(basename $0) [command] [color] [seconds|on|off] + +$(boldify 'Commands:') + testsuite $(gettext 'Run a small testsuite on Pibrella') + led $(gettext 'Turn on/off LEDs or on for N seconds') + +EOT +} + +# Usage: export_pin NB --> librpigpio.sh +export_pin() { + if [ ! -d "${sysfs}/gpio${1}" ]; then + echo ${1} > ${sysfs}/export + fi +} + +case "$1" in + + testsuite) + # LEDs + for pin in ${led_red} ${led_yellow} ${led_green} + do + export_pin ${pin} + echo "out" > ${sysfs}/gpio${pin}/direction + echo "1" > ${sysfs}/gpio${pin}/value + sleep 2 + echo "0" > ${sysfs}/gpio${pin}/value + done ;; + + led) + case "$2" in + r|red) pin=${led_red} ;; + y|yellow) pin=${led_yellow} ;; + g|green) pin= ${led_green} ;; + esac + case "$3" in + on) echo "1" > ${sysfs}/gpio${pin}/value ;; + off) echo "0" > ${sysfs}/gpio${pin}/value ;; + *) + sec="$3" + [ "$sec" ] || sec=1 + echo "1" > ${sysfs}/gpio${pin}/value + sleep ${sec} + echo "0" > ${sysfs}/gpio${pin}/value ;; + esac ;; + + *) + usage ;; + +esac +exit 0 diff -r ad488d58318b -r 8d67f2277f55 sat-rpi --- a/sat-rpi Thu May 15 18:57:11 2014 +0200 +++ b/sat-rpi Thu May 15 21:40:05 2014 +0200 @@ -175,7 +175,8 @@ fi # TazBerry, Piboot, Pileds, ... - for tool in tazberry piboot pileds raspicomm piface pitft-setup + for tool in tazberry piboot pileds raspicomm piface pitft-setup \ + pibrella piborg/piborg do echo -n "Copying utility: $tool" cp -f ${rpi}/${tool} ${rootfs}/usr/sbin @@ -241,8 +242,8 @@ cd ${kernel} export PATH=$PATH:/cross/${arch}/tools/bin export HOST_SYSTEM=${arch}-slitaz-linux-gnueabi - #make mrproper && - #make ARCH=arm bcmrpi_defconfig + make mrproper && + make ARCH=arm bcmrpi_defconfig if [ ! "$nopatch" ]; then echo "Patching SliTaz RPi Linux .config" patch -p0 -i ${data}/linux-rpi.patch || exit 1