Merge pull request #1504 from NiLuJe/master

(Hopefully) minor Kobo tweaks
pull/1505/head
Huang Xin 9 years ago
commit 3c6000fc26

@ -1 +1 @@
Subproject commit fb548638a9ea6c5d498153e357f9111f338ce6fc
Subproject commit bebfc78edcc359a663aaec6dccf36530dd7b0492

@ -66,7 +66,7 @@ end
function OPDSCatalog:onShow()
UIManager:setDirty(self, function()
return "partial", self[1].dimen
return "ui", self[1].dimen
end)
end

@ -133,7 +133,7 @@ function ReaderBookmark:onToggleBookmark()
end
self:toggleBookmark(pn_or_xp)
self.view.dogear_visible = not self.view.dogear_visible
UIManager:setDirty(self.view.dialog, "partial")
UIManager:setDirty(self.view.dialog, "ui")
return true
end

@ -73,7 +73,7 @@ end
function PageCropDialog:onShow()
UIManager:setDirty(self, function()
return "partial", self[1].dimen:combine(self[2].dimen)
return "ui", self[1].dimen:combine(self[2].dimen)
end)
return true
end

@ -346,7 +346,7 @@ function ReaderFooter:onTapFooter(arg, ges)
else
self:updateFooterPos()
end
UIManager:setDirty(self.view.dialog, "partial", self[1][1][1].dimen)
UIManager:setDirty(self.view.dialog, "ui", self[1][1][1].dimen)
return true
end

@ -41,8 +41,8 @@ local KoboDahlia = Kobo:new{
hasFrontlight = yes,
touch_phoenix_protocol = true,
display_dpi = 265,
-- bezel:
viewport = Geom:new{x=0, y=10, w=1080, h=1430},
-- the bezel covers the top 11 pixels:
viewport = Geom:new{x=0, y=11, w=1080, h=1429},
}
-- Kobo Aura HD:

@ -168,14 +168,14 @@ function Button:onTapSelectButton()
UIManager:scheduleIn(0.0, function()
self[1].invert = true
UIManager:setDirty(self.show_parent, function()
return "partial", self[1].dimen
return "ui", self[1].dimen
end)
end)
UIManager:scheduleIn(0.1, function()
self.callback()
self[1].invert = false
UIManager:setDirty(self.show_parent, function()
return "partial", self[1].dimen
return "ui", self[1].dimen
end)
end)
elseif self.tap_input then

@ -52,7 +52,7 @@ end
function ButtonDialog:onShow()
UIManager:setDirty(self, function()
return "partial", self[1][1].dimen
return "ui", self[1][1].dimen
end)
end

@ -72,7 +72,7 @@ function OptionTextItem:onTapSelect()
self.event, self.args,
self.events, self.current_item)
UIManager:setDirty(self.config, function()
return "partial", self[1].dimen
return "ui", self[1].dimen
end)
return true
end
@ -127,7 +127,7 @@ function OptionIconItem:onTapSelect()
self.event, self.args,
self.events, self.current_item)
UIManager:setDirty(self.config, function()
return "partial", self[1].dimen
return "ui", self[1].dimen
end)
return true
end
@ -532,7 +532,7 @@ function ConfigDialog:onShowConfigPanel(index)
local refresh_dimen =
old_dimen and old_dimen:combine(self.dialog_frame.dimen)
or self.dialog_frame.dimen
return "partial", refresh_dimen
return "ui", refresh_dimen
end)
return true
end

@ -91,7 +91,7 @@ end
function ConfirmBox:onShow()
UIManager:setDirty(self, function()
return "partial", self[1][1].dimen
return "ui", self[1][1].dimen
end)
end

@ -276,7 +276,7 @@ end
function DictQuickLookup:onShow()
UIManager:setDirty(self, function()
return "partial", self.dict_frame.dimen
return "ui", self.dict_frame.dimen
end)
return true
end

@ -44,7 +44,7 @@ function IconButton:onTapClickButton()
UIManager:scheduleIn(0.0, function()
self.image.invert = true
UIManager:setDirty(self.show_parent, function()
return "partial", self[1].dimen
return "ui", self[1].dimen
end)
end)
-- make sure button reacts before doing callback
@ -52,7 +52,7 @@ function IconButton:onTapClickButton()
self.callback()
self.image.invert = false
UIManager:setDirty(self.show_parent, function()
return "partial", self[1].dimen
return "ui", self[1].dimen
end)
end)
return true

