mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Merge remote-tracking branch 'upstream/master' into native-framebuffer
This commit is contained in:
@@ -13,6 +13,9 @@ local Device = {
|
||||
model = nil,
|
||||
firmware_rev = nil,
|
||||
frontlight = nil,
|
||||
has_no_keyboard = nil,
|
||||
is_touch_device = nil,
|
||||
has_front_light = nil,
|
||||
screen = Screen
|
||||
}
|
||||
|
||||
@@ -60,7 +63,7 @@ function Device:getModel()
|
||||
elseif pw_set[kindle_devcode] then
|
||||
self.model = "KindlePaperWhite"
|
||||
elseif pw2_set[kindle_devcode] then
|
||||
self.model = "KindlePaperWhite"
|
||||
self.model = "KindlePaperWhite2"
|
||||
end
|
||||
else
|
||||
local kg_test_fd = lfs.attributes("/bin/kobo_config.sh")
|
||||
@@ -98,8 +101,11 @@ function Device:isKobo()
|
||||
end
|
||||
|
||||
function Device:hasNoKeyboard()
|
||||
if self.has_no_keyboard ~= nil then return self.has_no_keyboard end
|
||||
local model = self:getModel()
|
||||
return (model == "KindlePaperWhite") or (model == "KindleTouch") or self:isKobo()
|
||||
self.has_no_keyboard = (model == "KindlePaperWhite") or (model == "KindlePaperWhite2")
|
||||
or (model == "KindleTouch") or self:isKobo()
|
||||
return self.has_no_keyboard
|
||||
end
|
||||
|
||||
function Device:hasKeyboard()
|
||||
@@ -107,13 +113,20 @@ function Device:hasKeyboard()
|
||||
end
|
||||
|
||||
function Device:isTouchDevice()
|
||||
if self.is_touch_device ~= nil then return self.is_touch_device end
|
||||
local model = self:getModel()
|
||||
return (model == "KindlePaperWhite") or (model == "KindleTouch") or self:isKobo() or util.isEmulated()
|
||||
self.is_touch_device = (model == "KindlePaperWhite") or (model == "KindlePaperWhite2")
|
||||
or (model == "KindleTouch") or self:isKobo() or util.isEmulated()
|
||||
return self.is_touch_device
|
||||
end
|
||||
|
||||
function Device:hasFrontlight()
|
||||
if self.has_front_light ~= nil then return self.has_front_light end
|
||||
local model = self:getModel()
|
||||
return (model == "KindlePaperWhite") or (model == "Kobo_dragon") or (model == "Kobo_kraken") or (model == "Kobo_phoenix") or util.isEmulated()
|
||||
self.has_front_light = (model == "KindlePaperWhite") or (model == "KindlePaperWhite2")
|
||||
or (model == "Kobo_dragon") or (model == "Kobo_kraken") or (model == "Kobo_phoenix")
|
||||
or util.isEmulated()
|
||||
return self.has_front_light
|
||||
end
|
||||
|
||||
function Device:setTouchInputDev(dev)
|
||||
@@ -206,7 +219,8 @@ function Device:getFrontlight()
|
||||
if self.frontlight ~= nil then
|
||||
return self.frontlight
|
||||
elseif self:hasFrontlight() then
|
||||
if self:getModel() == "KindlePaperWhite" then
|
||||
local model = self:getModel()
|
||||
if model == "KindlePaperWhite" or model == "KindlePaperWhite2" then
|
||||
self.frontlight = KindleFrontLight
|
||||
elseif self:isKobo() then
|
||||
self.frontlight = KoboFrontLight
|
||||
|
||||
@@ -4,12 +4,12 @@ local DEBUG = require("dbg")
|
||||
local Font = {
|
||||
fontmap = {
|
||||
-- default font for menu contents
|
||||
cfont = "freefont/FreeSerif.ttf",
|
||||
cfont = "droid/DroidSans.ttf",
|
||||
-- default font for title
|
||||
--tfont = "NimbusSanL-BoldItal.cff",
|
||||
tfont = "freefont/FreeSerif.ttf",
|
||||
tfont = "droid/DroidSans.ttf",
|
||||
-- default font for footer
|
||||
ffont = "freefont/FreeSerif.ttf",
|
||||
ffont = "droid/DroidSans.ttf",
|
||||
|
||||
-- default font for reading position info
|
||||
rifont = "droid/DroidSans.ttf",
|
||||
@@ -34,8 +34,8 @@ local Font = {
|
||||
},
|
||||
fallbacks = {
|
||||
[1] = "droid/DroidSansFallback.ttf",
|
||||
[2] = "freefont/FreeSans.ttf",
|
||||
[3] = "droid/DroidSans.ttf",
|
||||
[2] = "droid/DroidSans.ttf",
|
||||
[3] = "freefont/FreeSans.ttf",
|
||||
},
|
||||
|
||||
fontdir = os.getenv("FONTDIR") or "./fonts",
|
||||
|
||||
@@ -282,19 +282,17 @@ function Input:init()
|
||||
if not Device:isKobo() then
|
||||
input.open("fake_events")
|
||||
end
|
||||
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")
|
||||
end
|
||||
if dev_mod ~= "KindleTouch" and dev_mod ~= "KindlePaperWhite" then
|
||||
-- event1 in KindleTouch is "imx-yoshi Headset" (useless)
|
||||
-- and we don't have event1 in KindlePaperWhite
|
||||
input.open("/dev/input/event1")
|
||||
end
|
||||
if dev_mod == "KindlePaperWhite" then
|
||||
print(_("Auto-detected Kindle PaperWhite"))
|
||||
Device:setTouchInputDev("/dev/input/event0")
|
||||
input.open("/dev/input/event0")
|
||||
elseif dev_mod == "KindlePaperWhite2" then
|
||||
print(_("Auto-detected Kindle PaperWhite"))
|
||||
Device:setTouchInputDev("/dev/input/event1")
|
||||
input.open("/dev/input/event1")
|
||||
elseif dev_mod == "KindleTouch" then
|
||||
-- event0 in KindleTouch is "WM8962 Beep Generator" (useless)
|
||||
-- event1 in KindleTouch is "imx-yoshi Headset" (useless)
|
||||
Device:setTouchInputDev("/dev/input/event3")
|
||||
input.open("/dev/input/event2") -- Home button
|
||||
input.open("/dev/input/event3") -- touchscreen
|
||||
@@ -370,14 +368,18 @@ function Input:init()
|
||||
end
|
||||
elseif dev_mod == "Kindle4" then
|
||||
print(_("Auto-detected Kindle 4"))
|
||||
input.open("/dev/input/event1")
|
||||
self:adjustKindle4EventMap()
|
||||
elseif dev_mod == "Kindle3" then
|
||||
input.open("/dev/input/event2")
|
||||
print(_("Auto-detected Kindle 3"))
|
||||
input.open("/dev/input/event1")
|
||||
input.open("/dev/input/event2")
|
||||
elseif dev_mod == "KindleDXG" then
|
||||
print(_("Auto-detected Kindle DXG"))
|
||||
input.open("/dev/input/event1")
|
||||
elseif dev_mod == "Kindle2" then
|
||||
print(_("Auto-detected Kindle 2"))
|
||||
input.open("/dev/input/event1")
|
||||
else
|
||||
print(_("Not supported device model!"))
|
||||
os.exit(-1)
|
||||
|
||||
@@ -6,7 +6,7 @@ local ReaderActivityIndicator = EventListener:new{}
|
||||
|
||||
function ReaderActivityIndicator:init()
|
||||
local dev_mod = Device:getModel()
|
||||
if dev_mod == "KindlePaperWhite" or dev_mod == "KindleTouch" then
|
||||
if dev_mod == "KindlePaperWhite" or dev_mod == "KindlePaperWhite2" or dev_mod == "KindleTouch" then
|
||||
require "liblipclua"
|
||||
self.lipc_handle = lipc.init("com.github.koreader.activityindicator")
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user