原创 / 电脑研究

探索Unifi CloudKey Gen2+的小OLED屏幕驱动并显示自定义图片

在/lib/systemd/system中有着类似于ck-splash-reboot.service的文件 内容为

[Unit] Description=Boot error splash screen DefaultDependencies=no

[Service] Type=simple ExecStart=/sbin/ck-splash -s error.boot

[Install] WantedBy=emergency.target rescue.target

在尝试执行/sbin/ck-splash -s 时发现了更多命令

Available screens:

black done.fwupdate error.boot error.fwcheck error.fwupdate error.hdd error.power fwcheck fwupdate random reboot reset shutdown splash white image

这些命令都能工作但似乎这是完全闭源的程序所以无法修改

root@Krunk-CloudKey:~# /sbin/ck-splash -bs shutdown

20190627_020941.jpg

root@Krunk-CloudKey:~# /sbin/ck-splash -s error.boot

20190627_021020.jpg

Framebuffer splash utility v0.3.0 (c) kesha@ubnt.com Ubiquiti Networks, Inc. 2018 Usage: /sbin/ck-splash [] Where possible options are: -d choose framebuffer (default: 0) -b run program in background -f use specified PNG image -l list available splash screens -s use specified splash screen -h print this help output and exit

我使用自己的一个png图片并成功在屏幕上显示

root@Krunk-CloudKey:~# /sbin/ck-splash -f /usr/lib/unifi-voip/webapps/ROOT/lib/1.0.5.1178/stylesheets/images/close.png block ID=1 of 27 bytes @ 0x0009 block ID=2 of 15 bytes @ 0x0029 block ID=3 of 12 bytes @ 0x003d block ID=4 of 1940 bytes @ 0x004e Font has 97 chars

close-i.png 20190627_022343.jpg

root@Krunk-CloudKey:~# /sbin/ck-splash -f /tmp/krunk.png block ID=1 of 27 bytes @ 0x0009 block ID=2 of 15 bytes @ 0x0029 block ID=3 of 12 bytes @ 0x003d block ID=4 of 1940 bytes @ 0x004e Font has 97 chars

20190627_023059.jpg ck-ui是控制屏幕的驱动,通过I2C peripheral驱动屏幕

170:580 0 43717415 0 0 0 0 0 GIC 129 78b7000.spi

171:0 0 0 0 0 0 0 0 GIC 128 i2c-msm-v2-irq

172:18 58 0 0 0 0 0 0 GIC 331 i2c-msm-v2-irq

[Unit] Description=UniFi Cloud Key Gen2 On-Screen UI

[Service] ExecStart=/usr/bin/ck-ui KillMode=process Restart=on-failure TimeoutStopSec=2s

[Install] WantedBy=multi-user.target

$/usr/bin/ck-ui

UniFi Cloud Key Gen2 user interface application

Options: -h, --help Displays this help. -v, --version Displays version information. -c, --color Show color in -i, --image Show image from -b, --burnin Run burn-in test -s, --screen Show screen

所有描述都指向了这两个文件但似乎都不能实现自定义的文字,希望能获取到源代码或找到更多的帮助文件来实现unifi渲染图上宣传的但并没有加入系统的功能

写于 2019/06/26 · Krunk Zhou

一起聊聊