File: samsung

package info (click to toggle)
ddccontrol-db 20230223-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,640 kB
  • sloc: xml: 4,830; sh: 119; makefile: 32; sed: 16; perl: 12
file content (107 lines) | stat: -rwxr-xr-x 2,751 bytes parent folder | download | duplicates (4)
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#!/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
		7) echo "Will include SAMmb6. Altought maximum is 7."; SAMmb6=1 ;;
		240) echo "Will include SAMmb6."; SAMmb6=1 ;;
		6) echo "Will include SAMmb6."; SAMmb6=1 ;;
		5) echo "Will include SAMmb6."; SAMmb6=1 ;;
		4) SAMmb6=0 ;;
		*) echo "Unable to detect SAMmb6 ($COUNT), please put a note in the file." ;;
	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 ;;
		4) SAMcp10=0 ;;
		3) SAMcp10=0 ;;
		2) SAMcp10=0 ;;
		*) echo "Unable to detect SAMcp10 ($COUNT), please put a note in the file." ;;
	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), please put a note in the file." ;;
	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 "svn add $FILE && svn ci -m \"Add support for $NAME, thanks to $AUTHOR.\""

rm tmp