Fall back to GetCanvas() when the task framebuffer is unavailable#24
Fall back to GetCanvas() when the task framebuffer is unavailable#24wonderbeel wants to merge 3 commits into
Conversation
GetCurrentTask()/GetTaskFramebuffer() are only wired up on-device. In the desktop SDK emulator GetCurrentTask() returns -1 and the task framebuffer is null, so Screen::new() panics before anything is drawn. Fall back to the global canvas (GetCanvas) -- the same icanvas_s, populated in both environments. GetTaskFramebufferInfo is likewise task-only, so skip it on the emulator instead of unwrapping a null pointer. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
@wonderbeel, hey, I was wondering how you did the SDK emulator? |
|
@ihrfv I used the one included in the SDK (you can find the last one here https://github.com/Sean-on-Git/PocketBook-SDK I found it on mobile read), I am on vacation right now so I don't have the full script at hand but it isn't too difficult to start it in a Debian host. There is also this full emulator https://codeberg.org/datyoma/pbemu that I found on mobileread that completely emulates a device (it loads a firmware and spin it up with qemu and podman) and here the the framebuffer issue didn't happen, I guess that it was indeed a quirk of the SDK emulator (it doesn't emulate the full device so probably there is some discrepancy under the hood and with stricter checks you find it while it slips undetected in inkview itself). |
simmsb
left a comment
There was a problem hiding this comment.
Heya, thanks for adding this :)
I can't really remember why I have it fetch the framebuffer by using GetTaskFrameBuffer as opposed to just GetCanvas, if I find time I'll try having the library always use GetCanvas.
For a small change like this that is easily testable I don't have a problem with it being LLM generated.
|
Applied the comment, thank you for double checking :). |
Was playing with your bindings yesterday night and noticed that my hello world app was working fine on my physical devices but panicking on the SDK emulator. Pocked at it with help from claude and found that on the emulator the framebuffer task is always null and that it is causing the panic. Let me know if the patch is fine (rust novice, I am starting to use it now to play on my pocketbook) or if you would prefer a different approach to make the emulator work