File: config

package info (click to toggle)
ipw2200 1.2.0-3
  • links: PTS
  • area: contrib
  • in suites: etch, etch-m68k
  • size: 644 kB
  • ctags: 2,016
  • sloc: ansic: 11,589; sh: 518; makefile: 205
file content (44 lines) | stat: -rwxr-xr-x 757 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/sh
MODULE="ipw2200"
ENTRY="cfg"
EREG="s#.define \(CFG_.*\) *(1<<\([0-9]*\)).*#\1 \2#p"

unset FILE
for i in /sys/bus/pci/drivers/${MODULE}/*; do
	if [ -e "${i}/${ENTRY}" ]; then
		FILE="${i}/${ENTRY}"
	fi
done
if [ -z "${FILE}" ]; then
	echo "No '${ENTRY}' found in /sys/bus/pci/drivers/${MODULE}."
	return
fi

function bit()
{
	VAL=1
	for ((i = 0; i < $2; i++)); do
		VAL=$((VAL*2))
	done
	SET="$((VAL & $3))"
	if [ "${SET}" = "0" ]; then
		SET=" "
	else
		SET="*"
	fi
	printf "%-20s\t\t0x%08X [%s] %d\n" $1 $VAL "$SET" $i
}

IFS="
"
LEVELS=`sed -ne "${EREG}" ipw2200.h`
VALUE=`cat ${FILE}`

printf "%-20s\t\t%-10s Set Bit\n" "Description" "Hex"
for i in $LEVELS; do
	IFS=" 
"
	bit $i $((${VALUE}))
done

printf "${ENTRY} = ${VALUE} (* = active)\n"