bbasbagill
September 24th, 2021, 03:42 PM
Introduction
I spent the last few days rebuilding a car pc using an eGalax touch screen and Ubuntu 21.04. These touch display controllers have been used for over a decade by a variety of manufacturers. Anyone who has worked with these can tell you they can be a struggle to get up and running. There are hundreds of posts across the internet about setting these up but much of the information is fragmented or outdated. I post this information both as a set of notes to my future self but also in an effort to assist others who may be struggling with the same problems.
Scope
While this information may help troubleshoot other touch screen devices with Ubuntu, I am specifically working with a 7” eGalax in-dash unit:
lsusb
Bus 003 Device 004: ID 0eef:0001 D-WAV Scientific Co., Ltd Titan6001 Surface Acoustic Wave Touchscreen Controller [eGalax]
Also I have not been able to get this to work with Wayland, so make sure you are using X11 by selecting “Ubuntu on Xorg” instead of “Ubuntu” at the login screen by clicking on the little gear icon in the lower right corner (tab and arrows will navigate without a mouse).
Driver
Out of the box with a fresh install of Ubuntu hirsute hippo, this touch panel does nothing. The HDMI port gives a good display but when you tap on it there is no cursor movement or click action. From what I can tell, this D-Wav Scientific Co., Ltd is owned by a company called EETI. Their website can be found at http://www.eeti.com (http://www.eeti.com/) and as of this writing they are still actively developing linux drivers for eGalax panels. If you visit their site, go to the downloads section, accept their license, then navigate to the Linux section you will see a variety of linux driver packages available based on kernel version and architecture. If you don’t know what you are running, you can find out with a couple quick commands:
uname -r
5.11.0-36-generic
uname -i
x86_64
Hover your mouse over the appropriate link on the page to see the direct link to the driver package then you can download it like this:
wget https://www.eeti.com/touch_driver/Linux/20210716/eGTouch_v2.5.10206.L-x.tar.gz
After you download the package, unpack it like this (press tab after a few letters of eGTouch to autocomplete):
tar zxvf eGTouch_v2.5.10206.L-x.tar.gz
Change into the unpacked directory (again use tab to autocomplete):
cd eGTouch_v2.5.10206.L-x
Now install the driver:
sudo ./setup.sh
Agree to the patent declaration, pick USB for the controller, confirm the controller is connected, don’t bother with monitor rotation or multimonitor, only set up 1 controller, if you are prompted to blacklist a usbtouchscreen module blacklist the module, then reboot the system
sudo shutdown -r now
Daemon
The latest version of the driver installed the eGTouchD service for me without a problem but many other posts indicate this was a problem in the past. Verify the eGTouch daemon is running like this:
sudo service eGTouchD status
● eGTouchD.service
Loaded: loaded (/usr/bin/eGTouchD; enabled; vendor preset: enabled)
Active: active (running) since Fri 2021-09-24 08:16:37 EDT; 4min 56s ago
Process: 564 ExecStart=/usr/bin/eGTouchD start (code=exited, status=0/SUCCESS)
Main PID: 584 (eGTouchD)
Tasks: 2 (limit: 4327)
Memory: 5.8M
CGroup: /system.slice/eGTouchD.service
└─584 /usr/bin/eGTouchD start
You should see a green dot, “loaded” and “active” to indicate that the daemon service is running without a problem, otherwise search online for detailed instructions on how to rebuild it.
Swap Axes
At this point the driver and daemon load and we can tap on the screen for a click event but the X and Y of the mouse movement is reversed. The included eGTouchU app is fairly worthless and modern linux no longer uses a single xorg.conf file. I tried messing around with “SwapAxes”“SwapXY” and "InvertX""InvertY" options in a variety of other .conf files but had no luck so lets go deeper down the rabbit hole.
We can interact with the driver using the command “xinput”. This wasnt included with my default install so I added it like this:
sudo apt install xinput
The first thing we need to do is get the ID number for our eGalaxTouch device so we can talk to it. Just run the command with no options to get a list of devices:
xinput
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ eGalaxTouch Virtual Device for Single id=13 [slave pointer (2)]
From this list we can see that the eGalaxTouch device is ID number 13. Your number will likely be different but you’ll need to remember it for the following commands. Now we can ask what properties it supports:
xinput --list-props 13
Device 'eGalaxTouch Virtual Device for Single':
Device Enabled (151): 1
Coordinate Transformation Matrix (153): 0.000000, 1.000000, 0.000000, -1.000000, 0.000000, 1.000000, 0.000000, 0.000000, 1.000000
libinput Natural Scrolling Enabled (288): 0
libinput Natural Scrolling Enabled Default (289): 0
libinput Calibration Matrix (290): 1.200000, 0.000000, -0.050000, 0.000000, 1.090000, -0.050000, 0.000000, 0.000000, 1.000000
libinput Calibration Matrix Default (291): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
libinput Left Handed Enabled (292): 0
libinput Left Handed Enabled Default (293): 0
libinput Send Events Modes Available (271): 1, 0
libinput Send Events Mode Enabled (272): 0, 0
libinput Send Events Mode Enabled Default (273): 0, 0
Device Node (274): "/dev/input/event11"
Device Product ID (275): 3823, 1
libinput Drag Lock Buttons (294): <no items>
libinput Horizontal Scroll Enabled (295): 1
The property we are interested in is the “Coordinate Tansformation Matrix”. You can read about transformation matrices at https://wiki.ubuntu.com/X/InputCoordinateTransformation. Try different matrices on the fly until you find something that works for you. For me, using the “Right Rotate” matrix solved my swap axes problem:
xinput --set-prop 13 “Coordinate Transformation Matrix” 0 1 0 -1 0 1 0 0 1
Once you find the Coordinate Transformation Matrix that works for you, we can make it permanent by adding it to the file 52-egalax-virtual-libinput.conf that was created by the driver installation:
sudo nano /usr/share/X11/xorg.conf.d/52-egalax-virtual-libinput.conf
Look for the section that has the same name as the device we saw in the xinput list and add a “TransformationMatrix” option using the matrix numbers we just discovered:
Section "InputClass"
Identifier "eGalax virtual class"
MatchProduct "eGalaxTouch Virtual Device"
MatchDevicePath "/dev/input/event*"
Driver "libinput"
Option "TransformationMatrix" "0 1 0 -1 0 1 0 0 1"
EndSection
Calibration
At this point we can tap on the display and generate click events as well as move our cursor in the right direction. However the further we move away from the center of the screen the more inaccurate the mouse movement becomes. We need to calibrate the panel however the included eGTouchU app is fairly worthless and modern linux no longer uses a single xorg.conf file. I tried messing around with “MinX””MaxX” and “MinY””MaxY” options in a variety of other .conf files but had no luck. We can use the xinput tool again to calibrate our panel, lets jump back down the rabbit hole:
This time the property we are interested in is the “libinput Calibration Matrix”. There are some complicated formulas floating around the internet to calculate these matrices however they follow this general format:
[x width] 0 [x offset] 0 [y height] [y offset] 0 0 1
It’s also important to remember that since we rotated everything 90’ in the previous step x becomes vertical and y becomes horizontal. You can adjust these settings on the fly and experiment until you find something that works for you. Use increments of 0.1 or -0.1 for small adjustments then smaller numbers to be more exact. Pay special attention to the mouse position when you tap toward the edges of your screen, I suggest using a stylus instead of your finger for more accurate results:
xinput --set-prop 13 “libinput Calibration Matrix” 1.2 0 -0.05 0 1.09 -0.05 0 0 1
Once you find the Calibration Matrix that works for you, we can make it permanent by adding it to the file 52-egalax-virtual-libinput.conf:
sudo nano /usr/share/X11/xorg.conf.d/52-egalax-virtual-libinput.conf
Again, look for the section that has the same name as the device we saw in the xinput list and this time add a “CalibrationMatrix” option using the matrix numbers we just discovered:
Section "InputClass"
Identifier "eGalax virtual class"
MatchProduct "eGalaxTouch Virtual Device"
MatchDevicePath "/dev/input/event*"
Driver "libinput"
Option "TransformationMatrix" "0 1 0 -1 0 1 0 0 1"
Option "CalibrationMatrix" "1.2 0 -0.05 0 1.09 -0.05 0 0 1"
EndSection
Reboot and enjoy your working touch screen.
Edit: formatting cleanup
I spent the last few days rebuilding a car pc using an eGalax touch screen and Ubuntu 21.04. These touch display controllers have been used for over a decade by a variety of manufacturers. Anyone who has worked with these can tell you they can be a struggle to get up and running. There are hundreds of posts across the internet about setting these up but much of the information is fragmented or outdated. I post this information both as a set of notes to my future self but also in an effort to assist others who may be struggling with the same problems.
Scope
While this information may help troubleshoot other touch screen devices with Ubuntu, I am specifically working with a 7” eGalax in-dash unit:
lsusb
Bus 003 Device 004: ID 0eef:0001 D-WAV Scientific Co., Ltd Titan6001 Surface Acoustic Wave Touchscreen Controller [eGalax]
Also I have not been able to get this to work with Wayland, so make sure you are using X11 by selecting “Ubuntu on Xorg” instead of “Ubuntu” at the login screen by clicking on the little gear icon in the lower right corner (tab and arrows will navigate without a mouse).
Driver
Out of the box with a fresh install of Ubuntu hirsute hippo, this touch panel does nothing. The HDMI port gives a good display but when you tap on it there is no cursor movement or click action. From what I can tell, this D-Wav Scientific Co., Ltd is owned by a company called EETI. Their website can be found at http://www.eeti.com (http://www.eeti.com/) and as of this writing they are still actively developing linux drivers for eGalax panels. If you visit their site, go to the downloads section, accept their license, then navigate to the Linux section you will see a variety of linux driver packages available based on kernel version and architecture. If you don’t know what you are running, you can find out with a couple quick commands:
uname -r
5.11.0-36-generic
uname -i
x86_64
Hover your mouse over the appropriate link on the page to see the direct link to the driver package then you can download it like this:
wget https://www.eeti.com/touch_driver/Linux/20210716/eGTouch_v2.5.10206.L-x.tar.gz
After you download the package, unpack it like this (press tab after a few letters of eGTouch to autocomplete):
tar zxvf eGTouch_v2.5.10206.L-x.tar.gz
Change into the unpacked directory (again use tab to autocomplete):
cd eGTouch_v2.5.10206.L-x
Now install the driver:
sudo ./setup.sh
Agree to the patent declaration, pick USB for the controller, confirm the controller is connected, don’t bother with monitor rotation or multimonitor, only set up 1 controller, if you are prompted to blacklist a usbtouchscreen module blacklist the module, then reboot the system
sudo shutdown -r now
Daemon
The latest version of the driver installed the eGTouchD service for me without a problem but many other posts indicate this was a problem in the past. Verify the eGTouch daemon is running like this:
sudo service eGTouchD status
● eGTouchD.service
Loaded: loaded (/usr/bin/eGTouchD; enabled; vendor preset: enabled)
Active: active (running) since Fri 2021-09-24 08:16:37 EDT; 4min 56s ago
Process: 564 ExecStart=/usr/bin/eGTouchD start (code=exited, status=0/SUCCESS)
Main PID: 584 (eGTouchD)
Tasks: 2 (limit: 4327)
Memory: 5.8M
CGroup: /system.slice/eGTouchD.service
└─584 /usr/bin/eGTouchD start
You should see a green dot, “loaded” and “active” to indicate that the daemon service is running without a problem, otherwise search online for detailed instructions on how to rebuild it.
Swap Axes
At this point the driver and daemon load and we can tap on the screen for a click event but the X and Y of the mouse movement is reversed. The included eGTouchU app is fairly worthless and modern linux no longer uses a single xorg.conf file. I tried messing around with “SwapAxes”“SwapXY” and "InvertX""InvertY" options in a variety of other .conf files but had no luck so lets go deeper down the rabbit hole.
We can interact with the driver using the command “xinput”. This wasnt included with my default install so I added it like this:
sudo apt install xinput
The first thing we need to do is get the ID number for our eGalaxTouch device so we can talk to it. Just run the command with no options to get a list of devices:
xinput
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ eGalaxTouch Virtual Device for Single id=13 [slave pointer (2)]
From this list we can see that the eGalaxTouch device is ID number 13. Your number will likely be different but you’ll need to remember it for the following commands. Now we can ask what properties it supports:
xinput --list-props 13
Device 'eGalaxTouch Virtual Device for Single':
Device Enabled (151): 1
Coordinate Transformation Matrix (153): 0.000000, 1.000000, 0.000000, -1.000000, 0.000000, 1.000000, 0.000000, 0.000000, 1.000000
libinput Natural Scrolling Enabled (288): 0
libinput Natural Scrolling Enabled Default (289): 0
libinput Calibration Matrix (290): 1.200000, 0.000000, -0.050000, 0.000000, 1.090000, -0.050000, 0.000000, 0.000000, 1.000000
libinput Calibration Matrix Default (291): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
libinput Left Handed Enabled (292): 0
libinput Left Handed Enabled Default (293): 0
libinput Send Events Modes Available (271): 1, 0
libinput Send Events Mode Enabled (272): 0, 0
libinput Send Events Mode Enabled Default (273): 0, 0
Device Node (274): "/dev/input/event11"
Device Product ID (275): 3823, 1
libinput Drag Lock Buttons (294): <no items>
libinput Horizontal Scroll Enabled (295): 1
The property we are interested in is the “Coordinate Tansformation Matrix”. You can read about transformation matrices at https://wiki.ubuntu.com/X/InputCoordinateTransformation. Try different matrices on the fly until you find something that works for you. For me, using the “Right Rotate” matrix solved my swap axes problem:
xinput --set-prop 13 “Coordinate Transformation Matrix” 0 1 0 -1 0 1 0 0 1
Once you find the Coordinate Transformation Matrix that works for you, we can make it permanent by adding it to the file 52-egalax-virtual-libinput.conf that was created by the driver installation:
sudo nano /usr/share/X11/xorg.conf.d/52-egalax-virtual-libinput.conf
Look for the section that has the same name as the device we saw in the xinput list and add a “TransformationMatrix” option using the matrix numbers we just discovered:
Section "InputClass"
Identifier "eGalax virtual class"
MatchProduct "eGalaxTouch Virtual Device"
MatchDevicePath "/dev/input/event*"
Driver "libinput"
Option "TransformationMatrix" "0 1 0 -1 0 1 0 0 1"
EndSection
Calibration
At this point we can tap on the display and generate click events as well as move our cursor in the right direction. However the further we move away from the center of the screen the more inaccurate the mouse movement becomes. We need to calibrate the panel however the included eGTouchU app is fairly worthless and modern linux no longer uses a single xorg.conf file. I tried messing around with “MinX””MaxX” and “MinY””MaxY” options in a variety of other .conf files but had no luck. We can use the xinput tool again to calibrate our panel, lets jump back down the rabbit hole:
This time the property we are interested in is the “libinput Calibration Matrix”. There are some complicated formulas floating around the internet to calculate these matrices however they follow this general format:
[x width] 0 [x offset] 0 [y height] [y offset] 0 0 1
It’s also important to remember that since we rotated everything 90’ in the previous step x becomes vertical and y becomes horizontal. You can adjust these settings on the fly and experiment until you find something that works for you. Use increments of 0.1 or -0.1 for small adjustments then smaller numbers to be more exact. Pay special attention to the mouse position when you tap toward the edges of your screen, I suggest using a stylus instead of your finger for more accurate results:
xinput --set-prop 13 “libinput Calibration Matrix” 1.2 0 -0.05 0 1.09 -0.05 0 0 1
Once you find the Calibration Matrix that works for you, we can make it permanent by adding it to the file 52-egalax-virtual-libinput.conf:
sudo nano /usr/share/X11/xorg.conf.d/52-egalax-virtual-libinput.conf
Again, look for the section that has the same name as the device we saw in the xinput list and this time add a “CalibrationMatrix” option using the matrix numbers we just discovered:
Section "InputClass"
Identifier "eGalax virtual class"
MatchProduct "eGalaxTouch Virtual Device"
MatchDevicePath "/dev/input/event*"
Driver "libinput"
Option "TransformationMatrix" "0 1 0 -1 0 1 0 0 1"
Option "CalibrationMatrix" "1.2 0 -0.05 0 1.09 -0.05 0 0 1"
EndSection
Reboot and enjoy your working touch screen.
Edit: formatting cleanup