MCU-Templates icon indicating copy to clipboard operation
MCU-Templates copied to clipboard

Request: HID Touchscreen for CH552

Open nelsonjchen opened this issue 1 year ago • 17 comments

I've been using and hacking on https://github.com/biemster/3keys_1knob, a derivative of some of your work on Macropads for some cheap AliExpress keyboards.

I see that there's an HID mouse example. That is very neat but it only allows relative movements. I'm interested in sending touchscreen commands. There can be certain UIs that aren't friendly to mouses but are to touchscreens.

I have not been able to hack biemster's 3keys_1knob to the point where the Linux multitouch module is happy. I have been hacking the files in there, but I can't say I know exactly what I'm doing. I got it to the point that Linux knows to load multitouch to it but it's still pretty unhappy and multitouch in dmesg says it "can't get feature 0" or whatever that means. Not sure how I'm messing up the report descriptor.

I see you've been making changes to the templates for CH552. I'm probably going to start from scratch with the updated bases and try again to see if I can make HID Touchscreen "work" at rest without the kernel complaining.

Anyway, a HID touchscreen example that's compatible with Linux multitouch and possibly Windows 8+ for more users would be very much appreciated!

nelsonjchen avatar Jan 07 '24 16:01 nelsonjchen

Arduino prior art:

https://github.com/NicoHood/HID/pull/297/files

nelsonjchen avatar Jan 07 '24 16:01 nelsonjchen

That sounds like an interesting project. Unfortunately, I've never worked with touchscreens before, so I can't help you straight away. The updated templates do not fix any errors or add any new features. They are just slightly optimized and save about 100 bytes of code.

wagiminator avatar Jan 07 '24 17:01 wagiminator

Thanks for your response. I'll continue to keep hacking. If I got something going, I'll be sure to share.

nelsonjchen avatar Jan 07 '24 17:01 nelsonjchen

I'm keeping my fingers crossed for you and I'm looking forward to the result!

wagiminator avatar Jan 07 '24 17:01 wagiminator

I bought a touchscreen off Amazon to compare/steal/capture how it interacts as a touchscreen.

It has a CH554T that talks/makes a touchscreen. Can't find the source though. Hmm.

nelsonjchen avatar Jan 09 '24 23:01 nelsonjchen

Possible source. https://github.com/Remychou/usb-touchsreen. Messy, is the license real, but possibly a good reference and it's likely transformative as we're trying to get it to be a cleaner/SDCC implementation here.

nelsonjchen avatar Jan 10 '24 07:01 nelsonjchen

That looks promising.

wagiminator avatar Jan 10 '24 19:01 wagiminator

Bah the GitHub reply displayed twice in GitHub mobile and I accidentally deleted it.

Anyway, quick summary is the hacking I've been doing seems to cause interrupt troubles. Will rebase to the template to try to sort it out.

Also, not sure if my compilation environment is making something that causes this as well.

nelsonjchen avatar Jan 16 '24 01:01 nelsonjchen

Haven't had much success. Life has been busy but what time I've had with it hasn't been too great. I've decided to go and rebase atop the newest templates and do a hello world with a mouse jiggler on my setup to make sure I can even send reports if necessary.

I can get the LED on my development board to blink, that's great. However, any calls to mouse_move afterwards seem to cause the board to lock up or something. Extremely, extremely frustrating. I'm not sure if it's an issue with SDCC either.

nelsonjchen avatar Feb 20 '24 16:02 nelsonjchen

It took me forever, especially with life stuff, but i have a small hardcoded hello world going now. 😁

https://github.com/nelsonjchen/ch552-touch-play

It touches on a loop.

I need to get my use case going first and foremost and then look to see how to extract it out to a nice PR to this repo someday.

nelsonjchen avatar Apr 08 '24 05:04 nelsonjchen

https://github.com/wagiminator/MCU-Templates/assets/5363/e9416470-748a-424c-a64b-48dd8ea15d02

Hardcoded use case so far so good 😄

nelsonjchen avatar Apr 16 '24 04:04 nelsonjchen

Great!!!

wagiminator avatar Apr 16 '24 18:04 wagiminator

Works for my use case with the comma three. But not my girlfriend's Windows laptop after going to 2 fingers and above for some reason.

Will continue to polish and hopefully PR a working Windows compatible template implementation.

https://youtube.com/shorts/-VjC_3XHyv0?si=vSlsnMmhSsbk-Hsw

nelsonjchen avatar Apr 16 '24 18:04 nelsonjchen

"Productized" repo out.

https://github.com/nelsonjchen/c3-touchkey-keyboard

nelsonjchen avatar Apr 21 '24 04:04 nelsonjchen

Fantastic, this really turned out to be a cool project. Congratulations!!!

wagiminator avatar Apr 21 '24 07:04 wagiminator

Thanks! You and @biemster were the real MVPs!

nelsonjchen avatar Apr 21 '24 16:04 nelsonjchen

https://github.com/nelsonjchen/c3-faux-touch-keyboard/releases/tag/0.0.4 released with a refactor candidate/test for future upstreaming. Am traveling next week for the following two weeks.

Will probably go for MVP with the API for now for upstreaming when back

nelsonjchen avatar May 07 '24 18:05 nelsonjchen