mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
2
base
2
base
Submodule base updated: 442641fa75...5749fbccab
@@ -83,6 +83,7 @@ function Kindle2:init()
|
||||
device = self,
|
||||
event_map = require("device/kindle/event_map_keyboard"),
|
||||
}
|
||||
self.input.open("/dev/input/event0")
|
||||
self.input.open("/dev/input/event1")
|
||||
Kindle.init(self)
|
||||
end
|
||||
@@ -115,6 +116,7 @@ function Kindle4:init()
|
||||
device = self,
|
||||
event_map = require("device/kindle/event_map_kindle4"),
|
||||
}
|
||||
self.input.open("/dev/input/event0")
|
||||
self.input.open("/dev/input/event1")
|
||||
Kindle.init(self)
|
||||
end
|
||||
@@ -289,12 +291,12 @@ local function Set(list)
|
||||
end
|
||||
|
||||
|
||||
local kindle_sn = io.open("/proc/usid", "r")
|
||||
if not kindle_sn then return end
|
||||
local kindle_devcode = string.sub(kindle_sn:read(),3,4)
|
||||
kindle_sn:seek("set")
|
||||
local kindle_devcode_v2 = string.sub(kindle_sn:read(),4,6)
|
||||
kindle_sn:close()
|
||||
local kindle_sn_fd = io.open("/proc/usid", "r")
|
||||
if not kindle_sn_fd then return end
|
||||
local kindle_sn = kindle_sn_fd:read()
|
||||
kindle_sn_fd:close()
|
||||
local kindle_devcode = string.sub(kindle_sn,3,4)
|
||||
local kindle_devcode_v2 = string.sub(kindle_sn,4,6)
|
||||
|
||||
-- NOTE: Update me when new devices come out :)
|
||||
local k2_set = Set { "02", "03" }
|
||||
|
||||
@@ -7,7 +7,11 @@ return {
|
||||
[102] = "Home",
|
||||
[103] = "Up",
|
||||
[104] = "LPgFwd",
|
||||
[105] = "Left",
|
||||
[106] = "Right",
|
||||
[108] = "Down",
|
||||
[109] = "RPgBack",
|
||||
[139] = "Menu",
|
||||
[158] = "Back",
|
||||
[191] = "RPgFwd",
|
||||
[193] = "LPgBack",
|
||||
|
||||
@@ -166,8 +166,9 @@ function MenuItem:init()
|
||||
""..mandatory, true, self.bold).x
|
||||
|
||||
local state_button_width = self.state_size.w or 0
|
||||
local my_text = self.text and ""..self.text or ""
|
||||
w = RenderText:sizeUtf8Text(0, self.dimen.w, self.face,
|
||||
self.text, true, self.bold).x
|
||||
""..my_text, true, self.bold).x
|
||||
if w + mandatory_w + state_button_width >= self.content_width then
|
||||
if Device:hasKeyboard() then
|
||||
self.active_key_events.ShowItemDetail = {
|
||||
@@ -177,7 +178,7 @@ function MenuItem:init()
|
||||
local indicator = " >> "
|
||||
local indicator_w = RenderText:sizeUtf8Text(0, self.dimen.w, self.face,
|
||||
indicator, true, self.bold).x
|
||||
self.text = RenderText:getSubTextByWidth(self.text, self.face,
|
||||
self.text = RenderText:getSubTextByWidth(my_text, self.face,
|
||||
self.content_width - indicator_w - mandatory_w - state_button_width,
|
||||
true, self.bold) .. indicator
|
||||
end
|
||||
|
||||
@@ -121,12 +121,15 @@ export STARDICT_DATA_DIR="data/dict"
|
||||
# export external font directory
|
||||
export EXT_FONT_DIR="/mnt/us/fonts"
|
||||
|
||||
logmsg "Setting up IPTables rules . . ."
|
||||
# accept input ports for zsync plugin
|
||||
iptables -A INPUT -i wlan0 -p udp --dport 5670 -j ACCEPT
|
||||
iptables -A INPUT -i wlan0 -p tcp --dport 49152:49162 -j ACCEPT
|
||||
# accept input ports for calibre companion
|
||||
iptables -A INPUT -i wlan0 -p udp --dport 8134 -j ACCEPT
|
||||
# Only setup IPTables on evices where it makes sense to (FW 5.x & K4)
|
||||
if [ "${INIT_TYPE}" == "upstart" -o "$(uname -r)" == "2.6.31-rt11-lab126" ] ; then
|
||||
logmsg "Setting up IPTables rules . . ."
|
||||
# accept input ports for zsync plugin
|
||||
iptables -A INPUT -i wlan0 -p udp --dport 5670 -j ACCEPT
|
||||
iptables -A INPUT -i wlan0 -p tcp --dport 49152:49162 -j ACCEPT
|
||||
# accept input ports for calibre companion
|
||||
iptables -A INPUT -i wlan0 -p udp --dport 8134 -j ACCEPT
|
||||
fi
|
||||
|
||||
# bind-mount system fonts
|
||||
if ! grep ${KOREADER_DIR}/fonts/host /proc/mounts > /dev/null 2>&1 ; then
|
||||
@@ -235,15 +238,18 @@ fi
|
||||
if [ "${STOP_FRAMEWORK}" == "no" -a "${INIT_TYPE}" == "sysv" ] ; then
|
||||
logmsg "Resuming cvm . . ."
|
||||
killall -cont cvm
|
||||
# We need to handle the screen refresh ourselves, frontend/device/kindle/device.lua's Kindle3.exit is called before we resume cvm ;).
|
||||
echo 'send 139' > /proc/keypad
|
||||
echo 'send 139' > /proc/keypad
|
||||
fi
|
||||
|
||||
# Restart framework (if need be)
|
||||
if [ "${STOP_FRAMEWORK}" == "yes" ] ; then
|
||||
logmsg "Restarting framework . . ."
|
||||
if [ "${INIT_TYPE}" == "sysv" ] ; then
|
||||
/etc/init.d/framework start
|
||||
cd / && env -u LD_LIBRARY_PATH /etc/init.d/framework start
|
||||
else
|
||||
start lab126_gui
|
||||
cd / && env -u LD_LIBRARY_PATH start lab126_gui
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -260,9 +266,11 @@ if [ "${STOP_FRAMEWORK}" == "no" -a "${INIT_TYPE}" == "upstart" ] ; then
|
||||
fi
|
||||
fi
|
||||
|
||||
logmsg "Restoring IPTables rules . . ."
|
||||
# restore firewall rules
|
||||
iptables -D INPUT -i wlan0 -p udp --dport 8134 -j ACCEPT
|
||||
iptables -D INPUT -i wlan0 -p udp --dport 5670 -j ACCEPT
|
||||
iptables -D INPUT -i wlan0 -p tcp --dport 49152:49162 -j ACCEPT
|
||||
if [ "${INIT_TYPE}" == "upstart" -o "$(uname -r)" == "2.6.31-rt11-lab126" ] ; then
|
||||
logmsg "Restoring IPTables rules . . ."
|
||||
# restore firewall rules
|
||||
iptables -D INPUT -i wlan0 -p udp --dport 8134 -j ACCEPT
|
||||
iptables -D INPUT -i wlan0 -p udp --dport 5670 -j ACCEPT
|
||||
iptables -D INPUT -i wlan0 -p tcp --dport 49152:49162 -j ACCEPT
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user