using Ubuntu Frame, Flutter and Raspberry Pi Youngbin Han Member @ Ubuntu LoCo Council Organizer @ Ubuntu Korea Community FOSSASIA Summit 2024 Hanoi, Vietnam
some kind of best practices I’ll just talk about my own experience as a person new to Ubuntu Core, Ubuntu Frame and Flutter And many of those experiences includes some kind of weird workaround. So… If you want to utilize some of my experiences, use it at your own risk :)
check-in + other process(such as name tag printing) • To handle check-in of registration from multiple platforms • Event platform has no support for check-in app or it’s expensive paid add-on • And… Just for fun!
Ubuntu Core • The OS Optimized for IoT, Edge and Embedded • All packaged are managed with Snap Ubuntu Frame • Fullscreen display server for embedded graphical display such as kiosk and digital signage • Built with Mir Display server - A Wayland compositor
existing webcam for scanning QR code • Flutter with Yaru.dart • VisionFive2 - A RISC-V SBC I just got from crowdfunding • Cheap label printer with linux driver support The original plan was to…
Printer driver had linux support ◦ But only for x86, not for arm64 ◦ And my SBC for Kiosk setup is either arm64 or riscv64… • Tried to write and send TSPL command manually with libusb instead for printing labels • <- Figuring out how other mobile label printer apps send TSPL commands to print labels by dumping data… ◦ Ooooooops…
can install ubuntu-frame snap then run it for testing your GUI app on Ubuntu Frame. sudo snap install ubuntu-frame WAYLAND_DISPLAY=wayland-99 ubuntu-frame WAYLAND_DISPLAY=wayland-99 flutter run
for building desktop snap. But, You don’t need to start from scratch thanks to example project provided through documentation. Your app will launch as daemon - So that it won’t block your command prompt and also automatically start on boot on Ubuntu Core environment.
building for amd64 target • https://github.com/snapcore/action-build diddlesnaps/snapcraft-multiarch-action action • If you want to build for multiple targets. such as amd64, arm64(for your RPi), armhf and more. • https://github.com/diddlesnaps/snapcraft-multiarch-action
with Ubuntu Core Install and enable Ubuntu Frame daemon sudo snap install ubuntu-frame # Only if ubuntu-frame daemon not started automatically sudo snap start ubuntu-frame
Webcam view built with gstreamer ◦ Got segment fault on RPi, Couldn’t figure out how to fix ◦ Replaced with a simple text input + barcode scanner • Flutter quick_usb plugin ◦ Uses only x86 version of libusb embedded in their package making it not work on RPi. ◦ Wrote a simple python http server with PyUSB as a replacement
network on-site :( ◦ Venue setup was within few hours - Didn’t have enough time to connect to RPi remotely, setup and check network connection. • Venue has no ethernet connection and has Wi-Fi with Captive Portal. ◦ Ubuntu Core basically doesn’t have web brower that can deal with such things… ◦ My workaround was to hook up RPi with my laptop then share network connection from my laptop. :(
UbuCon KR 2023 • Network connection setup UI ◦ Uses nm package to interact with NetworkManager • There are many more packages available for interacting with Linux system stack. ◦ dbus, bluez, gsettings, lxd and more.
UbuCon KR 2023 • Better deployment - I’ve been manually deploying for now ◦ Try out uploading on Snap store to take advantage of OTA update ◦ Building Gadget snap & Custom Ubuntu Core image for building image with packages and configurations already setup. ▪ https://ubuntu.com/core/docs/gadget-building
Flutter Working with Flutter on Linux is quite straightforward. • Flutter SDK available as Snap, Flutter VSCode extension works of course. • Many flutter packages already supports linux - But if you’re building flutter app for other then amd64(such as arm64), some plugins might not work. (Just like to quick_usb package you’ve seen today)
Flutter • Using Ubuntu Frame itself isn’t difficult. ◦ It’s just a fullscreen wayland shell for displaying single app at a time. Touch input and OSK also just works. • Building your Snap for Ubuntu Core & Ubuntu Frame would be a bit difficult if you’re trying for first time. • Seems like there’s no easy network setup solution (something like Balena’s wifi-connect) for now. Would be nice if Ubuntu Core also have one for easy network setup - maybe someone can port?