Skip to content

Commit

Permalink
kobo/koreader.sh: fix rotation issue caused by koreader#2731
Browse files Browse the repository at this point in the history
  • Loading branch information
Frenzie committed Apr 8, 2017
1 parent 1da4e43 commit 2b773b6
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions platform/kobo/koreader.sh
Original file line number Diff line number Diff line change
Expand Up @@ -117,19 +117,29 @@ if [ -e crash.log ]; then
mv -f crash.log.new crash.log
fi

# workaround 32-bit without KSM
if [ -z ${ksmroot+x} ]; then
# TODO: add support for 32bit framebuffer in koreader. This is a workaround
# to run koreader in 16bpp. Useful since FW 4.0
CUR_ROTATE="$(cat "/sys/class/graphics/fb0/rotate")"
FB_BPP=$(cat /sys/class/graphics/fb0/bits_per_pixel)
[ "$FB_BPP" -gt 16 ] && /usr/sbin/fbset -depth 16
# fix rotation issues on Kobo Aura HD (dragon) and Kobo Aura H2O (dahlia)
# this suffices on normal devices, but H2O is stupid and sets the opposite
echo "${CUR_ROTATE}" > "/sys/class/graphics/fb0/rotate"
# this therefore turns it around on H2O (and other potential idiots) and merely
# innocently repeats on sane devices
# shellcheck disable=SC2094
case "$PRODUCT" in "dragon" | "dahlia" ) cat /sys/class/graphics/fb0/rotate > /sys/class/graphics/fb0/rotate ;; esac
cat "/sys/class/graphics/fb0/rotate" > "/sys/class/graphics/fb0/rotate"
fi

./reader.lua "${args}" >> crash.log 2>&1
RESULT=$?

# workaround 32-bit without KSM
if [ -z ${ksmroot+x} ]; then
# back to default depth in framebuffer.
[ "$FB_BPP" -gt 16 ] && /usr/sbin/fbset -depth "$FB_BPP"
fi

if [ "${FROM_NICKEL}" = "true" ] ; then
if [ "${FROM_KFMON}" != "true" ] ; then
Expand Down

0 comments on commit 2b773b6

Please sign in to comment.