-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathjivelite-sp
120 lines (99 loc) · 3.64 KB
/
jivelite-sp
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
#!/bin/sh
# Jivelite device detection and startup script.
# - Script handles all RasberryPi DSI touchscreens on RasberryPi boards
# - If you have an spi based screen that needs configuration.
# - Copy this script to /etc/sysconfig/tcedir/jivlite.sh
#
#
# - Insert screen startup related code
# - End screen related startup code
#
export LOG=/var/log/pcp_jivelite.log
#Variables coming from pcp.cfg
# SCREENROTATE
# HARDWARE_ROT
# JL_FRAME_RATE
# JL_FRAME_DEPTH
# JL_FRAME_BUFFER
if [ -f /usr/local/etc/pcp/pcp.cfg ]; then
source /usr/local/etc/pcp/pcp.cfg
fi
# Autodetect Touchscreen, and then mouse if no touch is found.
TOUCH=0
MOUSE=0
TMPFILE=$(mktemp)
udevadm info --export-db | grep "P: " | grep "event" | sed 's/P: //' > $TMPFILE
for LINE in $(cat $TMPFILE); do
udevadm info --query=property --path=$LINE | grep -q TOUCH
[ $? -eq 0 ] && eventno=$(basename $LINE);TOUCH=1;MOUSE=0
if [ "$eventno" != "" ]; then
echo -e "Automatic touchscreen detection found input device on $eventno: \nDevice Info:" >> $LOG
udevadm info --query=all --path=${LINE%/*} >> $LOG
# Some touchpanels need multitouch (known: MPI7003)
udevadm info --query=all --path=${LINE%/*} | grep -q "MPI7003"
if [ $? -eq 0 ]; then
echo "Detected touchscreen driver requiring multitouch, enabling driver..." >> $LOG
modprobe hid_multitouch
sed -i 's/^# module debounce/module debounce/' /usr/local/etc/ts.conf
fi
break
fi
udevadm info --query=property --path=$LINE | grep -q MOUSE
[ $? -eq 0 ] && eventno=$(basename $LINE);TOUCH=0;MOUSE=1
[ "$eventno" != "" ] && echo "Found mouse: $eventno" >> $LOG && break
done
rm -f $TMPFILE
if [ x"" != x"$eventno" -a $TOUCH -eq 1 ]; then
export JIVE_NOCURSOR=1
export TSLIB_TSDEVICE=/dev/input/$eventno
export SDL_MOUSEDRV=TSLIB
export SDL_MOUSEDEV=$TSLIB_TSDEVICE
fi
# Determine the driver being used. (drm-rpi-dsadrmf is a pi5 which must use the vc4 driver)
if [ ! -z ${JL_FRAME_BUFFER} ]; then
export SDL_FBDEV=$JL_FRAME_BUFFER
echo "Using $SDL_FBDEV as frame buffer device." >> $LOG
case $(cat /proc/fb | grep -E ^${JL_FRAME_BUFFER: -1} | cut -d' ' -f2) in
vc4drmfb|drm-rp1-dsidrmf) DRIVER="VC4";;
BCM2708) DRIVER="BCM2708";;
*) DRIVER="OTHER"
esac
echo "Detected framebuffer driver: $DRIVER" >> $LOG
fi
# Set software rotation if screen rotate is set and vc4 driver is being used.
if [ ! -z ${SCREENROTATE} ]; then
if [ "${DRIVER}" = "VC4" ]; then
# Rotation CCW=270, UD=180, CW=90 degrees
case "${SCREENROTATE}" in
90) export SDL_VIDEO_FBCON_ROTATION=CCW;;
180) export SDL_VIDEO_FBCON_ROTATION=UD;;
270) export SDL_VIDEO_FBCON_ROTATION=CW;;
*) unset SDL_VIDEO_FBCON_ROTATION;;
esac
fi
[ "${HARDWARE_ROT}" = "yes" ] && unset SDL_VIDEO_FBCON_ROTATION
if [ ! -z ${SDL_VIDEO_FBCON_ROTATION} ]; then
echo "SDL screen rotation set to $SDL_VIDEO_FBCON_ROTATION." >> $LOG
else
echo "No SDL Screen rotation, or handled in hardware/drivers." >> $LOG
fi
fi
if [ -z ${JL_FRAME_RATE} ]; then
JL_FRAME_RATE=22
fi
export JIVE_FRAMERATE=$JL_FRAME_RATE
echo "Frame rate set to $JIVE_FRAMERATE frames per second." >> $LOG
if [ -z ${JL_FRAME_DEPTH} ]; then
JL_FRAME_DEPTH=32
fi
if [ ${DRIVER} != "VC4" ]; then
/usr/sbin/fbset -depth $JL_FRAME_DEPTH >> $LOG
else
[ "${HARDWARE_ROT}" = "yes" ] || JL_FRAME_DEPTH=16
fi
echo "Frame buffer color bit depth set to $JL_FRAME_DEPTH." >> $LOG
export HOME=/home/tc
while true; do
sleep 3
/opt/jivelite/bin/jivelite >> $LOG 2>&1
done