ddvk / remarkable2-framebuffer

remarkable2 framebuffer reversing
MIT License
279 stars 22 forks source link

Client does not work with remarkable.net #66

Open i-am-shodan opened 3 years ago

i-am-shodan commented 3 years ago

When using Remarkable.net error messages can be seen in stdout and the display doesn’t update. The error messages can be tracked back to display refresh code in remarkable.net and specifically the C# ioctl call into libc returning -1.

I debugged this at great length with a debug build of the r2fb client and enabled function level debug logging going to stdout.

The client library was preloaded correctly into dotnet and the function tracer output could be seen. However when the main application (my DLL instead of the dotnet interpreter binary) was running it appeared that the function hooks were not being called at all.

I suspect that the existing open/close/ioctl hooks don’t work at all with dotnet applications.

As a workaround I preloaded the binary but also invoked functions directly in the client library instead of libc. At which point everything worked as expected.

I will put a PR into remarkable.net to call the client libraries directly but long term it might be better to have an API (socket, tcp) to use instead as when the client version number changes remarkable.net will break.

Eeems commented 11 months ago

@i-am-shodan https://github.com/parzivail/ReMarkable.NET/pull/5 this was the PR you mentioned, right?

As for the API, it's not really documented well, but the client does have a protocol that it uses to communicate with the server that can be used. It's using msgsnd to send messages to a message queue that the server handles. It also uses smem_open to allow waiting on updates to complete.

https://github.com/ddvk/remarkable2-framebuffer/blob/833dcbd7d9e87ac91e92ba749b4d3f839b93edef/src/client/main.cpp#L132-L191

i-am-shodan commented 11 months ago

Yeah that would be it

Eeems commented 11 months ago

14 was where progress was previously tracked for getting rm2fb to work with all the frameworks/libraries. It might be safe to close both that issue and this issue. We'll just revisit it when we need to make breaking changes to rm2fb, or if someone wants to change the remarkable.net implementation to directly speak the protocol.