سؤال

Here's the scenario: I've written a gui using the python framework Kivy, and I want to run it on a raspberry pi with this touchscreen. I've done the installation fine, and TSLIB_FBDEVICE=/dev/fb1 TSLIB_TSDEVICE=/dev/input/touchscreen FRAMEBUFFER=/dev/fb1 nohup startx & gets the xwindow desktop gui running fine. I've been unable to get my kivy gui working, though. I was able to get a test tkinter application working ok, by setting the DISPLAY environment variable.

I tried putting the following at the top of my kivy app, but to no avail:

os.environ['SDL_VIDEODRIVER'] = 'fbcon'
os.environ['SDL_FBDEV'] = '/dev/fb1'
os.environ['SDL_MOUSEDRV'] = 'TSLIB'
os.environ['SDL_MOUSEDEV'] = '/dev/input/touchscreen'

When I run my application, this is the debug output:

[INFO   ] [Logger      ] Record log in /home/pi/.kivy/logs/kivy_14-04-21_10.txt
[INFO   ] Kivy v1.8.1-dev
[INFO   ] [Python      ] v2.7.3 (default, Mar 18 2014, 05:13:23) 
[GCC 4.6.3]
[INFO   ] [Factory     ] 157 symbols loaded
[INFO   ] [Image       ] Providers: img_tex, img_dds, img_pygame, img_gif (img_pil ignored)
[INFO   ] [Text        ] Provider: pygame
[INFO   ] [Loader      ] using a thread pool of 2 workers
[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   ] [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 <stmpe-ts>

I don't know much (anything) about framebuffers and such; I'm hoping someone can point me in the right direction. It appears that the above environment variables I mentioned are useful for getting pygame applications to show up, and kivy is built on pygame.

Some links:

  • This is something I'm trying right now, in case both DISPLAY and a FBDEV need to be set. I'm also going to check and see if I have directfb or fbcon actually installed.
  • The relevant kivy google group issue
  • A fork I may try

I've had a hard time finding anything directly on this much later than April of last year.

Any help would be greatly appreciated. Thanks in advance!

هل كانت مفيدة؟

المحلول

This will not works. SPI screen works on SPI which is controlled by your CPU: http://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus

Kivy use the GPU of the Raspberry Pi, not the SPI or X11. As my understanding, displaying an accelerated GLES application on SPI will not work.

Ie, you could confirm this behavior by executing any GLES software from command line outside X11

نصائح أخرى

I found this to work by uncommenting the following line in /boot/config.txt

disable_overscan=1

then starting fbcp

fbcp &

and the running for example the showcase demo (I compile it for kivy for python3.4):

python3.4 kivy/examples/demo/showcase/main.py

kivy running on SPI display

Touch works, except that my y-axis is inverted.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top