@ -88,7 +88,7 @@ end
function InfoMessage:onShow()
-- triggered by the UIManager after we got successfully shown (not yet painted)
UIManager:setDirty(self, function()
return "partial", self[1][1].dimen
return "ui", self[1][1].dimen
end)
if self.timeout then
UIManager:scheduleIn(self.timeout, function() UIManager:close(self) end)

@ -120,7 +120,7 @@ end
function InputDialog:onShow()
UIManager:setDirty(self, function()
return "partial", self.dialog_frame.dimen
return "ui", self.dialog_frame.dimen
end)
end

@ -89,7 +89,7 @@ function InputText:initTextBox(text)
self.dimen = self[1]:getSize()
UIManager:setDirty(self.parent, function()
return "partial", self[1].dimen
return "ui", self[1].dimen
end)
end

@ -42,7 +42,7 @@ end
function LinkBox:onShow()
UIManager:setDirty(self, function()
return "partial", self.box
return "ui", self.box
end)
if self.timeout then
UIManager:scheduleIn(self.timeout, function()

@ -284,7 +284,7 @@ function MenuItem:onTapSelect(arg, ges)
local pos = self:getGesPosition(ges)
self[1].invert = true
local refreshfunc = function()
return "partial", self[1].dimen
return "ui", self[1].dimen
end
UIManager:setDirty(self.show_parent, refreshfunc)
UIManager:scheduleIn(0.1, function()
@ -299,7 +299,7 @@ function MenuItem:onHoldSelect(arg, ges)
local pos = self:getGesPosition(ges)
self[1].invert = true
local refreshfunc = function()
return "partial", self[1].dimen
return "ui", self[1].dimen
end
UIManager:setDirty(self.show_parent, refreshfunc)
UIManager:scheduleIn(0.1, function()
@ -686,7 +686,7 @@ function Menu:updateItems(select_number)
local refresh_dimen =
old_dimen and old_dimen:combine(self.dimen)
or self.dimen
return "partial", refresh_dimen
return "ui", refresh_dimen
end)
end

@ -65,7 +65,7 @@ end
function Notification:onShow()
-- triggered by the UIManager after we got successfully shown (not yet painted)
UIManager:setDirty(self, function()
return "partial", self[1][1].dimen
return "ui", self[1][1].dimen
end)
if self.timeout then
UIManager:scheduleIn(self.timeout, function() UIManager:close(self) end)

@ -148,7 +148,7 @@ function ToggleSwitch:onTapSelect(arg, gev)
self.config:onConfigChoose(self.values, self.name,
self.event, self.args, self.events, self.position)
UIManager:setDirty(self.config, function()
return "partial", self.dimen
return "ui", self.dimen
end)
return true
end

@ -98,7 +98,7 @@ function TouchMenuItem:onTapSelect(arg, ges)
UIManager:scheduleIn(0.0, function()
self.item_frame.invert = true
UIManager:setDirty(self.show_parent, function()
return "partial", self.dimen
return "ui", self.dimen
end)
end)
UIManager:scheduleIn(0.1, function()
@ -107,7 +107,7 @@ function TouchMenuItem:onTapSelect(arg, ges)
UIManager:scheduleIn(0.5, function()
self.item_frame.invert = false
UIManager:setDirty(self.show_parent, function()
return "partial", self.dimen
return "ui", self.dimen
end)
end)
return true
@ -123,7 +123,7 @@ function TouchMenuItem:onHoldSelect(arg, ges)
UIManager:scheduleIn(0.0, function()
self.item_frame.invert = true
UIManager:setDirty(self.show_parent, function()
return "partial", self.dimen
return "ui", self.dimen
end)
end)
UIManager:scheduleIn(0.1, function()
@ -132,7 +132,7 @@ function TouchMenuItem:onHoldSelect(arg, ges)
UIManager:scheduleIn(0.5, function()
self.item_frame.invert = false
UIManager:setDirty(self.show_parent, function()
return "partial", self.dimen
return "ui", self.dimen
end)
end)
return true
@ -469,7 +469,7 @@ function TouchMenu:updateItems()
local refresh_dimen =
old_dimen and old_dimen:combine(self.dimen)
or self.dimen
return "partial", refresh_dimen
return "ui", refresh_dimen
end)
end

@ -216,6 +216,7 @@ function VirtualKeyboard:init()
end
function VirtualKeyboard:_refresh()
-- TODO: Ideally, ui onShow & partial onClose
UIManager:setDirty(self, function()
return "partial", self[1][1].dimen
end)

@ -43,9 +43,16 @@ update_koreader()
found_koreader_package="false"
# Try to find a koreader package... Behavior undefined if there are multiple packages...
for file in /mnt/us/koreader-kindle-*.tar.gz ; do
if [ -f "${file}" ] ; then
found_koreader_package="${file}"
koreader_pkg_type="tgz"
fi
done
for file in /mnt/us/koreader-kindle-*.zip ; do
if [ -f "${file}" ] ; then
found_koreader_package="${file}"
koreader_pkg_type="zip"
fi
done
@ -61,11 +68,19 @@ update_koreader()
fi
# Get the version of the package...
koreader_pkg_ver="${found_koreader_package%.*}"
if [ "${koreader_pkg_type}" == "tgz" ] ; then
koreader_pkg_ver="${found_koreader_package%.*.*}"
else
koreader_pkg_ver="${found_koreader_package%.*}"
fi
koreader_pkg_ver="${koreader_pkg_ver#*-v}"
# Install it!
logmsg "Updating to KOReader ${koreader_pkg_ver} . . ."
unzip -q -o "${found_koreader_package}" -d "/mnt/us"
if [ "${koreader_pkg_type}" == "tgz" ] ; then
tar -C "/mnt/us" -xzf "${found_koreader_package}"
else
unzip -q -o "${found_koreader_package}" -d "/mnt/us"
fi
if [ $? -eq 0 ] ; then
logmsg "Update to v${koreader_pkg_ver} successful :)"
# Cleanup behind us...

@ -208,7 +208,7 @@ fi
./reader.lua "$@" 2> crash.log
# clean up our own process tree in case the reader crashed (if needed, to avoid flooding KUAL's log)
if pidof reader.lua > /dev/null 2>&1 ; then
if pkill -0 reader.lua ; then
logmsg "Sending a SIGTERM to stray KOreader processes . . ."
killall -TERM reader.lua
fi

@ -24,7 +24,7 @@ case "${kmodel}" in
;;
"13" | "54" | "2A" | "4F" | "52" | "53" )
# Kindle Voyage
SCREEN_X_RES=1072
SCREEN_X_RES=1088 # NOTE: Yes, 1088, not 1072 or 1080...
SCREEN_Y_RES=1448
EIPS_X_RES=16
EIPS_Y_RES=24 # Manually mesured, should be accurate.

@ -1 +1 @@
$root/.kobo/fmon/fmon $root/koreader.png $root/.kobo/koreader/koreader.sh &
${root}/.kobo/fmon/fmon "${root}/koreader.png" "${root}/.kobo/koreader/koreader.sh" &

@ -2,21 +2,21 @@
export LC_ALL="en_US.UTF-8"
# working directory of koreader
KOREADER_DIR=$(dirname $0)
KOREADER_DIR="${0%/*}"
# 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 $(dirname $KOREADER_DIR) && tar xf $NEWUPDATE && mv $NEWUPDATE $INSTALLED
if [ -f "${NEWUPDATE}" ] ; then
# TODO: any graphic indication for the updating progress?
cd "${KOREADER_DIR%/*}" && tar xf "${NEWUPDATE}" && mv "${NEWUPDATE}" "${INSTALLED}"
fi
# we're always starting from our working directory
cd $KOREADER_DIR
cd "${KOREADER_DIR}"
# load our own shared libraries if possible
export LD_LIBRARY_PATH=${KOREADER_DIR}/libs:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH="${KOREADER_DIR}/libs:${LD_LIBRARY_PATH}"
# export trained OCR data directory
export TESSDATA_PREFIX="data"
@ -29,50 +29,69 @@ export EXT_FONT_DIR="/mnt/onboard/fonts"
# fast and dirty way of check if we are called from nickel
# through fmon, or from another launcher (KSM or advboot)
from_nickel=`pidof nickel | wc -c`
from_nickel="false"
if pkill -0 nickel ; then
from_nickel="true"
fi
if [ "${from_nickel}" == "true" ] ; then
# Siphon a few things from nickel's env...
eval "$(xargs -n 1 -0 < /proc/$(pidof nickel)/environ | grep -e DBUS_SESSION_BUS_ADDRESS -e WIFI_MODULE -e PLATFORM -e WIFI_MODULE_PATH -e INTERFACE -e PRODUCT 2>/dev/null)"
export DBUS_SESSION_BUS_ADDRESS WIFI_MODULE PLATFORM WIFI_MODULE_PATH INTERFACE PRODUCT
if [ $from_nickel -ne 0 ]; then
# stop kobo software because is running
killall nickel hindenburg fmon 2>/dev/null
# flush disks, might help avoid trashing nickel's DB...
sync
# stop kobo software because it's running
killall nickel hindenburg fmon 2>/dev/null
fi
# fallback for old fmon (and advboot) users
if [ `echo $@ | wc -c` -eq 1 ]; then
args="/mnt/onboard"
# fallback for old fmon (and advboot) users (-> if no args were passed to the sript, start the FM)
if [ "$#" -eq 0 ] ; then
args="/mnt/onboard"
else
args=$@
args="$@"
fi
# check whether PLATFORM & PRODUCT have a value assigned by rcS
if [ ! -n "${PRODUCT}" ] ; then
PRODUCT="$(/bin/kobo_config.sh)"
[ "${PRODUCT}" != "trilogy" ] && PREFIX="${PRODUCT}-"
export PRODUCT
fi
# check whether PLATFORM has a value assigned by rcS
# PLATFORM is used in koreader for the path to the WiFi drivers
if [ -n "$PLATFORM" ]; then
PLATFORM=freescale
if [ `dd if=/dev/mmcblk0 bs=512 skip=1024 count=1 | grep -c "HW CONFIG"` == 1 ]; then
CPU=`ntx_hwconfig -s -p /dev/mmcblk0 CPU`
PLATFORM=$CPU-ntx
fi
if [ $PLATFORM == freescale ]; then
if [ ! -s /lib/firmware/imx/epdc_E60_V220.fw ]; then
mkdir -p /lib/firmware/imx
dd if=/dev/mmcblk0 bs=512K skip=10 count=1 | zcat > /lib/firmware/imx/epdc_E60_V220.fw
sync
fi
elif [ ! -e /etc/u-boot/$PLATFORM/u-boot.mmc ]; then
PLATFORM=ntx508
fi
export PLATFORM
if [ ! -n "${PLATFORM}" ] ; then
PLATFORM="freescale"
if dd if="/dev/mmcblk0" bs=512 skip=1024 count=1 | grep -q "HW CONFIG" ; then
CPU="$(ntx_hwconfig -s -p /dev/mmcblk0 CPU)"
PLATFORM="${CPU}-ntx"
fi
if [ "${PLATFORM}" == "freescale" ] ; then
if [ ! -s "/lib/firmware/imx/epdc_E60_V220.fw" ] ; then
mkdir -p "/lib/firmware/imx"
dd if="/dev/mmcblk0" bs=512K skip=10 count=1 | zcat > "/lib/firmware/imx/epdc_E60_V220.fw"
sync
fi
elif [ ! -e "/etc/u-boot/${PLATFORM}/u-boot.mmc" ] ; then
PLATFORM="ntx508"
fi
export PLATFORM
fi
# end of value check of PLATFORM
./reader.lua $args 2> crash.log
./reader.lua "${args}" 2> crash.log
if [ $from_nickel -ne 0 ]; then
# start kobo software because was running before koreader
./nickel.sh
if [ "${from_nickel}" == "true" ] ; then
# start kobo software because it was running before koreader
./nickel.sh &
else
# if we were called from advboot then we must reboot to go to the menu
if [ -d /mnt/onboard/.kobo/advboot ]; then
reboot
fi
# if we were called from advboot then we must reboot to go to the menu
# NOTE: This is actually achieved by checking if KSM is running:
# This might lead to false-positives if you use neither KSM nor advboot to launch KOReader *without nickel running*.
if ! pkill -0 ksmhome.sh ; then
reboot
fi
fi
return 0

@ -1,43 +1,71 @@
#!/bin/sh
PATH=$PATH:/usr/sbin:/sbin
PATH="/sbin:/bin:/usr/sbin:/usr/bin:/usr/lib"
# Handle the rotation weirdness on some devices
cur_rotate="$(cat "/sys/class/graphics/fb0/rotate")"
# start fmon again:
( usleep 400000; /etc/init.d/on-animator.sh ) &
# environment needed by nickel, from /etc/init.d/rcS:
export INTERFACE=eth0
export WIFI_MODULE=dhd
export WIFI_MODULE_PATH=/drivers/ntx508/wifi/$WIFI_MODULE.ko
export NICKEL_HOME=/mnt/onboard/.kobo
export LD_LIBRARY_PATH=/usr/local/Kobo
# environment needed by nickel, from /etc/init.d/rcS:
if [ ! -n "${WIFI_MODULE_PATH}" ] ; then
INTERFACE="wlan0"
WIFI_MODULE="ar6000"
if [ "${PLATFORM}" != "freescale" ] ; then
INTERFACE="eth0"
WIFI_MODULE="dhd"
fi
export INTERFACE
export WIFI_MODULE
export WIFI_MODULE_PATH="/drivers/${PLATFORM}/wifi/${WIFI_MODULE}.ko"
fi
export NICKEL_HOME="/mnt/onboard/.kobo"
export LD_LIBRARY_PATH="/usr/local/Kobo"
export LANG="en_US.UTF-8"
# start nickel again (from tshering's start menu v0.4), this should
# cover all firmware versions from 2.6.1 to 3.4.1 (tested on a kobo
# mini with 3.4.1 firmware)
( /usr/local/Kobo/pickel disable.rtc.alarm
if [ ! -e /etc/wpa_supplicant/wpa_supplicant.conf ]; then
cp /etc/wpa_supplicant/wpa_supplicant.conf.template /etc/wpa_supplicant/wpa_supplicant.conf
fi
echo 1 > /sys/devices/platform/mxc_dvfs_core.0/enable
/sbin/hwclock -s -u
) &
if [ ! -e /usr/local/Kobo/platforms/libkobo.so ]; then
export QWS_KEYBOARD=imx508kbd:/dev/input/event0
export QT_PLUGIN_PATH=/usr/local/Kobo/plugins
if [ -e /usr/local/Kobo/plugins/gfxdrivers/libimxepd.so ]; then
export QWS_DISPLAY=imxepd
else
export QWS_DISPLAY=Transformed:imx508:Rot90
export QWS_MOUSE_PROTO="tslib_nocal:/dev/input/event1"
fi
/usr/local/Kobo/hindenburg &
/usr/local/Kobo/nickel -qws -skipFontLoad
(
/usr/local/Kobo/pickel disable.rtc.alarm
if [ ! -e "/etc/wpa_supplicant/wpa_supplicant.conf" ] ; then
cp "/etc/wpa_supplicant/wpa_supplicant.conf.template" "/etc/wpa_supplicant/wpa_supplicant.conf"
fi
# FWIW, that appears to be gone from recent rcS scripts. AFAICT, still harmless, though.
echo 1 > "/sys/devices/platform/mxc_dvfs_core.0/enable"
/sbin/hwclock -s -u
) &
if [ ! -e "/usr/local/Kobo/platforms/libkobo.so" ] ; then
export QWS_KEYBOARD="imx508kbd:/dev/input/event0"
export QT_PLUGIN_PATH="/usr/local/Kobo/plugins"
if [ -e "/usr/local/Kobo/plugins/gfxdrivers/libimxepd.so" ] ; then
export QWS_DISPLAY="imxepd"
else
export QWS_DISPLAY="Transformed:imx508:Rot90"
export QWS_MOUSE_PROTO="tslib_nocal:/dev/input/event1"
fi
/usr/local/Kobo/hindenburg > /dev/null 2>&1 &
/usr/local/Kobo/nickel -qws -skipFontLoad > /dev/null 2>&1 &
else
/usr/local/Kobo/hindenburg &
insmod /drivers/ntx508/misc/lowmem.ko &
[ `cat /mnt/onboard/.kobo/Kobo/Kobo\ eReader.conf | grep -c dhcpcd=true` == 1 ] && dhcpcd -d -t 10 &
/usr/local/Kobo/nickel -platform kobo -skipFontLoad
/usr/local/Kobo/hindenburg > /dev/null 2>&1 &
lsmod | grep -q lowmem || insmod "/drivers/${PLATFORM}/misc/lowmem.ko" &
if grep -q "dhcpcd=true" "/mnt/onboard/.kobo/Kobo/Kobo eReader.conf" ; then
dhcpcd -d -t 10 &
fi
/usr/local/Kobo/nickel -platform kobo -skipFontLoad > /dev/null 2>&1 &
fi
# Rotation weirdness, part II
echo "${cur_rotate}" > "/sys/class/graphics/fb0/rotate"
cat "/sys/class/graphics/fb0/rotate" > "/sys/class/graphics/fb0/rotate"
return 0

@ -1,7 +1,7 @@
#!/bin/sh
export PATH=$PATH:/sbin:/usr/sbin
export PATH="${PATH}:/sbin:/usr/sbin"
#disable wifi
# disable wifi
if lsmod | grep -q sdio_wifi_pwr ; then
wlarm_le -i eth0 down
ifconfig eth0 down
@ -9,7 +9,7 @@ if lsmod | grep -q sdio_wifi_pwr ; then
rmmod -r sdio_wifi_pwr
fi
#go to sleep
# go to sleep
sync
echo 1 > /sys/power/state-extended
echo mem > /sys/power/state

Loading…
Cancel
Save