auto launch koreader when opening PDF/DJVU/EPUB/FB2 files in pocketbook

pull/1390/head
chrox 9 years ago
parent 7ac36a460c
commit 5c4651a3d9

@ -9,8 +9,13 @@ KOR_BASE?=base
VERSION=$(shell git describe HEAD)
REVISION=$(shell git rev-parse --short HEAD)
# subdirectory we use to build the installation bundle
export PATH:=$(CURDIR)/$(KOR_BASE)/toolchain/android-toolchain/bin:$(PATH)
# set PATH to find CC in managed toolchains
ifeq ($(TARGET), android)
PATH:=$(CURDIR)/$(KOR_BASE)/$(ANDROID_TOOLCHAIN)/bin:$(PATH)
else ifeq ($(TARGET), pocketbook)
PATH:=$(CURDIR)/$(KOR_BASE)/$(POCKETBOOK_TOOLCHAIN)/bin:$(PATH)
endif
MACHINE?=$(shell PATH=$(PATH) $(CC) -dumpmachine 2>/dev/null)
INSTALL_DIR=koreader-$(MACHINE)
@ -187,24 +192,31 @@ pbupdate: all
rm -f koreader-pocketbook-$(MACHINE)-$(VERSION).zip
# Pocketbook launching script
mkdir -p $(INSTALL_DIR)/applications
mkdir -p $(INSTALL_DIR)/system/bin
mkdir -p $(INSTALL_DIR)/system/config
cp $(POCKETBOOK_DIR)/koreader.app $(INSTALL_DIR)/applications
cp $(POCKETBOOK_DIR)/koreader.app $(INSTALL_DIR)/system/bin
cp $(POCKETBOOK_DIR)/extensions.cfg $(INSTALL_DIR)/system/config
cp -rfL $(INSTALL_DIR)/koreader $(INSTALL_DIR)/applications
# create new package
cd $(INSTALL_DIR) && \
zip -9 -r \
../koreader-pocketbook-$(MACHINE)-$(VERSION).zip \
koreader applications -x "koreader/resources/fonts/*" \
applications system -x "koreader/resources/fonts/*" \
"koreader/resources/icons/src/*" "koreader/spec/*"
# generate koboupdate package index file
zipinfo -1 koreader-pocketbook-$(MACHINE)-$(VERSION).zip > \
$(INSTALL_DIR)/koreader/ota/package.index
echo "koreader/ota/package.index" >> $(INSTALL_DIR)/koreader/ota/package.index
$(INSTALL_DIR)/applications/koreader/ota/package.index
echo "applications/koreader/ota/package.index" >> \
$(INSTALL_DIR)/applications/koreader/ota/package.index
# update index file in zip package
cd $(INSTALL_DIR) && zip -u ../koreader-pocketbook-$(MACHINE)-$(VERSION).zip \
koreader/ota/package.index
applications/koreader/ota/package.index
# make gzip pbupdate for zsync OTA update
cd $(INSTALL_DIR) && \
tar czafh ../koreader-pocketbook-$(MACHINE)-$(VERSION).tar.gz \
-T koreader/ota/package.index --no-recursion
-T applications/koreader/ota/package.index --no-recursion
androidupdate: all
mkdir -p $(ANDROID_LAUNCHER_DIR)/assets/module

