canselcik / libremarkable

The only public framework for developing applications with native refresh support for Remarkable Tablet
MIT License
616 stars 56 forks source link

Allow disabling the automatic use of our internal swtfb client by setting an env #118

Closed LinusCDE closed 3 months ago

LinusCDE commented 9 months ago

There was an issue raised at #117 where presumably a new library is used as a shim for rM 2 Framebuffer support, but it doesn't seem to use the offical server, which our client relies on.

In general there had been issues raised that issues could arise even with the official shim if it gets updated but our implementation still does the old behaviour. Such applications would require to be recompiled to use Framebuffer::device instead of Framebuffer::new or otherwise not work.

This PR allows people to make libremarkable choose the old implementation in case the developer didn't care about it anyway / left the choice up to libremarkable.

It is done by setting the lengthy env LIBREMARKABLE_FB_DISFAVOR_INTERNAL_RM2FB to 1, yes or true (case-insensitive). Feel free to suggest a better name, I couldn't think of any.

Package maintainers could also fix arising issues by setting that env in some wrapper script for that binary without the need of any source code change or even re-complication if the binary is recent enough.

Basically this should future proof applications built using libremarkable better.

Havner commented 1 month ago

Hi,

I can't get this to work as intended. Seems that libremarkable doesn't like rm2fb client. I've compile the demo and it works properly (through built-in client). But with this it doesn't work. Has anybody managed to make it work?

(Software 2.15, original rm2fb from toltec, not timower)

reMarkable: /opt/demo/ LD_PRELOAD=/opt/lib/librm2fb_client.so.1 LIBREMARKABLE_FB_DISFAVOR_INTERNAL_RM2FB=1 ./demo
thread 'main' panicked at src/framebuffer/core.rs:206:9:
FBIOGET_VSCREENINFO failed
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
reMarkable: /opt/demo/ LIBREMARKABLE_FB_DISFAVOR_INTERNAL_RM2FB=1 /opt/bin/rm2fb-client ./demo
thread 'main' panicked at src/framebuffer/core.rs:206:9:
FBIOGET_VSCREENINFO failed
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace