Changeset 15360 in niluje


Ignore:
Timestamp:
Aug 31, 2018, 7:59:44 PM (14 months ago)
Author:
NiLuJe
Message:

Kindle Hacks:

  • Merge otautils updates in MRPI
Location:
Configs/trunk/Kindle
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • Configs/trunk/Kindle/KUAL/MRInstaller/extensions/MRInstaller/bin/mrinstaller.sh

    r15299 r15360  
    151151}
    152152
    153 # Adapted from libkh[5]
    154 eips_print_bottom_centered()
     153# From libotautils[5], adapted from libkh[5]
     154## Check if we have an FBInk binary available somewhere...
     155has_fbink()
     156{
     157        for my_hackdir in libkh linkss linkfonts usbnet ; do
     158                my_fbink="/mnt/us/${my_hackdir}/bin/fbink"
     159                if [ -x "${my_fbink}" ] ; then
     160                        FBINK_BIN="${my_fbink}"
     161                        # Got it!
     162                        return 0
     163                fi
     164        done
     165
     166        # If we got this far, we don't have fbink installed
     167        return 1
     168}
     169
     170do_fbink_print()
    155171{
    156172        # We need at least two args
    157173        if [ $# -lt 2 ] ; then
    158                 logmsg "W" "eips_print_bottom_centered" "" "not enough arguments passed to eips_print_bottom_centered ($# while we need at least 2)"
    159                 return 1
     174                echo "not enough arguments passed to do_fbink_print ($# while we need at least 2)"
     175                return
    160176        fi
    161177
     
    163179        kh_eips_y_shift_up="${2}"
    164180
    165         # Log it, too
    166         logmsg "I" "eips_print_bottom_centered" "" "${kh_eips_string}"
     181        # Check if we asked for a highlighted message...
     182        if [ "${3}" == "h" ] ; then
     183                fbink_extra_args="h"
     184        else
     185                fbink_extra_args=""
     186        fi
     187
     188        # NOTE: FBInk will handle the padding. FBInk's default font is square, not tall like eips,
     189        #       so we compensate by tweaking the baseline ;).
     190        ${FBINK_BIN} -qpmL${fbink_extra_args} -y $(( -4 - ${kh_eips_y_shift_up} )) "${kh_eips_string}"
     191}
     192
     193do_eips_print()
     194{
     195        # We need at least two args
     196        if [ $# -lt 2 ] ; then
     197                echo "not enough arguments passed to do_eips_print ($# while we need at least 2)"
     198                return
     199        fi
     200
     201        kh_eips_string="${1}"
     202        kh_eips_y_shift_up="${2}"
    167203
    168204        # Get the real string length now
     
    183219        done
    184220
     221        # And finally, show our formatted message centered on the bottom of the screen (NOTE: Redirect to /dev/null to kill unavailable character & pixel not in range warning messages)
     222        eips 0 $((${EIPS_MAXLINES} - 2 - ${kh_eips_y_shift_up})) "${kh_eips_string}" >/dev/null
     223}
     224
     225eips_print_bottom_centered()
     226{
     227        # We need at least two args
     228        if [ $# -lt 2 ] ; then
     229                echo "not enough arguments passed to eips_print_bottom_centered ($# while we need at least 2)"
     230                return
     231        fi
     232
     233        kh_eips_string="${1}"
     234        kh_eips_y_shift_up="${2}"
     235
    185236        # Sleep a tiny bit to workaround the logic in the 'new' (K4+) eInk controllers that tries to bundle updates
    186237        if [ "${EIPS_SLEEP}" == "true" ] ; then
     
    188239        fi
    189240
    190         # And finally, show our formatted message centered on the bottom of the screen (NOTE: Redirect to /dev/null to kill unavailable character & pixel not in range warning messages)
    191         eips 0 $((${EIPS_MAXLINES} - 2 - ${kh_eips_y_shift_up})) "${kh_eips_string}" >/dev/null
     241        # Can we use FBInk?
     242        if has_fbink ; then
     243                do_fbink_print "${kh_eips_string}" ${kh_eips_y_shift_up}
     244        else
     245                do_eips_print "${kh_eips_string}" ${kh_eips_y_shift_up}
     246        fi
    192247}
    193248
  • Configs/trunk/Kindle/Touch_Hacks/Common/lib/libotautils5

    r15359 r15360  
    108108has_fbink()
    109109{
    110     for my_hackdir in libkh linkss linkfonts usbnet ; do
    111         my_fbink="/mnt/us/${my_hackdir}/bin/fbink"
    112         if [ -x "${my_fbink}" ] ; then
    113             FBINK_BIN="${my_fbink}"
    114             # Got it!
    115             return 0
    116         fi
    117     done
    118 
    119     # If we got this far, we don't have fbink installed
    120     return 1
     110        for my_hackdir in libkh linkss linkfonts usbnet ; do
     111                my_fbink="/mnt/us/${my_hackdir}/bin/fbink"
     112                if [ -x "${my_fbink}" ] ; then
     113                        FBINK_BIN="${my_fbink}"
     114                        # Got it!
     115                        return 0
     116                fi
     117        done
     118
     119        # If we got this far, we don't have fbink installed
     120        return 1
    121121}
    122122
Note: See TracChangeset for help on using the changeset viewer.