A DSI touchscreen stops responding to touch after a certain ASUS monitor is connected via HDMI
Affected version
OS: Ubuntu 22.04 Mutter version: 42.9 Tested only on Wayland.
Bug summary
A DSI touchscreen stops responding to touch after a certain ASUS monitor is connected via HDMI.
Steps to reproduce
- Connect the DSI monitor.
- Boot into the OS.
- Open any Gnome application such as Folder or Settings, then drag it via DSI panel (touchscreen is functional)
- Connect external HDMI monitor "ASUS VG23AH" specifically, then try to drag the Gnome application again. This issue can be reproduced only with this exact monitor.
What happened
DSI touchscreen is unresponsive to any touch gestures, unable to drag, select or open any application via it.
What did you expect to happen
Touchscreen remains functional no matter what HDMI monitor is connected.
Relevant logs, screenshots, screencasts etc.
There was no crash, any relevant information in logs, but after extensive debugging we have discovered that the following is happening:
-
In guess_candidates, when mutter is trying to match InputDevices to MetaMonitors, it evaluates the candidates and gives them the score.
-
Theoretically, in this part of the code, mutter should recognize and match touchscreen MetaMonitor with its respective device
for (l = monitors; l; l = l->next)
{
MetaOutputMatchType edid_match;
DeviceMatch match = { l->data, 0 };
g_assert (META_IS_MONITOR (l->data));
if (automatic && integrated && match_edid (input, l->data, &edid_match)) // DSI touchscreen does not have edid so we miss this case
match.score |= 1 << edid_match;
if (automatic && integrated && match_size (input, l->data)) // DSI touchscreen does not have udev properties set for size so we miss this case
match.score |= 1 << META_MATCH_SIZE;
if (automatic && builtin && match_builtin (mapper, l->data)) // theoretically, this case should work, because the touchscreen is builtin
match.score |= 1 << META_MATCH_IS_BUILTIN;
if (!automatic && match_config (input, l->data)) // we miss this case because vendor/model/serial properties of DSI touchscreen are unset
match.score |= 1 << META_MATCH_CONFIG;
if (match.score > 0)
g_array_append_val (info->matches, match);
}
but what happens in reality is after all these checks the score of touchscreen is 0.
-
But for the HDMI on the other hand, it reports EDID "ACI", although it's an ASUS. Which in turn matches with touchscreen's product name, which contains the word "Capacitive" in its name, so "ACI" matches with "Cap-aci-tive" because the
strcasestr
function is case-insensitive. -
This results in touchscreen getting score 0, and HDMI monitor getting
edid_match
score, thus being more than 0 and so HDMI monitor is considered to be the touchscreen by mutter while the actual touchscreen is not. -
If the touchscreen is connected to the computer on its own (no HDMI), the touch function works as expected. In
guess_candidates
, the touchscreen still gets the score 0, but later in the function we check if the device is touchscreen and so match it properly.
Proposed solution*
While we recognize that setting certain DSI touchscreen properties and make the match_config
case match could solve the issue, but in our opinion current implementation is logically incorrect. The variable builtin
seems to be just a flag that enables the match_builtin
check and it's always false (for non-wacom devices). But at the same time, later in line 504 we still call meta_monitor_manager_get_laptop_panel
.
We propose to set builtin
to true by default und thus check meta_monitor_manager_get_laptop_panel
earlier in the call. Setting builtin
to true fixes our previously described ASUS/ACI issue.
Downsides of the solution
While the solution is logically more sound than the existing implementation, we cannot gauge the fallout of this change, as I assume many devices rely on the existing logic.