summaryrefslogtreecommitdiff
path: root/evdevtest/juice_evtest.sh
blob: 9c3dd2083b7a043c3e3c539a82343ca91bb13bc8 (plain)
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
#!/system/bin/sh

rc=0

if [ ! -e /system/modules/juice_input_test_module.ko ]; then 
	echo "juice input kernel module doesn't exist!"
	exit
fi

rmmod juice_input_test_module

insmod /system/modules/juice_input_test_module.ko
rc=$?
if [ $rc -ne 0 ]; then
	echo "Insmod juice input kernel module failed!"
	exit
fi

input_dev=""
for dev in $(ls /dev/input/event*);do
    if getevent -i "${dev}"|grep -q "Juice EVDEV Test Module"; then
        input_dev=${dev}
        break
    fi
done

if [ -z "${input_dev}" ]; then
    echo "Failed to find the input device for kernel evdev test"
    exit 1
fi

echo "Evdev IOCTL CMD TEST START"
juice_evtest -p ${input_dev}
rc=$?
if [ $rc -ne 0 ]; then
	echo "Evdev IOCTL CMD TEST FAIL!"
else
	echo "EVDEV IOCTL CMD TEST FINISH"
fi

rmmod juice_input_test_module
rc=$?
if [ $rc -ne 0 ]; then
	echo "Remove juice input kernel module failed!"
fi