我在Raspberry Pi上使用Kivy,使用新的官方7英寸触摸屏。我正在尝试制作一个利用触摸屏进行简单按钮/手风琴操作的应用程序,但输入没有达到kivy程序。我错过了以下代码中有哪些重要内容?
触摸屏在X中工作正常,我还可以cat / dev / input / event0并在进行多点触控手势时查看缓冲区上的数据。
根据Kivy的说法,我在启动应用程序时肯定会初始化触摸屏:
[INFO ] [Logger ] Record log in /home/pi/.kivy/logs/kivy_15-09-16_22.txt
[INFO ] [Kivy ] v1.9.1-dev
[INFO ] [Python ] v2.7.3 (default, Mar 18 2014, 05:13:23)
[GCC 4.6.3]
[INFO ] [Factory ] 177 symbols loaded
[INFO ] [Image ] Providers: img_tex, img_dds, img_gif, img_pygame (img_pil, img_ffpyplayer ignored)
[INFO ] [Window ] Provider: egl_rpi
[INFO ] [GL ] OpenGL version <OpenGL ES 2.0>
[INFO ] [GL ] OpenGL vendor <Broadcom>
[INFO ] [GL ] OpenGL renderer <VideoCore IV HW>
[INFO ] [GL ] OpenGL parsed version: 2, 0
[INFO ] [GL ] Shading version <OpenGL ES GLSL ES 1.00>
[INFO ] [GL ] Texture max size <2048>
[INFO ] [GL ] Texture max units <8>
[INFO ] [Shader ] fragment shader: <Compiled>
[INFO ] [Shader ] vertex shader: <Compiled>
[INFO ] [Window ] virtual keyboard not allowed, single mode, not docked
[INFO ] [Text ] Provider: pygame
[INFO ] [OSC ] using <multiprocessing> for socket
[INFO ] [ProbeSysfs ] device match: /dev/input/event0
[INFO ] [HIDInput ] Read event from </dev/input/event0>
[INFO ] [Base ] Start application main loop
[INFO ] [HIDMotionEvent] using <FT5406 memory based driver>
[INFO ] [HIDMotionEvent] <FT5406 memory based driver> range ABS X position is 0 - 800
[INFO ] [HIDMotionEvent] <FT5406 memory based driver> range ABS Y position is 0 - 480
[INFO ] [GL ] NPOT texture support is available
[INFO ] [HIDMotionEvent] <FT5406 memory based driver> range position X is 0 - 800
[INFO ] [HIDMotionEvent] <FT5406 memory based driver> range position Y is 0 - 480
我的源代码非常简单:
import kivy
kivy.require('1.0.7')
from kivy.app import App
def button_pressed():
exit(0)
class CarInterfaceApp(App):
pass
if __name__ == '__main__':
CarInterfaceApp().run()
和我的kv文件同样很简单:
#:kivy 1.0
Accordion:
min_space: 60
orientation: 'vertical'
AccordionItem:
title: 'Car'
AccordionItem:
title: 'Music'
AccordionItem:
title: 'Messaging'
答案 0 :(得分:3)
我有两个问题要解决,以便在Arch Linux Arm上运行。
第一个问题是Peter的回答所涵盖的问题 - 我的配置中没有mtdev。我将[input]
的{{1}}部分设置为
~/.kivy/config.ini
第二个问题是stderr
[input]
mouse = mouse
mtdev_%(name)s = probesysfs,provider=mtdev
hid_%(name)s = probesysfs,provider=hidinput
此处的解决方案是使用[INFO ] [ProbeSysfs ] unable to found provider mtdev
[INFO ] [ProbeSysfs ] fallback on hidinput
答案 1 :(得分:2)
事实证明,kivy config.ini的默认配置文件在[input]部分中有provider=hidinput
。如果将其更改为provider=mtdev
,则FT5406正常工作!