# maizeshark/mcu2-desktop architecture

> Architecture diagram of the GitHub repository maizeshark/mcu2-desktop, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/maizeshark/mcu2-desktop
- Repository: https://github.com/maizeshark/mcu2-desktop

## Overview

mcu2-desktop runs Tesla QtCar firmware in a Linux chroot, exposing the UI through VNC or a native touchscreen and optionally simulating vehicle peripherals. The main workflow is: use the `tesla` command to prepare a firmware image with the patch kit, start QtCar, then interact with it while optional vehicle, GPS, audio, connectivity, and media features supply data or devices. The README documents these capabilities; several feature implementations were not sampled, so their internal links are shown only where documented, not inferred from directory names.

Main entry points: [`tesla`](https://github.com/maizeshark/mcu2-desktop/blob/main/tesla) (tesla CLI), [`tesla-touch/src/main.rs`](https://github.com/maizeshark/mcu2-desktop/blob/main/tesla-touch/src/main.rs) (Touch input), [`tesla-touch/src/touch.rs`](https://github.com/maizeshark/mcu2-desktop/blob/main/tesla-touch/src/touch.rs) (Virtual touchscreen), [`mcu2-patchkit/mcu2_patch.py`](https://github.com/maizeshark/mcu2-desktop/blob/main/mcu2-patchkit/mcu2_patch.py) (Firmware patcher)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_image["Image preparation"]
  node_patcher["Firmware patcher<br/>[mcu2_patch.py]"]
  node_profiles["Firmware profiles"]
end

subgraph group_runtime["QtCar runtime"]
  node_tesla["tesla CLI"]
  node_qtcar["QtCar chroot"]
  node_touch["Touch input<br/>[main.rs]"]
  node_pointer["X pointer capture<br/>[record.rs]"]
  node_gesture["Gesture mapping<br/>[main.rs]"]
  node_touchscreen["Virtual touchscreen<br/>[touch.rs]"]
  node_passthrough["Touch passthrough<br/>[passthrough.rs]"]
  node_cursor["Visible cursor<br/>[cursor.rs]"]
end

subgraph group_vehicle["Vehicle simulation"]
  node_vehicle_data["Vehicle state<br/>[tesla-can.py]"]
  node_webpanel["Vehicle web panel"]
  node_beamng["BeamNG bridge<br/>[beamng-bridge.py]"]
end

subgraph group_peripherals["Peripheral features"]
  node_gps["GPS source<br/>[tesla-gps.py]"]
  node_navigation["Offline navigation"]
  node_audio["Audio support"]
  node_bluetooth["Bluetooth bridge<br/>[hci-bridge.py]"]
  node_voice["Local speech<br/>[voice-server.py]"]
  node_media["USB music and camera"]
  node_wifi["Wi-Fi and cellular"]
end

subgraph group_tools["Host tools"]
  node_stick["Bootable USB"]
  node_logs["Run log summary<br/>[logsummary.py]"]
end

node_user(("Desktop user"))
node_vnc(("VNC viewer"))
node_native(("Native display"))

node_user -->|"runs commands"| node_tesla
node_tesla -->|"builds image"| node_patcher
node_patcher -->|"uses profile"| node_profiles
node_tesla -->|"starts chroot"| node_qtcar
node_user -->|"views UI"| node_vnc
node_vnc -->|"displays screen"| node_qtcar
node_user -->|"provides input"| node_touch
node_touch -->|"captures events"| node_pointer
node_touch -->|"maps gestures"| node_gesture
node_gesture -->|"emits touch frames"| node_touchscreen
node_touchscreen -->|"supplies touch"| node_qtcar
node_user -->|"uses display"| node_native
node_native -->|"passes touches"| node_passthrough
node_passthrough -->|"emits touch frames"| node_touchscreen
node_cursor -.->|"shows cursor"| node_vnc
node_vehicle_data -->|"supplies vehicle data"| node_qtcar
node_user -->|"changes vehicle state"| node_webpanel
node_beamng -->|"drives vehicle state"| node_vehicle_data
node_gps -->|"supplies position"| node_qtcar
node_navigation -->|"provides navigation"| node_qtcar
node_audio -->|"provides sound"| node_qtcar
node_bluetooth -->|"bridges Bluetooth"| node_qtcar
node_voice -->|"recognizes commands"| node_qtcar
node_media -->|"provides media"| node_qtcar
node_wifi -->|"provides connectivity"| node_qtcar
node_tesla -->|"builds boot media"| node_stick
node_tesla -->|"summarizes runs"| node_logs

click node_tesla "https://github.com/maizeshark/mcu2-desktop/blob/main/tesla"
click node_patcher "https://github.com/maizeshark/mcu2-desktop/blob/main/mcu2-patchkit/mcu2_patch.py"
click node_profiles "https://github.com/maizeshark/mcu2-desktop/tree/main/mcu2-patchkit/profiles"
click node_touch "https://github.com/maizeshark/mcu2-desktop/blob/main/tesla-touch/src/main.rs"
click node_pointer "https://github.com/maizeshark/mcu2-desktop/blob/main/tesla-touch/src/record.rs"
click node_gesture "https://github.com/maizeshark/mcu2-desktop/blob/main/tesla-touch/src/main.rs"
click node_touchscreen "https://github.com/maizeshark/mcu2-desktop/blob/main/tesla-touch/src/touch.rs"
click node_passthrough "https://github.com/maizeshark/mcu2-desktop/blob/main/tesla-touch/src/passthrough.rs"
click node_cursor "https://github.com/maizeshark/mcu2-desktop/blob/main/tesla-touch/src/cursor.rs"
click node_vehicle_data "https://github.com/maizeshark/mcu2-desktop/blob/main/vehicle/tesla-can.py"
click node_webpanel "https://github.com/maizeshark/mcu2-desktop/tree/main/vehicle"
click node_beamng "https://github.com/maizeshark/mcu2-desktop/blob/main/beamng/beamng-bridge.py"
click node_gps "https://github.com/maizeshark/mcu2-desktop/blob/main/vehicle/tesla-gps.py"
click node_navigation "https://github.com/maizeshark/mcu2-desktop/tree/main/navigation"
click node_audio "https://github.com/maizeshark/mcu2-desktop/tree/main/tools"
click node_bluetooth "https://github.com/maizeshark/mcu2-desktop/blob/main/bluetooth/hci-bridge.py"
click node_voice "https://github.com/maizeshark/mcu2-desktop/blob/main/voice/voice-server.py"
click node_media "https://github.com/maizeshark/mcu2-desktop/tree/main/tools"
click node_wifi "https://github.com/maizeshark/mcu2-desktop/tree/main/tools"
click node_stick "https://github.com/maizeshark/mcu2-desktop/tree/main/stick"
click node_logs "https://github.com/maizeshark/mcu2-desktop/blob/main/tools/logsummary.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_patcher,node_profiles,node_user,node_vnc toneBlue
class node_tesla,node_qtcar,node_touch,node_pointer,node_gesture,node_touchscreen,node_passthrough,node_cursor toneAmber
class node_vehicle_data,node_webpanel,node_beamng toneMint
class node_gps,node_navigation,node_audio,node_bluetooth,node_voice,node_media,node_wifi toneRose
class node_stick,node_logs,node_native toneIndigo
```

## Components

### Image preparation

- [Firmware patcher](https://github.com/maizeshark/mcu2-desktop/blob/main/mcu2-patchkit/mcu2_patch.py): `mcu2-patchkit/mcu2_patch.py`
- [Firmware profiles](https://github.com/maizeshark/mcu2-desktop/tree/main/mcu2-patchkit/profiles): `mcu2-patchkit/profiles`

### QtCar runtime

- [tesla CLI](https://github.com/maizeshark/mcu2-desktop/blob/main/tesla): `tesla`
- **QtCar chroot**
- [Touch input](https://github.com/maizeshark/mcu2-desktop/blob/main/tesla-touch/src/main.rs): `tesla-touch/src/main.rs`
- [X pointer capture](https://github.com/maizeshark/mcu2-desktop/blob/main/tesla-touch/src/record.rs): `tesla-touch/src/record.rs`
- [Gesture mapping](https://github.com/maizeshark/mcu2-desktop/blob/main/tesla-touch/src/main.rs): `tesla-touch/src/main.rs`
- [Virtual touchscreen](https://github.com/maizeshark/mcu2-desktop/blob/main/tesla-touch/src/touch.rs): `tesla-touch/src/touch.rs`
- [Touch passthrough](https://github.com/maizeshark/mcu2-desktop/blob/main/tesla-touch/src/passthrough.rs): `tesla-touch/src/passthrough.rs`
- [Visible cursor](https://github.com/maizeshark/mcu2-desktop/blob/main/tesla-touch/src/cursor.rs): `tesla-touch/src/cursor.rs`

### Vehicle simulation

- [Vehicle state](https://github.com/maizeshark/mcu2-desktop/blob/main/vehicle/tesla-can.py): `vehicle/tesla-can.py`
- [Vehicle web panel](https://github.com/maizeshark/mcu2-desktop/tree/main/vehicle): `vehicle`
- [BeamNG bridge](https://github.com/maizeshark/mcu2-desktop/blob/main/beamng/beamng-bridge.py): `beamng/beamng-bridge.py`

### Peripheral features

- [GPS source](https://github.com/maizeshark/mcu2-desktop/blob/main/vehicle/tesla-gps.py): `vehicle/tesla-gps.py`
- [Offline navigation](https://github.com/maizeshark/mcu2-desktop/tree/main/navigation): `navigation`
- [Audio support](https://github.com/maizeshark/mcu2-desktop/tree/main/tools): `tools`
- [Bluetooth bridge](https://github.com/maizeshark/mcu2-desktop/blob/main/bluetooth/hci-bridge.py): `bluetooth/hci-bridge.py`
- [Local speech](https://github.com/maizeshark/mcu2-desktop/blob/main/voice/voice-server.py): `voice/voice-server.py`
- [USB music and camera](https://github.com/maizeshark/mcu2-desktop/tree/main/tools): `tools`
- [Wi-Fi and cellular](https://github.com/maizeshark/mcu2-desktop/tree/main/tools): `tools`

### Host tools

- [Bootable USB](https://github.com/maizeshark/mcu2-desktop/tree/main/stick): `stick`
- [Run log summary](https://github.com/maizeshark/mcu2-desktop/blob/main/tools/logsummary.py): `tools/logsummary.py`

### Other components

- **Desktop user**
- **VNC viewer**
- **Native display**

## Connections

- Desktop user → tesla CLI: runs commands (evidence: `README.md`)
- tesla CLI → Firmware patcher: builds image (evidence: `README.md`)
- Firmware patcher → Firmware profiles: uses profile (evidence: `mcu2-patchkit/mcu2_patch.py`)
- tesla CLI → QtCar chroot: starts chroot (evidence: `README.md`)
- Desktop user → VNC viewer: views UI (evidence: `README.md`)
- VNC viewer → QtCar chroot: displays screen (evidence: `README.md`)
- Desktop user → Touch input: provides input (evidence: `README.md`)
- Touch input → X pointer capture: captures events (evidence: `tesla-touch/src/main.rs`)
- Touch input → Gesture mapping: maps gestures (evidence: `tesla-touch/src/main.rs`)
- Gesture mapping → Virtual touchscreen: emits touch frames (evidence: `tesla-touch/src/main.rs`)
- Virtual touchscreen → QtCar chroot: supplies touch (evidence: `README.md`)
- Desktop user → Native display: uses display (evidence: `README.md`)
- Native display → Touch passthrough: passes touches (evidence: `README.md`)
- Touch passthrough → Virtual touchscreen: emits touch frames (evidence: `tesla-touch/src/passthrough.rs`)
- Visible cursor → VNC viewer: shows cursor
- Vehicle state → QtCar chroot: supplies vehicle data (evidence: `README.md`)
- Desktop user → Vehicle web panel: changes vehicle state (evidence: `README.md`)
- BeamNG bridge → Vehicle state: drives vehicle state (evidence: `README.md`)
- GPS source → QtCar chroot: supplies position (evidence: `README.md`)
- Offline navigation → QtCar chroot: provides navigation (evidence: `README.md`)
- Audio support → QtCar chroot: provides sound (evidence: `README.md`)
- Bluetooth bridge → QtCar chroot: bridges Bluetooth (evidence: `README.md`)
- Local speech → QtCar chroot: recognizes commands (evidence: `README.md`)
- USB music and camera → QtCar chroot: provides media (evidence: `README.md`)
- Wi-Fi and cellular → QtCar chroot: provides connectivity (evidence: `README.md`)
- tesla CLI → Bootable USB: builds boot media (evidence: `README.md`)
- tesla CLI → Run log summary: summarizes runs (evidence: `README.md`)
