Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Readers > PocketBook > PocketBook Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 02-22-2025, 02:45 PM   #1
Mr Dini
Junior Member
Mr Dini began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Feb 2025
Device: PocketBook Basic Lux 4
Looking for framebuffer documentation

Hey,

I recently became a somewhat satisfied owner of a PB Basic Lux 4. Even managed to write some basic GUI apps with C using inkview, but I would love to get fyne (golang GUI framework) to work on this. That would open up many doors and I would be able to write GUI apps in golang.

I took a quick look at libinkview and if I am not mistaken, it doesn't open the framebuffer (fb0) directly, but calls out to libhwconfig.so which opens the device and initializes it.

Is there some docs about the exact commands, what to write, how to initialize whatsoever? I have a very simple use-case. I have a buffer I want to write and I want to display that on the screen directly from golang.

I saw the insane work that was put into https://github.com/NiLuJe/FBInk, but it's not PB specific and quite large... Is there any other resource I could look at? What would you recommend?

I do not have too much experience in this, but I am willing to learn.

Thanks
Mr Dini is offline   Reply With Quote
Old 02-23-2025, 08:47 AM   #2
Mr Dini
Junior Member
Mr Dini began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Feb 2025
Device: PocketBook Basic Lux 4
Actually, I figured out. If anyone else needs something similar, https://github.com/koreader/koreader-base/issues/1202/ is a great read. On the other hand, https://github.com/NiLuJe/FBInk/pull/47/files is a pure gold mine.

Apparently writing to the framebuffer itself is pretty much standard. You first need to obtain VarScreenInfo (0x4600) and FixScreenInfo (0x4602) using ioctl calls and parse the structs. FixScreenInfo has an SmemLen field which you can use to mmap either /dev/fb0 or the userspace library also tries to open /dev/graphics/fb0 if the first one fails. Finally, I can write grayscale pixels to the mapped fb0 based on the width, height (in VarScreenInfo) and lineLength (in FixScreenInfo).

But after doing all that I didn't see a thing. I knew from libinkview that I need to somehow trigger an update. Reverse engineering is really painful, because dynamically mapped functions are called with dynamically extracted values. Thanfully the FBInk implementation figured it out mostly for me. So we need to send MXCFB_SEND_UPDATE ioctl with certain flags. I would love to read more on details such as temp and dithering/waveform modes. For now I just hard-coded the values fbink used too.

Find the final piece of code here: https://gist.github.com/Diniboy1123/...681ae887d10774

Works fine, displays the image on the screen. It's obviously not optimized at all, but I am glad I got it working. Hope it will be helpful to someone.
Mr Dini is offline   Reply With Quote
Advert
Old 02-23-2025, 11:52 AM   #3
orontee
Connoisseur
orontee ought to be getting tired of karma fortunes by now.orontee ought to be getting tired of karma fortunes by now.orontee ought to be getting tired of karma fortunes by now.orontee ought to be getting tired of karma fortunes by now.orontee ought to be getting tired of karma fortunes by now.orontee ought to be getting tired of karma fortunes by now.orontee ought to be getting tired of karma fortunes by now.orontee ought to be getting tired of karma fortunes by now.orontee ought to be getting tired of karma fortunes by now.orontee ought to be getting tired of karma fortunes by now.orontee ought to be getting tired of karma fortunes by now.
 
orontee's Avatar
 
Posts: 83
Karma: 250308
Join Date: Sep 2023
Location: Toulouse, France
Device: Vivlio Touch HD Plus, reMarkable Paper Pro
Quote:
Originally Posted by Mr Dini View Post
Hey,
I saw the insane work that was put into https://github.com/NiLuJe/FBInk, but it's not PB specific and quite large... Is there any other resource I could look at? What would you recommend?
koreader skip the usual initialization offererd by Inkview API (they don't call InkViewMain() to install an event handler) and if I understand well they writes directly to the framebuffer (no call to DrawImage(), etc.). See (and other files with pocketbook in their name in same directory):

https://github.com/koreader/koreader...pocketbook.lua
orontee is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Unsupported framebuffer format bubak Recipes 12 12-04-2021 09:40 AM
K4 and Touch framebuffer changes geekmaster Kindle Developer's Corner 13 05-19-2014 08:08 PM
framebuffer settings for koreader shadoooo Kobo Developer's Corner 15 01-01-2014 11:20 AM
Paperweight has a 4bit framebuffer twobob Kindle Developer's Corner 76 10-06-2012 06:17 PM
Kindle Qt embedded framebuffer driver hassan Kindle Developer's Corner 2 08-20-2011 10:31 PM


All times are GMT -4. The time now is 01:21 AM.


MobileRead.com is a privately owned, operated and funded community.