| | 762 | === Touch input libraries |
| | 763 | |
| | 764 | [=#tslib] |
| | 765 | ==== tslib |
| | 766 | The tslib project provides a cross-platform library that provides access to touchscreen devices and the ability to apply filters to their input events. Linux input events are translated via a 5-pt matrix configured by default in /etc/pointercal. |
| | 767 | |
| | 768 | References: |
| | 769 | * http://www.tslib.org/ |
| | 770 | * https://github.com/libts/tslib |
| | 771 | |
| | 772 | tslib uses several env variables that can be used to specify the linux input dev, pointercal, ts.conf etc: |
| | 773 | * TSLIB_TSDEVICE - Touchscreen device file name. Default: automatic detection (on Linux) |
| | 774 | * TSLIB_CALIBFILE - Calibration file. Default: ${sysconfdir}/pointercal |
| | 775 | * TSLIB_CONFFILE - Config file. Default: ${sysconfdir}/ts.conf |
| | 776 | * TSLIB_PLUGINDIR - Plugin directory. Default: ${datadir}/plugins |
| | 777 | * TSLIB_CONSOLEDEVICE - Console device. Default: /dev/tty |
| | 778 | * TSLIB_FBDEVICE - Framebuffer device. Default: /dev/fb0 |
| | 779 | |
| | 780 | tslib consists of several applications to test and calibrate your touchscreen: |
| | 781 | - ts_print will show you touch events (filtered) |
| | 782 | - ts_test will show your touch events on the display |
| | 783 | - ts_calibrate prompt for touch events on the display at the four corners and center in order to create /etc/pointercal to translate (filter) events |
| | 784 | |
| | 785 | Example: |
| | 786 | * install libts and tools |
| | 787 | {{{#!bash |
| | 788 | # apt install libts-bin |
| | 789 | }}} |
| | 790 | * run ts_calibrate to create /etc/pointercal |
| | 791 | {{{#!bash |
| | 792 | # ts_calibrate |
| | 793 | xres = 1024, yres = 600 |
| | 794 | Took 2 samples... |
| | 795 | Top left : X = 961 Y = 530 |
| | 796 | Took 1 samples... |
| | 797 | Top right : X = 48 Y = 539 |
| | 798 | Took 3 samples... |
| | 799 | Bot right : X = 67 Y = 71 |
| | 800 | Took 1 samples... |
| | 801 | Bot left : X = 966 Y = 57 |
| | 802 | Took 2 samples... |
| | 803 | Center : X = 514 Y = 293 |
| | 804 | 1041.238403 -1.020124 -0.026010 |
| | 805 | 623.628540 -0.013489 -1.062863 |
| | 806 | Calibration constants: 68238600 -66854 -1704 40870120 -884 -69655 65536 |
| | 807 | # cat /etc/pointercal |
| | 808 | -66854 -1704 68238600 -884 -69655 40870120 65536 1024 600 0 |
| | 809 | }}} |
| | 810 | * run ts_test to test input |
| | 811 | {{{ |
| | 812 | # ts_test |
| | 813 | }}} |
| | 814 | |
| | 815 | |
| | 816 | |