Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Kobo e-ink devices #1

Open
pazos opened this issue Mar 25, 2018 · 4 comments
Open

Add support for Kobo e-ink devices #1

pazos opened this issue Mar 25, 2018 · 4 comments

Comments

@pazos
Copy link

pazos commented Mar 25, 2018

Awesome project, thank you!!!

On kobos and other linux e-ink ereaders writting to the framebuffer doesn't really works until we update the e-ink display. Could you please point me to the code that writes to the framebuffer?

I would like to port mpd-touch-screen-gui to my kobo aura hd, and maybe other models.

Thanks again

@muesli4
Copy link
Owner

muesli4 commented Mar 25, 2018

Awesome project, thank you!!!

You're welcome. I will try my best to help you although I can't guarantee that it will be easy.

On kobos and other linux e-ink ereaders writting to the framebuffer doesn't really works until we update the e-ink display. Could you please point me to the code that writes to the framebuffer?

There is no code that writes directly to the framebuffer. All drawing is handled by SDL2 with libwtk-sdl2. SDL2 in turn will then use software rendering to write into the framebuffer. On my Raspberry Pi I use it via a kernel module (fbdev) that writes to the framebuffer and then transmits it to the connected LCD. In addition I start an X11 instance but that is not stricly necessary. If you want to run it without X11, directfb should be a possiblity.

Here are basically the paths you can take:

  • Port SDL2 to your Kobo. I'm not sure if that is possible. At least there was a directfb backend for SDL.
  • Port the rendering code to your device.

In order to do the latter you will have to rewrite the following files:

https://github.com/muesli4/libwtk-sdl2/blob/master/src/widget_context.cpp#L44
Event conversion between SDL2 and libwtk-sdl2.

https://github.com/muesli4/libwtk-sdl2/blob/master/src/draw_context.cpp
All of the SDL2 drawing code is here. Except for some transformations with the viewport it should be relatively easy to port.

https://github.com/muesli4/libwtk-sdl2/blob/master/src/texture_view.cpp
I didn't implement a texture manager yet. So this is kind of a compromise.

https://github.com/muesli4/libwtk-sdl2/blob/master/src/font_word_cache.cpp
Font rendering will not be easy. I had to find a way to display some special characters. Therefore bitmap fonts were not flexible enough for me. I cache word textures which usually take 30 to 150 MB of memory. The initial font rendering could also use a lot of battery. But I can only speculate. Maybe you can find a better solution! :)

https://github.com/muesli4/libwtk-sdl2/blob/master/src/sdl_util.cpp
All of the functions depend on SDL2 but most won't be necessary.

In addition, I will provide a commit that typedefs SDL_Rect as I use it quite extensively.

edit: I had a closer look at your code and noticed that you already use SDL. Porting from SDL2 to SDL should be a piece of cake. It is even possible to update the screen only at dirty areas, if that is something you're interested in.

@muesli4
Copy link
Owner

muesli4 commented Mar 25, 2018

I also noticed that I will have to add a license. Does LGPL3 fit you?

@pazos
Copy link
Author

pazos commented Mar 27, 2018

@muesli4 Thanks for your time!!!

Port SDL2 to your Kobo. I'm not sure if that is possible. At least there was a directfb backend for SDL.

Not possible. I'm using fbcon as the video driver and was removed in sdl2. Kobos don't support directfb/x11 drivers.

Porting from SDL2 to SDL should be a piece of cake. It is even possible to update the screen only at dirty areas, if that is something you're interested in.

It would be awesome. I saw that libwtk-sdl2 is also yours, great work! Not sure how difficult is to (back)port that to sdl.

I also noticed that I will have to add a license. Does LGPL3 fit you?

I'm happy with any license that makes me able to study and use your work without you suing me :P 👍

I'll start for setting up the build system. I saw that C++17 is a requirement, and maybe the toolchain provided by the manufacturer (linaro-arm-gnuabihf 2013) is no able to build your code.

Again, thanks

@muesli4
Copy link
Owner

muesli4 commented Mar 27, 2018

Not possible. I'm using fbcon as the video driver and was removed in sdl2. Kobos don't support directfb/x11 drivers.

It would definitely be nice if the code could be shared. However, the easiest solution is a port to SDL1 (replace SDL_Texture with SDL_Surface and SDL_Renderer with surface drawing). I basically went the opposite route (because it was initially SDL1 I didn't use SDL_Renderer initially, see older commits of mpd-touch-screen-gui).

Maybe you can implement a SDL2 backend for fbcon? (I don't know how difficult it is.)

It would be awesome. I saw that libwtk-sdl2 is also yours, great work! Not sure how difficult is to (back)port that to sdl.

My guess is that you won't have to touch mpd-touch-screen-gui at all. All my earlier comments were for libwtk-sdl2.

I'm happy with any license that makes me able to study and use your work without you suing me :P

I'm happy that someone uses it.

I'll start for setting up the build system. I saw that C++17 is a requirement, and maybe the toolchain provided by the manufacturer (linaro-arm-gnuabihf 2013) is no able to build your code.

I fear that is a hard requirement. It uses a lot of modern language and library features of C++17. Replacing them would be a lot of work. (Library features can mostly be replaced with boost equivalents.)

On my Raspberry I compile it via distcc and the arm toolchain on my machine (x-tools-armv7-bin). What's your Kobo's specific CPU architecture?

@muesli4 muesli4 changed the title add support for Kobo e-ink devices Add support for Kobo e-ink devices Aug 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants