Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

no mouse movement or touch in kivy app run from cli in raspberry

I'm just starting with Kivy - I have issues getting the mouse and (multi)touchfunctionality to work. Setup: RPi 3b v1.2, Raspberry os buster 5.4 with desktop & python 3.7.3, using Waveshare DSI touch display Waveshare display drivers were installed: https://github.com/waveshare/LCD-show

Kivy is installed in virtualenv, which I start with source /home/wannes/kivy_venv/bin/activate ('wannes' being my username) Kivy examples are in ~/.local/share/kivy-examples/demo/showcase

I've added this to ~/.kivy/config.ini:

[modules]
touchring = show_cursor=true
[input]
mouse = mouse
#%(name)s = probesysfs,provider=hidinput
mtdev_%(name)s = probesysfs,provider=mtdev
hid_%(name)s = probesysfs,provider=hidinput

When running Kivy apps on the gui (using the e.f. the Kivy showcase example app), I can move around and click with my mouse, but not use the touch or multitouch functionality - I can simulate that with right-mouseclick.

I've been looking around, and I tried with the 'xhost +local:root' command - that give me an error: 'xhost: unable to open display""'

For running Kivy in clu, I did 'sudo usermod -a -G video $(whoami)' to avoid the 'failed to open vchiq instance' error here in cli I can also run Kivy apps - the apps open, but I have no mouse movement, click or touch whatsoever. There is no error, just no mouse or touch when running the Kivy apps straight from the cli.

Any thoughts as to:

  • why there is no mouse click or (multi)-touch functionality when running Kivy in x
  • why there is even no mouse movement when running Kivy apps from cli?

THANKS!!!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Found the solution. First, the waveshare driver has to be setup with the pi user and not any other - in their driver setup files the user pi is hardcoded... Then, the user (other than pi) with which you want to run the Kivy apps, has to be member of the 'input' group: sudo usermod -a -G input $(whoami) Kivy needs access to /dev/input/event0 /event4 and /event5 Waveshare setup give only the pi user access to the input group, which has read access to those devices. Problem solved - at least there is little documentation from Waveshare for setup of their touch driver.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...