# HG changeset patch # User Christophe Lincoln # Date 1397359444 -7200 # Node ID 01865197f1c0e974904b132ea2f21e853044c8a9 # Parent 344d66740f8e77c0750c0065683865f6a9b4d923 Start Rpi GPIO + leds CGI plugin and improve tazberry diff -r 344d66740f8e -r 01865197f1c0 cgi-adm/data/style.css --- a/cgi-adm/data/style.css Sun Apr 13 01:25:28 2014 +0200 +++ b/cgi-adm/data/style.css Sun Apr 13 05:24:04 2014 +0200 @@ -4,6 +4,7 @@ body { margin: 0; font-size: 90%; } h1 { color: #4d4d4d; } h2 { color: #666; font-size: 120%; } +h1, h2 { border-bottom: 1px dashed #afafaf; padding: 0 0 5px 0; } a:hover { text-decoration: none; } li { list-style-type: square; color: #4d4d4d; } pre, textarea { @@ -41,8 +42,8 @@ /* Content */ #content { margin: 4%; text-align: justify; } - -input[type="submit"], select { +.button a { text-decoration: none; } +input[type="submit"], select, .button a { color: #444444; border: 1px solid #afafaf; padding: 4px; @@ -55,7 +56,7 @@ -webkit-padding-end: 12px; -webkit-padding-start: 6px; } -input[type="submit"] { +input[type="submit"], { -webkit-box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.1); -moz-box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.1); box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.1); @@ -66,12 +67,12 @@ min-width: 360px; } -input[type="submit"]:hover, select:hover { +input[type="submit"]:hover, select:hover, .button a:hover { background-color: #ddd; border: 1px solid #999; } -pre, input[type="submit"], input[type="text"], textarea { +pre, input[type="submit"], input[type="text"], textarea, .button a { border-radius: 4px; } diff -r 344d66740f8e -r 01865197f1c0 rpi/cgi-adm/data/header.html --- a/rpi/cgi-adm/data/header.html Sun Apr 13 01:25:28 2014 +0200 +++ b/rpi/cgi-adm/data/header.html Sun Apr 13 05:24:04 2014 +0200 @@ -14,6 +14,7 @@ Plugins Status Config + GPIO diff -r 344d66740f8e -r 01865197f1c0 rpi/cgi-adm/plugins/rpi_config/rpi_config.cgi --- a/rpi/cgi-adm/plugins/rpi_config/rpi_config.cgi Sun Apr 13 01:25:28 2014 +0200 +++ b/rpi/cgi-adm/plugins/rpi_config/rpi_config.cgi Sun Apr 13 05:24:04 2014 +0200 @@ -1,17 +1,44 @@ #!/bin/sh # -# TazBerry CGI Plugin - Boot configs and options +# TazBerry CGI Plugin - Raspberry Pi configuration # case " $(GET) " in + *\ leds\ *) + trigger="/sys/class/leds/led0/trigger" + brightness="/sys/class/leds/led0/brightness" + html_header "Leds" + case " $(GET leds) " in + *\ act_test\ *) + echo "1" > ${brightness} + sleep 2; echo "0" > ${brightness} ;; + *\ act_on\ *) + echo "1" > ${brightness} ;; + *\ act_off\ *) + echo "0" > ${brightness} ;; + esac + cat << EOT +

Leds

+
+Trigger    : $(cat $trigger)
+Brightness : $(cat $brightness)
+
+
+ ACT Test + ACT On + ACT Off +
+EOT + html_footer && exit 0 ;; + *\ rdate\ *) html_header "System time" echo "

System time

" echo "
"
-		echo -n "Old date:"; date
+		echo -n "Old date: "; date
 		rdate -s tick.greyware.com
-		echo -n "New date:"; date 
+		echo -n "New date: "; date 
 		echo "
" html_footer && exit 0 ;; @@ -29,16 +56,16 @@ $(fgrep _freq /boot/config.txt) $(fgrep over_voltage /boot/config.txt) - -Edit boot configuration +
+ Edit boot configuration +
EOT html_footer && exit 0 ;; *\ rpi_config\ *) html_header "Raspberry Pi" - echo "

SliTaz Raspberry Pi

" - cat << EOT +

SliTaz Raspberry Pi

Remotely configure your SliTaz Raspberry Pi device. @@ -48,27 +75,32 @@

+

Kernel boot parameters

