Android 12 usb touch screen are buggy

So I try the stock android 12 tablet mode and when I use a USB touch screen the touch is scale down in the vertical buy horizontal track correctly I try whit two different screen and same thing append but if I connect both screen on windows or on my phone everything work fine BTW I try multiple resolution nothing changes

I have similar issues. If I switch the screen to portrait mode left to right maps to exactly 1 height and up to down maps to exactly one left to right.

I.e swiping down triggers a swipe from left to right and so on… Something funky going on with the Android touchscreen/HID driver on Rock 5B release (possibly others?)

I have it working on Ubuntu. Screen works with windows no problem. Screen works with Samsung DeX no problem. Screen worked with Android on a RPi4 no problem. It comes down to the Rock 5B or rather the Android image for Rock 5B.

Yup, same problem here. Horizontally it works, but the vertical touch is not scaled correctly. The screen works with pi zero. I have to double check on linux.

Would be an A++++ improvement if someone could figure this out… I haven’t been able to find out exactly why this happens but it seems to be spread between different screens at least.

Everything works so much smoother than my old RPi4 but I cannot use it because the touch is all wonky :sob:

I have figured it out, see issue on Github:

2 Likes

Does the solution work for Android too? What to set the file permissions/ownership to when adding it externally?

Yes this solution is specifically for Android.

Make sure to name the idc file with the actual vendor and product IDs as they might not be the same as mine.

I added the file by signing in with adb then “su” for root and creating the file in vi using busybox.

I guess the owner and group became root as i created the file as root.

“busybox vi FILENAME” to edit the file.

1 Like

My rock5 android is not rooted (Radxa android 20221129). I need to add the file by mounting the partition under Linux and adding it from there. But if the owner can be root, it shouldn’t be a problem I then, right?

I see no reason that it shouldn’t work to add it by mounting the file system somewhere else just set permissions the same as the already existing idc files.

Also i have done nothing special with the December 02 release from radxa to be able to be root using su command over adb. Are you sure you can’t become root over adb?

1 Like

I tried your solution as root (used su command over adb) yet when I try to save the file in vi it won’t let me with the message “Read-only file system”. Copying a file over to this /system/usr/idc folder results in the same error message. It doesn’t seem that I have write permissions for this folder even as root.

Are you sure you didn’t root the Rock before doing this? Did you do anything special in order to have write permissions?

I figured it out. I needed to run the following adb commands first:

adb root
adb shell mount -o remount,rw /system

Then I was able to put files in /system/usr/idc.

Unfortunately, this didn’t fix the problem for me. I changed the filename to be the vendor and product id of my touchscreen device, put the file there with the same contents as @massy described, and after a reboot nothing changed.

However, my problem is the same as @Elden but not @massy: it’s a vertical scaling issue. The horizontal scaling is fine, the orientation is fine, but oddly the vertical scaling is very wrong where only a narrow band of the touch screen’s vertical space maps to the entire vertical range of the Android screen. I have tried on another device (Orange Pi 5) and the touch screen works correctly. Changing the resolution of the screen also does nothing.

I am using the latest Android image Rock5B-Android12-rkr12-20230315-gpt

1 Like

Yes as you write you need to remount the filesystem to get write access, glad you figured it out!

It sounds like you have the same issue as me. I think we’ve just confused eachother.

Have you checked the permissions of the idc file? It should be the same as the already existing files in the folder. Also make 100% sure you typed the vendor and product id correctly.

I doubt anything has changed from the older image I am running in this regard.

Edit: Noticed my example was
/system/usr/idc/Vendor_2a94_Product_526.idc
it should be
/system/usr/idc/Vendor_2a94_Product_526d.idc
but that obviosuly only applies if you have the same device as me…

You were spot on with the file permissions - changing the file permissions to 644 fixed it! Touch screen is mapped correctly now. Thank you @massy!!

Afternoon all,

I am using the below screen on a 5A. I have exactly the same issue. X tracks correctly but Y I would describe as magnified/larger than the screen. Using device ID I can see that X is mapped as min 0 max 1279 and Y as min -624 max 1423 so effectively a 1280 by 2047 screen when it should be 1280x800. I have found the IDC folder as above and can pull files from the folder but cannot push due to it being read only.

Can anyone help me on the following?
1 - How do I gain write access to the idc folder? (I tried @zero25 in post 10 but got the error message “mount: ‘system/usr/idc’ not in /proc/mounts”)
My device is not rooted as I am struggling to work out how to accomplish this…

2 - How do I find out the vendor and product id to name the file?

3 - Inside the IDC file is it just as per the link in post 5?

Thank you

https://thepihut.com/products/10-1inch-capacitive-touch-display?variant=42428011118787&currency=GBP&utm_medium=product_sync&utm_source=google&utm_content=sag_organic&utm_campaign=sag_organic&gclid=CjwKCAjwq4imBhBQEiwA9Nx1BlOfEj2xC1PSdr66NXihZf2wMcJ2pj3mi8cODbb1j4oufeWVWWR4WxoC3BwQAvD_BwE

No problems, managed to work it out!!! Although that likely wouldnt have happened without this thread, thank you everyone!

can you share your answer please @Jad ? I am struggling to get files to the android /system/usr/idc folder. i can see it exists on android using an app but when i write from linux via terminal (no adb) it gets discarded.

also, i can’t setup adb since i have no way to get usb from the 5a to my pc.

i’ve also tried creating the file on the android device but since it’s root file system i can’t do it.

for anyone wondering how to do this. u need platform-tools for .adb which can be run in both linux and windows, after that connect over usb and enable usb debugging. from there you need to ./adb root ./adb remount then do ./adb dumpsys input find ur display vendor and product ids, then create a file on your local machine Vendor_YOURVENDORID_Product_YOURPRODUCTID.idc with the contents device device.internal=1 then you can ./adb push Vendor_YOURVENDORID_Product_YOURPRODUCTID.idc /system/usr/idc/ from local to android then you can do ./adb shell and cd /system/usr/idc and finally ls to view ur file is in the correct folder. reboot and u’ve got a screen with the correct config. also make sure usb is plugged to the otg port, altho haven’t verified this is required (not very familiar with android)

thanks to @massy for the fix.

1 Like

sorry Kinjo, just came here to reply! glad youre sorted.

1 Like

i couldn’t debug over ethernet but picked up a cable to save the troubles there.