无法在带有3.5英寸触摸屏的Raspberry Pi 3上成功启动Kivy应用程序

4

我尝试了所有关于在树莓派上安装Kivy的指南。

我的触摸屏完全正常,我不认为Kivy无法正确启动与此有任何关系。

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

例如,在examples/demo/pictures/下运行'python main.py'会给我:

[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

我目前遇到了与Eleduino 10.1英寸电容触摸屏相同的问题。我成功地解决了这个问题,配置文件:~/.kivy/config.ini 进入[input]部分并注释掉所有内容。然后,添加以下行:

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

0

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

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

我明白你的意思。虽然那个特定的配置部分似乎与输入接口有关,但我甚至无法成功启动应用程序。 - Matt Takao

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接