Rpi 4, 5"touchscreen & Akai mpk mk2. Touchscreen Setup help? [Solved]

Since it detects the screen, does this mean I’m as far as I can go with this? Or is there a way to get in there and fix it?

It is puzzling. Calibration screen waits for touch to detect the screen then waits for release before starting actual calibration. I wonder if the release isn’t being sent. I’ve been busy with the sequencer (which I have broken so need to fix) but will try to send you a script to test this hypothesis.

1 Like

@Aetro sorry for the delay - I have been busy with other activities. Try this:

  • Upload this file to your Zynthian: detect_ts.py (4.1 KB)
  • Stop Zynthian - from command line enter: systemctl stop zynthian
  • Run this command: startx /usr/bin/python3 ./detect_ts.py -- :0 (you will have to use the path to detect_ts.py where you uploaded it like last time)
  • This should show --------Starting touchscreen detection-------- in the terminal
  • Press and hold any area of the screen for 2 seconds
  • Release the screen
  • More output should be shown in the terminal including, --------End touchscreen detection--------
  • Post back here all the content between --------Starting touchscreen detection-------- and --------End touchscreen detection--------

This script does the same as the touchscreen calibration code in Zynthian so we can see how it behaves on your machine and whether there are some enhancements or fixes I can do to the detection code.

Cheers

Sorry for this, but what would the startx command line look like if I uploaded through the Capture on web-config?

startx /usr/bin/python3 ./detect_ts.py – :0

startx /usr/bin/python3 /zynthian/zynthian-my-data/capture/detect_ts.py – :0

Here you go, @riban
Thank you!

--------Starting touchscreen detection--------
Found absolute coordinate input devices: [InputDevice(‘/dev/input/event5’), InputDevice(‘/dev/input/event4’), InputDevice(‘/dev/i
nput/event2’)]
Detected press of evdev touch device: ADS7846 Touchscreen /dev/input/event5
Checking xinput device Virtual core pointer Device ‘Virtual core pointer’:
Device Enabled (113): 1
Coordinate Transformation Matrix (114): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1
.000000

Checking xinput device Virtual core XTEST pointer Device ‘Virtual core XTEST pointer’:
Device Enabled (113): 1
Coordinate Transformation Matrix (114): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1
.000000
XTEST Device (232): 1

Checking xinput device MOSART Semi. 2.4G Keyboard Mouse Mouse Device ‘MOSART Semi. 2.4G Keyboard Mouse Mouse’:
Device Enabled (113): 1
Coordinate Transformation Matrix (114): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1
.000000
libinput Natural Scrolling Enabled (250): 0
libinput Natural Scrolling Enabled Default (251): 0
libinput Scroll Methods Available (252): 0, 0, 1
libinput Scroll Method Enabled (253): 0, 0, 0
libinput Scroll Method Enabled Default (254): 0, 0, 0
libinput Button Scrolling Button (255): 2
libinput Button Scrolling Button Default (256): 2
libinput Middle Emulation Enabled (257): 0
libinput Middle Emulation Enabled Default (258): 0
libinput Accel Speed (259): 0.000000
libinput Accel Speed Default (260): 0.000000
libinput Accel Profiles Available (261): 1, 1
libinput Accel Profile Enabled (262): 1, 0
libinput Accel Profile Enabled Default (263): 1, 0
libinput Left Handed Enabled (264): 0
libinput Left Handed Enabled Default (265): 0
libinput Send Events Modes Available (235): 1, 0
libinput Send Events Mode Enabled (236): 0, 0
libinput Send Events Mode Enabled Default (237): 0, 0
Device Node (238): “/dev/input/event1”
Device Product ID (239): 1578, 36870
libinput Drag Lock Buttons (266):
libinput Horizontal Scroll Enabled (267): 1
Warning: There are multiple devices matching ‘MOSART Semi. 2.4G Keyboard Mouse Consumer Control’.
To ensure the correct one is selected, please use the device ID, or prefix the
device name with ‘pointer:’ or ‘keyboard:’ as appropriate.

unable to find device MOSART Semi. 2.4G Keyboard Mouse Consumer Control
Traceback (most recent call last):
File “/zynthian/zynthian-my-data/capture/detect_ts.py”, line 105, in
detectDevice()
File “/zynthian/zynthian-my-data/capture/detect_ts.py”, line 41, in detectDevice
setDevice(device.name, device.path)
File “/zynthian/zynthian-my-data/capture/detect_ts.py”, line 57, in setDevice
props_temp = xinput(‘–list-props’, libinput_name)
File “/zynthian/zynthian-my-data/capture/detect_ts.py”, line 19, in xinput
universal_newlines=True).stdout
File “/usr/lib/python3.7/subprocess.py”, line 487, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command ‘(’/usr/bin/xinput’, ‘–list-props’, ‘MOSART Semi. 2.4G Keyboard Mouse Consumer Control’)’
returned non-zero exit status 1.
xinit: connection

Excellent! As I suspected it is your MOSART multifunction keyboard/mouse thing that is triggering the issue. Will you try this script and see what you get?

detect_ts.py (4.2 KB)

How’s this look?

-----Starting touchscreen detection--------

