rsta2 / circle

A C++ bare metal environment for Raspberry Pi with USB (32 and 64 bit)

Home Page:https://circle-rpi.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unsuportted USB touch screen driver - Big Tree Tech HDMI7

dolence opened this issue · comments

Hi! I've discovered a nice display that are mainly used in 3D printers projects using Raspberry Pi. They are affordable and have an audio jack output, which is very nice to use with MiniDexed and other audio projects.

The thing is, touch isn't supported on Circle. Touch screen calibration tool doesn't recognize this screen, as you can see on the image above:
btt-hdmi7-touch-error

I knwo this display work under Linux, as it work on Klipper/Klipper Screen 3D printer firmware and also on my Ubuntu host. They don't need calibration. I managed to capture the data between the usb display and my computer using Wireshark. Is there anything I can do to try to get this working?

usb_touch.zip

The USB interface 3-1-0, which is provided by this touchscreen, seems to be uncommon to me. But there is some chance, that it will work with Circle, if you add this interface to the USB device factory for HID devices. Can you apply the following patch and try again:

diff --git a/lib/usb/usbdevicefactory.cpp b/lib/usb/usbdevicefactory.cpp
index fe183b1..478a959 100644
--- a/lib/usb/usbdevicefactory.cpp
+++ b/lib/usb/usbdevicefactory.cpp
@@ -94,7 +94,8 @@ CUSBFunction *CUSBDeviceFactory::GetDevice (CUSBFunction *pParent, CString *pNam
 		pResult = new CUSBMouseDevice (pParent);
 	}
 	else if (   pName->Compare ("int3-0-0") == 0
-		 || pName->Compare ("int3-0-2") == 0)
+		 || pName->Compare ("int3-0-2") == 0
+		 || pName->Compare ("int3-1-0") == 0)
 	{
 		CString *pVendor = pParent->GetDevice ()->GetName (DeviceNameVendor);
 		assert (pVendor != 0);

Hey, thank you! Unfortunately the patch didn't worked...

20240211_142242.jpg

OK, here another patch (contains the previous one):

diff --git a/lib/usb/usbdevicefactory.cpp b/lib/usb/usbdevicefactory.cpp
index fe183b1..478a959 100644
--- a/lib/usb/usbdevicefactory.cpp
+++ b/lib/usb/usbdevicefactory.cpp
@@ -94,7 +94,8 @@ CUSBFunction *CUSBDeviceFactory::GetDevice (CUSBFunction *pParent, CString *pNam
 		pResult = new CUSBMouseDevice (pParent);
 	}
 	else if (   pName->Compare ("int3-0-0") == 0
-		 || pName->Compare ("int3-0-2") == 0)
+		 || pName->Compare ("int3-0-2") == 0
+		 || pName->Compare ("int3-1-0") == 0)
 	{
 		CString *pVendor = pParent->GetDevice ()->GetName (DeviceNameVendor);
 		assert (pVendor != 0);
diff --git a/lib/usb/usbhiddevice.cpp b/lib/usb/usbhiddevice.cpp
index eb41e5d..5cd6246 100644
--- a/lib/usb/usbhiddevice.cpp
+++ b/lib/usb/usbhiddevice.cpp
@@ -105,7 +105,8 @@ boolean CUSBHIDDevice::ConfigureHID (unsigned nMaxReportSize)
 	}
 
 	if (   GetInterfaceClass ()    == 3	// HID class
-	    && GetInterfaceSubClass () == 1)	// boot class
+	    && GetInterfaceSubClass () == 1	// boot class
+	    && GetInterfaceProtocol () > 0)
 	{
 		if (GetHost ()->ControlMessage (GetEndpoint0 (),
 						REQUEST_OUT | REQUEST_CLASS | REQUEST_TO_INTERFACE,

It worked! Or kind of...
Now the display got recognized, touch screen tool starts and I can pass through the calibration process. Tried with my LVGL app and unfortunately this happened:

20240211_164723.jpg

EDIT: I think it is more an LVGL issue now, isn't?

100% working after inputing the touch screen data into cmdline.txt. This display outputs 0-4096 for X and Y coordinates. Thank you very much for your time! I'm very glad it worked!

Great that it is working now. I committed the patches to the develop branch and pushed it to the repo. It will be part of the next release. Thanks for testing.

Yes! On Circle and LVGL demos everything is running fine. Your driver update solved it. However, I'm still having those messages saying the vertical or horizontal coordinates are higher then screen resolution on MiniDexed (circle-stdlib). But yeah, it's probably on my side now. Today I will try to get it sorted.

By any chance, could be that the cmdline.txt touchscreeen values are not being parsed on circle-stdlib?

EDIT: I found something. I had a line already on cmdline.txt file. I've it deleted and let the touchscreen line alone and it worked. The line in question was:

usbspeed=full

EDIT 2: OK, I just have found the cmdline.txt parameters need to be on the same line. Everything working as expected!

This modification is in Circle 46.