Skip to content

pocketbook: inkview handling rework#2294

Open
benoit-pierre wants to merge 1 commit intokoreader:masterfrom
benoit-pierre:pr/inkview_rework
Open

pocketbook: inkview handling rework#2294
benoit-pierre wants to merge 1 commit intokoreader:masterfrom
benoit-pierre:pr/inkview_rework

Conversation

@benoit-pierre
Copy link
Member

@benoit-pierre benoit-pierre commented Mar 8, 2026

Rely on a new repo collecting different inkview versions: https://github.com/benoit-pierre/pocketbook-inkview.

Add a mechanism to generate a cdefs file handling all our supported inkview versions:

  • generate a dedicated cdefs file for each supported version using our standard ffi-cdecl tool
  • merge all those individual files into a single one (ffi/inkview_h.lua, see base/utils/gen_inkview_h.sh)

The pocketbook code is updated to work like this:

  • instead of directly requiring ffi/inkview_h and loading the inkview shared library, a new ffi/inkview module is required, which will:
    • load the inkview shared library
    • get the library version, and set a global ffi.C.POCKETBOOK_VERSION constant (in major * 100 + minor integer format, for easier comparison)
    • require ffi/inkview_h, which will load the right cdefs based on POCKETBOOK_VERSION
    • return the handle to the shared library
  • pcall based checks for inkview symbols are changed to test POCKETBOOK_VERSION

Supported inkview versions:

  • < 5.5: runtime error: 5.2 (the older inkview version I could find headers for), is not supported; as the layout of iv_mtinfo is not compatible with our inkview-compat code
  • >= 5.5, <= 6.11: explicitly supported; ffi/inkview_h will target the most recent version older or equal to POCKETBOOK_VERSION for which cdefs are available
  • > 6.11: no error is raised at runtime, the code assume the API we rely on is still binary compatible (ffi/inkview_h will target 6.11)

This change is Reviewable

Rely on a new repo collecting different inkview versions: https://github.com/benoit-pierre/pocketbook-inkview.

Add a mechanism to generate a cdefs file handling all our supported inkview versions:
- generate a dedicated cdefs file for each supported version using our standard ffi-cdecl tool
- merge all those individual files into a single one (`ffi/inkview_h.lua`, see `base/utils/gen_inkview_h.sh`)

The pocketbook code is updated to work like this:
- instead of directly requiring `ffi/inkview_h` and loading the inkview shared library,
  a new `ffi/inkview` module is required, which will:
  - load the inkview shared library
  - get the library version, and set a global `ffi.C.POCKETBOOK_VERSION` constant
    (in `major * 100 + minor` integer format, for easier comparison)
  - require `ffi/inkview_h`, which will load the right cdefs based on `POCKETBOOK_VERSION`
  - return the handle to the shared library
- pcall based checks for inkview symbols are changed to test `POCKETBOOK_VERSION`

Supported inkview versions:
- < 5.5: runtime error: 5.2 (the older inkview version I could find headers for), is not
  supported; as the layout of `iv_mtinfo` is not compatible with our inkview-compat code
- >= 5.5, <= 6.11: explicitly supported; `ffi/inkview_h` will target the most recent
  version older or equal to `POCKETBOOK_VERSION` for which cdefs are available
- > 6.11: no error is raised at runtime, the code assume the API we rely on is
  still binary compatible (`ffi/inkview_h` will target 6.11)
@benoit-pierre
Copy link
Member Author

This is of course completely untested, since I don't have access to a pocketbook! :P

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

Successfully merging this pull request may close these issues.

1 participant