2

I have Raspberry Pi with 3.5 in TFT (resisitive) touchscreen installed, and small application written in Kivy. When I'm on Desktop then mouse and touch work as expected (in particular are not rotated), however when I'm on kivy application then mouse works as expected (in particular is not rotated), but touch is rotated (when I move finger up, arrow goes right; when I move finger right, arrow goes down; when I move finger down arrow goes left, so it appears that touch is rotated 90 degres (clockwise)).

There was a dispute on the display rotations https://github.com/kivy/kivy/issues/2656 however it didnt't bring me to the final solution yet.

In .kivy/config.ini I have: [input] mouse = mouse mtdev_%(name)s = probesysfs,provider=mtdev hid_%(name)s = probesysfs,provider=hidinput

when I modify the last line to hid_%(name)s = probesysfs,provider=hidinput,param=rotation=270 I have some effect, but not the one I want: touch is affected, but mouse is also affected i.e. rotated (so mouse is spoiled, when I move mouse up, the arrow goes left, etc.).

I tried also pitft = mtdev,/dev/input/touchscreen,max_position_x=240,max_position_y=320,invert_y=0,invert_x=1,rotation=270 of Kivy and 3.5PiTFT and still without success

Question: How to change configuration so only touch is modified (rotated)?

Versions
Python: 2.7.9
OS: Raspian Jessie
Kivy: v1.10.0
Kivy installation method: From package, which is taken form archive.mitako.eu/ jessie
so following instruction "install KivyPie runtime on Raspbian" of http://kivypie.mitako.eu/kivy-faq.html

4 Answers 4

2

I have encountered this precise problem - the screen works fine in desktop mode, but I want to use kivy with Raspbian Lite. (Actually, I'd like to use ArchLinuxARM, but I'm not sure that the Waveshare driver works in Arch). Like jahu20, I found that the display orientation was fine, but the touch orientation is out by 90degrees. GarthFabean's and Matteo Furlan's answers pointed me in the right direction, what is needed in the .kivy/config.ini file is:

[input]
mouse = mouse
%(name)s = probesysfs,provider=hidinput,param=rotation=90
1

I added below to fix, as I had exact same problem. My mouse worked fine, but the touch on Kivy went in opposite direction. When I moved up, cursor went down and vice versa. Please see below

[input]
mouse = mouse
hid_%(name)s = probesysfs, provider=hidinput,param=invert_y=0
1
  • In my case, my touch screen was rotated so I had to use param=invert_x=1. +1, thanks!
    – Drake P
    Commented Mar 23, 2023 at 2:23
1

I am using Kivy 1.10+ and in the .kivy/config.ini file you can find the [graphics] section. There, I have added the rotation=90 option to make it run in vertical mode. But I am running Kivy without xserver so I'm not sure wether the mouse is affected by that.

0

Not sure if anyone else is going to run into this issue however, I had to slightly modify all of the above to get it to work for my instance. This is what worked for me:

mouse = mouse

mtdev_%(name)s = probesysfs,provider=mtdev,param=rotation=90,param=invert_y=1

hid_%(name)s = probesysfs,provider=hidinput

Goodluck all!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.