@ -6,7 +6,7 @@ KOReader
KOReader is a document viewer application, originally created for Kindle
e-ink readers. It currently runs on Kindle 5 (Touch), Kindle Paperwhite,
Kobo and Android (2.3+) devices. Developers can also run Koreader emulator
Kobo, PocketBook 840 and Android (2.3+) devices. Developers can also run Koreader emulator
for development purpose on desktop PC with Linux or Windows operating system.
Main features for users
@ -120,6 +120,16 @@ To build installable package for Kobo:
make TARGET=kobo clean koboupdate
```
To build installable package for PocketBook you need first to obtain the SDK
from PocketBook:
```
make pocketbook-toolchain
```
then similarly with Kindle and Kobo building run this command:
```
make TARGET=pocketbook clean pbupdate
```
To run, you must call the script `reader.lua`. Run it without arguments to see
usage notes. Note that the script and the `luajit` binary must be in the same
directory.

@ -1 +1 @@
Subproject commit 64ed78a30fd240216123543dd8267ec08c43b70f
Subproject commit 877d3b55cb3d687de2a2e4422395e6624c202c60

@ -11,6 +11,8 @@ local EVT_KEYPRESS = 25
local EVT_KEYUP = 26
local EVT_KEYRELEASE = 26
local EVT_KEYREPEAT = 28
local EVT_FOREGROUND = 151
local EVT_BACKGROUND = 152
local KEY_POWER = 0x01
local KEY_DELETE = 0x08
@ -34,50 +36,52 @@ local KEY_COVERCLOSE = 0x03
local function yes() return true end
local PocketBook = Generic:new{
-- both the following are just for testing similar behaviour
-- see ffi/framebuffer_mxcfb.lua
model = "PocketBook",
isPocketBook = yes,
isTouchDevice = yes,
display_dpi = 212,
touch_dev = "/dev/input/event1", -- probably useless
emu_events_dev = "/var/dev/shm/emu_events",
isInBackGroud = false,
}
function PocketBook:init()
-- this example uses the mxcfb framebuffer driver:
self.screen = require("ffi/framebuffer_mxcfb"):new{device = self, debug = DEBUG}
self.input = require("device/input"):new{
device = self,
debug = DEBUG,
event_map = {
[25] = "LPgBack",
[24] = "LPgFwd",
[1002] = "Power",
}
}
-- we inject an input hook for debugging purposes. You probably don't want
-- it after everything is implemented.
self.input:registerEventAdjustHook(function(_input, ev)
DEBUG("ev", ev)
if ev.type == EVT_KEYDOWN or ev.type == EVT_KEYUP then
ev.code = ev.code
ev.value = ev.type == EVT_KEYDOWN and 1 or 0
ev.type = 1 -- EV_KEY
elseif ev.type == EVT_BACKGROUND then
isInBackGroud = true
self:onPowerEvent("Power")
elseif isInBackGroud and ev.type == EVT_FOREGROUND then
isInBackGroud = false
self:onPowerEvent("Power")
end
end)
-- no backlight management yet
os.remove(self.emu_events_dev)
os.execute("mkfifo " .. self.emu_events_dev)
self.input.open(self.emu_events_dev, 1)
Generic.init(self)
end
-- maybe additional implementations are needed for other models,
-- testing on PocketBook Lux 2 for now.
local PocketBook840 = PocketBook:new{
isTouchDevice = yes,
hasKeys = yes,
display_dpi = 250,
emu_events_dev = "/var/dev/shm/emu_events",
}
function PocketBook840:init()
self.screen = require("ffi/framebuffer_mxcfb"):new{device = self, debug = DEBUG}
self.input = require("device/input"):new{
device = self,
event_map = {
[25] = "LPgBack",
[24] = "LPgFwd",
[1002] = "Power",
}
}
PocketBook.init(self)
end
return PocketBook
-- should check device model before return to support other PocketBook models
return PocketBook840

@ -0,0 +1,10 @@
pdf:@PDF_file:1:koreader.app:ICON_PDF
djvu:@DJVU_file:1:koreader.app:ICON_DJVU
epub:@EPUB_file:1:koreader.app:ICON_EPUB
fb2:@FB2_file:1:koreader.app:ICON_FB2
mobi:@MOBI_file:1:koreader.app:ICON_MOBI
zip:@ZIP_file:1:koreader.app:ICON_ZIP
cbz:@ZIP_file:1:koreader.app:ICON_ZIP

@ -2,7 +2,7 @@
export LC_ALL="en_US.UTF-8"
# working directory of koreader
KOREADER_DIR=/mnt/ext1/koreader
KOREADER_DIR=/mnt/ext1/applications/koreader
# update to new version from OTA directory
NEWUPDATE="${KOREADER_DIR}/ota/koreader.updated.tar"
@ -21,7 +21,13 @@ export TESSDATA_PREFIX="data"
# export dict directory
export STARDICT_DATA_DIR="data/dict"
./reader.lua /mnt/ext1 2> crash.log
if [ `echo $@ | wc -c` -eq 1 ]; then
args="/mnt/ext1/"
else
args="$@"
fi
./reader.lua "$args" 2> crash.log
if pidof reader.lua > /dev/null 2>&1 ; then
killall -TERM reader.lua

Loading…
Cancel
Save