无法在触摸屏上使用3.5在Raspberry Pi 3上成功启动Kivy应用程序

时间:2016-04-26 11:56:08

标签: python kivy egl raspberry-pi3

我遵循了将Kivy安装到Raspberry Pi上的所有指南。

我的触摸屏工作得很好,我不认为Kivy没有正确发射与此有任何关系。

尝试启动各种Kivy演示将导致看似部分启动,但之后它会挂起....也许我的config.ini配置不正确?

例如,运行' python main.py'例如/ demo / pictures /给了我:

[INFO   ] [Logger      ] Record log in /home/pi/.kivy/logs/kivy_16-04-25_12.txt
[INFO   ] [Kivy        ] v1.9.2-dev0
[INFO   ] [Python      ] v2.7.9 (default, Mar  8 2015, 00:52:26)
[GCC 4.9.2]
[INFO   ] [Factory     ] 193 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   ] [GL          ] NPOT texture support is available
[INFO   ] [Text        ] Provider: pygame
[INFO   ] [OSC         ] using <multiprocessing> for socket
[INFO   ] [ProbeSysfs  ] device match: /dev/input/event0
[INFO   ] [MTD         ] Read event from </dev/input/event0>
[INFO   ] [ProbeSysfs  ] device match: /dev/input/event0
[INFO   ] [HIDInput    ] Read event from </dev/input/event0>
[INFO   ] [Base        ] Start application main loop
[INFO   ] [MTD         ] </dev/input/event0> range position X is 0 - 4095
[INFO   ] [MTD         ] </dev/input/event0> range position Y is 0 - 4095
[INFO   ] [MTD         ] </dev/input/event0> range touch major is 0 - 0
[INFO   ] [MTD         ] </dev/input/event0> range touch minor is 0 - 0
[INFO   ] [MTD         ] </dev/input/event0> range pressure is 0 - 255
[INFO   ] [MTD         ] </dev/input/event0> axes invertion: X is 0, Y is 0
[INFO   ] [MTD         ] </dev/input/event0> rotation set to 0
[INFO   ] [HIDMotionEvent] using <ADS7846 Touchscreen>
[INFO   ] [HIDMotionEvent] <ADS7846 Touchscreen> range ABS X position is 0 -     4095
[INFO   ] [HIDMotionEvent] <ADS7846 Touchscreen> range ABS Y position is 0 - 4095
[INFO   ] [HIDMotionEvent] <ADS7846 Touchscreen> range ABS pressure is 0 - 65535

然后它就会永远挂起。没有窗口弹出,没有。

同样的事情是从触摸屏运行,通过SSH运行,并通过tightvncserver远程桌面运行。

