Revision: 58 http://svn.sourceforge.net/mactel-linux/?rev=58&view=rev Author: ludov Date: 2006-11-14 14:33:50 -0800 (Tue, 14 Nov 2006)
Log Message: ----------- Put that SPDIF-out to use! Jason Parekh <[EMAIL PROTECTED]> Added Paths: ----------- trunk/tools/macbook-led Added: trunk/tools/macbook-led =================================================================== --- trunk/tools/macbook-led (rev 0) +++ trunk/tools/macbook-led 2006-11-14 22:33:50 UTC (rev 58) @@ -0,0 +1,55 @@ +#!/bin/bash + +VERSION=01 + +if [ "$1" == "--help" ]; then + echo " +MacBook LED indicator (v$VERSION) Jason Parekh <[EMAIL PROTECTED]> +Put that SPDIF-out to use! http://jasonparekh.com/linux-on-macbook + +Usage: $0 <type> [dev] + +type Choose between 'disk' (default) or 'net' indicator +dev Use the 'dev' device (eg: 'sda1' or even just 'sda' for all partitions) + +Examples: + $0 Monitors all block devices activity (disk and CD/DVD drives) + $0 disk sda Monitors all disk drives activity + $0 net eth0 Monitors LAN activity + $0 net Monitors all network activity (WARNING: wlan0 will pickup ANY wifi activity) + $0 net ath0 Monitors wireless activity +" + exit +fi + +STATS_FILE="/proc/diskstats" + +if [ "$1" == "net" ]; then + STATS_FILE="/proc/net/dev" +fi + +STATS_CMD="cat $STATS_FILE" +if [ "$2" != "" ]; then + STATS_CMD="grep $2 $STATS_FILE" +fi + +renice 19 -p $$ >/dev/null 2>&1 + +while [ 1 ]; do + CUR_STATS=`$STATS_CMD` + if [ "$CUR_STATS" != "$LAST_STATS" ]; then + if [ "$LAST_OP" != "ACTIVE" ]; then + amixer set IEC958 on >/dev/null 2>&1 + fi + LAST_OP="ACTIVE" + else + if [ "$LAST_OP" != "IDLE" ]; then + amixer set IEC958 off >/dev/null 2>&1 + fi + LAST_OP="IDLE" + fi + LAST_STATS="$CUR_STATS" + sleep 0.2 +done + + Property changes on: trunk/tools/macbook-led ___________________________________________________________________ Name: svn:executable + * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Mactel-linux-devel mailing list Mactel-linux-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mactel-linux-devel