mirror of
https://github.com/koreader/koreader
synced 2024-10-31 21:20:20 +00:00
Merge pull request #148 from giorgio130/master
Clean-up for kobo devices
This commit is contained in:
commit
4c1e17ae8f
2
Makefile
2
Makefile
@ -67,7 +67,7 @@ customupdate: all
|
||||
rm -rf $(INSTALL_DIR)
|
||||
# create new dir for package
|
||||
mkdir -p $(INSTALL_DIR)/{history,screenshots,clipboard,libs}
|
||||
cp -p README.md COPYING $(KOR_BASE)/{koreader-base,extr,sdcv} koreader.sh $(LUA_FILES) $(INSTALL_DIR)
|
||||
cp -p README.md COPYING $(KOR_BASE)/{koreader-base,extr,sdcv} koreader.sh koreader_kobo.sh $(LUA_FILES) $(INSTALL_DIR)
|
||||
$(STRIP) --strip-unneeded $(INSTALL_DIR)/koreader-base $(INSTALL_DIR)/extr $(INSTALL_DIR)/sdcv
|
||||
mkdir $(INSTALL_DIR)/data $(INSTALL_DIR)/data/dict $(INSTALL_DIR)/data/tessdata
|
||||
cp -L koreader-base/$(DJVULIB) $(KOR_BASE)/$(CRELIB) \
|
||||
|
@ -8,6 +8,10 @@ Device = {
|
||||
|
||||
function Device:getModel()
|
||||
if self.model then return self.model end
|
||||
if util.isEmulated()==1 then
|
||||
self.model = "Emulator"
|
||||
return self.model
|
||||
end
|
||||
local std_out = io.popen("grep 'MX' /proc/cpuinfo | cut -d':' -f2 | awk {'print $2'}", "r")
|
||||
local cpu_mod = std_out:read()
|
||||
if not cpu_mod then
|
||||
@ -30,7 +34,9 @@ function Device:getModel()
|
||||
if pw_test_fd then
|
||||
self.model = "KindlePaperWhite"
|
||||
elseif kg_test_fd then
|
||||
self.model = "Kobo"
|
||||
local std_out = io.popen("/bin/kobo_config.sh", "r")
|
||||
local codename = std_out:read()
|
||||
self.model = "Kobo_" .. codename
|
||||
elseif kt_test_fd then
|
||||
self.model = "KindleTouch"
|
||||
else
|
||||
@ -69,6 +75,18 @@ function Device:isKindle2()
|
||||
end
|
||||
end
|
||||
|
||||
function Device:isKobo()
|
||||
if not self.model then
|
||||
self.model = self:getModel()
|
||||
end
|
||||
re_val = string.find(self.model,"Kobo_")
|
||||
if re_val == 1 then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
function Device:hasNoKeyboard()
|
||||
if not self.model then
|
||||
self.model = self:getModel()
|
||||
@ -84,7 +102,7 @@ function Device:isTouchDevice()
|
||||
if not self.model then
|
||||
self.model = self:getModel()
|
||||
end
|
||||
return (self.model == "KindlePaperWhite") or (self.model == "KindleTouch") or (self.model == "Kobo") or util.isEmulated()
|
||||
return (self.model == "KindlePaperWhite") or (self.model == "KindleTouch") or self:isKobo() or util.isEmulated()
|
||||
end
|
||||
|
||||
function Device:setTouchInputDev(dev)
|
||||
|
@ -278,10 +278,10 @@ function Input:init()
|
||||
self.event_map = self.sdl_event_map
|
||||
else
|
||||
local dev_mod = Device:getModel()
|
||||
if dev_mod ~= "Kobo" then
|
||||
if not Device:isKobo() then
|
||||
input.open("fake_events")
|
||||
end
|
||||
if dev_mod ~= "KindleTouch" and dev_mod ~= "Kobo" then
|
||||
if dev_mod ~= "KindleTouch" and not Device:isKobo() then
|
||||
-- event0 in KindleTouch is "WM8962 Beep Generator" (useless)
|
||||
Device:setTouchInputDev("/dev/input/event0")
|
||||
input.open("/dev/input/event0")
|
||||
@ -313,11 +313,11 @@ function Input:init()
|
||||
return ev
|
||||
end
|
||||
print(_("Auto-detected Kindle Touch"))
|
||||
elseif dev_mod == "Kobo" then
|
||||
elseif Device:isKobo() then
|
||||
input.open("/dev/input/event1")
|
||||
Device:setTouchInputDev("/dev/input/event1")
|
||||
input.open("/dev/input/event0") -- Light button and sleep slider
|
||||
print("Auto-detected Kobo")
|
||||
print(_("Auto-detected Kobo"))
|
||||
function Input:eventAdjustHook(ev)
|
||||
if ev.type == EV_ABS then
|
||||
if ev.code == ABS_X then
|
||||
|
@ -96,7 +96,15 @@ function Screen:getHeight()
|
||||
end
|
||||
|
||||
function Screen:getDPI()
|
||||
return Device:getModel() == "KindlePaperWhite" and 212 or 167
|
||||
if(Device:getModel() == "KindlePaperWhite") or (Device:getModel() == "Kobo_kraken") then
|
||||
return 212
|
||||
elseif Device:getModel() == "Kobo_dragon" then
|
||||
return 265
|
||||
elseif Device:getModel() == "Kobo_pixie" then
|
||||
return 200
|
||||
else
|
||||
return 167
|
||||
end
|
||||
end
|
||||
|
||||
function Screen:scaleByDPI(px)
|
||||
|
21
koreader_kobo.sh
Normal file
21
koreader_kobo.sh
Normal file
@ -0,0 +1,21 @@
|
||||
#!/bin/sh
|
||||
export LC_ALL="en_US.UTF-8"
|
||||
|
||||
# we're always starting from our working directory
|
||||
cd /mnt/onboard/.kobo/koreader/
|
||||
|
||||
# export trained OCR data directory
|
||||
export TESSDATA_PREFIX="data"
|
||||
|
||||
# export dict directory
|
||||
export STARDICT_DATA_DIR="data/dict"
|
||||
|
||||
# stop nickel
|
||||
killall nickel
|
||||
|
||||
# finally call reader
|
||||
./reader.lua "$1" 2> crash.log
|
||||
|
||||
# continue with nickel
|
||||
|
||||
reboot
|
Loading…
Reference in New Issue
Block a user