更新 没有好消息,但更多细节。使用带有键盘中断的简单应用程序(https://kivy.org/docs/guide/basic.html#quickstart)运行python main.py -c kivy:log_level:trace

[INFO   ] [Logger      ] Record log in /home/pi/.kivy/logs/kivy_16-04-26_17.txt
[INFO   ] [Kivy        ] v1.9.2-dev0
[INFO   ] [Python      ] v2.7.9 (default, Mar  8 2015, 00:52:26)
[GCC 4.9.2]
[INFO   ] [Factory     ] 193 symbols loaded
[DEBUG  ] [Cache       ] register <kv.lang> with limit=None, timeout=None
[TRACE  ] [Builder     ] load file /home/pi/kivy/kivy/data/style.kv
[TRACE  ] [Parser      ] parsing 1271 lines
[TRACE  ] [Parser      ] got directive <kivy 1.0>
[TRACE  ] [Builder     ] build rule for <Label>
[TRACE  ] [Builder     ] build rule for <-Button,-ToggleButton>
[TRACE  ] [Builder     ] build rule for <BubbleContent>
[TRACE  ] [Builder     ] build rule for <BubbleButton>
[TRACE  ] [Builder     ] build rule for <Slider>
[TRACE  ] [Builder     ] build rule for <ProgressBar>
[TRACE  ] [Builder     ] build rule for <SplitterStrip>
[TRACE  ] [Builder     ] build rule for <Scatter>
[TRACE  ] [Builder     ] build rule for <RelativeLayout>
[TRACE  ] [Builder     ] build rule for <Image,AsyncImage>
[TRACE  ] [Builder     ] build rule for <EffectWidget>
[TRACE  ] [Builder     ] build rule for <TabbedPanelContent>
[TRACE  ] [Builder     ] build rule for <TabbedPanelStrip>
[TRACE  ] [Builder     ] build rule for <StripLayout>
[TRACE  ] [Builder     ] build rule for <TabbedPanelHeader>
[TRACE  ] [Builder     ] build rule for <Selector>
[TRACE  ] [Builder     ] build rule for <TextInput>
[TRACE  ] [Builder     ] build rule for <TextInputCutCopyPaste>
[TRACE  ] [Builder     ] build rule for <CodeInput>
[TRACE  ] [Builder     ] build rule for <TreeViewNode>
[TRACE  ] [Builder     ] build rule for <TreeViewLabel>
[TRACE  ] [Builder     ] build rule for <StencilView>
[TRACE  ] [Builder     ] build rule for <FileChooserListLayout>
[TRACE  ] [Builder     ] build rule for <FileChooserListView>
[TRACE  ] [Builder     ] build template for [FileListEntry@FloatLayout+TreeViewNode]
[TRACE  ] [Builder     ] build rule for <FileChooserIconLayout>
[TRACE  ] [Builder     ] build rule for <FileChooserIconView>
[TRACE  ] [Builder     ] build template for [FileIconEntry@Widget]
[TRACE  ] [Builder     ] build rule for <FileChooserProgress>
[TRACE  ] [Builder     ] build rule for <Switch>
[TRACE  ] [Builder     ] build rule for <ModalView>
[TRACE  ] [Builder     ] build rule for <Popup>
[TRACE  ] [Builder     ] build rule for <SpinnerOption>
[TRACE  ] [Builder     ] build rule for <Spinner>
[TRACE  ] [Builder     ] build rule for <ActionBar>
[TRACE  ] [Builder     ] build rule for <ActionView>
[TRACE  ] [Builder     ] build rule for <ActionSeparator>
[TRACE  ] [Builder     ] build rule for <ActionButton,ActionToggleButton>
[TRACE  ] [Builder     ] build rule for <ActionLabel>
[TRACE  ] [Builder     ] build rule for <ActionGroup>
[TRACE  ] [Builder     ] build rule for <ActionCheck>
[TRACE  ] [Builder     ] build rule for <ActionPreviousImage@Image>
[TRACE  ] [Builder     ] build rule for <ActionPreviousButton@Button>
[TRACE  ] [Builder     ] build rule for <ActionPrevious>
[TRACE  ] [Builder     ] build rule for <ActionGroup>
[TRACE  ] [Builder     ] build rule for <ActionOverflow>
[TRACE  ] [Builder     ] build rule for <ActionDropDown>
[TRACE  ] [Builder     ] build template for [AccordionItemTitle@Label]
[TRACE  ] [Builder     ] build rule for <AccordionItem>
[TRACE  ] [Builder     ] build rule for <SettingSpacer>
[TRACE  ] [Builder     ] build rule for <SettingItem>
[TRACE  ] [Builder     ] build rule for <SettingBoolean>
[TRACE  ] [Builder     ] build rule for <SettingString>
[TRACE  ] [Builder     ] build rule for <SettingPath>
[TRACE  ] [Builder     ] build rule for <SettingOptions>
[TRACE  ] [Builder     ] build rule for <SettingTitle>
[TRACE  ] [Builder     ] build rule for <SettingSidebarLabel>
[TRACE  ] [Builder     ] build rule for <SettingsPanel>
[TRACE  ] [Builder     ] build rule for <Settings>
[TRACE  ] [Builder     ] build rule for <InterfaceWithSidebar>
[TRACE  ] [Builder     ] build rule for <InterfaceWithSpinner>
[TRACE  ] [Builder     ] build rule for <MenuSpinner>
[TRACE  ] [Builder     ] build rule for <MenuSidebar>
[TRACE  ] [Builder     ] build rule for <ContentPanel>
[TRACE  ] [Builder     ] build rule for <InterfaceWithTabbedPanel>
[TRACE  ] [Builder     ] build rule for <ScrollView>
[TRACE  ] [Builder     ] build rule for <VideoPlayerPreview>
[TRACE  ] [Builder     ] build rule for <VideoPlayerAnnotation>
[TRACE  ] [Builder     ] build rule for <VideoPlayer>
[TRACE  ] [Builder     ] build rule for <CheckBox>
[TRACE  ] [Builder     ] build rule for <ScreenManager>
[TRACE  ] [Builder     ] build rule for <ColorPicker_Input@TextInput>
[TRACE  ] [Builder     ] build rule for <ColorPicker_Label@Label>
[TRACE  ] [Builder     ] build rule for <ColorPicker_Selector@BoxLayout>
[TRACE  ] [Builder     ] build rule for <ColorWheel>
[TRACE  ] [Builder     ] build rule for <ColorPicker>
[DEBUG  ] [Cache       ] register <kv.image> with limit=None, timeout=60
[DEBUG  ] [Cache       ] register <kv.atlas> with limit=None, timeout=None
[TRACE  ] [Image       ] Unable to use <gif> as loader!
[TRACE  ]
Traceback (most recent call last):
  File "/home/pi/kivy/kivy/core/__init__.py", line 129, in core_register_libs
    level=0)
  File "/home/pi/kivy/kivy/core/image/img_ffpyplayer.py", line 7, in <module>
    import ffpyplayer
