#!/usr/bin/env python2
"""
Barebones example of FBInk usage through Python's cFFI module
"""
# To get a Py3k-like print function
from __future__ import print_function
import sys
# Load the wrapper module, it's linked against FBInk, so the dynamic loader will take care of pulling in the actual FBInk library
from _fbink import ffi, lib as FBInk
# Let's check which FBInk version we're using...
# NOTE: ffi.string() returns a bytes on Python 3, not a str, hence the extra decode
print("Loaded FBInk {}".format(ffi.string(FBInk.fbink_version()).decode("ascii")))
# And now we're good to go! Let's print "Hello World" in the center of the screen...
# Setup the config...
fbink_cfg = ffi.new("FBInkConfig *")
fbink_cfg.is_centered = False
fbink_cfg.is_halfway = True
fbink_cfg.is_cleared = True
fbink_cfg.is_verbose = True
fbink_ot_cfg = ffi.new("FBInkOTConfig *")
fbink_ot_cfg.size_pt = 24
"""
# Open the FB...
fbfd = FBInk.fbink_open()
if fbfd == -1:
raise SystemExit("Failed to open the framebuffer, aborting . . .")
# Initialize FBInk...
if FBInk.fbink_init(fbfd, fbink_cfg) < 0:
raise SystemExit("Failed to initialize FBInk, aborting . . .")
# Do stuff!
if FBInk.fbink_print(fbfd, b"Hello World", fbink_cfg) < 0:
print("Failed to print that string!", file=sys.stderr)
# And now we can wind things down...
if FBInk.fbink_close(fbfd) < 0:
raise SystemExit("Failed to close the framebuffer, aborting . . .")
"""
# Or, the same but in a slightly more Pythonic approach ;).
fbfd = FBInk.fbink_open()
try:
FBInk.fbink_init(fbfd, fbink_cfg)
FBInk.fbink_add_ot_font("BigBlue_Terminal.ttf", FBInk.FNT_REGULAR)
string = u"Success \uf632 or \ufadf or \ufae0 or \ufc8f or \uf633 or \uf4a1" // \uf633
string += u"\n"
string += u"Error \uf071 or \uf525 or \uf529 or \uf421 or \ufb8f" // \uf071
string += u"\n"
string += u"Wait \uf252 or \ufa1e or \uf49b" // \uf252
string += u"\n"
string += u"Python \ue73c or \ue235 or \uf81f or \ue606" // \ue73c
string += u"\n"
string += u"USBNet \ue795 or \uf68c or \ufcb5 or \uf489" // \uf68c
string += u"\n"
string += u"Bridge \uf270 or \uf52c or \ue286 or \uf5a6 or \ue214" // \ue286 (AMZ: \uf270)
string += u"\n"
string += u":( \uf119 or \uf6f7" // \uf119
string += u"\n"
string += u"Linux \uf17c or \uf31a or \uf83c" // \uf17c
string += u"\n"
string += u":) \uf118 or \uf6f4" // \uf118
string += u"\n"
string += u"Tools \ue20f or \ufbf6 or \uf992 or \ufab6 or \uf425" // \uf425
string += u"\n"
string += u"MRPI \ufcdd or \ufcde or \uf8d5 or \uf962 or \ufac3 or \uf487 or \uf427" // \uf8d5 (KUAL: \uf962)
string = string.encode("utf-8")
# NOTE: On Python 3, cFFI maps char to bytes, not str
FBInk.fbink_print_ot(fbfd, string, fbink_ot_cfg, fbink_cfg, ffi.NULL)
finally:
FBInk.fbink_free_ot_fonts()
FBInk.fbink_close(fbfd)
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
KINDLE.zip (53个子文件)
kindle刷机插件
mrpackages
Update_KUALBooklet_v2.7.21_install.bin 50KB
extensions
helper
bin
start_update.sh 169B
setorientation.sh 506B
otaprevent.sh 157B
otaallow.sh 90B
device_id.sh 17KB
ssprevent.sh 66B
ssallow.sh 66B
411.sh 106B
kill-kterm.sh 66B
menu.json 2KB
config.xml 270B
android
boot.sh 191B
menu.json 109B
config.xml 263B
MRInstaller
lib
K3
PW2
K5_20230306_103853
data
mrpi-K5.tar.gz 386KB
mrpi-PW2.tar.gz 401KB
BigBlue_Terminal.ttf 841KB
icons.py 3KB
mrpi-K3.tar.gz 394KB
bin
K3
PW2
mrinstaller.sh 37KB
K5
CREDITS 2KB
menu.json 474B
config.xml 268B
log
main-htmlviewer.tar.gz 51KB
INK_wechatread_v1.5.2.apk 19.76MB
KV刷机包
voyage.220810.zip 463.27MB
voyage.220810
uboot
extensions.zip 1KB
main-htmlviewer.tar.gz 51KB
voyage
Start.exe 306KB
Files
kdroid.sign 8B
ver 38B
fakesn.bin 64B
AdbWinUsbApi.dll 60KB
AdbWinApi.dll 94KB
var.bin 64MB
restore.exe 846KB
Z05.bin 99KB
kindl.bin 8B
kernel.sign 9B
fastdownload.exe 1.05MB
fastboot.exe 192KB
C1.bin 100KB
kdroid.bin 4.08MB
system.bin 439.45MB
data.bin 64MB
esystem.bin 350MB
wipe.exe 1.05MB
licdat.bin 256B
doload.exe 846KB
kernel.bin 2.91MB
config.bin 2B
Android adb 驱动
adb-setup-1.4.3.exe 9.17MB
共 53 条
- 1
资源评论
ITZHIHONH
- 粉丝: 42
- 资源: 5
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功