Tiny Core Linux

Tiny Core Base => Raspberry Pi => Topic started by: MrToga on May 20, 2022, 08:57:49 AM

Title: Touchscreen on piCore
Post by: MrToga on May 20, 2022, 08:57:49 AM
Hello guys,

I have a touchscreen on piCore but it seem that the axe x are reverse

How can I calibrate my screen ?
Title: Re: Touchscreen on piCore
Post by: MrToga on May 20, 2022, 10:42:29 AM
axis x*
Title: Re: Touchscreen on piCore
Post by: Paul_123 on May 20, 2022, 03:40:38 PM
Its probably easiest to swap it in the touch driver.  But it depends on what touchscreen you have.
Title: Re: Touchscreen on piCore
Post by: patrikg on May 21, 2022, 02:22:42 PM
Is the screen official one ?
You can just edit the config.txt file to swap the screen and the touch.

https://support.thepihut.com/hc/en-us/articles/115002072865-Official-touchscreen-is-upside-down

https://forums.raspberrypi.com/viewtopic.php?t=281149
Title: Re: Touchscreen on piCore
Post by: MrToga on May 24, 2022, 08:58:04 AM
Update :

I needed to install xinput and xrandr, after that I used
Code: [Select]
xinput set-prop <deviceid> "Coordinate Transformation Matrix" -1.1 0 1.02 0 1.05 -0.02 0 0 1link here : https://unix.stackexchange.com/questions/685039/x11-how-to-invert-axis-on-touchscreen-matrix
But now I was wondering if I can make this modification persistent on my rasp I found this but don't know what to do (https://askubuntu.com/questions/20298/how-to-make-xinput-settings-persist-after-devices-are-unplugged-replugged-and)
Title: Re: Touchscreen on piCore
Post by: MrToga on May 25, 2022, 08:47:43 AM
Update :

After searching I found out that you can put a file in xorg.conf.d/ to handle the touchscreen ( https://askubuntu.com/questions/178140/xinput-coordinate-transformation-matrix-in-xorg-conf)
But after putting the file in xorg.conf.d and startx my touchscreen isn't modified by that file (See attached file).

Any toughts ?
Title: Re: Touchscreen on piCore
Post by: Juanito on May 25, 2022, 09:17:58 AM
Assuming you put the snippet in /usr/local/share/X11/xorg.conf.d, do you need MatchIsTouchscreen "on"?
Title: Re: Touchscreen on piCore
Post by: MrToga on May 25, 2022, 09:29:00 AM
Hi juanito,

I just put MatchTouchscreen "on" betwenn Identifier and Driver it still doesn't work (I'm putting the snippet in /usr/local/share/X11/xorg.conf.d).
Maybe it's my syntax.
Any toughts ?
Title: Re: Touchscreen on piCore
Post by: Juanito on May 25, 2022, 09:32:30 AM
Not MatchTouchscreen, but MatchIsTouchscreen...
Title: Re: Touchscreen on piCore
Post by: MrToga on May 25, 2022, 09:38:10 AM
Sorry that's what I wrote in the file but still doesn't work
Title: Re: Touchscreen on piCore
Post by: Juanito on May 25, 2022, 09:39:21 AM
So this doesn't work?

Quote
Section "InputClass"
        Identifier "libinput touchscreen catchall"
        MatchIsTouchscreen "on"
        MatchDevicePath "/dev/input/event*"
        Driver "libinput"
   Option   "TransformationMatrix"   "-1.1 0 1.02 0 1.05 -0.02 0 0 1"
EndSection
Title: Re: Touchscreen on piCore
Post by: MrToga on May 25, 2022, 09:54:26 AM
Yes doesn't work for me
Title: Re: Touchscreen on piCore
Post by: Juanito on May 25, 2022, 10:05:29 AM
Are there any other conf snippets in /usr/local/share/X11/xorg.conf.d that might conflict with this?
Title: Re: Touchscreen on piCore
Post by: MrToga on May 25, 2022, 10:09:08 AM
Maybe the 40-libinput.conf but I can't modify this file since it's in /tmp/tcloop/xf86-input-libinput/usr/local/share/X11/xorg.conf.d/
Plus Xorg execute the file with the lowest number first.
Title: Re: Touchscreen on piCore
Post by: Juanito on May 25, 2022, 10:10:59 AM
What happens if you rename your snippet 50-screen.conf -> 10-screen.conf?
Title: Re: Touchscreen on piCore
Post by: MrToga on May 25, 2022, 10:24:33 AM
Doesn't work either.
I saw a file named 10-quirk so I try to rename the file 09-screen.conf but still don't work
Title: Re: Touchscreen on piCore
Post by: MrToga on May 31, 2022, 05:34:35 AM
Hello guys,

