tazpanel rev 217

hardware.cgi: add LCD brightness support
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri Dec 30 17:31:42 2011 +0100 (2011-12-30)
parents c9d901c36128
children 775fbfd01b04
files hardware.cgi styles/default/style.css
line diff
     1.1 --- a/hardware.cgi	Wed Dec 07 15:14:37 2011 +0100
     1.2 +++ b/hardware.cgi	Fri Dec 30 17:31:42 2011 +0100
     1.3 @@ -92,6 +92,9 @@
     1.4  		done
     1.5  		table_end ;;
     1.6  	*)
     1.7 +		[ -n "$(GET brightness)" ] &&
     1.8 +		echo -n $(GET brightness) > /proc/acpi/video/$(GET dev)/LCD/brightness
     1.9 +		
    1.10  		#
    1.11  		# Default to summary with mounted filesystem, loaded modules
    1.12  		#
    1.13 @@ -100,6 +103,41 @@
    1.14  <div id="wrapper">
    1.15  	<h2>`gettext "Drivers &amp; Devices"`</h2>
    1.16  	<p>`gettext "Manage your computer hardware`</p>
    1.17 +EOT
    1.18 +		if [ -n "$(ls /proc/acpi/video/*/LCD/brightness 2> /dev/null)" ]; then
    1.19 +			cat <<EOT
    1.20 +<form method="get" action="$SCRIPT_NAME">
    1.21 +EOT
    1.22 +			for dev in /proc/acpi/video/*/LCD/brightness ; do
    1.23 +				name=$(echo $dev | sed 's|.*/video/||;s|/LCD/.*||')
    1.24 +				cat <<EOT
    1.25 +<input type="hidden" name="dev" value="$name" />
    1.26 +$(gettext "LCD brightness") $name: <select name="brightness" onchange="submit();">
    1.27 +EOT
    1.28 +				awk '{
    1.29 +					if ($1 == "levels:")
    1.30 +					for (i = 2; i <= NF; i++) level[$i] = i
    1.31 +					if ($1 == "current:") current=$2
    1.32 +				}
    1.33 +				END {
    1.34 +					for (i in level) {
    1.35 +						s="<option value=\"" i "\""
    1.36 +						if (current == i) s=s " selected=\"selected\""
    1.37 +						s=s ">" i "%</option>"
    1.38 +						if (i == 100) last=s
    1.39 +						else print s
    1.40 +					}
    1.41 +					print last
    1.42 +				}' < $dev
    1.43 +				cat <<EOT
    1.44 +</select>
    1.45 +EOT
    1.46 +			done
    1.47 +			cat << EOT
    1.48 +</form>
    1.49 +EOT
    1.50 +		fi
    1.51 +		cat << EOT
    1.52  </div>
    1.53  <div>
    1.54  	<a class="button" href="$SCRIPT_NAME?modules">
    1.55 @@ -124,7 +162,7 @@
    1.56  	<td>$size</td>
    1.57  	<td>$av</td>
    1.58  	<td class="pct"><div class="pct"
    1.59 -		style="width: $pct;">$used - $pct</div></td>
    1.60 +		style="width: $pct;">$used&nbsp;-&nbsp;$pct</div></td>
    1.61  	<td>$mp</td>
    1.62  </tr>
    1.63  EOT
     2.1 --- a/styles/default/style.css	Wed Dec 07 15:14:37 2011 +0100
     2.2 +++ b/styles/default/style.css	Fri Dec 30 17:31:42 2011 +0100
     2.3 @@ -184,7 +184,7 @@
     2.4  td.pkg { max-width: 160px; }
     2.5  td.desc { max-width: 300px; }
     2.6  td.pct { min-width: 200px; background: #eee; }
     2.7 -div.pct { background: #ccc; display: inline; }
     2.8 +div.pct { background: #ccc; }
     2.9  td.pct, div.pct { border-radius: 2px; }
    2.10  
    2.11  #thead, .thead, thead {