slitaz-arm view rpi/cgi-adm/plugins/rpi_config/rpi_config.cgi @ 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 d670034c1f00
children 6650d379a52f
line source
1 #!/bin/sh
2 #
3 # TazBerry CGI Plugin - Raspberry Pi configuration
4 #
6 case " $(GET) " in
8 *\ leds\ *)
9 trigger="/sys/class/leds/led0/trigger"
10 brightness="/sys/class/leds/led0/brightness"
11 html_header "Leds"
12 case " $(GET leds) " in
13 *\ act_test\ *)
14 echo "1" > ${brightness}
15 sleep 2; echo "0" > ${brightness} ;;
16 *\ act_on\ *)
17 echo "1" > ${brightness} ;;
18 *\ act_off\ *)
19 echo "0" > ${brightness} ;;
20 esac
21 cat << EOT
22 <h1>Leds</h1>
23 <pre>
24 Trigger : $(cat $trigger)
25 Brightness : $(cat $brightness)
26 </pre>
27 <div class="button">
28 <a href="$script?leds=act_on">ACT Test</a>
29 <a href="$script?leds=act_on">ACT On</a>
30 <a href="$script?leds=act_off">ACT Off</a>
31 </div>
32 EOT
33 html_footer && exit 0 ;;
35 *\ rdate\ *)
36 html_header "System time"
37 echo "<h1>System time</h1>"
38 echo "<pre>"
39 echo -n "Old date: "; date
40 rdate -s tick.greyware.com
41 echo -n "New date: "; date
42 echo "</pre>"
43 html_footer && exit 0 ;;
45 *\ oclock\ *)
46 html_header "Overclocking"
47 cat << EOT
48 <h1>RPi Overclocking</h1>
50 <pre>
51 $(/home/pankso/Projects/slitaz-arm/rpi/tazberry rpi_oclock)
52 </pre>
54 <h2>Current settings:</h2>
55 <pre>
56 $(fgrep _freq /boot/config.txt)
57 $(fgrep over_voltage /boot/config.txt)
58 </pre>
59 <div class="button">
60 <a href='$script?editor&amp;file=/boot/config.txt'>Edit boot configuration</a>
61 <div>
62 EOT
63 html_footer && exit 0 ;;
65 *\ rpi_config\ *)
66 html_header "Raspberry Pi"
67 cat << EOT
68 <h1>SliTaz Raspberry Pi</h1>
70 <p>
71 Remotely configure your SliTaz Raspberry Pi device.
72 </p>
74 <div id="actions">
75 <form method="get" action="$script">
76 <input type="submit" name="rdate" value="Set system time" />
77 <input type="submit" name="oclock" value="Overclocking" />
78 <input type="submit" name="leds" value="Leds" />
79 </form>
80 </div>
82 <h2>Kernel boot parameters</h2>
83 <p>
84 This file provide the Linux Kernel boot time parameter and SliTaz
85 boot time options.
86 </p>
87 <pre>
88 $(cat /boot/cmdline.txt 2>/dev/null)
89 </pre>
90 <div class="button">
91 <a href="$script?editor&amp;file=/boot/cmdline.txt">Edit cmdline.txt</a>
92 </div>
94 <h2>Boot configuration file</h2>
95 <p>
96 The Raspberry Pi boot time configuration file
97 </p>
98 <pre>
99 $(cat /boot/config.txt 2>/dev/null)
100 </pre>
101 <div class="button">
102 <a href="$script?editor&amp;file=/boot/config.txt">Edit config.txt</a>
103 </div>
104 EOT
106 html_footer && exit 0 ;;
107 esac