Raspberry Pi4 Touch Event Focus/Positioning Issue (2 positions of one click from mouse)

27 views
Skip to first unread message

Peyton

unread,
Jun 26, 2020, 1:58:20 PM6/26/20
to Kivy users support
Hi, I am having some issues with the setup on my raspberry pi4. I believe there is 1 root issue going to my opengl or sdl2 configuration but I am not well versed in these drivers.

Basically when I click I get events in more than one widget of my application. It's as if there are two mouse cursors. Has anyone else seen this problem with pi4 and know a fix. Here is a basic code example where I will see clicks or events in more than one location. One way to demonstrate this without a video is that I added the on-focus method to one of the TextInput widgets. For every click I get a focus event and a defocus event

Click 1:
User focused <kivy.uix.textinput.TextInput object at 0xaee433b0>
User defocused <kivy.uix.textinput.TextInput object at 0xaee433b0>

Click 2:
User focused <kivy.uix.textinput.TextInput object at 0xaee433b0>
User defocused <kivy.uix.textinput.TextInput object at 0xaee433b0>

Click 3:
User focused <kivy.uix.textinput.TextInput object at 0xaee433b0>
User defocused <kivy.uix.textinput.TextInput object at 0xaee433b0>

Tested same code and other examples on windows and never have a problem with position of where click happens or instance of 2 clicks in different positions.

test.py
Enter code here...from kivy.app import App
from kivy.uix.gridlayout import GridLayout


class Test_Page(GridLayout):
def __init__(self, **kwargs):
super(Test_Page, self).__init__(**kwargs)


self.ids.test_text.bind(focus=self.on_focus)

def on_focus(self, instance, value):
if value:
print('User focused', instance)
else:
print('User defocused', instance)


class TestApp(App):
def build(self):
return Test_Page()

if __name__ == '__main__':
TestApp().run()



test.kv
Enter code here...<Test_Page>:
    cols: 2
BoxLayout:
orientation: "horizontal"
TextInput:
id: test_text
multiline: False
Button:
id: button
text: "button"
TextInput:
id: test_text1
#multiline: False
Button:
id: button1
text: "button"

Here is my output:
[INFO   ] [Logger      ] Record log in /home/pi/.kivy/logs/kivy_20-06-26_12.txt
[INFO   ] [Kivy        ] v2.0.0rc2, git-Unknown, 20200527
[INFO   ] [Kivy        ] Installed at "/home/pi/.local/lib/python3.7/site-packages/kivy/__init__.py"
[INFO   ] [Python      ] v3.7.3 (default, Dec 20 2019, 18:57:59) 
[GCC 8.3.0]
[INFO   ] [Python      ] Interpreter at "/usr/bin/python3.7"
[INFO   ] [Factory     ] 184 symbols loaded
[INFO   ] [Image       ] Providers: img_tex, img_dds, img_sdl2, img_pil (img_ffpyplayer, img_gif ignored)
[INFO   ] [Window      ] Provider: sdl2
[INFO   ] [GL          ] Using the "OpenGL" graphics system
[INFO   ] [GL          ] Backend used <sdl2>
[INFO   ] [GL          ] OpenGL version <b'2.1 Mesa 19.3.2'>
[INFO   ] [GL          ] OpenGL vendor <b'Broadcom'>
[INFO   ] [GL          ] OpenGL renderer <b'V3D 4.2'>
[INFO   ] [GL          ] OpenGL parsed version: 2, 1
[INFO   ] [GL          ] Shading version <b'1.20'>
[INFO   ] [GL          ] Texture max size <4096>
[INFO   ] [GL          ] Texture max units <16>
[INFO   ] [Window      ] auto add sdl2 input provider
[INFO   ] [Window      ] virtual keyboard not allowed, single mode, not docked
[INFO   ] [Text        ] Provider: sdl2
[INFO   ] [Clipboard   ] Provider: xclip
[INFO   ] [CutBuffer   ] cut buffer support enabled
[INFO   ] [ProbeSysfs  ] device match: /dev/input/event3
[INFO   ] [HIDInput    ] Read event from </dev/input/event3>
[INFO   ] [ProbeSysfs  ] device match: /dev/input/event1
[INFO   ] [HIDInput    ] Read event from </dev/input/event1>
[INFO   ] [ProbeSysfs  ] device match: /dev/input/event2
[INFO   ] [HIDInput    ] Read event from </dev/input/event2>
[INFO   ] [ProbeSysfs  ] device match: /dev/input/event0
[INFO   ] [HIDInput    ] Read event from </dev/input/event0>
[INFO   ] [Base        ] Start application main loop
[INFO   ] [HIDMotionEvent] using <Logitech USB Receiver System Control >
[INFO   ] [HIDMotionEvent] using <Logitech USB Receiver Mouse >
[INFO   ] [HIDMotionEvent] using <Logitech USB Receiver Consumer Control >
[INFO   ] [HIDMotionEvent] using <Logitech USB Receiver >
[INFO   ] [GL          ] NPOT texture support is available

Wolfmanjm

unread,
Jun 26, 2020, 5:53:43 PM6/26/20
to Kivy users support
Yes this is a common issue. in the inputs section of the kivy config file you have to have ONE input, so either HIDInput OR mtdev but not both, also no mouse=mouse either as that is for xwindows.
If you have a touch screen then you would have 

[input]
mtdev_%(name)s = probesysfs,provider=mtdev

Only

Peyton

unread,
Jun 26, 2020, 10:15:48 PM6/26/20
to Kivy users support
Wolfmanjim, I really appreciate the response. 

I read the thread with a similar problem that involved you and attempted to eliminate mouse=mouse and it didnt work for me. I assumed this was because that person was using a touch screen. Then after reading your response I attempted again and still same problem persisted.

So I started to wonder if my project was even reading the updates I was making directly the the .config file in vi. So just to break it I to I commented out the %(name)s= probesysfs, provider=hid line and now it works!

My config file looks like this: (Note the only line is commented out for any future readers with this problem)
[input]
#%(name)s = probesysfs,provider=hid

So with nothing set to the input the problem was eliminated. I will however at some point be switching to a touchscreen so that is good to know regarding the mtdev line you gave me as well.

Thanks!
Reply all
Reply to author
Forward
0 new messages