- File path: /boot/cmdline.txt - [ Edit ] + This file provide the Linux Kernel boot time parameter and SliTaz + boot time options.

 $(cat /boot/cmdline.txt 2>/dev/null)
 
+

Boot configuration file

- File path: /boot/config.txt - [ Edit ] + The Raspberry Pi boot time configuration file

 $(cat /boot/config.txt 2>/dev/null)
 
- + EOT html_footer && exit 0 ;; diff -r 344d66740f8e -r 01865197f1c0 rpi/cgi-adm/plugins/rpi_config/rpi_config.conf --- a/rpi/cgi-adm/plugins/rpi_config/rpi_config.conf Sun Apr 13 01:25:28 2014 +0200 +++ b/rpi/cgi-adm/plugins/rpi_config/rpi_config.conf Sun Apr 13 05:24:04 2014 +0200 @@ -3,4 +3,4 @@ PLUGIN="Raspberry Pi config" SHORT_DESC="Raspberry Pi hardware/boot configuration" MAINTAINER="pankso@slitaz.org" -WEB_SITE="http://arm.slitaz.org/rpi/" +WEB_SITE="http://arm.slitaz.org/rpi" diff -r 344d66740f8e -r 01865197f1c0 rpi/cgi-adm/plugins/rpi_gpio/rpi_gpio.cgi --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rpi/cgi-adm/plugins/rpi_gpio/rpi_gpio.cgi Sun Apr 13 05:24:04 2014 +0200 @@ -0,0 +1,28 @@ +#!/bin/sh +# +# TazBerry CGI Plugin - Raspberry Pi GPIO settings +# + +case " $(GET) " in + + *\ rpi_gpio\ *) + sysfs="/sys/class/gpio" + html_header "GPIO pins" + cat << EOT +

Raspberry Pi GPIO pins

+ +
+$(ls $sysfs)
+
+ +

Export example

+ +
+# echo 24 > $sysfs/export
+# cat $sysfs/gpio24/direction
+
+ +EOT + + html_footer && exit 0 ;; +esac diff -r 344d66740f8e -r 01865197f1c0 rpi/cgi-adm/plugins/rpi_gpio/rpi_gpio.conf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rpi/cgi-adm/plugins/rpi_gpio/rpi_gpio.conf Sun Apr 13 05:24:04 2014 +0200 @@ -0,0 +1,6 @@ +# TazBerry CGI Plugin configuration + +PLUGIN="Raspberry Pi GPIO" +SHORT_DESC="Raspberry Pi GPIO pins settings" +MAINTAINER="pankso@slitaz.org" +WEB_SITE="http://arm.slitaz.org/rpi" diff -r 344d66740f8e -r 01865197f1c0 rpi/tazberry --- a/rpi/tazberry Sun Apr 13 01:25:28 2014 +0200 +++ b/rpi/tazberry Sun Apr 13 05:24:04 2014 +0200 @@ -135,7 +135,8 @@ Current /boot/config.txt ------------------------ -$(cat $config) +$(fgrep _freq /boot/config.txt) +$(fgrep over_voltage /boot/config.txt) EOT dialog --cr-wrap \ @@ -155,8 +156,9 @@ "rpi-stats" "$(gettext 'Show some RPi system stats')" \ "boot-cmdline" "$(gettext 'View boot args /boot/cmdline.txt')" \ "boot-config" "$(gettext 'View config file /boot/config.txt')" \ +"oclock" "$(gettext 'Overclocking information and config')" \ "rpi-turbo" "$(gettext 'Enable or disable RPi turbo on next boot')" \ -"oclock" "$(gettext 'Overclocking information and config')" \ +"act-led" "$(gettext 'Test RPi onboard ACT green led')" \ "packages" "$(gettext 'Spk packages manager')" \ "config" "$(gettext 'System config (lang, keyboard)')" \ "reboot" "$(gettext 'Reboot SliTaz')" \ @@ -178,11 +180,15 @@ text_box /boot/cmdline.txt ;; boot-config) text_box ${config} ;; + oclock) + oclock_box ;; rpi-turbo) rpi_turbo && newline gettext "Press ENTER to go back to TazBerry"; read ;; - oclock) - oclock_box ;; + act-led) + brightness="/sys/class/leds/led0/brightness" + (echo "1" > ${brightness} + sleep 2; echo "0" > ${brightness}) & ;; packages) spk-dialog ;; config)