ImportError: No module named ffpyplayer
[INFO   ] [Image       ] Providers: img_tex, img_dds, img_gif, img_pygame, img_pil (img_ffpyplayer ignored)
[DEBUG  ] [Cache       ] register <kv.texture> with limit=1000, timeout=60
[DEBUG  ] [Cache       ] register <kv.shader> with limit=1000, timeout=3600
[INFO   ] [Text        ] Provider: pygame
[DEBUG  ] [App         ] Loading kv <./my.kv>
[DEBUG  ] [App         ] kv <./my.kv> not found
[INFO   ] [Window      ] Provider: egl_rpi
[DEBUG  ] [Window      ] Actual display size: 720x480
[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>
[DEBUG  ] [Shader      ] Fragment compiled successfully
[INFO   ] [Shader      ] vertex shader: <Compiled>
[DEBUG  ] [Shader      ] Vertex compiled successfully
[DEBUG  ] [ImagePygame ] Load </home/pi/kivy/kivy/data/glsl/default.png>
[TRACE  ] [Image       ] '/home/pi/kivy/kivy/data/glsl/default.png', populate to textures (1)
[INFO   ] [Window      ] virtual keyboard not allowed, single mode, not docked
[TRACE  ] [Builder     ] Found 1 rules for <kivy.uix.label.Label object at 0x74333458>
[DEBUG  ] [Resource    ] add </usr/share/fonts/truetype> in path list
[DEBUG  ] [Resource    ] add </usr/share/fonts/truetype/freefont> in path list
[DEBUG  ] [Resource    ] add </usr/share/fonts/truetype/roboto> in path list
[DEBUG  ] [Resource    ] add </usr/share/fonts/truetype/openoffice> in path list
[DEBUG  ] [Resource    ] add </usr/share/fonts/truetype/dejavu> in path list
[DEBUG  ] [Resource    ] add </usr/share/fonts/truetype/gentium-basic> in path list
[DEBUG  ] [Resource    ] add </usr/local/share/fonts> in path list
[DEBUG  ] [Resource    ] add </home/pi/kivy/kivy/data/fonts> in path list
[INFO   ] [OSC         ] using <multiprocessing> for socket
[DEBUG  ] [Base        ] Create provider from mouse
[INFO   ] [Base        ] Start application main loop
[INFO   ] [GL          ] NPOT texture support is available
[TRACE  ] [Builder     ] call_fn <kivy.graphics.vertex_instructions.Rectangle object at 0x74317650>, key=size, value=<code object <module> at 0x76553890, file "/home/pi/kivy/kivy/data/style.kv", line 9>, 'self.texture_size'
[TRACE  ] [Builder     ] call_fn => value=[79, 18]
[TRACE  ] [Builder     ] call_fn <kivy.graphics.vertex_instructions.Rectangle object at 0x74317650>, key=texture, value=<code object <module> at 0x76553608, file "/home/pi/kivy/kivy/data/style.kv", line 8>, 'self.texture'
[TRACE  ] [Builder     ] call_fn => value=<Texture hash=1945546224 id=0 size=(79, 18) colorfmt='rgba' bufferfmt='ubyte' source=None observers=1>
[TRACE  ] [Builder     ] call_fn <kivy.graphics.vertex_instructions.Rectangle object at 0x74317650>, key=pos, value=<code object <module> at 0x765538d8, file "/home/pi/kivy/kivy/data/style.kv", line 10>, 'int(self.center_x - self.texture_size[0] / 2.), int(self.center_y - self.texture_size[1] / 2.)'
[TRACE  ] [Builder     ] call_fn => value=(320, 231)
^C[INFO   ] [Base        ] Leaving application in progress...
 Traceback (most recent call last):
   File "main.py", line 11, in <module>
     MyApp().run()
   File "/home/pi/kivy/kivy/app.py", line 828, in run
     runTouchApp()
   File "/home/pi/kivy/kivy/base.py", line 487, in runTouchApp
     EventLoop.window.mainloop()
   File "/home/pi/kivy/kivy/core/window/window_egl_rpi.py", line 89, in mainloop
     self._mainloop()
   File "/home/pi/kivy/kivy/core/window/window_egl_rpi.py", line 84, in _mainloop
     EventLoop.idle()
   File "/home/pi/kivy/kivy/base.py", line 327, in idle
     Clock.tick()
   File "/home/pi/kivy/kivy/clock.py", line 499, in tick
     usleep(1000000 * (sleeptime - sleep_undershoot))
   File "/home/pi/kivy/kivy/clock.py", line 292, in usleep
     _libc_usleep(int(microseconds))
 KeyboardInterrupt

我最好的猜测是它缺少ffpyplayer模块或与EGL有关。

更新2: 好吧,我重新使用Windows Kivy中的基本应用程序来比较日志(应用程序在我的Windows Kivy中成功启动)。 ffplayer错误仍然存​​在,让我相信它是某种EGL问题。

2 个答案:

答案 0 :(得分:0)

也许这个tutorial会帮助你。它使用与您相同的控制器(ADS7846)。只需跳过GPIO部分即可。文件~/.kivy/config.ini中的[input]部分有一部分被更改:

mouse = mouse
mtdev_%(name)s = probesysfs,provider=mtdev
hid_%(name)s = probesysfs,provider=hidinput

答案 1 :(得分:0)

我目前面临与Eleduino 10.1英寸电容式触摸屏相同的问题。我设法解决了配置文件的问题:〜/ .kivy / config.ini 转到[输入]部分并评论所有内容。然后,添加以下行:

    test = mtdev,/dev/input/event3
    ntrig = mtdev,/dev/input/event1