Repository navigation
Problems with USB touchscreens that pretend to be USB mouse #723
|
(targetting Pi Zero W) I am trying to get a couple of touchscreen displays working. They are an Adafruit 800x480 HDMI backpack with an AR1100 touch controller, and a "7inch HDMI Display-C" (described in lcdwiki). Both of them report as a USB mouse with USB id 4d80:0c02 and 0483:5750 respectively. The Adafruit one uses interface 3-1-2 while the other uses 3-0-0. I am using the sample/10-usbmouse code (compiled against master, not develop branch), and consistently seeing that the USB mouse has 3 buttons, the USB mouse has a wheel, and then what I assume is a stack dump caused by a failing assertion at line 212 in usbmouse.cpp because the condition length<=32 has failed. I'm guessing this means that the report isn't being correctly decoded. I assumed that because it was using a "standard" interface, then it would 'just work' Any suggestions? |
Replies: 13 comments 37 replies
|
USB touchscreens with mouse interface are not fully supported. I would like to have a look at the HID descriptors of the two devices. Can you please apply this patch and take a photo of the boot logs for each device, or (better) capture them using a serial adapter? Thanks. |
|
Thanks. For the first device (Adafruit screen) the capture is adafruit.txt, for the second device (unknown brand) it is unknown.txt Hope they are of use. Obviously if you need anything else, let me know. What kind of descriptor is this supposed to be? |
|
I think the Adafruit device wrongly has a wheel, because a variable has not been cleared in the USB mouse driver. Actually it does not report a wheel and that's why an uninitialized length value is used, which leads to this failed assertion. Probably all tested mice had a wheel, so this problem did not occur so far. I hope this patch fixes the problem: Maybe also the other display works with this (?) in Mouse mode, but it should work in Digitizer (Touch screen) mode, because it reports such usage and it should fit better. A fix for this comes next. |
|
With the attached patch your Unknown display device should work in Digitizer (Touch screen) mode. Can you please test both patches? |
|
Ah yes, the mouse driver does only work with devices, which report
x/y-values between -127 and 127. That's why it was only loaded for
devices with the USB interface "int3-1-2" before. With the commit
fc6f484 it was also loaded for "int3-0-0" interfaces with Mouse
usage in the HID report descriptor. It was probably a mistake to accept
this and I think, I will revert it (including commit 7f60f02).
Digitizer usage will be the only available option for USB touch screens
then.
|
|
Thanks! The device is configured in digitizer mode (as evidenced by the product ID in the vendor string). However, calibration always fails with "Invalid calibration data". I got touch positions for the corners of the screen too, to see what the approximate ranges for X/Y axes are, and they are roughly 0-3980 for X, and 136-3600 for Y. How did you derive the '100' used to validate the calibration data? |
|
Thanks for testing! You can safely set the '100' in the calibrator to
'200'. This was only a best guess. I think the coordinates in your
calib.txt look reasonable so far. Please let us talk about rotation,
when it's clear, that it works all right without ;).
|
|
I adjusted the maximum differences allowed to 250 for X and 200 for Y (by adding a couple of I have two of these devices, so calibrated them both with the AR1100 configuration utility and set them to digitizer mode. Success! Again - many thanks for this; two more pieces of hardware saved from the recycling pile. On the calibration thing, I don't need it at the moment, but I have some screens with XPT touchscreens, which may need it. However, they are further down the stack than I am interested in at the moment. I still have a couple of 7" screens which now configure, but then don't seem to generate any touch events - using the touch calibration I see the display as I would normally, but there is no response. Thanks again. |
|
Yes, the "develop" branch was right. Thanks for testing!
OK, I think we should stop here. Funnily I have a display with the same
"veneef-5" identification and nearly the same HID report descriptor here
and it works without any patches. Unfortunately I'm running out of
ideas, what could be tried. Maybe your display has quirks, which Linux
can handle and Circle cannot. Sometimes one have to decide, if it makes
sense to spend more time on something, and here my answer is no. :(
|
|
Configuration#1 KEDEI display On a clean develop clone, using 28-touchscreen, only #3 and #4 work. Thank you so much - you solved the problem! I would appreciate it if you were able to test whether this change affects your own systems - which I recognise, may take a little time, and it it does not, I would really be grateful if this could be put into the develop branch for later release. Again, many thanks. |
|
GET_REPORT 0x302 requests a special feature report, which only has 2
bytes (the report ID 2, and the number of maximum contacts in the second
byte. GET_REPORT 0x100 requests the normal event report, which is also
sent via the Interrupt endpoint.
AI says, there are displays, which do not support requesting a normal
event report (0x100) using GET_REPORT and deliver the event report only
via the Interrupt endpoint.
I need a list of vendor/device IDs for all of your displays, which
require the 0x302 GET_REPORT request to work. Then I can send it, and
only for these displays. If I would send it for all devices, there would
be some, which will not accept it and will not work. So this is not a
possible solution. Let me know, if you have a better idea.
|
|
Obviously this device has two operation modes, which are represented by
two different USB interfaces. The problem is, how should the driver now,
that the second interface has to be used. This decision could also only
be made based on the vendor/device ID and is not better then.
Did the "veneef-5" not require the 0x302 GET_REPORT request (or the
0x100 GET_REPORT request). I thought nearly all of your displays require
one of them to work. Of course in the driver I would send the 0x302
request only, because it worked for all of your displays. So I expect
the ID list to be longer. Can you clarify this.
|
|
The latest (functioning) patch has been added on the develop branch. I also added a warning log message, which is shown, when the USB mouse driver is loaded for USB HID devices with mouse usage, that will not work. |
The latest (functioning) patch has been added on the develop branch. I also added a warning log message, which is shown, when the USB mouse driver is loaded for USB HID devices with mouse usage, that will not work.