install.sh 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #!/bin/bash
  2. if ! grep "#Waveshare" /boot/config.txt >/dev/null
  3. then
  4. cp /boot/config.txt .
  5. cat <<'EOF'>> add.txt
  6. #Waveshare 5inch
  7. hdmi_group=2
  8. hdmi_mode=87
  9. hdmi_cvt 800 480 60 6 0 0 0
  10. hdmi_drive=1
  11. dtoverlay=ads7846,cs=1,penirq=25,penirq_pull=2,speed=50000,keep_vref_on=0,swapxy=0,pmax=255,xohms=150,xmin=200,xmax=3900,ymin=200,ymax=3900
  12. EOF
  13. cat add.txt >> config.txt
  14. rm add.txt
  15. sudo cp config.txt /boot/
  16. rm config.txt
  17. fi
  18. sudo apt-get update
  19. sudo apt-get install xserver-xorg-input-evdev xinput-calibrator -y
  20. sudo cp -rf /usr/share/X11/xorg.conf.d/10-evdev.conf /usr/share/X11/xorg.conf.d/45-evdev.conf
  21. if [ -f /usr/share/X11/xorg.conf.d/99-calibration.conf ]
  22. then
  23. sudo rm /usr/share/X11/xorg.conf.d/99-calibration.conf
  24. fi
  25. sudo cat <<'EOF'>> 99-calibration.conf
  26. Section "InputClass"
  27. Identifier "calibration"
  28. MatchProduct "ADS7846 Touchscreen"
  29. Option "Calibration" "208 3905 288 3910"
  30. Option "SwapAxes" "0"
  31. Option "EmulateThirdButton" "1"
  32. Option "EmulateThirdButtonTimeout" "1000"
  33. Option "EmulateThirdButtonMoveThreshold" "300"
  34. EndSection
  35. EOF
  36. sudo cp 99-calibration.conf /usr/share/X11/xorg.conf.d/99-calibration.conf
  37. rm 99-calibration.conf