I found something while searching if my touchscreen is really seen as a touchscreen but in Xorg.0.log I saw that my touchscreen driver is seen as a mouse and that he is using the configuration InputClass from 'libinpute pointer catchall' :
Code: [Select]
   53.460] (II) config/udev: Adding input device EloTouchSystems,Inc Elo TouchSystems 2216 AccuTouch® USB Touchmonitor Interface (/dev/input/event4)
[    53.460] (**) EloTouchSystems,Inc Elo TouchSystems 2216 AccuTouch® USB Touchmonitor Interface: Applying InputClass "libinput pointer catchall"
and that Xorg recognise this like I said : 
Code: [Select]
event4  - EloTouchSystems,Inc Elo TouchSystems 2216 AccuTouch® USB Touchmonitor Interface: is tagged by udev as: Mouse
[    53.726] (II) event4  - EloTouchSystems,Inc Elo TouchSystems 2216 AccuTouch® USB Touchmonitor Interface: device is a pointer
Any toughts ?
Title: Re: Touchscreen on piCore
Post by: Juanito on May 31, 2022, 06:42:23 AM
Does the boot code usbhid.mousepoll=0 fix it?
Title: Re: Touchscreen on piCore
Post by: MrToga on May 31, 2022, 07:47:20 AM
Where do I put this line because I don't find any file that show bootcode I only find an option called showbootcode that only shows me what are the oprtion on boot I try to search something like this : http://forum.tinycorelinux.net/index.php?topic=13762.0 /extlinux.conf but didn't find any.

Title: Re: Touchscreen on piCore
Post by: Rich on May 31, 2022, 08:15:06 AM
Hi MrToga
... /extlinux.conf but didn't find any.
Pi uses a different bootloader. Try this:
Code: [Select]
sudo mount /dev/mmcblk0p1
cd /mnt/mmcblk0p1/
Then add it to  cmdline.txt.

Quote
Where do I put this line ...
It's not a separate line. Append it to the existing line.
Title: Re: Touchscreen on piCore
Post by: MrToga on May 31, 2022, 08:27:36 AM
So I added like Rich said but it still say that my touchscreen is a mouse here the cmdline.txt file

Am I in the wrong file ?
Title: Re: Touchscreen on piCore
Post by: Rich on May 31, 2022, 08:48:07 AM
Hi MrToga
It looks like you did it correctly.

Maybe there's an easier way since this worked:
I needed to install xinput and xrandr, after that I used
Code: [Select]
xinput set-prop <deviceid> "Coordinate Transformation Matrix" -1.1 0 1.02 0 1.05 -0.02 0 0 1 ----- Snip -----
But now I was wondering if I can make this modification persistent on my rasp ...
Create a file (any name you want) in the  /home/tc/.X.d  directory containing:
Code: [Select]
xinput set-prop <deviceid> "Coordinate Transformation Matrix" -1.1 0 1.02 0 1.05 -0.02 0 0 1 &Run a backup. Next time you boot, that command will be run automatically right after X starts.
Title: Re: Touchscreen on piCore
Post by: MrToga on May 31, 2022, 09:05:32 AM
Hi Rich,

The problem with xinput is that when you unplug your usb and replug it the driver are set at defaults so the transformation matrix is reset.
Title: Re: Touchscreen on piCore
Post by: Rich on May 31, 2022, 09:50:01 AM
Hi MrToga
I see. This may be a job for udev using a  .rules  file. Do the following:
1.
Code: [Select]
udevadm monitor --property > touch.txt2. Unplug the USB device.
3. Count to 3.
4. Re-plug the USB device.
5. Count to 3.
6. Press  Ctrl-C
7. Attach the  touch.txt  file to your next post.

