2
0
mirror of https://github.com/koreader/koreader synced 2024-10-31 21:20:20 +00:00

add PocketBook port of Koreader

This commit is contained in:
chrox 2015-01-13 00:14:56 +08:00
parent b476989d3b
commit 1cba495fe0
6 changed files with 71 additions and 12 deletions

View File

@ -18,6 +18,7 @@ INSTALL_DIR=koreader-$(MACHINE)
PLATFORM_DIR=platform
KINDLE_DIR=$(PLATFORM_DIR)/kindle
KOBO_DIR=$(PLATFORM_DIR)/kobo
POCKETBOOK_DIR=$(PLATFORM_DIR)/pocketbook
ANDROID_DIR=$(PLATFORM_DIR)/android
ANDROID_LAUNCHER_DIR:=$(ANDROID_DIR)/luajit-launcher
WIN32_DIR=$(PLATFORM_DIR)/win32
@ -179,6 +180,32 @@ koboupdate: all
tar czafh ../koreader-kobo-$(MACHINE)-$(VERSION).tar.gz \
-T koreader/ota/package.index --no-recursion
pbupdate: all
# ensure that the binaries were built for ARM
file $(INSTALL_DIR)/koreader/luajit | grep ARM || exit 1
# remove old package if any
rm -f koreader-pocketbook-$(MACHINE)-$(VERSION).zip
# Pocketbook launching script
mkdir -p $(INSTALL_DIR)/applications
cp $(POCKETBOOK_DIR)/koreader.app $(INSTALL_DIR)/applications
# create new package
cd $(INSTALL_DIR) && \
zip -9 -r \
../koreader-pocketbook-$(MACHINE)-$(VERSION).zip \
koreader applications -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
# update index file in zip package
cd $(INSTALL_DIR) && zip -u ../koreader-pocketbook-$(MACHINE)-$(VERSION).zip \
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
androidupdate: all
mkdir -p $(ANDROID_LAUNCHER_DIR)/assets/module
-rm $(ANDROID_LAUNCHER_DIR)/assets/module/koreader-*

2
base

@ -1 +1 @@
Subproject commit 941047421763c56ab2d41da73a0e9cf23fea1437
Subproject commit 3ffa5dcb6e70fa1342b07f95ebced4046608990c

View File

@ -8,9 +8,10 @@ local ReaderActivityIndicator = EventListener:new{}
function ReaderActivityIndicator:init()
local dev_mod = Device.model
if dev_mod == "KindlePaperWhite" or dev_mod == "KindlePaperWhite2" or dev_mod == "KindleVoyage" or dev_mod == "KindleBasic" or dev_mod == "KindleTouch" then
require "liblipclua"
if (pcall(require, "liblipclua")) then
self.lipc_handle = lipc.init("com.github.koreader.activityindicator")
end
end
end
function ReaderActivityIndicator:onStartActivityIndicator()

View File

@ -143,8 +143,8 @@ wrapper for FFI input open
Note that we adhere to the "." syntax here for compatibility.
TODO: clean up separation FFI/this
--]]
function Input.open(device)
input.open(device)
function Input.open(device, kobo_events)
input.open(device, kobo_events and 1 or 0)
end
--[[
@ -341,6 +341,7 @@ function Input:handleTouchEv(ev)
local touch_ges = self.gesture_detector:feedEvent(self.MTSlots)
self.MTSlots = {}
if touch_ges then
--DEBUG("ges", touch_ges)
return Event:new("Gesture",
self.gesture_detector:adjustGesCoordinate(touch_ges)
)

View File

@ -6,29 +6,30 @@ 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 = "KindlePaperWhite",
isKindle = yes,
model = "PocketBook",
isPocketBook = yes,
isTouchDevice = yes,
display_dpi = 212,
touch_dev = "/dev/input/event0",
touch_dev = "/dev/input/event1", -- probably useless
emu_events_dev = "/var/dev/shm/emu_events",
}
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}
self.input = require("device/input"):new{device = self, debug = DEBUG}
-- we inject an input hook for debugging purposes. You probably don't want
-- it after everything is implemented.
self.input:registerEventAdjustHook(function(event)
DEBUG("got event:", event)
end)
-- no backlight management yet
self.input.open("/dev/input/event0")
self.input.open("/dev/input/event1")
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

View File

@ -0,0 +1,29 @@
#!/bin/sh
export LC_ALL="en_US.UTF-8"
# working directory of koreader
KOREADER_DIR=/mnt/ext1/koreader
# update to new version from OTA directory
NEWUPDATE="${KOREADER_DIR}/ota/koreader.updated.tar"
INSTALLED="${KOREADER_DIR}/ota/koreader.installed.tar"
if [ -f $NEWUPDATE ]; then
# TODO: any graphic indication for the updating progress?
cd /mnt/ext1/ && tar xf $NEWUPDATE && mv $NEWUPDATE $INSTALLED
fi
# we're always starting from our working directory
cd $KOREADER_DIR
# export trained OCR data directory
export TESSDATA_PREFIX="data"
# export dict directory
export STARDICT_DATA_DIR="data/dict"
./reader.lua /mnt/ext1 2> crash.log
if pidof reader.lua > /dev/null 2>&1 ; then
killall -TERM reader.lua
fi