|
@@ -4,14 +4,14 @@ Status as of 2026-11-09. All code is in `linux/`. The LPC1114 firmware in the
|
|
|
repository root is unchanged.
|
|
repository root is unchanged.
|
|
|
|
|
|
|
|
**Update 2026-11-10:** the panel now runs on real hardware through i2c-dev
|
|
**Update 2026-11-10:** the panel now runs on real hardware through i2c-dev
|
|
|
-(`radio-i2c --pattern geometry|gray` over a USB I²C bridge at 400 kHz): 240×160,
|
|
|
|
|
|
|
+(`radio-ui i2c --pattern geometry|gray` over a USB I²C bridge at 400 kHz): 240×160,
|
|
|
2 bpp and pixel polarity confirmed. The control lines were remapped to the
|
|
2 bpp and pixel polarity confirmed. The control lines were remapped to the
|
|
|
actual board (see `linux/README.md`), and the review in
|
|
actual board (see `linux/README.md`), and the review in
|
|
|
`linux/s1d13700-recommendations.md` was applied to the core and the DRM
|
|
`linux/s1d13700-recommendations.md` was applied to the core and the DRM
|
|
|
driver. The DRM driver, keys and device tree overlay are still untested on
|
|
driver. The DRM driver, keys and device tree overlay are still untested on
|
|
|
hardware.
|
|
hardware.
|
|
|
|
|
|
|
|
-**Later on 2026-11-10:** the full UI ran on the real panel (`radio-i2c --host`),
|
|
|
|
|
|
|
+**Later on 2026-11-10:** the full UI ran on the real panel (`radio-ui i2c --host`),
|
|
|
which led to three fixes:
|
|
which led to three fixes:
|
|
|
|
|
|
|
|
- **Cursor block.** A memory write turns the controller's cursor on even when
|
|
- **Cursor block.** A memory write turns the controller's cursor on even when
|
|
@@ -21,14 +21,26 @@ which led to three fixes:
|
|
|
models the behaviour and the tests check that the cursor stays off and that
|
|
models the behaviour and the tests check that the cursor stays off and that
|
|
|
an update while blanked does not switch the display back on.
|
|
an update while blanked does not switch the display back on.
|
|
|
- **Text.** Gray glyph edges looked smeared at 2 bpp, so text is now drawn in
|
|
- **Text.** Gray glyph edges looked smeared at 2 bpp, so text is now drawn in
|
|
|
- plain black and white with full hinting (`UI_TEXT_ANTIALIAS` overrides this
|
|
|
|
|
- at build time). The small and log fonts became Verdana and Andale Mono
|
|
|
|
|
|
|
+ plain black and white with full hinting (`TEXT_ANTIALIAS` in
|
|
|
|
|
+ `radio/render.py` overrides this). The small and log fonts became Verdana and Andale Mono
|
|
|
(Microsoft core fonts), with Liberation as the fallback. The log has 7 rows
|
|
(Microsoft core fonts), with Liberation as the fallback. The log has 7 rows
|
|
|
of 10 px, leaving room for Polish accents.
|
|
of 10 px, leaving room for Polish accents.
|
|
|
- **DRM backlight.** The driver now registers a `radio-backlight` backlight
|
|
- **DRM backlight.** The driver now registers a `radio-backlight` backlight
|
|
|
device for the expander's P1.0 pin, driven from the flush worker, so the
|
|
device for the expander's P1.0 pin, driven from the flush worker, so the
|
|
|
frontend's default sysfs path works. Still compiled only.
|
|
frontend's default sysfs path works. Still compiled only.
|
|
|
|
|
|
|
|
|
|
+**Update 2026-11-11:** the application is now Python (`linux/radio/`, run as
|
|
|
|
|
+`linux/radio-ui sim|i2c|drm`), written for Python 3.7.3 (Debian buster, on the
|
|
|
|
|
+target) through 3.14. The panel core stays in C, since the kernel driver shares
|
|
|
|
|
+it, and is loaded through ctypes from `build/libradiopanel.so` (`make lib`).
|
|
|
|
|
+The `sim` window's LCD area matched the C window pixel for pixel, apart from one
|
|
|
|
|
+pixel of progress bar caused by timing. New: a test mode (`--window-keys`) that
|
|
|
|
|
+drives the real panel and a real MPD but takes keys from a window on the PC's X
|
|
|
|
|
+display. The Python DRM frontend ran on the real panel with the driver loaded,
|
|
|
|
|
+against the fake MPD. The command names below were updated:
|
|
|
|
|
+`radio-gtk` → `radio-ui sim`, `radio-i2c` → `radio-ui i2c`, `radio-drm` →
|
|
|
|
|
+`radio-ui drm`.
|
|
|
|
|
+
|
|
|
## 1. Summary
|
|
## 1. Summary
|
|
|
|
|
|
|
|
The LPC1114 is replaced by software on the Linux board, with the S1D13700 LCD
|
|
The LPC1114 is replaced by software on the Linux board, with the S1D13700 LCD
|
|
@@ -61,18 +73,18 @@ address binds to one driver, which is another reason for a separate expander.
|
|
|
|
|
|
|
|
## 3. Architecture
|
|
## 3. Architecture
|
|
|
|
|
|
|
|
- MPD (libmpdclient, idle events) ─┐
|
|
|
|
|
|
|
+ MPD (mpd.py, idle events) ───────┐
|
|
|
/dev/kmsg (optional) ────────────┤
|
|
/dev/kmsg (optional) ────────────┤
|
|
|
- keys (evdev or window buttons) ──┤
|
|
|
|
|
|
|
+ keys (evdev, or a window) ───────┤
|
|
|
▼
|
|
▼
|
|
|
- app_core.c + ui_render.c (Cairo/Pango)
|
|
|
|
|
- │ XRGB8888 frame + changed rectangle
|
|
|
|
|
|
|
+ app.py + render.py (Cairo/Pango) Python
|
|
|
|
|
+ │ XRGB8888 frame + changed rows
|
|
|
┌───────────────────────┼─────────────────────────┐
|
|
┌───────────────────────┼─────────────────────────┐
|
|
|
▼ ▼ ▼
|
|
▼ ▼ ▼
|
|
|
- main_gtk.c main_i2c.c main_drm.c
|
|
|
|
|
|
|
+ radio-ui sim radio-ui i2c radio-ui drm
|
|
|
│ │ dumb buffer + DIRTYFB
|
|
│ │ dumb buffer + DIRTYFB
|
|
|
- │ │ ▼
|
|
|
|
|
- │ │ s1d13700_drm.c
|
|
|
|
|
|
|
+ ▼ ▼ ▼
|
|
|
|
|
+ libpanel.c (ctypes) libpanel.c (ctypes) s1d13700_drm.c
|
|
|
▼ ▼ ▼
|
|
▼ ▼ ▼
|
|
|
┌───────────────── s1d13700_core.c ──────────────────────┐
|
|
┌───────────────── s1d13700_core.c ──────────────────────┐
|
|
|
│ XRGB→2 bpp · byte diff against shadow · write planner │
|
|
│ XRGB→2 bpp · byte diff against shadow · write planner │
|
|
@@ -114,26 +126,32 @@ command or too many of them, unknown commands, bad registers, messages ending
|
|
|
between P0 and P1, inconsistent SYSTEM SET, and writes during reset. The window
|
|
between P0 and P1, inconsistent SYSTEM SET, and writes during reset. The window
|
|
|
frontend exits with an error code if any occurred.
|
|
frontend exits with an error code if any occurred.
|
|
|
|
|
|
|
|
-### Application (`linux/app/`)
|
|
|
|
|
|
|
+### Application (`linux/radio/`)
|
|
|
|
|
+
|
|
|
|
|
+Python 3.7.3 to 3.14, with PyGObject (GLib, Pango, PangoCairo), pycairo and
|
|
|
|
|
+python3-gi-cairo; GTK 3 only for the window and the test mode, libdrm only for
|
|
|
|
|
+`drm`. The MPD protocol is implemented directly, so no MPD library is needed.
|
|
|
|
|
|
|
|
| File | Role |
|
|
| File | Role |
|
|
|
|---|---|
|
|
|---|---|
|
|
|
-| `app_core.c` | Render scheduling, changed-area detection, keys, backlight timeout, log batching |
|
|
|
|
|
-| `ui_render.c` | Screen layout: title, state icon, track, time, progress, options, volume, link warning, log |
|
|
|
|
|
-| `mpd_client.c` | Event-driven MPD connection; reconnects every 3 s |
|
|
|
|
|
-| `log_kmsg.c` | Follows the kernel log |
|
|
|
|
|
-| `main_gtk.c` | Window with simulated panel, buttons, shortcuts and a live traffic readout |
|
|
|
|
|
-| `main_i2c.c` | Real panel through i2c-dev, plus `--pattern geometry` / `gray` for bring-up |
|
|
|
|
|
-| `main_drm.c` | Real panel through the DRM driver |
|
|
|
|
|
-| `platform_linux.c` | evdev keys, sysfs backlight, signal handling |
|
|
|
|
|
|
|
+| `app.py` | Render scheduling, changed-rows detection, keys, backlight timeout, log batching, kernel log |
|
|
|
|
|
+| `render.py` | Screen layout: title, state icon, track, time, progress, options, volume, link warning, log |
|
|
|
|
|
+| `mpd.py` | Event-driven MPD connection; reconnects every 3 s |
|
|
|
|
|
+| `panel.py`, `libpanel.c` | The C panel core and simulator behind a handle, through ctypes |
|
|
|
|
|
+| `sim.py` | `sim`: window with simulated panel, buttons, shortcuts and a live traffic readout |
|
|
|
|
|
+| `gtkkeys.py` | Key table and buttons, and the test mode's key window |
|
|
|
|
|
+| `drm.py` | `drm`: the panel through the DRM driver (libdrm 2.4.97 calls, dumb buffer by ioctl) |
|
|
|
|
|
+| `platform.py` | evdev keys, sysfs backlight, i2c bus check, signal handling |
|
|
|
|
|
+| `__main__.py` | Command line, `i2c` frontend and its `--pattern geometry` / `gray` |
|
|
|
|
|
|
|
|
Behaviour kept from the firmware: 300 ms key lockout, 30 s backlight, the same
|
|
Behaviour kept from the firmware: 300 ms key lockout, 30 s backlight, the same
|
|
|
command for each key, no title while stopped. New: event-driven updates instead
|
|
command for each key, no title while stopped. New: event-driven updates instead
|
|
|
of 2 s polling, proper Polish characters, a progress bar, volume display. Log
|
|
of 2 s polling, proper Polish characters, a progress bar, volume display. Log
|
|
|
redraws are batched to at most one per second.
|
|
redraws are batched to at most one per second.
|
|
|
|
|
|
|
|
-Key mapping in the window: `Z X C V B` prev/play/pause/stop/next, arrows
|
|
|
|
|
-(Up/Down = volume), `Enter` OK, `Esc` refresh, `M` menu, `L` list, `Space` pause.
|
|
|
|
|
|
|
+Key mapping in the window and the test mode's key window: `Z X C V B` prev/play/pause/stop/next, arrows
|
|
|
|
|
+(Up/Down = volume), `Enter` OK, `Esc` refresh, `M` menu, `L` list, `Space` pause; also the media and volume keys of a
|
|
|
|
|
+multimedia keyboard.
|
|
|
OK, Menu, List, Left and Right wake the backlight only, as in the firmware.
|
|
OK, Menu, List, Left and Right wake the backlight only, as in the firmware.
|
|
|
|
|
|
|
|
### DRM driver (`linux/driver/s1d13700_drm.c`)
|
|
### DRM driver (`linux/driver/s1d13700_drm.c`)
|
|
@@ -172,15 +190,23 @@ re-sending DISP ON (the cursor fix); the last two rows predate it.
|
|
|
| Panel tests: init values, invalid configs, no-change = no traffic, direction choice, gap merging, 2000 random update rounds at 1/2/4 bpp and message sizes 7/61/1025, error recovery, pixel conversion | Pass, also under ASan and UBSan |
|
|
| Panel tests: init values, invalid configs, no-change = no traffic, direction choice, gap merging, 2000 random update rounds at 1/2/4 bpp and message sizes 7/61/1025, error recovery, pixel conversion | Pass, also under ASan and UBSan |
|
|
|
| The simulator's fault detector fires on bad streams | Pass |
|
|
| The simulator's fault detector fires on bad streams | Pass |
|
|
|
| All frontends, the overlay and the module compile; module with `W=1` | No warnings shown |
|
|
| All frontends, the overlay and the module compile; module with `W=1` | No warnings shown |
|
|
|
|
|
+| Python UI tests (`make pytest`, 17 tests): MPD parsing, commands, push and reconnect against the fake server; rendering through the simulator with no faults; key lockout; patterns; bus refusal; evdev codes against the overlay | Pass on 3.14.7 |
|
|
|
|
|
+| `radio-ui sim` against the C window, same fake server | LCD area identical except one progress bar pixel (timing) |
|
|
|
|
|
+| `radio-ui drm` on the real panel (driver loaded), fake MPD | Runs, no errors from the frontend or the kernel |
|
|
|
|
|
+| Test mode key window: every shortcut, media key and window close, injected as GDK events | All 13 keys mapped; closing the window quits |
|
|
|
|
|
+| DRM ctypes structures and ioctl numbers against the C headers | Identical |
|
|
|
| Window buttons against a fake MPD: Next, Up, Down, Pause, Prev, Stop, Play, Esc, Menu | The seven MPD commands sent correctly; Menu sends none |
|
|
| Window buttons against a fake MPD: Next, Up, Down, Pause, Prev, Stop, Play, Esc, Menu | The seven MPD commands sent correctly; Menu sends none |
|
|
|
| Real MPD on `radio.lo` (0.21.4), read-only | Connects and displays correctly; player state not changed |
|
|
| Real MPD on `radio.lo` (0.21.4), read-only | Connects and displays correctly; player state not changed |
|
|
|
| MPD pushing a change | Triggers a refresh (fake server) |
|
|
| MPD pushing a change | Triggers a refresh (fake server) |
|
|
|
| Server lost, then back | Warning shown, reconnects automatically (fake server) |
|
|
| Server lost, then back | Warning shown, reconnects automatically (fake server) |
|
|
|
-| `radio-i2c` on PIIX4, AMDGPU I²C and AUX buses | All refused, no traffic |
|
|
|
|
|
|
|
+| `radio-i2c` (C) on PIIX4, AMDGPU I²C and AUX buses; Python bus check with mocked names | All refused, no traffic |
|
|
|
|
|
|
|
|
-The kernel module was built but **never loaded**. The window's keyboard shortcuts
|
|
|
|
|
-were not exercised automatically (no input injection tool here), and neither was
|
|
|
|
|
-real MPD with key presses, to avoid changing playback.
|
|
|
|
|
|
|
+Python 3.7.3 was not run here (no interpreter or container available): the code
|
|
|
|
|
+was parsed with `ast.parse(feature_version=(3, 7))` and avoids newer library
|
|
|
|
|
+calls, but needs a run on the target. Real X keyboard delivery to the key window
|
|
|
|
|
+was not exercised (no input injection tool), nor real MPD with key presses, to
|
|
|
|
|
+avoid changing playback. `radio-ui i2c` was not run on hardware after the port:
|
|
|
|
|
+the DRM driver held the panel's address at the time.
|
|
|
|
|
|
|
|
## 7. Not verified
|
|
## 7. Not verified
|
|
|
|
|
|
|
@@ -203,14 +229,14 @@ These can only be settled with hardware.
|
|
|
|
|
|
|
|
| | Stay on 4.19 | Upgrade to current |
|
|
| | Stay on 4.19 | Upgrade to current |
|
|
|
|---|---|---|
|
|
|---|---|---|
|
|
|
-| Panel | `radio-i2c` | `radio-drm` + driver, or `radio-i2c` |
|
|
|
|
|
|
|
+| Panel | `radio-ui i2c` | `radio-ui drm` + driver, or `radio-ui i2c` |
|
|
|
| Kernel changes | Overlay only | Overlay + module |
|
|
| Kernel changes | Overlay only | Overlay + module |
|
|
|
| Standard graphics tools | No | Yes (DRM, fbdev emulation) |
|
|
| Standard graphics tools | No | Yes (DRM, fbdev emulation) |
|
|
|
|
|
|
|
|
The driver cannot build on 4.19: it depends on damage tracking, shmem and client
|
|
The driver cannot build on 4.19: it depends on damage tracking, shmem and client
|
|
|
helpers from much later kernels. There is no 4.19 tree here to measure the gap.
|
|
helpers from much later kernels. There is no 4.19 tree here to measure the gap.
|
|
|
|
|
|
|
|
-**Recommendation:** bring up on 4.19 with `radio-i2c`, which gets a working panel
|
|
|
|
|
|
|
+**Recommendation:** bring up on 4.19 with `radio-ui i2c`, which gets a working panel
|
|
|
with no kernel risk. Upgrade only if standard graphics tools turn out to be
|
|
with no kernel risk. Upgrade only if standard graphics tools turn out to be
|
|
|
wanted, since the application does not need DRM.
|
|
wanted, since the application does not need DRM.
|
|
|
|
|
|
|
@@ -236,7 +262,8 @@ cost on the board.
|
|
|
- [ ] Check the backlight through sysfs
|
|
- [ ] Check the backlight through sysfs
|
|
|
|
|
|
|
|
**Phase 2: application on the board**
|
|
**Phase 2: application on the board**
|
|
|
-- [ ] Build on the SoC or cross-compile; install fonts (DejaVu)
|
|
|
|
|
|
|
+- [ ] Install python3-gi, python3-gi-cairo, gir1.2-pango-1.0 and fonts (DejaVu); `make lib` on the SoC
|
|
|
|
|
+- [ ] Run `make pytest` on the target's Python 3.7.3
|
|
|
- [ ] Add a systemd unit with restart and `WatchdogSec` (the firmware had a watchdog; the app has no `sd_notify` yet)
|
|
- [ ] Add a systemd unit with restart and `WatchdogSec` (the firmware had a watchdog; the app has no `sd_notify` yet)
|
|
|
- [ ] Measure CPU load and real update times
|
|
- [ ] Measure CPU load and real update times
|
|
|
- [ ] Decide on volume control (section 11)
|
|
- [ ] Decide on volume control (section 11)
|
|
@@ -245,7 +272,7 @@ cost on the board.
|
|
|
|
|
|
|
|
**Phase 3: DRM (only if upgrading)**
|
|
**Phase 3: DRM (only if upgrading)**
|
|
|
- [ ] Upgrade the kernel; build the module for the target
|
|
- [ ] Upgrade the kernel; build the module for the target
|
|
|
-- [ ] Test with `modetest` and `radio-drm`
|
|
|
|
|
|
|
+- [ ] Test with `modetest` and `radio-ui drm` (the frontend has run on the dev PC)
|
|
|
- [ ] Add R1/R2 formats and a blank/power-save path if useful
|
|
- [ ] Add R1/R2 formats and a blank/power-save path if useful
|
|
|
- [ ] Keep fbcon off this panel: a blinking cursor means constant I²C traffic
|
|
- [ ] Keep fbcon off this panel: a blinking cursor means constant I²C traffic
|
|
|
|
|
|
|
@@ -283,7 +310,7 @@ cost on the board.
|
|
|
The development PC is an AMD BC-250. Its `I2C_HEADER1` and possibly its PIIX4
|
|
The development PC is an AMD BC-250. Its `I2C_HEADER1` and possibly its PIIX4
|
|
|
SMBus ports reach the voltage regulators (ISL69247, ISL95712). Do not attach the
|
|
SMBus ports reach the voltage regulators (ISL69247, ISL95712). Do not attach the
|
|
|
expanders there, and do not run `i2cdetect` scans on buses 6-10.
|
|
expanders there, and do not run `i2cdetect` scans on buses 6-10.
|
|
|
-`radio-i2c` refuses those buses by name. Use a dedicated USB adapter such as an
|
|
|
|
|
|
|
+`radio-ui i2c` refuses those buses by name. Use a dedicated USB adapter such as an
|
|
|
MCP2221A; this needs `CONFIG_HID_MCP2221` and `CONFIG_GPIOLIB` enabled.
|
|
MCP2221A; this needs `CONFIG_HID_MCP2221` and `CONFIG_GPIOLIB` enabled.
|
|
|
|
|
|
|
|
## 13. References
|
|
## 13. References
|