Found absolute coordinate input devices: [InputDevice(‘/dev/input/event5’), InputDevice(‘/dev/input/event4’), InputDevice(‘/dev/i
nput/event2’)]
Detected press of evdev touch device: ADS7846 Touchscreen /dev/input/event5
Checking xinput device Virtual core pointer Device ‘Virtual core pointer’:
Device Enabled (113): 1
Coordinate Transformation Matrix (114): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1
.000000

Checking xinput device Virtual core XTEST pointer Device ‘Virtual core XTEST pointer’:
Device Enabled (113): 1
Coordinate Transformation Matrix (114): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1
.000000
XTEST Device (232): 1

Checking xinput device MOSART Semi. 2.4G Keyboard Mouse Mouse Device ‘MOSART Semi. 2.4G Keyboard Mouse Mouse’:
Device Enabled (113): 1
Coordinate Transformation Matrix (114): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1
.000000
libinput Natural Scrolling Enabled (250): 0
libinput Natural Scrolling Enabled Default (251): 0
libinput Scroll Methods Available (252): 0, 0, 1
libinput Scroll Method Enabled (253): 0, 0, 0
libinput Scroll Method Enabled Default (254): 0, 0, 0
libinput Button Scrolling Button (255): 2
libinput Button Scrolling Button (255): 2
libinput Button Scrolling Button Default (256): 2
libinput Middle Emulation Enabled (257): 0
libinput Middle Emulation Enabled Default (258): 0
libinput Accel Speed (259): 0.000000
libinput Accel Speed Default (260): 0.000000
libinput Accel Profiles Available (261): 1, 1
libinput Accel Profile Enabled (262): 1, 0
libinput Accel Profile Enabled Default (263): 1, 0
libinput Left Handed Enabled (264): 0
libinput Left Handed Enabled Default (265): 0
libinput Send Events Modes Available (235): 1, 0
libinput Send Events Mode Enabled (236): 0, 0
libinput Send Events Mode Enabled Default (237): 0, 0
Device Node (238): “/dev/input/event1”
Device Product ID (239): 1578, 36870
libinput Drag Lock Buttons (266):
libinput Horizontal Scroll Enabled (267): 1

Warning: There are multiple devices matching ‘MOSART Semi. 2.4G Keyboard Mouse Consumer Control’.
To ensure the correct one is selected, please use the device ID, or prefix the
device name with ‘pointer:’ or ‘keyboard:’ as appropriate.

unable to find device MOSART Semi. 2.4G Keyboard Mouse Consumer Control
Checking xinput device MOSART Semi. 2.4G Keyboard Mouse Consumer Control
Checking xinput device ADS7846 Touchscreen Device ‘ADS7846 Touchscreen’:
Checking xinput device ADS7846 Touchscreen Device ‘ADS7846 Touchscreen’:
Device Enabled (113): 1
Coordinate Transformation Matrix (114): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1
.000000
libinput Calibration Matrix (270): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1
.000000
libinput Calibration Matrix Default (271): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.0
00000, 1.000000
libinput Send Events Modes Available (235): 1, 0
libinput Send Events Mode Enabled (236): 0, 0
libinput Send Events Mode Enabled Default (237): 0, 0
Device Node (238): “/dev/input/event5”
Device Product ID (239): 0, 0

Using xinput ADS7846 Touchscreen Device ‘ADS7846 Touchscreen’:
Device Enabled (113): 1
Coordinate Transformation Matrix (114): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1
.000000
libinput Calibration Matrix (270): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1
.000000
libinput Calibration Matrix Default (271): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.0
00000, 1.000000
libinput Send Events Modes Available (235): 1, 0
libinput Send Events Mode Enabled (236): 0, 0
libinput Send Events Mode Enabled Default (237): 0, 0
Device Node (238): “/dev/input/event5”
libinput Send Events Mode Enabled Default (237): 0, 0
Device Node (238): “/dev/input/event5”
Device Product ID (239): 0, 0

Using xinput ADS7846 Touchscreen Device ‘ADS7846 Touchscreen’:
Device Enabled (113): 1
Coordinate Transformation Matrix (114): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1
.000000
libinput Calibration Matrix (270): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1
.000000
libinput Calibration Matrix Default (271): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.0
00000, 1.000000
libinput Send Events Modes Available (235): 1, 0
libinput Send Events Mode Enabled (236): 0, 0
libinput Send Events Mode Enabled Default (237): 0, 0
Device Node (238): “/dev/input/event5”
Device Product ID (239): 0, 0

Got node: "/dev/input/event5
Detected release of evdev touch device: ADS7846 Touchscreen /dev/input/event5

1 Like

That is great, thanks @Aetro . I have submitted a pull request to fix this which I hope @jofemodo will apply soon.

If anyone is interested in the detail… It looks like @Aetro has a wireless keyboard / mouse connected which was confusing the calibration code and causing it to fail. I have added some exception handling to silently ignore such devices which should allow calibration to complete. Even if I had every input device known to man, I would not have the time to test every one of them!!!

Thanks to @Aetro for patiently working through this issue with me to identify the cause. It’s getting better every day…

5 Likes

Done! Thanks @riban !

1 Like

Cool! @Aetro please update and let us know your progress.

1 Like

Seems to be working as it should now! Thanks everyone!

I do get an “Error” now on splash screen, and I’m having a few other problems. But I think these are a separate issue. So I’ll tool around and see if I can figure it out.