Page MenuHomeFreeBSD

Fixing a broken touchscreen controller
ClosedPublic

Authored by hselasky on Aug 17 2018, 3:16 PM.
Tags
None
Referenced Files
F78465052: D16772.diff
Sun, Mar 3, 6:42 PM
Unknown Object (File)
Dec 21 2023, 12:50 AM
Unknown Object (File)
Dec 20 2023, 1:13 AM
Unknown Object (File)
Dec 12 2023, 10:35 PM
Unknown Object (File)
Oct 29 2023, 5:18 PM
Unknown Object (File)
Sep 18 2023, 9:44 PM
Unknown Object (File)
Sep 4 2023, 12:30 PM
Unknown Object (File)
Aug 15 2023, 9:54 AM
Subscribers

Details

Summary

In r337289 the touchscreen stop working properly. The model of the

	 touchscreen that stopped working was a Raydium Corporation Raydium
	 Touch System.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Can you explain the change with a few words?

This revision is now accepted and ready to land.Aug 17 2018, 4:21 PM

Can you explain the change with a few words?

A partial revert of the r337289. I am not sure why the change made the driver to stop working.

hselasky requested changes to this revision.EditedAug 20 2018, 12:24 PM
hselasky added a subscriber: wulf.

Hi,

I think your patch is wrong.

Adding @wulf .

--HPS

This revision now requires changes to proceed.Aug 20 2018, 12:24 PM
hselasky edited reviewers, added: wulf; removed: bapt, bdrewery, jhb, dim, gleb, glebius, garga, jhibbits.
hselasky edited reviewers, added: larafercue_gmail.com; removed: hselasky.

Roberto, can you plug the failing device w/o your patch, setting:

sysctl hw.usb.wmt.debug=16

It will help @wulf debug this issue.

Thank you!

hid_report_size() should not be used unconditionally here as it calculates total size of all input reports rather than size of one given report. I guess that something wrong with HID descriptor

Roberto, can you provide some info?

  1. Is wmt.ko fails to attach or it successfully attaches and stays silent?

on attach failure /dev/input/event node is not created an you can see something like

wmt0 on uhub0
wmt0: <ELAN Touchscreen, class 0/0, rev 2.00/0.10, addr 2> on usbus0
wmt0: 10 contacts and [WH]. Report range [0:0] - [3776:2112]
device_attach: wmt0 attach returned 6  <------ Attach error message!!!!
  1. Post your touchscreen's HID descriptor. It can be obtained with usbhid-dump utility (sysutils/usbhid-dump)
  2. Post report size (sc->isize) calculated with hid_report_size() (You should insert debugging printf for it: printf("isize: %d\n", sc->isize); right after hid_report_size() call)
  3. Post report size (sc->isize) calculated with wmt_hid_report_size() with debugging printf.
  4. Post actual report size. To obtain it you should

a. compile wmt with USB_DEBUG option set
b. sysctl hw.usb.wmt.debug=16
c. switch to ttyv0 with alt+F1 and open event device node with e.g. evemu-record (devel/evemu)
d. Do a touch. actual report lenght will be printed on console in wmt_intr_callback line as actlen:

wmt_intr_callback: sc=0xfffff80110ed6000 actlen=116
wmt_process_report: nconts = 1    TIP  WDTH HGHT X    Y    C_ID TL_X TL_Y
wmt_process_report: cont0: data = 0001 0006 0006 00fd 02d3 0004 00fd 02d3 slot = 0

To make things easier I attached the patch that does p.3. and p.4.

--- sys/dev/usb/input/wmt.c
+++ sys/dev/usb/input/wmt.c
@@ -809,6 +809,9 @@ wmt_hid_parse(struct wmt_softc *sc, const void *d_ptr, uint16_t d_len)
 	}
 
 	sc->isize = wmt_hid_report_size(d_ptr, d_len, hid_input, report_id);
+	device_printf(sc->dev, "Report %hhu size: %d\n", report_id, sc->isize);
+	sc->isize = hid_report_size(d_ptr, d_len, hid_input, NULL);
+	device_printf(sc->dev, "Maximum input size: %d\n", sc->isize);
 	sc->cont_max_rlen = wmt_hid_report_size(d_ptr, d_len, hid_feature,
 	    cont_max_rid);
 	if (thqa_cert_rid > 0)

It effectively reverts r337289 and adds required debugging printfs so your attach messge will shown like this:

wmt0 on uhub0
wmt0: <ELAN Touchscreen, class 0/0, rev 2.00/0.10, addr 2> on usbus0
wmt0: Report 1 size: 116
wmt0: Maximum input size: 116
wmt0: 10 contacts and [WH]. Report range [0:0] - [3776:2112]

