More toys, fatty?
Yes, after waiting (im)patiently for a cheap touchscreen display to come up on ebay, I finally gave up and got a Hannspree HT225 touchscreen display for the LinuxCNC Bantam. I could have bought a used one with no warranty for perhaps half the price but a new one wouldn't exactly break the bank and most come with 2-3 years warranty.
Most of the Linux GUIs are optimised (intended) for use with a touchscreen and it's a PITA having to walk over to the bench to grab the mouse each time I want to start and stop the Bantam when in manual mode.
This thing has a built-in PSU and a host of video inputs. And I checked it has a capacitive touchscreen, rather than an IR version. The Shiz has an ASUS All-In-One PC with IR touchscreen and I ended up disabling the touch function due to the endless issues I had with dust on/in the touch system and interference of sunlight with the damned thing.
The reviews seem to suggest these will work out of the box with Linux Ubuntu, Mint etc, so what could possibly go wrong? There's only one way to find out....
Well - does it work then?
Sure enough, it sparked up immediately and the touchscreen interface even worked without requiring any driver buggerage. Very pleasing. Except.....with 2 displays to deal with, the mouse cursor moves across BOTH screens when you drag your finger from one side of the touchscreen to the other. WTF??
Luckily, this isn't an obscure problem, so there are various posts showing how to scale the horizontal movement across just one display. Like this one.
This line shows you what input and output devices are configured:
muzzer_linux@LinuxCNC:~$ xinput
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ Logitech Wireless Mouse id=10 [slave pointer (2)]
⎜ ↳ Logitech K540/K545 id=11 [slave pointer (2)]
⎜ ↳ Weida Hi-Tech CoolTouchR System Mouse id=12 [slave pointer (2)]
⎜ ↳ Weida Hi-Tech CoolTouchR System id=13 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
↳ Power Button id=6 [slave keyboard (3)]
↳ Video Bus id=7 [slave keyboard (3)]
↳ Power Button id=8 [slave keyboard (3)]
↳ Sleep Button id=9 [slave keyboard (3)]
↳ Logitech K540/K545 id=14 [slave keyboard (3)]
The CoolTouch device with id=13 is the touchscreen input device.
Next, this line tells you what displays are connected and which video mode they are in:
muzzer_linux@LinuxCNC:~$ xrandr
Screen 0: minimum 320 x 200, current 3840 x 1080, maximum 16384 x 16384
VGA-1 connected 1920x1080+1920+0 (normal left inverted right x axis y axis) 531mm x 299mm
1920x1080 60.00*+
1600x1200 60.00
1680x1050 59.95
1280x1024 75.02 60.02
1440x900 59.89
1280x960 60.00
1152x864 75.00
1024x768 75.03 70.07 60.00
832x624 74.55
800x600 72.19 75.00 60.32 56.25
640x480 75.00 72.81 66.67 59.94
720x400 70.08
DP-1 disconnected (normal left inverted right x axis y axis)
HDMI-1 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 477mm x 268mm
1920x1080 60.00*+ 50.00 59.94
1920x1080i 60.00 50.00 59.94
1680x1050 59.88
1400x1050 59.95
1600x900 60.00
1280x1024 75.02 60.02
1440x900 59.90
1152x864 75.00
1280x720 60.00 50.00 59.94
1024x768 75.03 70.07 60.00
832x624 74.55
800x600 72.19 75.00 60.32 56.25
720x576 50.00
720x576i 50.00
720x480 60.00 59.94
720x480i 60.00 59.94
640x480 75.00 72.81 66.67 60.00 59.94
720x400 70.08
So the fix is to map device 13 to dispay HDMI-1 like this:
muzzer_linux@LinuxCNC:~$ xinput map-to-output 13 HDMI-1
...and whoopee shit - it works!
Making it last:
Of course, when you reboot, that setting is lost and the script doesn't magically rerun itself without some help.
There are any number of Linux power users offering baffling "power user" solutions to this question. All I want is for this script to be run automatically at startup. Shit like this:
https://askubuntu.com/questions/919054/how-do-i-run-a-single-command-at-startup-using-systemd
https://askubuntu.com/questions/814/how-to-run-scripts-on-start-up
FFS!
But yes, in fact there is a simple way to do it. In System > Startup Applications, you can either select a program to run at startup or (if you prefer) a script.
Like this:
Oddly enough, I've called mine "Touchscreen calibration". The script appears to run at startup (with a carriage return) and seems to do the trick.
No comments:
Post a Comment