Update of /cvsroot/ddccontrol/ddccontrol-db/scripts
In directory sc8-pr-cvs12.sourceforge.net:/tmp/cvs-serv17370/scripts
Added Files:
samsung
Log Message:
Add script to auto-generate Samsung database files.
--- NEW FILE: samsung ---
#!/bin/bash
if [ ! -d db ]; then
echo "You must be in the base directory of ddccontrol-db."
exit 0
fi
echo "Paste file, then type Ctrl-D:"
cat > tmp
echo
PNPNAME=`grep "Plug and Play ID: " tmp | sed -e "s/.* \(.......\) .*/\1/"`
CAPSSTART=`grep -n "Raw output" tmp | sed -e "s/^\([0-9]*\).*/\1/"`
CAPSEND=`grep -n "Parsed output" tmp | sed -e "s/^\([0-9]*\).*/\1/"`
let CAPSTAIL=CAPSEND-1
let CAPSHEAD=CAPSEND-CAPSSTART
CAPS=`head -n $CAPSTAIL tmp | tail -n $CAPSHEAD | sed -e "s/Raw output: //"`
LIST="87 CA CC E2 F5"
for elem in $LIST
do
echo $CAPS | grep -q -i $elem
if [ $? = 1 ]; then
grep -q -i "Control 0x$elem:" tmp
if [ $? = 0 ]; then
LISTC="$LISTC $elem"
fi
fi
done
echo "Will add controls $LISTC"
# Detect SAMmb6
grep -q " 0xdc" tmp
if [ $? = 0 ]; then
COUNT=`grep "0xdc" tmp | sed -e "s:.*/[0-9]*/\([0-9]*\) .*$:\1:"`
case $COUNT in
5) echo "Will include SAMmb6."; SAMmb6=1 ;;
4) SAMmb6=0 ;;
*) echo "Unable to detect SAMmb6 ($COUNT)"; exit 0; ;;
esac
fi
# Detect SAMcp10
grep -q " 0xe0" tmp
if [ $? = 0 ]; then
COUNT=`grep "0xe0" tmp | sed -e "s:.*/[0-9]*/\([0-9]*\) .*$:\1:"`
case $COUNT in
10) echo "Will include SAMcp10."; SAMcp10=1 ;;
3) SAMcp10=0 ;;
2) SAMcp10=0 ;;
*) echo "Unable to detect SAMcp10 ($COUNT)"; exit 0; ;;
esac
fi
# Detect SAMg9
grep -q " 0xf2" tmp
if [ $? = 0 ]; then
COUNT=`grep "0xf2" tmp | sed -e "s:.*/[0-9]*/\([0-9]*\) .*$:\1:"`
case $COUNT in
9) echo "Will include SAMg9, WARNING, there are 2 kinds of 9-values gamma controls."; SAMg9=1 ;;
2) SAMg9=0 ;;
*) echo "Unable to detect SAMg9 ($COUNT)"; exit 0; ;;
esac
fi
FILE="db/monitor/$PNPNAME.xml"
if [ -f $FILE ]; then
echo "DB file exists ($FILE), aborting."
exit 0
fi
echo "Enter monitor name, followed by 2 enters:"
NAME=`cat | head -n 1`
echo "Enter author name, followed by 2 enters:"
AUTHOR=`cat | head -n 1`
echo "<?xml version=\"1.0\"?>" > $FILE
echo "<monitor name=\"$NAME\" init=\"standard\">" >> $FILE
echo " <!--- $CAPS -->" >> $FILE
CNT=`echo $LISTC | wc -c`
if [ $CNT -gt 2 ]; then
echo " <caps add=\"(vcp($LISTC))\"/>" >> $FILE
fi
test a$SAMmb6 = a1 && echo " <include file=\"SAMmb6\"/>" >> $FILE
test a$SAMcp10 = a1 && echo " <include file=\"SAMcp10\"/>" >> $FILE
test a$SAMg9 = a1 && echo " <include file=\"SAMg9\"/>" >> $FILE
echo " <include file=\"SAMlcd\"/>" >> $FILE
echo "</monitor>" >> $FILE
echo "Done!"
echo "You should now run:"
echo "cvs add $FILE && cvs ci -m \"Add support for $NAME, thanks to $AUTHOR.\""
rm tmp
|