-
Notifications
You must be signed in to change notification settings - Fork 26
/
rpi_twofing_install.sh
49 lines (44 loc) · 1.8 KB
/
rpi_twofing_install.sh
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
#!/bin/bash
# See http://plippo.de/dev_twofing
# and https://github.com/Plippo/twofing
# and https://github.com/sjlongland/twofing
sudo apt-get -y install build-essential libx11-dev libxtst-dev libxi-dev x11proto-randr-dev libxrandr-dev git
git clone https://github.com/Plippo/twofing.git
cd twofing || exit 255
make
sudo cp twofing /usr/bin/
sudo cat /proc/bus/input/devices # Find the device name to use as matching string, find Vendor and Product IDs
sudo bash -c 'cat << EOF > /etc/udev/rules.d/70-touchscreen.rules
SUBSYSTEMS=="input", KERNEL=="event[0-9]*", ENV{ID_INPUT_TOUCHSCREEN}=="1", SYMLINK+="touchscreen0"
SUBSYSTEMS=="input", KERNEL=="event[0-9]*", ENV{ID_INPUT_TOUCHSCREEN}=="1", SYMLINK+="twofingtouch", RUN+="/bin/chmod a+r /dev/twofingtouch"
EOF'
sudo apt-get -y install xserver-xorg-input-evdev xinput-calibrator
# To find name for MatchProduct:
#
# udevadm info -a -n /dev/touchscreen0 | grep "ATTRS{name}" | sed -e 's#.*=="##' -e 's#"$##'
#
MATCH_PRODUCT=$(udevadm info -a -n /dev/touchscreen0 | grep "ATTRS{name}" | sed -e 's#.*=="##' -e 's#"$##')
sudo bash -c 'cat << EOF > /usr/share/X11/xorg.conf.d/90-touchinput.conf
Section "InputClass"
Identifier "calibration"
Driver "evdev"
MatchProduct "'"${MATCH_PRODUCT}"'"
MatchDevicePath "/dev/input/event*"
Option "EmulateThirdButton" "1"
Option "EmulateThirdButtonTimeout" "750"
Option "EmulateThirdButtonMoveThreshold" "30"
EndSection
EOF'
sudo bash -c 'cat << EOF > /etc/udev/rules.d/99-input-tagging.rules
ACTION=="add", KERNEL=="event*", SUBSYSTEM=="input", TAG+="systemd", , ENV{SYSTEMD_ALIAS}+="/sys/subsystem/input/devices/$env{ID_SERIAL}"
EOF'
mkdir -p ~/.config/autostart
cat << EOF > ~/.config/autostart/twofing-startup.desktop
[Desktop Entry]
Type=Application
Name=Twofing
Exec=twofing
StartupNotify=false
EOF
rm -rf twofing
#reboot