# SYSTEMD STARTUP — Beebo 407 boot → audio → UI chain

All facts read directly from the image's `/etc/systemd/system/`,
`/usr/bin/start_beebo.sh` and `/home/debian/` (VERIFIED).

## 1. Chain — VERIFIED

```
systemd
 └─ jack.service (multi-user.target)
     ├─ ExecStart=/usr/bin/start_beebo.sh start      (User=debian,
     │   WorkingDirectory=/home/debian/UI,
     │   LimitRTPRIO/limitMEMLOCK/limitRTTIME = infinity, Restart=always, 3s)
     └─ start_beebo.sh start:
         1. wait for JACK: jack_wait -c polling every 0.2 s
            (JACK_NO_AUDIO_RESERVATION=1 exported;
             jackd line present only as COMMENT — see §3)
         2. /usr/bin/ttymidi -s /dev/ttyS1 &        (serial MIDI)
         3. a2jmidid / jack-matchmaker:
            /usr/local/bin/jack-matchmaker -p /home/debian/patterns &
         4. /usr/bin/ingen -e -p 3 -a /home/debian/start_up.ingen
            (engine mode = the -e, 3 threads = -p 3, initial patch
             /home/debian/start_up.ingen = -a)
     └─ ExecStop=/usr/bin/start_beebo.sh stop  (usr/bin/pkill "ingen")
```

## 2. UI chain — VERIFIED

```
lightdm → autologin debian → LXDE/openbox
  → ~/.config/lxsession/LXDE/autostart → start_frontend.sh
    → python3 show_widget.py -style /home/debian/UI/poly_style
        └─ ingen_wrapper.py waits for /tmp/ingen.sock, socket_connect()
```

## 3. Broken / not-found items — VERIFIED (recorded, not guessed)

- **jackd launch point not found**: the only jackd command lines in
  `start_beebo.sh` are commented out:
  - `#/usr/bin/jackd -R -P80 -t 5000 -d alsa -dhw:CARD=digitpcm3168a,DEV=0 -p 128 -i 2 -o 2 &`
  - `#/usr/bin/jackd -R -P80 -t 5000 -d alsa -P"hw:CARD=digitpcm3168a,DEV=0" -C"hw:CARD=digitpcm3168a,DEV=1" -p 256 -i 6 -o 8 &`
  The script nonetheless *waits* for a running server, so something starts
  jackd outside this script; its real startpoint remains an open item of
  `docs/HARDWARE_HANDOFF.md` in the v2.0.1 tree. jackd2 1.9.21~dfsg-3 is
  installed (dpkg).
- `ingen.service` and `polyui.service` unit-name symlinks under
  `/etc/systemd/system/` are **dangling** (broken); the working ingen is the
  one started from `jack.service` → `start_beebo.sh`.

## 4. Kernel / hardware identity — VERIFIED

- Kernel `5.4.2-rt5-001` (PREEMPT_RT), device tree
  `sun50i-a64-sopine-baseboard.dtb` → Allwinner A64 SoPine baseboard.
- Data partition (p3, btrfs) carries `audio/`, `presets/`, `temp_boot/`,
  `ext2_saved/`; presets bootstrap copies `/to_nor_flash/`→`/nor_flash` on
  first boot (`start_beebo.sh`).

## 5. Consequences for our integration (PROPOSED, next phase)

- Our FX layer keys off the running digit_ui process (callbacks + wrapper
  module) — the verified chain shows exactly one such process
  (`show_widget.py`) and exactly one ingen instance — consistent with our
  "no second Ingen client / no second evdev reader" rules.
- Nothing in this pass touched services, QML, start scripts or the image
  (brief §28). Systemd-startup changes are not required by the plan.