slitaz-arm rev 100
Start Rpi GPIO + leds CGI plugin and improve tazberry
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Sun Apr 13 05:24:04 2014 +0200 (2014-04-13) |
parents | 344d66740f8e |
children | 95d36c394202 |
files | cgi-adm/data/style.css rpi/cgi-adm/data/header.html rpi/cgi-adm/plugins/rpi_config/rpi_config.cgi rpi/cgi-adm/plugins/rpi_config/rpi_config.conf rpi/cgi-adm/plugins/rpi_gpio/rpi_gpio.cgi rpi/cgi-adm/plugins/rpi_gpio/rpi_gpio.conf rpi/tazberry |
line diff
1.1 --- a/cgi-adm/data/style.css Sun Apr 13 01:25:28 2014 +0200 1.2 +++ b/cgi-adm/data/style.css Sun Apr 13 05:24:04 2014 +0200 1.3 @@ -4,6 +4,7 @@ 1.4 body { margin: 0; font-size: 90%; } 1.5 h1 { color: #4d4d4d; } 1.6 h2 { color: #666; font-size: 120%; } 1.7 +h1, h2 { border-bottom: 1px dashed #afafaf; padding: 0 0 5px 0; } 1.8 a:hover { text-decoration: none; } 1.9 li { list-style-type: square; color: #4d4d4d; } 1.10 pre, textarea { 1.11 @@ -41,8 +42,8 @@ 1.12 /* Content */ 1.13 1.14 #content { margin: 4%; text-align: justify; } 1.15 - 1.16 -input[type="submit"], select { 1.17 +.button a { text-decoration: none; } 1.18 +input[type="submit"], select, .button a { 1.19 color: #444444; 1.20 border: 1px solid #afafaf; 1.21 padding: 4px; 1.22 @@ -55,7 +56,7 @@ 1.23 -webkit-padding-end: 12px; 1.24 -webkit-padding-start: 6px; 1.25 } 1.26 -input[type="submit"] { 1.27 +input[type="submit"], { 1.28 -webkit-box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.1); 1.29 -moz-box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.1); 1.30 box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.1); 1.31 @@ -66,12 +67,12 @@ 1.32 min-width: 360px; 1.33 } 1.34 1.35 -input[type="submit"]:hover, select:hover { 1.36 +input[type="submit"]:hover, select:hover, .button a:hover { 1.37 background-color: #ddd; 1.38 border: 1px solid #999; 1.39 } 1.40 1.41 -pre, input[type="submit"], input[type="text"], textarea { 1.42 +pre, input[type="submit"], input[type="text"], textarea, .button a { 1.43 border-radius: 4px; 1.44 } 1.45
2.1 --- a/rpi/cgi-adm/data/header.html Sun Apr 13 01:25:28 2014 +0200 2.2 +++ b/rpi/cgi-adm/data/header.html Sun Apr 13 05:24:04 2014 +0200 2.3 @@ -14,6 +14,7 @@ 2.4 <a href="tools.cgi?plugins">Plugins</a> 2.5 <a href="tools.cgi?status">Status</a> 2.6 <a href="tools.cgi?rpi_config">Config</a> 2.7 + <a href="tools.cgi?rpi_gpio">GPIO</a> 2.8 </nav> 2.9 </header> 2.10
3.1 --- a/rpi/cgi-adm/plugins/rpi_config/rpi_config.cgi Sun Apr 13 01:25:28 2014 +0200 3.2 +++ b/rpi/cgi-adm/plugins/rpi_config/rpi_config.cgi Sun Apr 13 05:24:04 2014 +0200 3.3 @@ -1,17 +1,44 @@ 3.4 #!/bin/sh 3.5 # 3.6 -# TazBerry CGI Plugin - Boot configs and options 3.7 +# TazBerry CGI Plugin - Raspberry Pi configuration 3.8 # 3.9 3.10 case " $(GET) " in 3.11 3.12 + *\ leds\ *) 3.13 + trigger="/sys/class/leds/led0/trigger" 3.14 + brightness="/sys/class/leds/led0/brightness" 3.15 + html_header "Leds" 3.16 + case " $(GET leds) " in 3.17 + *\ act_test\ *) 3.18 + echo "1" > ${brightness} 3.19 + sleep 2; echo "0" > ${brightness} ;; 3.20 + *\ act_on\ *) 3.21 + echo "1" > ${brightness} ;; 3.22 + *\ act_off\ *) 3.23 + echo "0" > ${brightness} ;; 3.24 + esac 3.25 + cat << EOT 3.26 +<h1>Leds</h1> 3.27 +<pre> 3.28 +Trigger : $(cat $trigger) 3.29 +Brightness : $(cat $brightness) 3.30 +</pre> 3.31 +<div class="button"> 3.32 + <a href="$script?leds=act_on">ACT Test</a> 3.33 + <a href="$script?leds=act_on">ACT On</a> 3.34 + <a href="$script?leds=act_off">ACT Off</a> 3.35 +</div> 3.36 +EOT 3.37 + html_footer && exit 0 ;; 3.38 + 3.39 *\ rdate\ *) 3.40 html_header "System time" 3.41 echo "<h1>System time</h1>" 3.42 echo "<pre>" 3.43 - echo -n "Old date:"; date 3.44 + echo -n "Old date: "; date 3.45 rdate -s tick.greyware.com 3.46 - echo -n "New date:"; date 3.47 + echo -n "New date: "; date 3.48 echo "</pre>" 3.49 html_footer && exit 0 ;; 3.50 3.51 @@ -29,16 +56,16 @@ 3.52 $(fgrep _freq /boot/config.txt) 3.53 $(fgrep over_voltage /boot/config.txt) 3.54 </pre> 3.55 - 3.56 -<a href='$script?editor&file=/boot/config.txt'>Edit boot configuration</a> 3.57 +<div class="button"> 3.58 + <a href='$script?editor&file=/boot/config.txt'>Edit boot configuration</a> 3.59 +<div> 3.60 EOT 3.61 html_footer && exit 0 ;; 3.62 3.63 *\ rpi_config\ *) 3.64 html_header "Raspberry Pi" 3.65 - echo "<h1>SliTaz Raspberry Pi</h1>" 3.66 - 3.67 cat << EOT 3.68 +<h1>SliTaz Raspberry Pi</h1> 3.69 3.70 <p> 3.71 Remotely configure your SliTaz Raspberry Pi device. 3.72 @@ -48,27 +75,32 @@ 3.73 <form method="get" action="$script"> 3.74 <input type="submit" name="rdate" value="Set system time" /> 3.75 <input type="submit" name="oclock" value="Overclocking" /> 3.76 + <input type="submit" name="leds" value="Leds" /> 3.77 </form> 3.78 </div> 3.79 3.80 <h2>Kernel boot parameters</h2> 3.81 <p> 3.82 - File path: /boot/cmdline.txt 3.83 - [ <a href="$script?editor&file=/boot/cmdline.txt">Edit</a> ] 3.84 + This file provide the Linux Kernel boot time parameter and SliTaz 3.85 + boot time options. 3.86 </p> 3.87 <pre> 3.88 $(cat /boot/cmdline.txt 2>/dev/null) 3.89 </pre> 3.90 +<div class="button"> 3.91 + <a href="$script?editor&file=/boot/cmdline.txt">Edit cmdline.txt</a> 3.92 +</div> 3.93 3.94 <h2>Boot configuration file</h2> 3.95 <p> 3.96 - File path: /boot/config.txt 3.97 - [ <a href="$script?editor&file=/boot/config.txt">Edit</a> ] 3.98 + The Raspberry Pi boot time configuration file 3.99 </p> 3.100 <pre> 3.101 $(cat /boot/config.txt 2>/dev/null) 3.102 </pre> 3.103 - 3.104 +<div class="button"> 3.105 + <a href="$script?editor&file=/boot/config.txt">Edit config.txt</a> 3.106 +</div> 3.107 EOT 3.108 3.109 html_footer && exit 0 ;;
4.1 --- a/rpi/cgi-adm/plugins/rpi_config/rpi_config.conf Sun Apr 13 01:25:28 2014 +0200 4.2 +++ b/rpi/cgi-adm/plugins/rpi_config/rpi_config.conf Sun Apr 13 05:24:04 2014 +0200 4.3 @@ -3,4 +3,4 @@ 4.4 PLUGIN="Raspberry Pi config" 4.5 SHORT_DESC="Raspberry Pi hardware/boot configuration" 4.6 MAINTAINER="pankso@slitaz.org" 4.7 -WEB_SITE="http://arm.slitaz.org/rpi/" 4.8 +WEB_SITE="http://arm.slitaz.org/rpi"
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 5.2 +++ b/rpi/cgi-adm/plugins/rpi_gpio/rpi_gpio.cgi Sun Apr 13 05:24:04 2014 +0200 5.3 @@ -0,0 +1,28 @@ 5.4 +#!/bin/sh 5.5 +# 5.6 +# TazBerry CGI Plugin - Raspberry Pi GPIO settings 5.7 +# 5.8 + 5.9 +case " $(GET) " in 5.10 + 5.11 + *\ rpi_gpio\ *) 5.12 + sysfs="/sys/class/gpio" 5.13 + html_header "GPIO pins" 5.14 + cat << EOT 5.15 +<h1>Raspberry Pi GPIO pins</h1> 5.16 + 5.17 +<pre> 5.18 +$(ls $sysfs) 5.19 +</pre> 5.20 + 5.21 +<h2>Export example</h2> 5.22 + 5.23 +<pre> 5.24 +# echo 24 > $sysfs/export 5.25 +# cat $sysfs/gpio24/direction 5.26 +</pre> 5.27 + 5.28 +EOT 5.29 + 5.30 + html_footer && exit 0 ;; 5.31 +esac
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 6.2 +++ b/rpi/cgi-adm/plugins/rpi_gpio/rpi_gpio.conf Sun Apr 13 05:24:04 2014 +0200 6.3 @@ -0,0 +1,6 @@ 6.4 +# TazBerry CGI Plugin configuration 6.5 + 6.6 +PLUGIN="Raspberry Pi GPIO" 6.7 +SHORT_DESC="Raspberry Pi GPIO pins settings" 6.8 +MAINTAINER="pankso@slitaz.org" 6.9 +WEB_SITE="http://arm.slitaz.org/rpi"
7.1 --- a/rpi/tazberry Sun Apr 13 01:25:28 2014 +0200 7.2 +++ b/rpi/tazberry Sun Apr 13 05:24:04 2014 +0200 7.3 @@ -135,7 +135,8 @@ 7.4 7.5 Current /boot/config.txt 7.6 ------------------------ 7.7 -$(cat $config) 7.8 +$(fgrep _freq /boot/config.txt) 7.9 +$(fgrep over_voltage /boot/config.txt) 7.10 7.11 EOT 7.12 dialog --cr-wrap \ 7.13 @@ -155,8 +156,9 @@ 7.14 "rpi-stats" "$(gettext 'Show some RPi system stats')" \ 7.15 "boot-cmdline" "$(gettext 'View boot args /boot/cmdline.txt')" \ 7.16 "boot-config" "$(gettext 'View config file /boot/config.txt')" \ 7.17 +"oclock" "$(gettext 'Overclocking information and config')" \ 7.18 "rpi-turbo" "$(gettext 'Enable or disable RPi turbo on next boot')" \ 7.19 -"oclock" "$(gettext 'Overclocking information and config')" \ 7.20 +"act-led" "$(gettext 'Test RPi onboard ACT green led')" \ 7.21 "packages" "$(gettext 'Spk packages manager')" \ 7.22 "config" "$(gettext 'System config (lang, keyboard)')" \ 7.23 "reboot" "$(gettext 'Reboot SliTaz')" \ 7.24 @@ -178,11 +180,15 @@ 7.25 text_box /boot/cmdline.txt ;; 7.26 boot-config) 7.27 text_box ${config} ;; 7.28 + oclock) 7.29 + oclock_box ;; 7.30 rpi-turbo) 7.31 rpi_turbo && newline 7.32 gettext "Press ENTER to go back to TazBerry"; read ;; 7.33 - oclock) 7.34 - oclock_box ;; 7.35 + act-led) 7.36 + brightness="/sys/class/leds/led0/brightness" 7.37 + (echo "1" > ${brightness} 7.38 + sleep 2; echo "0" > ${brightness}) & ;; 7.39 packages) 7.40 spk-dialog ;; 7.41 config)