HID descriptor an actual report length is still needed

In D16772#357775, @wulf wrote:

hid_report_size() should not be used unconditionally here as it calculates total size of all input reports rather than size of one given report. I guess that something wrong with HID descriptor

Roberto, can you provide some info?

  1. Is wmt.ko fails to attach or it successfully attaches and stays silent?

on attach failure /dev/input/event node is not created an you can see something like

wmt0 on uhub0
wmt0: <ELAN Touchscreen, class 0/0, rev 2.00/0.10, addr 2> on usbus0
wmt0: 10 contacts and [WH]. Report range [0:0] - [3776:2112]
device_attach: wmt0 attach returned 6  <------ Attach error message!!!!

I don't see this. What I see is

wmt0: 10 contacts and []. Report range [0:0] - [1920:1080]
  1. Post your touchscreen's HID descriptor. It can be obtained with usbhid-dump utility (sysutils/usbhid-dump)y
  2. Post report size (sc->isize) calculated with hid_report_size() (You should insert debugging printf for it: printf("isize: %d\n", sc->isize); right after hid_report_size() call)
  3. Post report size (sc->isize) calculated with wmt_hid_report_size() with debugging printf.
  4. Post actual report size. To obtain it you should

a. compile wmt with USB_DEBUG option set
b. sysctl hw.usb.wmt.debug=16
c. switch to ttyv0 with alt+F1 and open event device node with e.g. evemu-record (devel/evemu)
d. Do a touch. actual report lenght will be printed on console in wmt_intr_callback line as actlen:

wmt_intr_callback: sc=0xfffff80110ed6000 actlen=116
wmt_process_report: nconts = 1    TIP  WDTH HGHT X    Y    C_ID TL_X TL_Y
wmt_process_report: cont0: data = 0001 0006 0006 00fd 02d3 0004 00fd 02d3 slot = 0
In D16772#357775, @wulf wrote:

hid_report_size() should not be used unconditionally here as it calculates total size of all input reports rather than size of one given report. I guess that something wrong with HID descriptor

Roberto, can you provide some info?

  1. Is wmt.ko fails to attach or it successfully attaches and stays silent?

on attach failure /dev/input/event node is not created an you can see something like

wmt0 on uhub0
wmt0: <ELAN Touchscreen, class 0/0, rev 2.00/0.10, addr 2> on usbus0
wmt0: 10 contacts and [WH]. Report range [0:0] - [3776:2112]
device_attach: wmt0 attach returned 6  <------ Attach error message!!!!

I don't see this error message.

  1. Post your touchscreen's HID descriptor. It can be obtained with usbhid-dump utility (sysutils/usbhid-dump)
  2. Post report size (sc->isize) calculated with hid_report_size() (You should insert debugging printf for it: printf("isize: %d\n", sc->isize); right after hid_report_size() call)
  3. Post report size (sc->isize) calculated with wmt_hid_report_size() with debugging printf.
  4. Post actual report size. To obtain it you should

a. compile wmt with USB_DEBUG option set
b. sysctl hw.usb.wmt.debug=16
c. switch to ttyv0 with alt+F1 and open event device node with e.g. evemu-record (devel/evemu)
d. Do a touch. actual report lenght will be printed on console in wmt_intr_callback line as actlen:

wmt_intr_callback: sc=0xfffff80110ed6000 actlen=116
wmt_process_report: nconts = 1    TIP  WDTH HGHT X    Y    C_ID TL_X TL_Y
wmt_process_report: cont0: data = 0001 0006 0006 00fd 02d3 0004 00fd 02d3 slot = 0

I have applied the patch and the output of dmesg, evemu-record and usbhid-dump are attached.

Please, test this patch on top of unmodified wmt.c:

--- sys/dev/usb/input/wmt.c
+++ sys/dev/usb/input/wmt.c
@@ -521,7 +521,7 @@ wmt_intr_callback(struct usb_xfer *xfer, usb_error_t error)
 
 	case USB_ST_SETUP:
 tr_setup:
-		usbd_xfer_set_frame_len(xfer, 0, sc->isize);
+		usbd_xfer_set_frame_len(xfer, 0, usbd_xfer_max_len(xfer));
 		usbd_transfer_submit(xfer);
 		break;
 	default:

Hi Roberto,

Any news about testing last patch?

In D16772#361521, @wulf wrote:

Hi Roberto,

Any news about testing last patch?

Hi, I didn't have the time to test it until now. It works perfectly, thanks!!

This revision was not accepted when it landed; it landed in state Needs Revision.Sep 4 2018, 7:22 PM
This revision was automatically updated to reflect the committed changes.