slitaz-arm view rpi/cgi-adm/plugins/rpi_config/rpi_config.cgi @ rev 138

cgi-adm: move time setiing to core and misc fixes
author Christophe Lincoln <pankso@slitaz.org>
date Sat Apr 26 12:06:42 2014 +0200 (2014-04-26)
parents c10b9b20b9a5
children 71b3777ac5f1
line source
1 #!/bin/sh
2 #
3 # TazBerry CGI Plugin - Raspberry Pi configuration
4 #
6 case " $(GET) " in
7 *\ audio\ *)
8 html_header "Audio Control"
9 case " $(GET audio) " in
10 *\ auto\ *|*\ analog\ *|*\ hdmi\ *)
11 amixer -q cset numid=3 $(GET cset) ;;
12 *\ vol\ *)
13 amixer -q cset numid=1 "$(GET cset)%" ;;
14 *\ mute\ *)
15 amixer -q cset numid=1 mute ;;
16 *\ play\ *)
17 notify "Playing MP3 system sound..."
18 mpg123 /usr/share/sounds/ready.mp3 2>/dev/null
19 notify hide ;;
20 esac
21 cat << EOT
22 <h1>Audio Mixer</h1>
23 <div class="button">
24 <a href="$script?audio=play">Play sound</a>
25 <a href="$script?audio=mute">Mute</a>
26 <a href="$script?audio=vol&amp;cset=100">Vol 100%</a>
27 <a href="$script?audio=vol&amp;cset=50">Vol 50%</a>
28 </div>
29 <pre>
30 $(amixer)
31 </pre>
33 <h2>Audio Output</h2>
34 <p>
35 The Raspberry Pi has two audio output modes: HDMI and headphone jack.
36 You can switch between these modes at any time.
37 </p>
38 <div class="button">
39 <a href="$script?audio=auto&amp;cset=0">Auto</a>
40 <a href="$script?audio=analog&amp;cset=1">Headphone</a>
41 <a href="$script?audio=hdmi&amp;cset=2">HDMI</a>
42 </div>
44 <h2>Controls</h2>
45 <pre>
46 $(amixer controls)
47 </pre>
49 <h2>Contents</h2>
50 <pre>
51 $(amixer contents)
52 </pre>
54 EOT
55 html_footer && exit 0 ;;
57 *\ leds\ *)
58 trigger="/sys/class/leds/led0/trigger"
59 brightness="/sys/class/leds/led0/brightness"
60 html_header "Leds"
61 case " $(GET leds) " in
62 *\ act_test\ *)
63 notify "ACT Led turned on for 5 sec..."
64 echo "1" > ${brightness}
65 sleep 5
66 echo "0" > ${brightness}
67 notify hide ;;
68 *\ act_on\ *)
69 echo "0" > ${brightness}; usleep 50000
70 echo "1" > ${brightness} ;;
71 *\ act_off\ *)
72 echo "0" > ${brightness} ;;
73 esac
74 cat << EOT
75 <h1>Leds</h1>
76 <pre>
77 Trigger : $(cat $trigger)
78 Brightness : $(cat $brightness)
79 </pre>
80 <div class="button">
81 <a href="$script?leds=act_test">ACT Led test</a>
82 <a href="$script?leds=act_on">ACT Led on</a>
83 <a href="$script?leds=act_off">ACT Led off</a>
84 </div>
85 EOT
86 html_footer && exit 0 ;;
88 *\ oclock\ *)
89 html_header "Overclocking"
90 cat << EOT
91 <h1>RPi Overclocking</h1>
93 <pre>
94 $(tazberry rpi_oclock)
95 </pre>
97 <h2>Current settings:</h2>
98 <pre>
99 $(fgrep _freq /boot/config.txt)
100 $(fgrep over_voltage /boot/config.txt)
101 </pre>
102 <div class="button">
103 <a href='$script?editor&amp;file=/boot/config.txt&amp;from=?rpi_config'>Edit boot configuration</a>
104 <div>
105 EOT
106 html_footer && exit 0 ;;
108 *\ rpi_config\ *)
109 blacklist="/etc/modprobe.d/rpi-blacklist.conf"
110 html_header "Raspberry Pi"
111 cat << EOT
112 <h1>SliTaz Raspberry Pi</h1>
114 <p>
115 Remotely configure your SliTaz Raspberry Pi device.
116 </p>
118 <div id="actions">
119 <form method="get" action="$script">
120 <input type="submit" name="audio" value="Audio control" />
121 <input type="submit" name="oclock" value="Overclocking" />
122 <input type="submit" name="leds" value="Leds" />
123 </form>
124 </div>
126 <h2>Kernel boot parameters</h2>
127 <p>
128 This file provides the Linux Kernel boot time parameters and SliTaz
129 boot time options.
130 </p>
131 <pre>
132 $(cat /boot/cmdline.txt 2>/dev/null)
133 </pre>
134 <div class="button">
135 <a href="$script?editor&amp;file=/boot/cmdline.txt&amp;from=?rpi_config">Edit cmdline.txt</a>
136 </div>
138 <h2>Boot configuration file</h2>
139 <p>
140 The Raspberry Pi boot time configuration file
141 </p>
142 <pre>
143 $(cat /boot/config.txt 2>/dev/null)
144 </pre>
145 <div class="button">
146 <a href="$script?editor&amp;file=/boot/config.txt&amp;from=?rpi_config">Edit config.txt</a>
147 </div>
149 <h2>Blacklisted Kernel modules</h2>
150 <p>
151 List of the Linux Kernel modules that should not be loaded on boot
152 time to save resources and speed up your Raspberry Pi.
153 </p>
154 <pre>
155 $(cat $blacklist 2>/dev/null)
156 </pre>
157 <div class="button">
158 <a href="$script?editor&amp;file=$blacklist&amp;from=?rpi_config">Edit $(basename $blacklist)</a>
159 </div>
160 EOT
162 html_footer && exit 0 ;;
163 esac