Last year, I started hacking on eink devices with a friend (or three). These devices typically don’t run an X server, so programming for them involves lower level programming than usual. While there is a QT plugin that allows people to develop apps in QT and deploy them to the remarkable or kobo, we decided to only rely on the linux OS system APIs.

We coded in C++ (okp technically), but also spent time reading Rust code. Along the way, we learned quite a lot. Some highlights are:

  • how to interact with the eink display using ioctl commands. we heavily relied on other people’s efforts and reading the i.MX reference manual. to draw to the display typically involves: changing some pixels in a framebuffer and then calling an ioctl to flush the pixels. the difficult part is that you have to specify which waveform to use and this has reprecussions on the number of grays that can be displayed and how long it takes to repaint.
  • how to interact with the input devices using the linux input subsystem, including how to interact with a stylus device and how to deal with multi-touch input.
  • we implemented multi-touch swipe gestures and even allow injecting custom events into the subsystem to allow people to draw custom shapes with automation
  • how to manage power states and schedule wakes with rtcwake: after 10 - 20 minutes, we put the device into sleep. After several hours, we power the device down
  • for the rm2 framebuffer, we learned how to reverse engineer binaries and intercept / add new code using a combination of LD_PRELOAD and frida-gum
  • we implemented an absolutely positioned widget system that handles and dispatches events. It uses the concept of “scenes” to know what to paint on the screen. It has simple widgets, like buttons, dialogs, dropdowns and uses a signaling system for event handlers
  • we did some socket programming, sending JSON back and forth to our server - it was relatively painless.

I could go on for quite a while, but since the tablet was relatively new there was a lot of green fields. Overall, embedded device development has been fun for me, despite being a resource constrained environment.