ronnie
2022-10-14 1504bb53e29d3d46222c0b3ea994fc494b48e153
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
#!/bin/sh
 
process=$(ps -ef | grep core | grep -v grep)
[ -n "$process" ] && exit 1
 
/bin/start_adb.sh &
source script_parser.sh
 
mkdir -p /system /vendor /vendor/etc 2>/dev/null
 
if [ ! -d /system/vendor/ ]; then
   ln -s /vendor /system/vendor
   ln -s /lib/modules/`uname -r`/ /vendor/modules
fi
 
if [ ! -d /vendor/etc/hawkview ]; then
   ln -s /dragonboard/bin/hawkview /vendor/etc/hawkview
fi
 
if [ ! -d /vendor/etc/firmware ]; then
   ln -s /dragonboard/firmware /vendor/etc/firmware
fi
 
ROOT_DEVICE="/dev/mmcblk0p7"
for parm in $(cat /proc/cmdline); do
   case $parm in
       root=*)
           ROOT_DEVICE=`echo $parm | awk -F\= '{print $2}'`
           ;;
   esac
done
 
# install nand driver if we boot from sdmmc
nand_activated=`script_fetch "nand" "activated"`
echo "nand activated #$nand_activated"
if [ $nand_activated -eq 1 ]; then
   case $ROOT_DEVICE in
       /dev/mmc*)
 
       nand_module_path=`script_fetch "nand" "module_path"`
       if [ -n "$nand_module_path" ]; then
           insmod "$nand_module_path"
      fi
           ;;
   esac
 
fi
 
# insmod touchscreen driver
tp_module_path=`script_fetch "tp" "module_path"`
if [ -n "$tp_module_path" ]; then
   insmod "$tp_module_path"
 
   #traverse event num so that match tp event num and export it
   a=-1
   device_name=`script_fetch "tp" "device_name"`
   echo "script_fetch device name is $device_name"
   sleep 1
   if [ -n "$device_name" ]; then                                # match device name on a83 a64 platform
       for event in $(cd /sys/class/input; ls event*); do
           name=`cat /sys/class/input/$event/device/name`
           let a++
           case $name in
               $device_name)
                   echo "Found tp device_name is $name, event num is $a"
                   event_num=$a
                   export TSLIB_TSDEVICE=/dev/input/event$event_num    # if match,export it for tp drvier
                   ;;
               *)
                   ;;
           esac
       done
   else
       # match event num on a33 platform
       event_num=`script_fetch "tp" "event_num"`
       export TSLIB_TSDEVICE=/dev/input/event$event_num
   fi
 
   # waiting for tp dev node
   found_time=0
    while true; do
       if [ ! -c /dev/input/event$event_num ]; then
           let found_time++
           if [ $found_time -eq 6 ];then
               echo "Time out,can not find tp event num /dev/input/event$event_num"
               break
           fi
           sleep 1
           continue
       else
           echo "Found tp event num is /dev/input/event$event_num"
           # calibrate touchscreen if need
           tp_type=`script_fetch "tp" "type"`
           if [ $tp_type -eq 0 ]; then
               while true; do
                   ts_calibrate
                   if [ $? -eq 0 ]; then
                       break
                   fi
               done
           fi
           break
       fi
   done
else
   echo "NO!!! touchscreen driver to be insmod"
fi
 
 
# insmod ir driver
ir_activated=`script_fetch "ir" "activated"`
[ -z "$ir_activated" ] && ir_activated=0
if [ $ir_activated -eq 1 ]; then
   ir_module_path=`script_fetch "ir" "module_path"`
   if [ -n "$ir_module_path" ]; then
       insmod "$ir_module_path"
   fi
fi
 
# start camera test firstly
while true; do
   camera_activated=`script_fetch "camera" "activated"`
   echo "camera activated #$camera_activated"
   if [ $camera_activated -eq 1 ]; then
       echo "camera activated"
       module_count=`script_fetch "camera" "module_count"`
       if [ $module_count -gt 0 ]; then
           for i in $(seq $module_count); do
               key_name="module"$i"_path"
               module_path=`script_fetch "camera" "$key_name"`
               if [ -n "$module_path" ]; then
                   insmod "$module_path"
                   if [ $? -ne 0 ]; then
                       echo "insmod $module_path failed"
                       break 2
                   fi
               fi
           done
       fi
   else
       echo "camera not activated"
       break
   fi
 
   echo "camera module insmod done"
   touch /tmp/camera_insmod_done
done
 
if [ ! -d /data/misc/dmt/ ]; then
   mkdir -p /data/misc/dmt/
fi
 
# run dragonboard core process
core &