New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RFC] Remarkable port #1023
[RFC] Remarkable port #1023
Conversation
input/input-remarkable.h
Outdated
#define _KO_INPUT_REMARKABLE_H | ||
|
||
static void generateFakeEvent(int pipefd[2]) { | ||
// TODO anything required here? Sony PRS port monitors battery charge etc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can generate fake events that will be forwarded to the frontend as normal input events. There are a few defined in https://github.com/koreader/koreader-base/blob/master/input/input.c#L36-L41 but you can define more.
Normally is used to notify the program hardware changes, and we use libue to get that info from udev.
Once you have your fake events ready you can react to them in UIManager, but first do note that names are slightly different in the frontend. See how they're named in https://github.com/koreader/koreader/blob/f1f75c5cb0fa063c35f49a84b2e025f1d292ea01/frontend/device/input.lua#L176
Makefile.defs
Outdated
@@ -151,6 +151,10 @@ else ifeq ($(TARGET), sony-prstux) | |||
CHOST?=arm-linux-gnueabihf | |||
export SONY_PRSTUX=1 | |||
export USE_LJ_WPACLIENT=1 | |||
else ifeq ($(TARGET), remarkable) | |||
CHOST?=arm-kobo-linux-gnueabihf |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you using the kobo toolchain from https://github.com/koreader/koxtoolchain?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Kobo tc should work fine but may be targeting somewhat older features.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yea I had forgotten about that, I did use the kobo toolchain from koxtoolchain. I started using the toolchain provided by remarkable but it doesn't have a static libstdc++ library (which the koreader build seems to require).
I will take a look at creating a custom toolchain, I think I compared the kobo/remarkable SoCs and decided that there wasn't much difference in the hardware really, but the remarkable is running a much newer version of the Linux kernel so possibly it's worth building a custom toolchain for that reason.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remarkable's cpuinfo is exactly the same as the Kobo Forma. Not sure about kernel/libc versions in these devices and if is possible to make a new target for both and/or if makes sense. Pinging @NiLuJe
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, then you're in luck ;).
It's not plugged in the koxtoolchain frontend, but the 1.24 branch of my ct-ng tree has a kobomk7 sample, which should be much closer to that ;).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You'll just have to tweak the minimum kernel version (or not, as the Mk7 one is lower and still 4.1.x), and double-check the glibc version, as I'm not sure what poky 2.1.3 was using.
Probably something along those lines, since that's similar the the current Kindle (lab126) TC, IIRC.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Err, now that I think about it, probably best to take it as inspiration only, because it's using mainline GCC instead of the final Linaro GCC 7.5 release, and GCC 8/9 (possibly 10) is still suffering from severe neon performance regressions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At first glance everything looks good. I dunno about that Archlinux change with luarocks will break older debian/ubuntu luarocks versions. Pinging @NiLuJe
Since the Remarkable runs plain linux you might want to port FBInk too. FBInk is used to give feedback on certain actions, like OTA updates. It shouldn't take you too long.
The same with the toolchain. You can pick one of the availables or create one for your device.
BTW, welcome aboard 😄
For reference, the other PR is koreader/koreader#5697. |
Makefile.defs
Outdated
@@ -151,6 +151,10 @@ else ifeq ($(TARGET), sony-prstux) | |||
CHOST?=arm-linux-gnueabihf | |||
export SONY_PRSTUX=1 | |||
export USE_LJ_WPACLIENT=1 | |||
else ifeq ($(TARGET), remarkable) | |||
CHOST?=arm-kobo-linux-gnueabihf |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Kobo tc should work fine but may be targeting somewhat older features.
Makefile.third
Outdated
@@ -682,7 +682,7 @@ $(LUA_SPORE_ROCK): $(THIRDPARTY_DIR)/lua-Spore/*.* | |||
$(CMAKE) $(CMAKE_FLAGS) -DOUTPUT_DIR="$(CURDIR)/$(OUTPUT_DIR)" \ | |||
-DLUA_SPORE_VER=$(LUA_SPORE_VER) -DLD="$(CC)" \ | |||
-DCC="$(CC)" -DCFLAGS="$(CFLAGS) -I$(LUAJIT_DIR)/src" \ | |||
-DLUAROCKS=$(if $(DARWINHOST),"luarocks --lua-dir=/usr/local/opt/lua@5.1",luarocks) \ | |||
-DLUAROCKS=$(if $(DARWINHOST),"luarocks --lua-dir=/usr/local/opt/lua@5.1","luarocks --lua-version=5.1") \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks potentially suspicious; does it work on 2.x or is that just 3.x?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's 3.x only, IIRC.
(For ref., I still patch my local copy w/ http://trac.ak-team.com/trac/browser/niluje/Configs/trunk/Kindle/Misc/koreader-luarocks-3.patch because I'm way too lazy to figure out what's got its panties in a twist ;)).
IIRC, there's some fancy undocumented (on their side) flags for their specific tweaks to waveform shenanigans. Most of it is detailed in the libremarkable sources, if memory serves ;). In any case, for a start, that should be perfectly fine enough. I don't actually recall the extent of their tweaks and if they'd actually be useful here anyway ;). Take that with a grain of salt, I've never ever seen a Remarkable, and I've only ever quickly skimmed libremarkable's code ;). |
I've added event generation for USB plug/unplug and battery charging/discharging. Looks like there is a delay of up to a minute or two for the battery status to change after plug/unplug (watching the uevents with |
You mean like this? I never really looked into the raw stuff. koreader-base/input/input-kobo.h Lines 44 to 56 in 26bdb0b
|
If the plug/unplug events themselves are on time, I wouldn't worry about it too much ;). But speaking of battery, there is sometimes a different state for "plugged and charging" vs. "plugged and not charging". Not sure if that's relevant here, though ;). |
I generate the plug/unplug events from the charger, which seem to be instantaneous. The charging/not-charging comes from the battery device, and its state seems slow to change. So the plugged and charging status are separate. The state usually goes something like:
But you could get plugged+not-charging if the battery is full probably. Looks like kindle & kobo have quite different device setup for usb plug/unplug. I also noticed that the Sony PRS port has a custom input generation function in |
It is in koreader/koreader#4567 Having support for the SonyPRSTux platform is great. But the support wasn't intended for other people outside its contributor. We can safely assume the number of users are <= 1. Maybe I'm wrong, but we lack:
So the only person who is able to give feedback about its state is @v01d and we're not in a hurry to merge PRs because we're sure the author of the port is able to figure out and fix things, even when the fixes never reach this repo. |
ffi/framebuffer_mxcfb.lua
Outdated
@@ -441,6 +452,12 @@ local function refresh_pocketbook(fb, refreshtype, waveform_mode, x, y, w, h) | |||
return mxc_update(fb, C.MXCFB_SEND_UPDATE, refarea, refreshtype, waveform_mode, x, y, w, h) | |||
end | |||
|
|||
local function refresh_remarkable(fb, refreshtype, waveform_mode, x, y, w, h) | |||
local refarea = ffi.new("struct mxcfb_update_data[1]") | |||
refarea[0].temp = C.TEMP_USE_AMBIENT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To match xochitl:
refarea[0].temp = C.TEMP_USE_AMBIENT | |
if waveform_mode == C.WAVEFORM_MODE_DU then | |
refarea[0].temp = C.TEMP_USE_REMARKABLE | |
else | |
refarea[0].temp = C.TEMP_USE_AMBIENT | |
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
ffi/framebuffer_mxcfb.lua
Outdated
self.waveform_fast = C.WAVEFORM_MODE_DU | ||
self.waveform_ui = C.WAVEFORM_MODE_AUTO | ||
self.waveform_flashui = self.waveform_ui | ||
self.waveform_full = C.WAVEFORM_MODE_GC16 | ||
self.waveform_partial = C.WAVEFORM_MODE_AUTO | ||
self.waveform_night = C.WAVEFORM_MODE_GC16 | ||
self.waveform_flashnight = self.waveform_night | ||
self.night_is_reagl = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To match xochitl:
self.waveform_fast = C.WAVEFORM_MODE_DU | |
self.waveform_ui = C.WAVEFORM_MODE_AUTO | |
self.waveform_flashui = self.waveform_ui | |
self.waveform_full = C.WAVEFORM_MODE_GC16 | |
self.waveform_partial = C.WAVEFORM_MODE_AUTO | |
self.waveform_night = C.WAVEFORM_MODE_GC16 | |
self.waveform_flashnight = self.waveform_night | |
self.night_is_reagl = false | |
self.waveform_fast = C.WAVEFORM_MODE_DU | |
self.waveform_ui = C.WAVEFORM_MODE_GL16 | |
self.waveform_flashui = C.WAVEFORM_MODE_GC16 | |
self.waveform_full = C.WAVEFORM_MODE_GC16 | |
self.waveform_partial = C.WAVEFORM_MODE_GL16 | |
self.waveform_night = C.WAVEFORM_MODE_GC16 | |
self.waveform_flashnight = self.waveform_night | |
self.night_is_reagl = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Thanks @NiLuJe for sorting out the waveform mapping & related stuff. I can remove the |
Should be fine, here at least. :-) |
Mostly copied from sony-prstux port
Assumes the koreader systemd unit is installed correctly. Launched koreader when the middle (home) button is held for 3 seconds. Inspired by https://github.com/dixonary/button-capture-reMarkable but significantly simpler.
Port not yet upstream
USB Plug/Unplug, charge status change. Seems to take a minute or two from USB Unplug to the battery state changing to discharging in sysfs.
Rather than reusing kobo toolchain. Built from koxtoolchain.
To get remarkable support
After some testing NiLuJe has figured out the proper mapping Removes a bunch of modes which are just unusable
As recommended by NiLuJe.
Rebased on latest master, removed |
Makefile
Outdated
@@ -29,7 +29,8 @@ all: $(OUTPUT_DIR)/libs $(if $(ANDROID),,$(LUAJIT)) \ | |||
$(if $(or $(DARWIN),$(WIN32),$(ANDROID),$(UBUNTUTOUCH),$(APPIMAGE)),,$(OUTPUT_DIR)/dropbear) \ | |||
$(if $(or $(KINDLE),$(KOBO),$(CERVANTES)),$(OUTPUT_DIR)/sftp-server,) \ | |||
$(if $(or $(DARWIN),$(WIN32)),,$(OUTPUT_DIR)/tar) \ | |||
$(if $(or $(KINDLE),$(KOBO),$(CERVANTES)),$(OUTPUT_DIR)/fbink,) \ | |||
$(if $(or $(KINDLE),$(KOBO),$(CERVANTES),$(REMARKABLE)),$(OUTPUT_DIR)/fbink,) \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That being said, my order comment applies more broadly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reordered
Makefile
Outdated
@@ -95,7 +97,7 @@ libs: \ | |||
$(OUTPUT_DIR)/libs/libkoreader-input.so: input/*.c input/*.h $(if $(KINDLE),$(POPEN_NOSHELL_LIB),) | |||
@echo "Building koreader input module..." | |||
$(CC) $(DYNLIB_CFLAGS) -I$(POPEN_NOSHELL_DIR) -I./input \ | |||
$(if $(KOBO),-DKOBO,) $(if $(KINDLE),-DKINDLE,) $(if $(POCKETBOOK),-DPOCKETBOOK,) $(if $(SONY_PRSTUX),-DSONY_PRSTUX,) $(if $(CERVANTES),-DCERVANTES,)\ | |||
$(if $(KOBO),-DKOBO,) $(if $(KINDLE),-DKINDLE,) $(if $(POCKETBOOK),-DPOCKETBOOK,) $(if $(REMARKABLE),-DREMARKABLE,) $(if $(SONY_PRSTUX),-DSONY_PRSTUX,) $(if $(CERVANTES),-DCERVANTES,)\ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reordered
thirdparty/fbink/CMakeLists.txt
Outdated
set(INSTALL_CMD3 ${CMAKE_COMMAND} -E rename ${SOURCE_DIR}/Release/fbdepth ${BINARY_DIR}/fbdepth) | ||
endif() | ||
endif() | ||
|
||
ko_write_gitclone_script( | ||
GIT_CLONE_SCRIPT_FILENAME | ||
https://github.com/NiLuJe/FBInk.git | ||
tags/v1.20.3 | ||
origin/master |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We really do prefer tags or specific commits.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
master is a moving target. In this case we can prod @NiLuJe to create a new tag, generally speaking just use a hash like b06bd399611875fe98b52e5fdadd6525872dde5c.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've just tagged v1.21.0 ;).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, updated to use v1.21.0
Yeah, I'll tag today or tomorrow ;).
…On Sat, Feb 1, 2020, 15:21 Frans de Jonge ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In thirdparty/fbink/CMakeLists.txt
<#1023 (comment)>
:
> set(INSTALL_CMD3 ${CMAKE_COMMAND} -E rename ${SOURCE_DIR}/Release/fbdepth ${BINARY_DIR}/fbdepth)
endif()
endif()
ko_write_gitclone_script(
GIT_CLONE_SCRIPT_FILENAME
https://github.com/NiLuJe/FBInk.git
- tags/v1.20.3
+ origin/master
master is a moving target. In this case we can prod @NiLuJe
<https://github.com/NiLuJe> to create a new tag, generally speaking just
use a hash like b06bd399611875fe98b52e5fdadd6525872dde5c.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1023?email_source=notifications&email_token=AAA3KZXJZT2JL276IS3ATM3RAWAO7A5CNFSM4J5PTVF2YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCT4VZPQ#discussion_r373782418>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAA3KZRVOBMC2OURSNAIW6TRAWAO7ANCNFSM4J5PTVFQ>
.
|
Includes remarkable support
As on Kobo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing jumps out at me; I'll leave merging to @NiLuJe ;-)
And we're cooking with gas! ;). Thanks! |
* Re-enable HW dithering on Kindle (koreader/koreader-base#1034) * Update SQLite to 3.31.1 (koreader/koreader-base#1035) * reMarkable port (koreader/koreader-base#1023) * zsync2 (koreader/koreader-base#1036)
* Switch to zsync2 Requires koreader/koreader-base#1036 * Simplify FBInk syntax The weird-ass workarounds for -s's subopts handling are no longer needed w/ FBInk >= 1.21.0 * Update base * Re-enable HW dithering on Kindle (koreader/koreader-base#1034) * Update SQLite to 3.31.1 (koreader/koreader-base#1035) * reMarkable port (koreader/koreader-base#1023) * zsync2 (koreader/koreader-base#1036) * zsync2 means we can finally have nice things (OpenStack backed storage) * We also no longer need that insane workaround on ARM * And comment out @chrox's mirror, which appears to be down. * Warn that a malformed URL will horribly blow up in fun and interesting ways
* Switch to zsync2 Requires koreader/koreader-base#1036 * Simplify FBInk syntax The weird-ass workarounds for -s's subopts handling are no longer needed w/ FBInk >= 1.21.0 * Update base * Re-enable HW dithering on Kindle (koreader/koreader-base#1034) * Update SQLite to 3.31.1 (koreader/koreader-base#1035) * reMarkable port (koreader/koreader-base#1023) * zsync2 (koreader/koreader-base#1036) * zsync2 means we can finally have nice things (OpenStack backed storage) * We also no longer need that insane workaround on ARM * And comment out @chrox's mirror, which appears to be down. * Warn that a malformed URL will horribly blow up in fun and interesting ways
I have a remarkable (https://remarkable.com/). The builtin PDF reader was too slow so I did a quick port of koreader. This is mostly based on the Sony PRS port.
I've never worked on koreader before so would appreciate any comments etc.
I display stuff could be improved. I think the remarkable has a modern eink display with reagl and stuff so could probably use better paths for partial updates etc (xochitl, the interface the remarkable ships with, does a good job of low-latency not too flashy updates). I don't really know much about the eink driver stuff so I've just left it alone now things seem to be working...
There's also a pull request open over in koreader/koreader for the other bits and bobs.
This change is