I'll look at it tonight and see if I can figure out a  .rules  file to handle this.
Title: Re: Touchscreen on piCore
Post by: MrToga on May 31, 2022, 09:56:06 AM
Hi Rich,

Here's the file.
Hope you can find something .
Title: Re: Touchscreen on piCore
Post by: Rich on May 31, 2022, 12:49:53 PM
Hi MrToga
Create a file called  TouchScreen.sh  in your  /home/tc/.local/bin  directory  that looks like this:
Code: [Select]
#!/bin/sh

# Exit if X is not running yet.
[ -z "$DISPLAY" ] && exit

xinput set-prop <deviceid> "Coordinate Transformation Matrix" -1.1 0 1.02 0 1.05 -0.02 0 0 1
Make it executable:
Code: [Select]
chmod 775 .local/bin/TouchScreen.sh
Create a file in the  /home/tc/.X.d  directory containing:
Code: [Select]
TouchScreen.sh &You can name that file anything you want.

Save the attached  98-touch.rules  file to  /etc/udev/rules.d/
Add  etc/udev/rules.d/98-touch.rules  to your backup.
Run a backup.

When you reboot, the file you created in  /home/tc/.X.d  will run  TouchScreen.sh.
Now udev should sense any time your USB device gets plugged in and run  TouchScreen.sh.

    [EDIT]: Attachment removed. See reply #27 for corrected version.  Rich
Title: Re: Touchscreen on piCore
Post by: MrToga on June 01, 2022, 05:39:39 AM
Update :
So after putting all the files like Rich told me. The command worked when I start my X server but when I try to unplug/replug my usb it doesn't work so I used the command :
Code: [Select]
sudo udevd --debugto see if there are problem and I saw something like this after commanting the line in touchscreen (because it return me 0 and doesn't work either) :
Code: [Select]
[ -z "$DISPLAY" ] && exit
Code: [Select]
[1319.071965] [3907] udev_event_spawn: starting '/home/tc/.local/bin/TouchScreen.sh'
[1319.088537] [3899] spawn_read: '/home/tc/.local/bin/TouchScreen.sh'(err) 'Unable to connect to X server'
[1319.090857] [3899] spawn_wait: '/home/tc/.local/bin/TouchScreen.sh' [3907] exit with return code 1
It's strange because I run xhost + and xterm -display my.ip.adress:0.0 to be sure that I can connect and it worked.
Any toughts ?
Title: Re: Touchscreen on piCore
Post by: Rich on June 01, 2022, 08:40:17 AM
Hi MrToga
Save this new attached  98-touch.rules  file to  /etc/udev/rules.d/
Run:
Code: [Select]
sudo udevadm control --reload-rules See if unplugging/replugging the USB works now.
Title: Re: Touchscreen on piCore
Post by: MrToga on June 01, 2022, 08:58:15 AM
Hi Rich,

Thanks a lot it worked now but can you explain me how does the 98-touch.rules file work ?
Title: Re: Touchscreen on piCore
Post by: Rich on June 01, 2022, 09:24:58 AM
Hi MrToga
I'll do my best.

If the current action is not bind, ignore this event.
Code: [Select]
ACTION!="bind", GOTO="touch_end"
If the current subsystem is not usb, ignore this event.
Code: [Select]
SUBSYSTEM!="usb", GOTO="touch_end"
If the vendor ID matches 04e7 and the model ID mathes 0050 ...
Code: [Select]
ENV{ID_VENDOR_ID}=="04e7", ENV{ID_MODEL_ID}=="0050", ...
 ... then run the command inside the quotes:
Code: [Select]
RUN+="/b in/sh -c 'DISPLAY=:0 /home/tc/.local/bin/TouchScreen.sh'"
The values were obtained from the  touch.txt  file you attached in a previous post. The event they were taken
from was the last event that occurred after you plug in the USB (end of file).

More adventures with udev can be found here:
http://forum.tinycorelinux.net/index.php/topic,25540.0.html
Title: Re: Touchscreen on piCore
Post by: MrToga on June 22, 2022, 10:45:27 AM
Hello,

xinput extension submitted