wok diff linux-source/stuff/rdev @ rev 16495

Add python-smbus (from i2c-tools) + python-rpi-gpio to handle R-Pi gpio
author Christophe Lincoln <pankso@slitaz.org>
date Wed Apr 23 16:32:16 2014 +0200 (2014-04-23)
parents 4d8ac8a31cab
children 8144275286f2
line diff
     1.1 --- a/linux-source/stuff/rdev	Tue Aug 07 17:35:57 2012 +0200
     1.2 +++ b/linux-source/stuff/rdev	Wed Apr 23 16:32:16 2014 +0200
     1.3 @@ -1,56 +1,55 @@
     1.4  #!/bin/sh
     1.5  
     1.6 -devname()
     1.7 +dev()
     1.8  {
     1.9 -	d=$(find /dev -type b | while read b ; do
    1.10 -		[ "$(stat -c %02t%02T $b)" == "$1" ] && echo $b && break
    1.11 -	done)
    1.12 -	[ -n "$d" ] && echo $d || echo 0x$1
    1.13 +for b in $(find /dev -type b); do
    1.14 +	[ $(stat -c %02t%02T $b) = $1 ] && echo $b && return
    1.15 +done
    1.16 +echo 0x$1
    1.17  }
    1.18  
    1.19 -sw=""
    1.20 +s=
    1.21  case "$0" in
    1.22 -*rootflags)	sw="-R" ;;
    1.23 -*ramsize)	sw="-r" ;;
    1.24 -*vidmode)	sw="-v" ;;
    1.25 +*gs)	s=-R;;
    1.26 +*ze)	s=-r;;
    1.27 +*de)	s=-v
    1.28  esac
    1.29 -[ -n "$sw" ] && set -- $sw "$@"
    1.30 +set -- $s "$@"
    1.31  
    1.32 -ofs=508
    1.33 -img=
    1.34 -val=
    1.35 -fmt=
    1.36 +o=508
    1.37 +i=
    1.38 +v=
    1.39 +f=
    1.40  while [ -n "$1" ]; do
    1.41 -	case "$1" in	
    1.42 -	-R)	ofs=498; fmt="Root flags" ;;
    1.43 -	-r)	ofs=504; fmt="Ramsize" ;;
    1.44 -	-v)	ofs=506; fmt="Video mode" ;;
    1.45 -	-o)	ofs=$(($2)); shift ;;
    1.46 -	*-h*)	echo "Usage: rdev [-Rrvh] [-o offset] [kernel [data [offset]]]"
    1.47 -		exit 1 ;;
    1.48 -	*)	if [ -z "$img" ]; then
    1.49 -			img="$1"
    1.50 -		elif [ -z "$val" ]; then
    1.51 -			[ "${1:0:5}" == "/dev/" ] && val=0x$(stat -c %t%02T $1)
    1.52 -			val=$((${val:-$1}))
    1.53 -		else
    1.54 -			ofs=$(($1))
    1.55 -		fi
    1.56 -	esac
    1.57 -	shift
    1.58 +case "$1" in	
    1.59 +-R)	o=498; f="Root flags";;
    1.60 +-r)	o=504; f="Ramsize";;
    1.61 +-v)	o=506; f="Video mode";;
    1.62 +-o)	o=$(($2)); f=" "; shift;;
    1.63 +-*)	echo "Usage: rdev [-Rrvh] [-o offset] [kernel [data [offset]]]"
    1.64 +	exit 1;;
    1.65 +*)	if [ -z "$i" ]; then
    1.66 +		i="$1"
    1.67 +	elif [ -z "$v" ]; then
    1.68 +		[ -b "$1" ] && v=0x$(stat -c %t%02T $1)
    1.69 +		v=$((${v:-$1}))
    1.70 +	else
    1.71 +		o=$(($1))
    1.72 +	fi
    1.73 +esac
    1.74 +shift
    1.75  done
    1.76  
    1.77  dd="dd bs=1 conv=notrunc count=2"
    1.78 -if [ ! -s "$img" ]; then
    1.79 -	echo $(devname $(stat -c %04D /)) /
    1.80 -elif [ -n "$val" ]; then
    1.81 +if [ ! -s "$i" ]; then
    1.82 +	echo $(dev $(stat -c %04D /)) /
    1.83 +elif [ -n "$v" ]; then
    1.84  	for i in 1 2; do
    1.85 -		printf '\\\\x%02X' $(($val & 255))
    1.86 -		val=$(($val >> 8))
    1.87 -	done | xargs echo -en | $dd of=$img seek=$ofs
    1.88 -elif [ -n "$fmt" ]; then
    1.89 -	$dd if=$img skip=$ofs | hexdump -e "\"\" 1/2 \"$fmt %u\" \"\n\""
    1.90 +		printf '\\\\x%02X' $(($v&255))
    1.91 +		v=$(($v>>8))
    1.92 +	done | xargs echo -en | $dd of=$i seek=$o
    1.93 +elif [ -n "$f" ]; then
    1.94 +	echo $f $($dd if=$i skip=$o | od -dAn)
    1.95  else
    1.96 -	echo -n "Root device "
    1.97 -	devname $($dd if=$img skip=$ofs | hexdump -e '"" 1/2 "%04X" "\n"')
    1.98 +	echo "Root device $(dev $($dd if=$i skip=$o | od -xAn))"
    1.99  fi 2>/dev/null