Compare commits

13 Commits
Author SHA1 Message Date
yann64andClaude Opus 5.5 b7d60634dc release: v0.3.0
CI / Linux arm64 (push) Waiting to run
CI / Linux x86_64 (push) Waiting to run
CI / ASan + UBSan (push) Waiting to run
Release / Linux arm64 (push) Waiting to run
Release / Linux x86_64 (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WDASLCiN764v685boRVYar
2026-11-29 07:37:17 +01:00
yann64andClaude Opus 5.5 d190a8b5f8 Haiku packaging: .hpkg script and HaikuPorts recipe template
CI / Linux arm64 (push) Waiting to run
CI / Linux x86_64 (push) Waiting to run
CI / ASan + UBSan (push) Waiting to run
- tools/haiku-package.sh: release build staged into the package layout
  (apps/OpenPU, bin/openpu-cli, data/locale, Deskbar link), .PackageInfo
  with the library requirements, `package create`. Validated with
  `pkgman install` in the Haiku R1/beta6 VM.
- packaging/haiku/openpu.recipe: HaikuPorts recipe template, to be named
  after the released version with the archive checksum.
- The Haiku application is installed in apps/ and finds its translations
  through BPathFinder (data/locale of its installation location).
- Fix: `cmake --install --strip` dropped the application's resources
  (icon, signature, version); they are attached again after install.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WDASLCiN764v685boRVYar
2026-11-29 06:50:47 +01:00
yann64andClaude Opus 5.5 b757b35709 README: AppImage and release workflow validated
CI / Linux arm64 (push) Waiting to run
CI / Linux x86_64 (push) Waiting to run
CI / ASan + UBSan (push) Waiting to run
The manual Release run built the .deb, AppImage and openpu-cli tarball
for x86_64 and arm64; the x86_64 AppImage runs in WSL with its French
translation and bundled icons.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WDASLCiN764v685boRVYar
2026-11-29 06:29:06 +01:00
yann64andClaude Opus 5.5 ce7316af29 Linux packaging: Debian package, AppImage script, release workflow
CI / Linux arm64 (push) Waiting to run
CI / Linux x86_64 (push) Waiting to run
CI / ASan + UBSan (push) Waiting to run
- CPack DEB configuration (cmake/Packaging.cmake): dependencies from
  dpkg-shlibdeps, udisks2 recommended, strip.
- AppStream metadata, installed with the desktop file and the icons;
  tools/release.sh adds each release to it.
- tools/appimage.sh: AppImage of the GTK interface and openpu-cli with
  linuxdeploy and its GTK plugin (x86_64 and aarch64).
- Release workflow: .deb, AppImage and openpu-cli tarball for x86_64 and
  arm64, attached to the release of a vX.Y.Z tag, or kept as artifacts
  on a manual run. tools/release.sh edits the release when the workflow
  created it first.
- The GTK interface finds its translations next to the executable
  (../share/locale), for relocatable installs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WDASLCiN764v685boRVYar
2026-11-29 06:17:50 +01:00
yann64andClaude Opus 5.5 bbc3bb3896 Add the OpenPU application icon (SVG, HVIF, PNG)
CI / Linux arm64 (push) Waiting to run
CI / Linux x86_64 (push) Waiting to run
CI / ASan + UBSan (push) Waiting to run
Original artwork: a generic shield with a "PU" monogram and a small
download arrow, deep blue and white. tools/make_icons.py describes the
shapes once and writes the master SVG, a simplified 16/24 px variant, the
Haiku HVIF and PNG renderings from 16 to 512 px (own antialiased
rasterizer, standard library only).

- Linux: icons installed in the hicolor theme as io.github.openpu.OpenPU
  (the name the .desktop file and the About dialog already use), with a
  build-tree copy for uninstalled runs.
- Haiku: the HVIF is embedded as the vector_icon resource; the executable
  is relinked when only its resources change.
- Fix: po/ did not include GNUInstallDirs, so translations were installed
  outside the locale directory.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WDASLCiN764v685boRVYar
2026-11-29 06:11:23 +01:00
yann64andClaude Opus 5.5 155545660e Haiku: native Interface Kit user interface
CI / Linux arm64 (push) Waiting to run
CI / Linux x86_64 (push) Waiting to run
CI / ASan + UBSan (push) Waiting to run
Same workflow as the GTK interface: vehicle list, adding a vehicle by VIN,
available updates, download folder, resumable download with progress, USB
stick selection with an erase confirmation, writing, installation guide.
Also a Preferences window (folder, language, automatic new-version check),
an About window and the manual new-version check.

Worker threads post closures to the window through a non-blocking queue
(BMessenger with a zero timeout). Translations use gettext with the GTK
catalogs; the default language comes from the Locale preferences. The
executable gets its signature and version from a generated .rdef.

Validated in the Haiku R1/beta6 VM against a mock Majestic server: full
flow down to a FAT32 stick with license/, both archives and no
UpdateInfo.xml; French interface; GitHub new-version check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WDASLCiN764v685boRVYar
2026-11-29 05:56:25 +01:00
yann64andClaude Opus 5.5 e5af8ea27d docs: fix JSON escaping example
CI / Linux arm64 (push) Waiting to run
CI / Linux x86_64 (push) Waiting to run
CI / ASan + UBSan (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WDASLCiN764v685boRVYar
2026-11-28 23:50:40 +01:00
yann64andClaude Opus 5.5 c2ed18a8ed docs: restore JSON escaping example, Haiku USB support in the status list
CI / Linux arm64 (push) Waiting to run
CI / Linux x86_64 (push) Waiting to run
CI / ASan + UBSan (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WDASLCiN764v685boRVYar
2026-11-28 23:50:29 +01:00
yann64andClaude Opus 5.5 9a24c2eb61 docs: translate docs/analysis to English
CI / Linux arm64 (push) Waiting to run
CI / Linux x86_64 (push) Waiting to run
CI / ASan + UBSan (push) Waiting to run
- API.md, workflow.md and usb-layout.md translated
- usb-layout.md: describe the formatting that OpenPU actually performs
  on Linux (UDisks2) and Haiku (one transaction per step)
- API.md: restore the = / & escaping example lost earlier

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WDASLCiN764v685boRVYar
2026-11-28 23:50:13 +01:00
yann64andClaude Opus 5.5 962343f220 haiku: working USB backend, symlink-safe extraction
CI / Linux arm64 (push) Waiting to run
CI / Linux x86_64 (push) Waiting to run
CI / ASan + UBSan (push) Waiting to run
- usb_haiku.cpp: each disk device transaction kept minimal, because
  Haiku R1/beta6 rejects or hangs on combined ones: erase foreign
  content, delete old MBR partitions, create the 0x0c partition
  ("FAT 32-bit, LBA-mapped", with "active false" parameters) and format
  FAT32 are separate commits; Uninitialize is never used on an MBR
- OPENPU_DEBUG=1 traces the Haiku disk device steps on stderr
- extractTar resolves the destination first: SECURE_SYMLINKS refused
  destinations under a symlink (/tmp on Haiku)
- check.sh: clang-tidy skips sources not built on Linux
- validated in the Haiku VM: write-usb on the virtual stick gives an MBR,
  a FAT32 partition at 1 MiB, the label, license/ and the archive tree
  without UpdateInfo.xml, with identical checksums; 53 unit tests pass

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WDASLCiN764v685boRVYar
2026-11-28 23:49:13 +01:00
yann64andClaude Opus 5.5 b2ca454d44 haiku: USB backend (Storage Kit), bundled doctest, VM sync tooling
CI / Linux arm64 (push) Waiting to run
CI / Linux x86_64 (push) Waiting to run
CI / ASan + UBSan (push) Waiting to run
- usb_haiku.cpp: lists /dev/disk/usb/* drives (never the boot volume),
  formats MBR + FAT32 at 1 MiB through BDiskDevice/BPartition, mounts,
  unmounts and ejects; modifications are cancelled on failure
- third_party/doctest (MIT single header) used when no system package
  exists (HaikuPorts has none)
- tools/haiku-vm.sh: sync command, dedicated SSH key; tools/qmp.py:
  typefile command and slower key pacing
- builds on Haiku R1/beta6 x86_64; usb-list sees the virtual stick.
  Known issue: some unit tests still fail on Haiku (to investigate).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WDASLCiN764v685boRVYar
2026-11-28 20:20:43 +01:00
yann64andClaude Opus 5.5 114976b912 release.sh: fix release notes extraction (empty notes in v0.2.0)
CI / Linux arm64 (push) Waiting to run
CI / Linux x86_64 (push) Waiting to run
CI / ASan + UBSan (push) Waiting to run
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WDASLCiN764v685boRVYar
2026-11-28 20:09:05 +01:00
yann64andClaude Opus 5.5 1c1ccd631a docs: CHANGELOG in English, README without the mirror link; Haiku VM tooling
CI / Linux arm64 (push) Waiting to run
CI / Linux x86_64 (push) Waiting to run
CI / ASan + UBSan (push) Waiting to run
- CHANGELOG.md translated to English (GitHub release notes of v0.1.0 and
  v0.2.0 updated accordingly)
- tools/haiku-vm.sh: Haiku R1/beta6 x86_64 VM under QEMU/KVM (verified
  image, 20 GB disk, virtual USB stick, SSH port forward, QMP socket)
- tools/qmp.py: headless control through QMP (PNG screenshots, absolute
  clicks, typing, key combos, power-off)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WDASLCiN764v685boRVYar
2026-11-28 20:08:31 +01:00
49 changed files with 11060 additions and 573 deletions

No files matched your search

+83
View File
@@ -0,0 +1,83 @@
# SPDX-License-Identifier: MIT
# Release binaries for Linux x86_64 and arm64: Debian package, AppImage and a tarball of the
# command-line tool. On a vX.Y.Z tag they are attached to the GitHub release (created here if
# tools/release.sh has not created it yet); a manual run keeps them as workflow artifacts.
name: Release
on:
push:
tags: ["v*"]
workflow_dispatch:
permissions:
contents: write
jobs:
linux:
name: Linux ${{ matrix.arch }}
strategy:
fail-fast: false
matrix:
include:
- arch: x86_64
runner: ubuntu-24.04
- arch: arm64
runner: ubuntu-24.04-arm
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0 # tags are needed for the version description
- name: Dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
build-essential cmake ninja-build pkg-config gettext file desktop-file-utils \
libcurl4-openssl-dev libarchive-dev nlohmann-json3-dev doctest-dev \
libglib2.0-dev libgtkmm-4.0-dev librsvg2-common
- name: Build and test
run: |
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr \
-DOPENPU_WERROR=ON -DOPENPU_UI_GTK=ON
cmake --build build
ctest --test-dir build --output-on-failure
- name: Debian package
run: |
cd build && cpack -G DEB
dpkg-deb -I openpu_*.deb
- name: Command-line tool
run: |
version=$(build/src/cli/openpu-cli --version | awk '{print $2}')
mkdir -p "dist/openpu-cli-$version-linux-${{ matrix.arch }}"
cp build/src/cli/openpu-cli LICENSE README.md "dist/openpu-cli-$version-linux-${{ matrix.arch }}/"
strip "dist/openpu-cli-$version-linux-${{ matrix.arch }}/openpu-cli"
tar -C dist -czf "openpu-cli-$version-linux-${{ matrix.arch }}.tar.gz" "openpu-cli-$version-linux-${{ matrix.arch }}"
- name: AppImage
run: tools/appimage.sh "$PWD/build-appimage"
- name: Collect
run: |
mkdir -p out
mv build/openpu_*.deb openpu-cli-*.tar.gz OpenPU-*.AppImage out/
(cd out && sha256sum * > SHA256SUMS-linux-${{ matrix.arch }}.txt && ls -l)
- uses: actions/upload-artifact@v4
with:
name: openpu-linux-${{ matrix.arch }}
path: out/*
- name: Attach to the release
if: startsWith(github.ref, 'refs/tags/v')
env:
GH_TOKEN: ${{ github.token }}
TAG: ${{ github.ref_name }}
run: |
gh release view "$TAG" >/dev/null 2>&1 ||
gh release create "$TAG" --verify-tag --title "OpenPU ${TAG#v}" --notes-from-tag ||
gh release view "$TAG" >/dev/null # the other architecture may have created it meanwhile
gh release upload "$TAG" out/* --clobber
+72 -30
View File
@@ -1,47 +1,89 @@
# Changelog # Changelog
Format: [Keep a Changelog](https://keepachangelog.com/fr/1.1.0/). Versions follow Format: [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). Versions follow
[Semantic Versioning](https://semver.org/lang/fr/): `0.x` until the Linux and Haiku applications are [Semantic Versioning](https://semver.org/): `0.x` until the Linux and Haiku applications are
complete; every release is an annotated git tag `vX.Y.Z` (see `tools/release.sh`). complete; every release is an annotated git tag `vX.Y.Z` (see `tools/release.sh`).
## [Unreleased] ## [Unreleased]
## [0.3.0] - 2026-11-29
### Added
- Haiku development VM tooling: `tools/haiku-vm.sh` (Haiku R1/beta6 x86_64 under QEMU/KVM, with a
virtual USB stick) and `tools/qmp.py` (headless screenshots, clicks and typing through QMP).
- Haiku USB backend (Storage Kit disk device API): lists USB drives, writes an MBR with one FAT32
partition at 1 MiB, mounts, unmounts and ejects. Validated end to end in the VM.
- The core library and `openpu-cli` build and pass all unit tests on Haiku R1/beta6 x86_64.
- Haiku graphical interface (Interface Kit): the same screens as the GTK interface (vehicles,
adding a vehicle, updates, download folder, resumable download, USB stick, writing, installation
guide), Preferences window, About window and new-version check. It uses the gettext catalogs of
the GTK interface, and the language of the Locale preferences by default.
- Application icon: an original shield with a "PU" monogram, as SVG, HVIF (embedded in the Haiku
executable) and PNG from 16 to 512 px (installed in the hicolor icon theme on Linux), generated
by `tools/make_icons.py`.
- Debian package through CPack (dependencies from `dpkg-shlibdeps`, `udisks2` recommended) and
AppStream metadata (`io.github.openpu.OpenPU.metainfo.xml`).
- `tools/appimage.sh`: AppImage of the GTK interface and `openpu-cli` (linuxdeploy + GTK plugin).
- `Release` GitHub workflow: Debian package, AppImage and `openpu-cli` tarball for Linux x86_64
and arm64, attached to the release of every `vX.Y.Z` tag.
- Haiku package: `tools/haiku-package.sh` builds an `.hpkg` (application, `openpu-cli`,
translations, Deskbar entry), and `packaging/haiku/openpu.recipe` is a HaikuPorts recipe
template.
### Changed
- The Haiku application is installed in `apps/` and finds its translations in the `data/locale`
directory of its installation location.
- The GTK interface looks for its translations in `../share/locale` next to the executable first,
so that relocatable installs (AppImage) are translated.
- `tools/release.sh` adds the release to the AppStream metadata and updates a GitHub release
that the release workflow created first.
### Fixed
- `cmake --install --strip` dropped the resources of the Haiku application (icon, signature,
version): they are attached again to the installed file.
- Translations were installed in `/<language>/LC_MESSAGES` instead of the locale directory.
- Archive extraction failed when the destination path contained a symbolic link (e.g. `/tmp` on
Haiku).
- `tools/release.sh` produced empty release notes.
## [0.2.0] - 2026-11-28 ## [0.2.0] - 2026-11-28
### Ajouté ### Added
- Interface graphique GTK4 (gtkmm) : véhicules, ajout par VIN, mises à jour disponibles, choix du - GTK4 (gtkmm) graphical interface: vehicles, adding a vehicle by VIN, available updates, download
dossier, téléchargement avec reprise, choix de la clé USB, écriture, guide d'installation. folder, resumable download, USB stick selection, writing, installation guide.
- Versionnage : version CMake + `git describe` à chaque compilation, `openpu-cli --version`, - Versioning: CMake version + `git describe` on every build, `openpu-cli --version`, About dialog,
boîte « À propos », User-Agent `OpenPU/<version>`, script `tools/release.sh`. `OpenPU/<version>` User-Agent, `tools/release.sh`.
- Infrastructure de traduction gettext (textes sources en anglais, français fourni). - gettext translation infrastructure (English source strings, French translation).
- Liens vers les guides d'installation officiels (PDF) en français et en anglais. - Links to the official installation guides (PDF) in French and English.
- Préférences : dossier de téléchargement, langue (langue du système par défaut), recherche - Preferences: download folder, language (system language by default), automatic check for a new
automatique d'une nouvelle version d'OpenPU au démarrage. OpenPU version at startup.
- Recherche d'une nouvelle version d'OpenPU (releases GitHub) : proposition d'ouvrir la page de - New OpenPU version check (GitHub releases), offering to open the download page in the browser;
téléchargement dans le navigateur ; `openpu-cli app-update`. `openpu-cli app-update`.
- Licence MIT (`LICENSE`, en-têtes SPDX). - MIT license (`LICENSE`, SPDX headers).
- Intégration continue GitHub Actions : compilation et tests sur Linux x86_64 et arm64, ASan/UBSan. - GitHub Actions continuous integration: build and tests on Linux x86_64 and arm64, ASan/UBSan.
### Prévu ### Changed
- Paquets Linux `.deb`, Flatpak et AppImage ; paquet Haiku `.hpkg`. - The main repository is now https://github.com/yann64/openpu.
- À partir de 1.0.0, binaires joints à chaque release, x86_64 et arm64. - `vehicles.json` keeps the order in which vehicles were added.
### Modifié ### Planned
- Le dépôt principal est désormais https://github.com/yann64/openpu (Gitea reste un miroir). - Linux `.deb`, Flatpak and AppImage packages; Haiku `.hpkg` package.
- `vehicles.json` garde l'ordre d'ajout des véhicules. - From 1.0.0 on, binaries attached to every release, for x86_64 and arm64.
## [0.1.0] - 2026-11-28 ## [0.1.0] - 2026-11-28
### Ajouté ### Added
- Analyse de « Peugeot Update » 1.6.1 (`docs/analysis/`). - Analysis of "Peugeot Update" 1.6.1 (`docs/analysis/`).
- `libopenpu` : client de l'API Majestic (VIN, calculateurs, mises à jour), téléchargement avec - `libopenpu`: Majestic API client (VIN, head units, updates), resumable downloads (HTTP Range),
reprise (Range), licence (placeholder vide de Majestic géré), archives tar (vérification, license download (including the empty placeholder Majestic returns while generating it), tar
extraction sécurisée sans `UpdateInfo.xml`), réglages et véhicules compatibles avec l'app archives (integrity check, safe extraction skipping `UpdateInfo.xml`), settings and vehicles
officielle, USB Linux via UDisks2 (MBR + FAT32, montage, éjection). compatible with the official application, Linux USB support through UDisks2 (MBR + FAT32,
mounting, ejecting).
- `openpu-cli`: `check`, `download`, `verify`, `extract`, `usb-list`, `write-usb`, `write-dir`. - `openpu-cli`: `check`, `download`, `verify`, `extract`, `usb-list`, `write-usb`, `write-dir`.
- Qualité : tests doctest, ASan/UBSan, valgrind, clang-tidy, cppcheck (`tools/check.sh`), test USB - Quality: doctest unit tests, ASan/UBSan, valgrind, clang-tidy, cppcheck (`tools/check.sh`),
de bout en bout sur image loop (`tools/e2e-usb.sh`). end-to-end USB test on a loop image (`tools/e2e-usb.sh`).
[Unreleased]: https://github.com/yann64/openpu/compare/v0.2.0...HEAD [Unreleased]: https://github.com/yann64/openpu/compare/v0.3.0...HEAD
[0.3.0]: https://github.com/yann64/openpu/releases/tag/v0.3.0
[0.2.0]: https://github.com/yann64/openpu/releases/tag/v0.2.0 [0.2.0]: https://github.com/yann64/openpu/releases/tag/v0.2.0
[0.1.0]: https://github.com/yann64/openpu/releases/tag/v0.1.0 [0.1.0]: https://github.com/yann64/openpu/releases/tag/v0.1.0
+16 -6
View File
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.20) cmake_minimum_required(VERSION 3.20)
project(openpu VERSION 0.2.0 LANGUAGES CXX) project(openpu VERSION 0.3.0 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
@@ -9,15 +9,16 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
option(OPENPU_BUILD_CLI "Build openpu-cli" ON) option(OPENPU_BUILD_CLI "Build openpu-cli" ON)
option(OPENPU_BUILD_TESTS "Build unit tests" ON) option(OPENPU_BUILD_TESTS "Build unit tests" ON)
option(OPENPU_UI_GTK "Build the GTK4 user interface" OFF) option(OPENPU_UI_GTK "Build the GTK4 user interface" OFF)
option(OPENPU_UI_HAIKU "Build the Haiku user interface" OFF) if(CMAKE_SYSTEM_NAME STREQUAL "Haiku")
set(OPENPU_UI_HAIKU_DEFAULT ON)
else()
set(OPENPU_UI_HAIKU_DEFAULT OFF)
endif()
option(OPENPU_UI_HAIKU "Build the Haiku user interface" ${OPENPU_UI_HAIKU_DEFAULT})
option(OPENPU_WERROR "Treat warnings as errors" OFF) option(OPENPU_WERROR "Treat warnings as errors" OFF)
option(OPENPU_CLANG_TIDY "Run clang-tidy while compiling" OFF) option(OPENPU_CLANG_TIDY "Run clang-tidy while compiling" OFF)
option(OPENPU_SANITIZE "Build with ASan + UBSan" OFF) option(OPENPU_SANITIZE "Build with ASan + UBSan" OFF)
if(CMAKE_SYSTEM_NAME STREQUAL "Haiku")
set(OPENPU_UI_HAIKU_DEFAULT ON)
endif()
add_library(openpu_warnings INTERFACE) add_library(openpu_warnings INTERFACE)
target_compile_options(openpu_warnings INTERFACE -Wall -Wextra -Wpedantic -Wshadow -Wconversion -Wno-sign-conversion) target_compile_options(openpu_warnings INTERFACE -Wall -Wextra -Wpedantic -Wshadow -Wconversion -Wno-sign-conversion)
if(OPENPU_WERROR) if(OPENPU_WERROR)
@@ -42,6 +43,11 @@ endif()
if(OPENPU_UI_GTK) if(OPENPU_UI_GTK)
add_subdirectory(src/ui-gtk) add_subdirectory(src/ui-gtk)
endif()
if(OPENPU_UI_HAIKU)
add_subdirectory(src/ui-haiku)
endif()
if(OPENPU_UI_GTK OR OPENPU_UI_HAIKU)
add_subdirectory(po) add_subdirectory(po)
endif() endif()
@@ -49,3 +55,7 @@ if(OPENPU_BUILD_TESTS)
enable_testing() enable_testing()
add_subdirectory(tests) add_subdirectory(tests)
endif() endif()
if(NOT CMAKE_SYSTEM_NAME STREQUAL "Haiku") # Haiku packages are built from a HaikuPorts recipe
include(cmake/Packaging.cmake)
endif()
+50 -10
View File
@@ -1,3 +1,5 @@
<p align="center"><img src="data/icons/png/openpu-128.png" width="128" height="128" alt="OpenPU logo"></p>
# OpenPU # OpenPU
A free and native client to download updates for Peugeot head units A free and native client to download updates for Peugeot head units
@@ -8,22 +10,25 @@ It is an alternative to the official "Peugeot Update" application (Windows/macOS
> Independent project, not affiliated with Stellantis or Peugeot. The names mentioned are > Independent project, not affiliated with Stellantis or Peugeot. The names mentioned are
> trademarks of their respective owners. > trademarks of their respective owners.
- Repository: https://github.com/yann64/openpu (mirror: https://git.barbel.synology.me/yann64/opu) - Repository: https://github.com/yann64/openpu
- License: [MIT](LICENSE) - License: [MIT](LICENSE)
- Release history: [CHANGELOG.md](CHANGELOG.md) - Release history: [CHANGELOG.md](CHANGELOG.md)
## Status ## Status
- [x] Analysis of the existing application: see [`docs/analysis/`](docs/analysis/) (in French) - [x] Analysis of the existing application: see [`docs/analysis/`](docs/analysis/)
- [x] C++ core: VIN, Majestic API, resumable downloads, license, tar, settings, vehicles - [x] C++ core: VIN, Majestic API, resumable downloads, license, tar, settings, vehicles
- [x] Linux USB support (UDisks2: listing, MBR + FAT32, mounting, ejecting) and writing the update - [x] Linux USB support (UDisks2: listing, MBR + FAT32, mounting, ejecting) and writing the update
- [x] `openpu-cli` command-line tool - [x] `openpu-cli` command-line tool
- [x] GTK4 UI (Linux): complete workflow, preferences, new-version check - [x] GTK4 UI (Linux): complete workflow, preferences, new-version check
- [x] Versioning (`--version`, About dialog, `vX.Y.Z` tags, GitHub releases) - [x] Versioning (`--version`, About dialog, `vX.Y.Z` tags, GitHub releases)
- [x] gettext translations (English, French) - [x] gettext translations (English, French)
- [ ] Haiku USB support (Storage Kit) - [x] Haiku: core library, CLI and USB support (Storage Kit), validated in a Haiku R1/beta6 VM
- [ ] Haiku UI - [x] Haiku UI (Interface Kit): complete workflow, preferences, new-version check
- [x] GitHub Actions continuous integration (Linux x86_64 + arm64) - [x] GitHub Actions continuous integration (Linux x86_64 + arm64)
- [ ] Linux packages: `.deb`, Flatpak and AppImage; Haiku: `.hpkg` - [x] Linux packages: Debian package (`cpack -G DEB`) and AppImage (`tools/appimage.sh`)
- [x] `Release` workflow: `.deb`, AppImage and `openpu-cli` tarball for x86_64 and arm64
- [x] Haiku package (`tools/haiku-package.sh`) and HaikuPorts recipe template
- [ ] Flatpak
- [ ] x86_64 + arm64 binaries attached to every release (from 1.0.0 on) - [ ] x86_64 + arm64 binaries attached to every release (from 1.0.0 on)
## Architecture ## Architecture
@@ -52,6 +57,36 @@ tools/e2e-usb.sh ../build-openpu/debug/src/cli/openpu-cli --license X.key update
When running from the build tree, `OPENPU_LOCALEDIR=../build-openpu/debug/locale` lets the When running from the build tree, `OPENPU_LOCALEDIR=../build-openpu/debug/locale` lets the
interface find its translations. interface find its translations.
## Packages (Linux)
```sh
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -DOPENPU_UI_GTK=ON
cmake --build build && (cd build && cpack -G DEB) # build/openpu_<version>_<arch>.deb
tools/appimage.sh # ./OpenPU-<version>-<arch>.AppImage
```
The Debian package gets its dependencies from `dpkg-shlibdeps` and recommends `udisks2`, which
formats and mounts the USB stick. `tools/appimage.sh` downloads linuxdeploy and its GTK plugin
into `~/.cache/openpu-appimage`.
The `Release` GitHub workflow builds the Debian package, the AppImage and a `openpu-cli` tarball
for x86_64 and arm64. On a `vX.Y.Z` tag it attaches them to the release, and a manual run keeps
them as workflow artifacts.
## Building (Haiku)
```sh
pkgman install cmake ninja curl_devel libarchive_devel nlohmann_json gettext gettext_libintl_devel
cmake -S . -B build -G Ninja && cmake --build build && build/tests/openpu_tests
OPENPU_LOCALEDIR=build/locale build/src/ui-haiku/OpenPU # graphical interface
build/src/cli/openpu-cli usb-list
```
Package: `tools/haiku-package.sh` builds `openpu-<version>-1-x86_64.hpkg` in the current
directory (application in `apps/`, `openpu-cli` in `bin/`, translations, Deskbar entry); install
it with `pkgman install ./openpu-*.hpkg`. GitHub has no Haiku runners, so the package is built in
the VM and attached to the release by hand. `packaging/haiku/openpu.recipe` is the template of the
HaikuPorts recipe, to fill in with the released version and its checksum.
`tools/haiku-vm.sh` installs and runs a Haiku R1/beta6 VM under QEMU/KVM (from WSL or Linux), with
a virtual USB stick; `sync` copies the working tree into it and `ssh` runs commands there.
## Versioning ## Versioning
- The reference version is `project(openpu VERSION x.y.z)` in `CMakeLists.txt`. On every build, - The reference version is `project(openpu VERSION x.y.z)` in `CMakeLists.txt`. On every build,
`git describe` produces the displayed description (for example `0.2.0+3.g1a2b3c4.dirty`). `git describe` produces the displayed description (for example `0.2.0+3.g1a2b3c4.dirty`).
@@ -60,14 +95,19 @@ interface find its translations.
commits, tags, pushes to every remote and creates the release. commits, tags, pushes to every remote and creates the release.
## Translations ## Translations
Source strings are in English and translations use gettext (`po/<language>.po`). To add a Source strings are in English and translations use gettext (`po/<language>.po`), on Linux and on
language: Haiku: both interfaces share the same catalogs. On Haiku the default language is the first one of
the Locale preferences. To add a language:
1. update the template with `cmake --build <build> --target pot`, or with 1. update the template with `cmake --build <build> --target pot`, or with
`python3 tools/extract_strings.py po/openpu.pot src/ui-gtk/main_window.cpp` if gettext is not `python3 tools/extract_strings.py po/openpu.pot src/ui-gtk/main_window.cpp src/ui-haiku/main_window.cpp`
installed; if gettext is not installed;
2. copy `po/openpu.pot` to `po/<language>.po` and translate it; 2. copy `po/openpu.pot` to `po/<language>.po` and translate it;
3. add the language to `po/LINGUAS` and to the list in the Preferences dialog. 3. add the language to `po/LINGUAS` and to the language list of the Preferences window of both
interfaces.
## Tools ## Tools
- `tools/make_icons.py`: generates the application icon (original artwork, MIT like the rest of
the project) from a single description: `data/icons/openpu.svg`, a simplified variant for 16 and
24 px, `openpu.hvif` for Haiku and PNG files from 16 to 512 px. Standard library only.
- `tools/asar_extract.py`: minimal, read-only asar extractor used to study the reference - `tools/asar_extract.py`: minimal, read-only asar extractor used to study the reference
application. Extracted sources stay **outside the repository**. application. Extracted sources stay **outside the repository**.
+28
View File
@@ -0,0 +1,28 @@
# SPDX-License-Identifier: MIT
# Debian package (cpack -G DEB). Dependencies are computed by dpkg-shlibdeps from the binaries,
# so the package matches the distribution it was built on.
set(CPACK_PACKAGE_NAME openpu)
set(CPACK_PACKAGE_VENDOR "OpenPU contributors")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Download Peugeot head unit updates and prepare the USB stick")
set(CPACK_PACKAGE_HOMEPAGE_URL "https://github.com/yann64/openpu")
set(CPACK_RESOURCE_FILE_LICENSE ${PROJECT_SOURCE_DIR}/LICENSE)
set(CPACK_PACKAGE_INSTALL_DIRECTORY openpu)
set(CPACK_STRIP_FILES ON)
set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT) # openpu_<version>_<arch>.deb
set(CPACK_DEBIAN_PACKAGE_SECTION utils)
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "OpenPU contributors <https://github.com/yann64/openpu>")
set(CPACK_DEBIAN_PACKAGE_DESCRIPTION
"Download Peugeot head unit updates and prepare the USB stick\n\
OpenPU downloads the firmware and navigation map updates of Peugeot head units\n\
(NAC, RCC, AIO, Crony) and prepares the installation USB stick: FAT32\n\
formatting, license and update files. Graphical interface (GTK 4) and\n\
command-line tool. Independent project, not affiliated with Stellantis or Peugeot.")
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
# UDisks2 formats and mounts the stick; without it only `openpu-cli write-dir` works.
set(CPACK_DEBIAN_PACKAGE_RECOMMENDS "udisks2")
set(CPACK_SOURCE_GENERATOR TGZ)
set(CPACK_SOURCE_IGNORE_FILES "/\\\\.git/" "/build/" "\\\\.swp$")
include(CPack)
+13
View File
@@ -0,0 +1,13 @@
<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 64 64">
<title>OpenPU</title>
<defs>
<linearGradient id="bg" gradientUnits="userSpaceOnUse" x1="32" y1="4" x2="32" y2="60">
<stop offset="0" stop-color="#2563b8"/>
<stop offset="1" stop-color="#163a6b"/>
</linearGradient>
</defs>
<path fill="url(#bg)" d="M12 4 L52 4 C54.2 4 56 5.8 56 8 L56 34 C56 49 45 57 32 61 C19 57 8 49 8 34 L8 8 C8 5.8 9.8 4 12 4Z"/>
<path fill="#ffffff" d="M15 19 L23 19 C26.9 19 29 22.1 29 26 C29 29.9 26.9 33 23 33 L21 33 L21 41 L15 41Z"/>
<path fill="url(#bg)" d="M21 24 L23 24 C24.1 24 25 24.9 25 26 C25 27.1 24.1 28 23 28 L21 28Z"/>
<path fill="#ffffff" d="M33 19 L39 19 L39 33 C39 34.1 39.9 35 41 35 C42.1 35 43 34.1 43 33 L43 19 L49 19 L49 33 C49 37.4 45.4 41 41 41 C36.6 41 33 37.4 33 33Z"/>
</svg>

After

Width:  |  Height:  |  Size: 841 B

Binary file not shown.
+16
View File
@@ -0,0 +1,16 @@
<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 64 64">
<title>OpenPU</title>
<defs>
<linearGradient id="bg" gradientUnits="userSpaceOnUse" x1="32" y1="4" x2="32" y2="60">
<stop offset="0" stop-color="#2563b8"/>
<stop offset="1" stop-color="#163a6b"/>
</linearGradient>
</defs>
<path fill="url(#bg)" d="M12 4 L52 4 C54.2 4 56 5.8 56 8 L56 34 C56 49 45 57 32 61 C19 57 8 49 8 34 L8 8 C8 5.8 9.8 4 12 4Z"/>
<path fill="#ffffff" d="M14 6.85 L50 6.85 C51.98 6.85 53.6 8.47 53.6 10.45 L53.6 33.85 C53.6 47.35 43.7 54.55 32 58.15 C20.3 54.55 10.4 47.35 10.4 33.85 L10.4 10.45 C10.4 8.47 12.02 6.85 14 6.85Z"/>
<path fill="url(#bg)" d="M14.8 7.99 L49.2 7.99 C51.09 7.99 52.64 9.54 52.64 11.43 L52.64 33.79 C52.64 46.69 43.18 53.57 32 57.01 C20.82 53.57 11.36 46.69 11.36 33.79 L11.36 11.43 C11.36 9.54 12.91 7.99 14.8 7.99Z"/>
<path fill="#ffffff" d="M15 15 L23 15 C26.9 15 29 18.1 29 22 C29 25.9 26.9 29 23 29 L21 29 L21 37 L15 37Z"/>
<path fill="url(#bg)" d="M21 20 L23 20 C24.1 20 25 20.9 25 22 C25 23.1 24.1 24 23 24 L21 24Z"/>
<path fill="#ffffff" d="M33 15 L39 15 L39 29 C39 30.1 39.9 31 41 31 C42.1 31 43 30.1 43 29 L43 15 L49 15 L49 29 C49 33.4 45.4 37 41 37 C36.6 37 33 33.4 33 29Z"/>
<path fill="#8ec5ff" d="M30 41 L34 41 L34 47 L39 47 L32 54 L25 47 L30 47Z"/>
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 407 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 613 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 982 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

+38
View File
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- SPDX-License-Identifier: MIT -->
<component type="desktop-application">
<id>io.github.openpu.OpenPU</id>
<metadata_license>MIT</metadata_license>
<project_license>MIT</project_license>
<name>OpenPU</name>
<summary>Download head unit updates and prepare the USB stick</summary>
<summary xml:lang="fr">Télécharger les mises à jour de l'autoradio et préparer la clé USB</summary>
<description>
<p>
OpenPU downloads the firmware and navigation map updates of Peugeot head units (NAC, RCC,
AIO, Crony) and prepares the installation USB stick: FAT32 formatting, license and update
files. Downloads resume where they stopped.
</p>
<p>
Independent project, not affiliated with Stellantis or Peugeot.
</p>
</description>
<launchable type="desktop-id">io.github.openpu.OpenPU.desktop</launchable>
<url type="homepage">https://github.com/yann64/openpu</url>
<url type="bugtracker">https://github.com/yann64/openpu/issues</url>
<developer id="io.github.yann64">
<name>yann64 and the OpenPU contributors</name>
</developer>
<content_rating type="oars-1.1"/>
<categories>
<category>Utility</category>
</categories>
<requires>
<internet>always</internet>
</requires>
<releases>
<release version="0.3.0" date="2026-11-29"/>
<release version="0.2.0" date="2026-11-28"/>
<release version="0.1.0" date="2026-11-28"/>
</releases>
</component>
+87 -87
View File
@@ -1,50 +1,49 @@
# API Majestic (PSA / Stellantis) — utilisée par « Peugeot Update » 1.6.1 # Majestic API (PSA / Stellantis) as used by "Peugeot Update" 1.6.1
Source : sources TypeScript embarquées dans `resources/app.asar` (`src/environments`, Sources: the TypeScript sources shipped in `resources/app.asar` (`src/environments`,
`src/app/services/{vehicle,update}.service.ts`, `electron/{rangeDownload,downloadManagement}.ts`) `src/app/services/{vehicle,update}.service.ts`, `electron/{rangeDownload,downloadManagement}.ts`)
et journal `%APPDATA%\Peugeot Update\log.log`. and the log file `%APPDATA%\Peugeot Update\log.log`.
Aucune authentification utilisateur : pas d'OAuth, pas de cookie, pas de jeton. There is no user authentication: no OAuth, no cookie, no token. Only a fixed application
Seul un `client_id` applicatif, fixe, est passé en query string. `client_id` is passed in the query string.
| Constante | Valeur (marque Peugeot) | | Constant | Value (Peugeot build) |
|---|---| |---|---|
| `apiAvailableUpdates` | `https://api.groupe-psa.com/applications/majesticf/v1/getAvailableUpdate` | | `apiAvailableUpdates` | `https://api.groupe-psa.com/applications/majesticf/v1/getAvailableUpdate` |
| `apiDevices` | `https://api.groupe-psa.com/applications/majesticf/v1/devices/` | | `apiDevices` | `https://api.groupe-psa.com/applications/majesticf/v1/devices/` |
| `clientId` | `?client_id=20a4cf7c-f5fb-41d5-9175-a6e23b9880e5` | | `clientId` | `?client_id=20a4cf7c-f5fb-41d5-9175-a6e23b9880e5` |
| `regExpVin` | `^V[FR]{1}3[A-Z0-9]{14}$` | | `regExpVin` | `^V[FR]{1}3[A-Z0-9]{14}$` |
Les autres marques du groupe (Citroën, DS, Opel…) utilisent probablement le même backend The group's other brands (Citroën, DS, Opel…) probably use the same backend with a different
avec un `client_id` différent : OpenPU rend ces valeurs configurables. `client_id`, so OpenPU makes these values configurable.
## 1. Liste des calculateurs : `GET devices/{VIN}` ## 1. Head units of a vehicle: `GET devices/{VIN}`
``` ```
GET https://api.groupe-psa.com/applications/majesticf/v1/devices/{VIN}?client_id=… GET https://api.groupe-psa.com/applications/majesticf/v1/devices/{VIN}?client_id=…
``` ```
Réponse 200 : 200 response:
```json ```json
{ "vin": "VR3XXXXXXXXXXXXXX", "requestDate": "…", "devices": [ { "ecuType": "RCC_EU_…" } ] } { "vin": "VR3XXXXXXXXXXXXXX", "requestDate": "…", "devices": [ { "ecuType": "RCC_EU_…" } ] }
``` ```
- **404** ⇒ VIN inconnu (traité comme « véhicule inexistant », pas comme une erreur réseau). - **404** means the VIN is unknown (treated as "no such vehicle", not as a network error).
- Autre erreur HTTP ⇒ erreur serveur ; statut 0 ⇒ erreur réseau. - Any other HTTP error is a server error; status 0 is a network error.
### Classification `ecuType` ### `ecuType` classification
`prefix = ecuType.split('_')[0]`, comparaison insensible à la casse : `prefix = ecuType.split('_')[0]`, compared case-insensitively:
| Préfixe | Type | Lien guide (`wave`) | | Prefix | Type | Guide link (`wave`) |
|---|---|---| |---|---|---|
| `RCC` | `rcc` | `path_guide_rcc` | | `RCC` | `rcc` | `path_guide_rcc` |
| `AIO` | `aio` | `path_guide_aio` | | `AIO` | `aio` | `path_guide_aio` |
| `NAC` | `nac` | dernier segment `WAVE1..4` → `path_guide_wave_1..4`, sinon `path_guide_wave_default` | | `NAC` | `nac` | last segment `WAVE1..4` → `path_guide_wave_1..4`, otherwise `path_guide_wave_default` |
| `CRONY…` (5 premiers caractères) | `crony_nav` / `crony_nonav` | `CRONY2_EU_VAR{1..4}_WAVE1` → `path_guide_crony_{1..4}` | | `CRONY…` (first 5 characters) | `crony_nav` / `crony_nonav` | `CRONY2_EU_VAR{1..4}_WAVE1` → `path_guide_crony_{1..4}` |
Seuls les devices dont le préfixe est reconnu sont retenus. Il faut **exactement un** Only devices with a known prefix are kept. A guide link requires **exactly one** valid device. With
device valide pour obtenir un lien de guide. S'il y a au moins un device valide mais pas de lien, at least one valid device but no link, the vehicle "exists" with an empty type.
le véhicule « existe » avec un type vide.
## 2. Mises à jour disponibles : `POST getAvailableUpdate` ## 2. Available updates: `POST getAvailableUpdate`
``` ```
POST https://api.groupe-psa.com/applications/majesticf/v1/getAvailableUpdate?client_id=… POST https://api.groupe-psa.com/applications/majesticf/v1/getAvailableUpdate?client_id=…
@@ -53,8 +52,8 @@ Content-Type: application/json
{ "vin": "VF3…", "softwareTypes": [ { "softwareType": "rcc-firmware" }, { "softwareType": "map-eur" } ] } { "vin": "VF3…", "softwareTypes": [ { "softwareType": "rcc-firmware" }, { "softwareType": "map-eur" } ] }
``` ```
### Types de logiciel ### Software types
| Constante | `softwareType` | | Constant | `softwareType` |
|---|---| |---|---|
| SOFT_FW_OVIP (NAC) | `ovip-int-firmware-version` | | SOFT_FW_OVIP (NAC) | `ovip-int-firmware-version` |
| SOFT_FW_RCC | `rcc-firmware` | | SOFT_FW_RCC | `rcc-firmware` |
@@ -64,21 +63,21 @@ Content-Type: application/json
| SOFT_CARTO | `map-eur` | | SOFT_CARTO | `map-eur` |
| SOFT_CARTO_CRONY | `crony2-map-western_europe` | | SOFT_CARTO_CRONY | `crony2-map-western_europe` |
**Ajout d'un véhicule** (`checkVehicle`) : les 7 types sont envoyés, en parallèle de `devices/{VIN}`. **Adding a vehicle** (`checkVehicle`): all 7 types are requested, in parallel with `devices/{VIN}`.
Pour Crony, si la réponse contient une entrée `crony2-software-nonav` avec un `update[0].updateId`, For Crony, the type is `crony_nonav` when the answer has a `crony2-software-nonav` entry with an
le type est `crony_nonav`, sinon `crony_nav`. `update[0].updateId`, `crony_nav` otherwise.
**Recherche de mises à jour** (`getUpdates`) : 2 types selon le type de véhicule. **Looking for updates** (`getUpdates`): 2 types depending on the vehicle type.
| Type véhicule | Firmware | Cartographie | | Vehicle type | Firmware | Map |
|---|---|---| |---|---|---|
| `nac` | `ovip-int-firmware-version` | `map-eur` | | `nac` | `ovip-int-firmware-version` | `map-eur` |
| `rcc` | `rcc-firmware` | `map-eur` | | `rcc` | `rcc-firmware` | `map-eur` |
| `aio` (et défaut) | `aio-firmware` | `map-eur` | | `aio` (and default) | `aio-firmware` | `map-eur` |
| `crony_nav` | `crony2-software-nav` | `crony2-map-western_europe` | | `crony_nav` | `crony2-software-nav` | `crony2-map-western_europe` |
| `crony_nonav` | `crony2-software-nonav` | — (`null` envoyé) | | `crony_nonav` | `crony2-software-nonav` | — (`null` sent) |
### Réponse ### Response
```json ```json
{ {
"requestResult": "OK", "requestResult": "OK",
@@ -91,8 +90,8 @@ le type est `crony_nonav`, sinon `crony_nav`.
"currentSoftwareVersion": "…", "currentSoftwareVersion": "…",
"update": [ "update": [
{ {
"updateId": "005…", // 18 chiffres, chaîne "updateId": "005…", // 18 digits, as a string
"updateSize": "8390000000", // chaîne, octets "updateSize": "8390000000", // string, bytes
"updateVersion": "…", "updateVersion": "…",
"updateDate": "…", "updateDate": "…",
"updateURL": "https://majestic-web.mpsa.com/mjf00-web/rest/UpdateDownload?updateId=…&uin=…&type=fw", "updateURL": "https://majestic-web.mpsa.com/mjf00-web/rest/UpdateDownload?updateId=…&uin=…&type=fw",
@@ -103,69 +102,70 @@ le type est `crony_nonav`, sinon `crony_nav`.
] ]
} }
``` ```
Une mise à jour n'est retenue que si `requestResult == "OK"`, `updateRequestResult == "OK"`, An update is used only if `requestResult == "OK"`, `updateRequestResult == "OK"`, `update` is not
`update` est non vide et `updateURL` est une URL valide. empty and `updateURL` is a valid URL.
> Note : l'app d'origine trie `update[]` avec `a.updateDate - b.updateDate` sur des chaînes, ce qui > Note: the original application sorts `update[]` with `a.updateDate - b.updateDate` on strings,
> donne `NaN` : le tri n'a donc aucun effet et c'est `update[0]` qui est pris. OpenPU prend aussi > which yields `NaN`: the sort has no effect and `update[0]` is used. OpenPU also uses `update[0]`,
> `update[0]`, sauf si plusieurs entrées ont des dates ISO comparables, auquel cas il prend la plus récente. > unless several entries have comparable ISO dates, in which case it takes the most recent one.
`uin` est l'identifiant du calculateur (20 caractères hexadécimaux). Il est encodé dans les URLs `uin` is the head unit identifier (20 hexadecimal characters). It is embedded in the returned URLs;
renvoyées, et le client n'a jamais à le connaître. the client never needs to know it.
## 3. Téléchargements (`majestic-web.mpsa.com`) ## 3. Downloads (`majestic-web.mpsa.com`)
| URL | Rôle | | URL | Role |
|---|---| |---|---|
| `…/mjf00-web/rest/UpdateDownload?updateId=&uin=&type=fw` | redirige (3xx) vers le CDN `https://ds4emloty3shq.cloudfront.net/<FOURNISSEUR>/<HU_REGION>/<softwareType>/<fichier>.tar` | | `…/mjf00-web/rest/UpdateDownload?updateId=&uin=&type=fw` | redirects (3xx) to the CDN `https://ds4emloty3shq.cloudfront.net/<SUPPLIER>/<HU_REGION>/<softwareType>/<file>.tar` |
| `…/mjf00-web/rest/LicenseDownload?mediaVersion=&uin=` | fichier licence, nom donné par `Content-Disposition: …filename=<nom>` (`license_<UIN>.key` ou `licenses_<updateId>_<yyyyMMddHHmmss>.tar`) | | `…/mjf00-web/rest/LicenseDownload?mediaVersion=&uin=` | license file, named by `Content-Disposition: …filename=<name>` (`license_<UIN>.key` or `licenses_<updateId>_<yyyyMMddHHmmss>.tar`) |
### Nom de fichier ### File names
- Firmware/carte : dernier segment du chemin de l'**URL finale** (après redirections), sans query. - Firmware/map: last path segment of the **final URL** (after redirects), without the query.
- Licence : HEAD, puis `Content-Disposition` découpé sur `filename=`. À défaut, dernier segment de l'URL. - License: HEAD, then `Content-Disposition` split on `filename=`; otherwise the last URL segment.
- Les noms sont résolus **séquentiellement**. Commentaire d'origine : deux requêtes simultanées - Names are resolved **sequentially**. Comment in the original code: two simultaneous requests to
vers Majestic échouent parfois toutes les deux. Majestic sometimes both fail.
### Téléchargement avec reprise (`rangeDownload.ts`) ### Resumable download (`rangeDownload.ts`)
1. `HEAD updateURL` (`Connection: keep-alive`), timeout 5 s, redirections suivies. 1. `HEAD updateURL` (`Connection: keep-alive`), 5 s timeout, redirects followed. The answer must be
La réponse doit être un 200 avec un `content-length` non nul, qui donne la taille totale. a 200 with a non-zero `content-length`, which gives the total size.
2. Si `<dossier>/<fichier>` existe déjà, sa taille donne `have`. Si `have >= total`, le fichier est complet. 2. If `<folder>/<file>` already exists, its size gives `have`. If `have >= total`, the file is complete.
3. `GET urlFinale` avec `Range: bytes=<have>-<total-1>`. On attend un **206** avec 3. `GET finalUrl` with `Range: bytes=<have>-<total-1>`. A **206** with `content-length == total-have`
`content-length == total-have` ; les données sont ajoutées en fin de fichier. is expected; data is appended to the file.
- Un 200 (pas de support Range) ou une longueur incorrecte ⇒ le fichier partiel est supprimé, on passe en - A 200 (no Range support) or a wrong length deletes the partial file, switches to non-Range mode
mode sans Range et on réessaie. and retries.
4. Watchdog : 10 s sans données ⇒ abandon de la connexion, puis réessai. 4. Watchdog: 10 s without data drops the connection, then retries.
5. 5 réessais au maximum (cache de session vidé entre deux). Une erreur disque est fatale tout de suite. 5. At most 5 retries (session cache cleared in between). A disk error is fatal immediately.
6. Pause et reprise : arrêt de la requête, puis on recommence à l'étape 1 (le fichier partiel est conservé). 6. Pause and resume: the request is stopped, then step 1 starts again (the partial file is kept).
La licence est téléchargée **sans reprise** (`electron-dl`). Si le fichier existe déjà, il n'est pas retéléchargé. The license is downloaded **without resume** (`electron-dl`). An existing file is not downloaded again.
### Proxy ### Proxy
`<install>/proxy.json` : `{http_proxy, https_proxy, no_proxy}`. OpenPU utilise les variables `<install>/proxy.json`: `{http_proxy, https_proxy, no_proxy}`. OpenPU uses the standard environment
d'environnement standard (libcurl les gère nativement). variables (natively supported by libcurl).
## 4. Observations sur l'API réelle (capture du 2026-11-28) ## 4. Observations on the real API (capture of 2026-11-28)
- **Passerelle** (`X-Global-Transaction-ID`, de type IBM DataPower) : les réponses n'ont **pas de - **Gateway** (`X-Global-Transaction-ID`, IBM DataPower-like): responses have **no
`Content-Length`**, et la passerelle ferme la connexion TLS **sans `close_notify`**. OpenSSL 3 `Content-Length`**, and the gateway closes the TLS connection **without `close_notify`**. OpenSSL 3
signale alors `unexpected eof while reading` (curl : code 56), alors que le corps est complet. Chromium then reports `unexpected eof while reading` (curl error 56) although the body is complete. Chromium
tolère ce cas, et OpenPU aussi, mais uniquement pour un corps délimité par la fermeture de la connexion. tolerates it; so does OpenPU, but only for bodies delimited by the connection close.
- Le JSON échappe `=` et `&` en `=` / `&` dans les URL. Il faut donc toujours décoder avant d'analyser. - The JSON escapes `=` and `&` as `\u003d` / `\u0026` in URLs: always decode before parsing.
- `ecuType` réels : `NAC_EUR_WAVE2`, `NAC_EUR_WAVE4`, RCC (voir les fixtures). - Real `ecuType` values: `NAC_EUR_WAVE2`, `NAC_EUR_WAVE4`, RCC (see the test fixtures).
- `updateDate` est au format `yyyy-MM-dd HH:mm:ss.S`. `updateSize` est une chaîne. - `updateDate` uses the `yyyy-MM-dd HH:mm:ss.S` format. `updateSize` is a string.
- **Cartographie NAC** : `updateURL` pointe directement vers le CDN TomTom - **NAC maps**: `updateURL` points directly to the TomTom CDN
(`https://download-cde.tomtom.com/OEM/PSA/MAP/PSA_map-eur_<ver>-NAC_EUR_WAVE2.tar`), et `licenseURL` est vide. (`https://download-cde.tomtom.com/OEM/PSA/MAP/PSA_map-eur_<ver>-NAC_EUR_WAVE2.tar`), and
- `installerURL` est présent au niveau racine (une URL `UpdateDownload` sur `majestic.mpsa.com`). Son rôle est inconnu `licenseURL` is empty.
et l'app d'origine ne l'utilise pas. - `installerURL` is present at the root (an `UpdateDownload` URL on `majestic.mpsa.com`). Its role is
- Un VIN inexistant renvoie **404** avec un corps HTML. unknown and the original application does not use it.
- **Licence générée de façon asynchrone** : le premier `LicenseDownload` d'une mise à jour a renvoyé un 200 - An unknown VIN returns **404** with an HTML body.
avec `Content-Disposition: filename=licenses_<updateId>_<yyyyMMddHHmmss>.tar` et un **corps vide**. - **The license is generated asynchronously**: the first `LicenseDownload` of an update returned a
Un appel suivant renvoie le vrai `license_<UIN>.key` (environ 10 Ko). L'app officielle garde le fichier vide, 200 with `Content-Disposition: filename=licenses_<updateId>_<yyyyMMddHHmmss>.tar` and an **empty
d'où les ENOENT et le « redémarrer l'app » de son journal. OpenPU supprime la réponse vide et réessaie body**. A later call returns the real `license_<UIN>.key` (about 10 KB). The official application
en allongeant progressivement le délai. keeps the empty file, hence the ENOENT errors and "restart the app" in its log. OpenPU deletes the
- CDN firmware RCC (CloudFront) : `HEAD` → 200 + `Content-Length`, et `Range` → 206. La reprise a été vérifiée empty answer and retries with an increasing delay.
(interruption à 1,59 Go puis reprise, environ 80 Mo/s). - RCC firmware CDN (CloudFront): `HEAD` → 200 + `Content-Length`, and `Range` → 206. Resuming was
- Aucun en-tête particulier n'est requis : le User-Agent est libre, et HTTP/1.1 suffit (pas de négociation h2). verified (interrupted at 1.59 GB then resumed, about 80 MB/s).
- No special header is required: any User-Agent works, and HTTP/1.1 is enough (no h2 negotiation).
## 5. Mise à jour de l'application elle-même ## 5. Updating the application itself
electron-updater, fournisseur générique `https://d1tik0o5ahgjm.cloudfront.net/peugeot/latest.yml`. electron-updater, generic provider `https://d1tik0o5ahgjm.cloudfront.net/peugeot/latest.yml`.
Hors périmètre pour OpenPU. Out of scope for OpenPU.
+38 -31
View File
@@ -1,43 +1,50 @@
# Préparation de la clé USB # Preparing the USB stick
## Formatage ## Formatting
- Système de fichiers : **FAT32**, table de partitions MBR (macOS : `diskutil eraseDisk FAT32 <LABEL> MBR`). - File system: **FAT32**, MBR partition table (macOS: `diskutil eraseDisk FAT32 <LABEL> MBR`).
- Label : le label actuel de la clé, assaini avec `replace(/[^a-zA-Z0-9_]+/g,'')`, tronqué à 11 caractères - Label: the stick's current label, sanitised with `replace(/[^a-zA-Z0-9_]+/g,'')`, truncated to 11
et mis en majuscules. Valeur par défaut : `NEW`. characters and upper-cased. Default: `NEW`.
- Windows: - Windows:
- ≤ 32 GiB : `format X: /q /fs:FAT32 /v:LABEL` ; - up to 32 GiB: `format X: /q /fs:FAT32 /v:LABEL`;
- au-delà, ou en cas d'échec : `chkdsk X: & timeout 20 & echo y | fat32format X: & label X: LABEL`, - above, or on failure: `chkdsk X: & timeout 20 & echo y | fat32format X: & label X: LABEL`, with
avec élévation de privilèges. elevated privileges.
- Linux (code présent dans l'app mais jamais livré) : `umount <mnt> && mkfs.vfat -n LABEL /dev/disk/by-uuid/<uuid>`. - Linux (code present in the app but never shipped): `umount <mnt> && mkfs.vfat -n LABEL
Seul le volume est reformaté, pas la table de partitions. /dev/disk/by-uuid/<uuid>`. Only the volume is reformatted, not the partition table.
Équivalents OpenPU : OpenPU equivalents:
- Linux : UDisks2 `org.freedesktop.UDisks2.Block.Format("vfat", {label, erase?})` sur le - Linux: UDisks2 `org.freedesktop.UDisks2.Block.Format("dos")` on the whole block device, then
périphérique bloc entier (création d'une table MBR et d'une partition FAT32), via polkit, sans root. `PartitionTable.CreatePartitionAndFormat` (type `0x0c` at 1 MiB, `vfat` with the label), through
- Haiku : `BDiskDevice` → `BPartition::Initialize("fat", label, "fat 32")` (add-on DriveSetup FAT). polkit, without root.
- Haiku: Storage Kit disk device API (`BDiskDevice` / `BPartition`, as DriveSetup), MBR ("intel")
with one "FAT 32-bit, LBA-mapped" partition at 1 MiB, formatted with the "fat" disk system.
On Haiku R1/beta6 each step must be its own transaction (erase foreign content, delete old
partitions, create the partition, format): combined transactions fail or hang, and
`Uninitialize()` on an existing MBR hangs the disk device manager.
## Taille minimale ## Minimum size
``` ```
besoin = (taille fw + taille licence + taille carto) × 1.1 needed = (firmware size + license size + map size) × 1.1
usbMin = 2 Go ; tant que usbMin × 10^9 < besoin : usbMin ×= 2 usbMin = 2 GB; while usbMin × 10^9 < needed: usbMin ×= 2
liste = disques USB montés dont la taille > besoin choices = mounted USB drives larger than needed
``` ```
## Arborescence produite ## Resulting tree
``` ```
<USB>/ <USB>/
├── license/ ├── license/
│ └── <nom licence> # license_<UIN>.key ou licenses_<id>_<ts>.tar, copié tel quel │ └── <license name> # license_<UIN>.key or licenses_<id>_<ts>.tar, copied as is
├── rcc_update/… # contenu du tar firmware RCC (le nom dépend du calculateur) ├── rcc_update/… # content of the RCC firmware tar (the name depends on the head unit)
└── … # contenu du tar cartographie, extrait à la racine └── … # content of the map tar, extracted at the root
``` ```
### Archive firmware RCC réelle (6_0432_23-2I44-1, 8 391 587 840 octets)
- Format **ustar** standard (magic `ustar\000`), 16 entrées, uniquement des fichiers réguliers et des dossiers.
- Premier membre : `UpdateInfo.xml` (racine), puis `rcc_update/…`.
- Plus gros fichiers : `rcc_update/stc.A2.bsh.tar.bin` (2,70 Go), `stc.A1…` (2,68 Go) et `rfs.A2.wml.fp.tar.bin` (1,0 Go).
Tout tient sous la limite FAT32 de 4 Gio par fichier. Pour les cartes NAC (10,5 Go), c'est à vérifier.
- Tout fichier dont le *basename* est `UpdateInfo.xml` est ignoré lors de l'extraction. ### Real RCC firmware archive (6_0432_23-2I44-1, 8,391,587,840 bytes)
- Le tar peut être sans « magic number » (`allowUnknownFormat`), donc il faut un lecteur tar tolérant - Standard **ustar** format (magic `ustar\000`), 16 entries, only regular files and directories.
(libarchive : `archive_read_support_format_tar` + `archive_read_support_format_raw` désactivé). - First member: `UpdateInfo.xml` (root), then `rcc_update/…`.
- Une extraction « à blanc » (dry-run) préalable vérifie l'intégrité du tar. - Largest files: `rcc_update/stc.A2.bsh.tar.bin` (2.70 GB), `stc.A1…` (2.68 GB) and
`rfs.A2.wml.fp.tar.bin` (1.0 GB). Everything fits under the 4 GiB FAT32 per-file limit. To be
checked for NAC maps (10.5 GB).
- Any file whose *basename* is `UpdateInfo.xml` is skipped during extraction.
- The tar may lack the "magic number" (`allowUnknownFormat` in the original app), so a tolerant tar
reader is needed (libarchive's tar reader accepts V7 archives without magic).
- A preliminary "dry-run" extraction checks the integrity of the tar.
+36 -36
View File
@@ -1,56 +1,56 @@
# Déroulé fonctionnel de « Peugeot Update » # Functional workflow of "Peugeot Update"
## Écrans (Angular) ## Screens (Angular)
1. **Bienvenue** (`welcome`), qu'on peut masquer (`hideWelcome`). 1. **Welcome** (`welcome`), can be hidden (`hideWelcome`).
2. **Véhicules** (`vehicles`, `vehicle-editor`) : liste, ajout (VIN + nom), suppression, 2. **Vehicles** (`vehicles`, `vehicle-editor`): list, add (VIN + name), delete, link to the PDF guide
lien vers le guide PDF (`wave` → clé i18n → URL PDF localisée). (`wave` → i18n key → localised PDF URL).
3. **Mises à jour** (`available-updates`) : firmware et/ou cartographie, cases à cocher. 3. **Updates** (`available-updates`): firmware and/or map, check boxes.
4. **Dossier de téléchargement** (`path-selector`) : refusé s'il est sur une clé USB, 4. **Download folder** (`path-selector`): refused when it is on a USB stick, or when the free space
ou si l'espace libre est inférieur à (taille restante × 1.1). is below (remaining size × 1.1).
5. **Téléchargement** (`download-file`) : barre de progression, pause/reprise/annulation, temps estimé. 5. **Download** (`download-file`): progress bar, pause/resume/cancel, estimated time.
6. **Clé USB** (`usb-selector`) : seuls les disques USB montés de taille > besoin sont listés ; 6. **USB stick** (`usb-selector`): only mounted USB drives larger than needed are listed;
confirmation du formatage. formatting must be confirmed.
7. **Copie** (`copy-progress`) puis **Fin**, avec les instructions d'installation dans le véhicule. 7. **Copy** (`copy-progress`), then **Finish**, with installation instructions for the vehicle.
## Machine à états (download-manager) ## State machine (download-manager)
``` ```
SelectUpdates SelectUpdates
└─ résolution séquentielle des noms : fw → licence (si fw) → carto └─ names resolved sequentially: fw → license (if fw) → map
→ lastDownload = {state: download, vin, fw/cartoUpdateSelected, versions, noms} → lastDownload = {state: download, vin, fw/cartoUpdateSelected, versions, names}
ChooseFolder ChooseFolder
└─ vérifications : dossier pas sur USB, espace libre > besoin×1.1 └─ checks: folder not on USB, free space > needed × 1.1
Download Download
├─ si fw : licence (simple) → firmware (Range) ├─ if fw: license (simple) → firmware (Range)
└─ puis carto (Range) └─ then map (Range)
→ lastDownload.state = usb → lastDownload.state = usb
PrepareUsb PrepareUsb
├─ taille = Σ(tailles fw + licence + carto) × 1.1 ; taille USB min = 2 Go × 2^n ≥ besoin (base 10^9) ├─ size = Σ(fw + license + map sizes) × 1.1; minimum stick = 2 GB × 2^n ≥ needed (base 10^9)
├─ confirmation → formatage FAT32 (label = label actuel de la clé assaini, défaut NEW) ├─ confirmation → FAT32 formatting (label = the stick's current label, sanitised, default NEW)
├─ si fw : copie licence → <usb>/license/<nomLicence> ├─ if fw: copy license → <usb>/license/<licenseName>
├─ extraction du tar fw → <usb>/ (en ignorant tout fichier nommé UpdateInfo.xml) ├─ extract the fw tar → <usb>/ (skipping any file named UpdateInfo.xml)
├─ extraction du tar carto → <usb>/ ├─ extract the map tar → <usb>/
├─ suppression des fichiers téléchargés ; lastDownload remis à zéro ├─ delete the downloaded files; lastDownload reset
└─ éjection (Windows) └─ eject (Windows)
Finish Finish
``` ```
En cas de tar invalide (`Invalid tar header` / `unsupported type`), le tar est supprimé et On an invalid tar (`Invalid tar header` / `unsupported type`), the tar is deleted and the user goes
l'utilisateur revient à la liste des véhicules (il faut retélécharger). back to the vehicle list (the file has to be downloaded again).
## Persistance (`%APPDATA%\Peugeot Update`) ## Persistence (`%APPDATA%\Peugeot Update`)
- `config.json`: `language`, `hideWelcome`, `downloadPath`, - `config.json`: `language`, `hideWelcome`, `downloadPath`,
`lastDownload{state(0=none,…), vin, fwUpdateSelected, cartoUpdateSelected, fwLastVersion, `lastDownload{state(0=none,…), vin, fwUpdateSelected, cartoUpdateSelected, fwLastVersion,
cartoLastVersion, fwFileName, cartoFileName, licenseFileName}` cartoLastVersion, fwFileName, cartoFileName, licenseFileName}`
- `vehicles.json`: `{ "<VIN>": {name, type, wave, undeletedFiles?{fw,carto,license}} }` - `vehicles.json`: `{ "<VIN>": {name, type, wave, undeletedFiles?{fw,carto,license}} }`
- `downloadPath.txt`, `log.log` (electron-log) - `downloadPath.txt`, `log.log` (electron-log)
Au démarrage, si `lastDownload.state != none`, l'app propose de reprendre le téléchargement At startup, when `lastDownload.state != none`, the application offers to resume the download or
ou de supprimer les fichiers. to delete the files.
## Particularités et défauts observés (à ne pas reproduire) ## Quirks and defects observed (not to reproduce)
- `wmic` est utilisé pour lire le label de la clé, mais il a été retiré de Windows 11. - `wmic` is used to read the stick label, but it was removed from Windows 11.
- `xcopy` échoue vers la racine du lecteur, avec repli sur `robocopy`. - `xcopy` fails when the target is a drive root; it falls back to `robocopy`.
- Une licence au nom déjà vu, puis supprimée, est réutilisée : ENOENT jusqu'au redémarrage de l'app. - A license name seen before and then deleted is reused: ENOENT until the application restarts.
- Le dossier temporaire `toUsbContent` n'est pas toujours supprimé (ENOTEMPTY). - The temporary `toUsbContent` folder is not always deleted (ENOTEMPTY).
- Le tri des mises à jour par date est sans effet (voir API.md). - Sorting updates by date has no effect (see API.md).
+65
View File
@@ -0,0 +1,65 @@
SUMMARY="Download Peugeot head unit updates and prepare the USB stick"
DESCRIPTION="OpenPU downloads the firmware and navigation map updates of Peugeot head \
units (NAC, RCC, AIO, Crony) and prepares the installation USB stick: FAT32 formatting, \
license and update files. Downloads resume where they stopped.
It provides a native graphical application and a command-line tool (openpu-cli). \
Independent project, not affiliated with Stellantis or Peugeot."
HOMEPAGE="https://github.com/yann64/openpu"
COPYRIGHT="2026 yann64 and the OpenPU contributors"
LICENSE="MIT"
REVISION="1"
# Template for HaikuPorts (app-misc/openpu/openpu-<version>.recipe): set the file name to the
# released version and CHECKSUM_SHA256 to the sha256sum of the tag archive below.
SOURCE_URI="https://github.com/yann64/openpu/archive/refs/tags/v$portVersion.tar.gz"
CHECKSUM_SHA256="0000000000000000000000000000000000000000000000000000000000000000"
SOURCE_DIR="openpu-$portVersion"
ARCHITECTURES="all !x86_gcc2"
PROVIDES="
openpu$secondaryArchSuffix = $portVersion
app:OpenPU = $portVersion
cmd:openpu_cli = $portVersion
"
REQUIRES="
haiku$secondaryArchSuffix
lib:libarchive$secondaryArchSuffix
lib:libcurl$secondaryArchSuffix
lib:libintl$secondaryArchSuffix
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
devel:libarchive$secondaryArchSuffix
devel:libcurl$secondaryArchSuffix
devel:libintl$secondaryArchSuffix
devel:nlohmann_json
"
BUILD_PREREQUIRES="
cmd:cmake
cmd:g++$secondaryArchSuffix
cmd:mimeset
cmd:msgfmt
cmd:ninja
cmd:rc
cmd:xres
"
BUILD()
{
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="$prefix" -DOPENPU_BUILD_TESTS=ON
cmake --build build $jobArgs
}
INSTALL()
{
# apps/OpenPU, bin/openpu-cli, data/locale and the Deskbar link, relative to $prefix.
cmake --install build --strip
}
TEST()
{
build/tests/openpu_tests
}
+8 -1
View File
@@ -1,5 +1,11 @@
# Translations (gettext). Source strings are English; add a language by adding <lang>.po and # Translations (gettext). Source strings are English; add a language by adding <lang>.po and
# listing it in LINGUAS. # listing it in LINGUAS.
include(GNUInstallDirs)
if(CMAKE_SYSTEM_NAME STREQUAL "Haiku")
set(OPENPU_INSTALL_LOCALEDIR data/locale) # Haiku package layout
else()
set(OPENPU_INSTALL_LOCALEDIR ${CMAKE_INSTALL_LOCALEDIR})
endif()
find_package(Gettext) find_package(Gettext)
if(NOT GETTEXT_FOUND) if(NOT GETTEXT_FOUND)
message(WARNING "gettext (msgfmt) not found: translations are not built") message(WARNING "gettext (msgfmt) not found: translations are not built")
@@ -13,7 +19,7 @@ foreach(lang IN LISTS OPENPU_LINGUAS)
COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} --check -o ${mo} ${CMAKE_CURRENT_SOURCE_DIR}/${lang}.po COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} --check -o ${mo} ${CMAKE_CURRENT_SOURCE_DIR}/${lang}.po
DEPENDS ${lang}.po) DEPENDS ${lang}.po)
list(APPEND OPENPU_MO_FILES ${mo}) list(APPEND OPENPU_MO_FILES ${mo})
install(FILES ${mo} DESTINATION ${CMAKE_INSTALL_LOCALEDIR}/${lang}/LC_MESSAGES) install(FILES ${mo} DESTINATION ${OPENPU_INSTALL_LOCALEDIR}/${lang}/LC_MESSAGES)
endforeach() endforeach()
add_custom_target(translations ALL DEPENDS ${OPENPU_MO_FILES}) add_custom_target(translations ALL DEPENDS ${OPENPU_MO_FILES})
@@ -24,5 +30,6 @@ if(XGETTEXT)
COMMAND ${XGETTEXT} --keyword=_ --keyword=N_ --from-code=UTF-8 --package-name=openpu COMMAND ${XGETTEXT} --keyword=_ --keyword=N_ --from-code=UTF-8 --package-name=openpu
--add-comments=TRANSLATORS -o ${CMAKE_CURRENT_SOURCE_DIR}/openpu.pot --add-comments=TRANSLATORS -o ${CMAKE_CURRENT_SOURCE_DIR}/openpu.pot
${PROJECT_SOURCE_DIR}/src/ui-gtk/main_window.cpp ${PROJECT_SOURCE_DIR}/src/ui-gtk/main_window.cpp
${PROJECT_SOURCE_DIR}/src/ui-haiku/main_window.cpp
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}) WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
endif() endif()
+395 -245
View File
@@ -2,319 +2,469 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: openpu\n" "Project-Id-Version: openpu\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-11-29 05:53+0100\n"
"PO-Revision-Date: 2026-11-28 20:00+0100\n" "PO-Revision-Date: 2026-11-28 20:00+0100\n"
"Last-Translator: OpenPU contributors\n" "Last-Translator: OpenPU contributors\n"
"Language-Team: French\n" "Language-Team: French\n"
"MIME-Version: 1.0\n"
"Language: fr\n" "Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n"
#: src/ui-gtk/main_window.cpp:54 src/ui-haiku/main_window.cpp:185
msgid "Crony (navigation)" msgid "Crony (navigation)"
msgstr "Crony (avec navigation)" msgstr "Crony (avec navigation)"
#: src/ui-gtk/main_window.cpp:55 src/ui-haiku/main_window.cpp:186
msgid "Crony (no navigation)" msgid "Crony (no navigation)"
msgstr "Crony (sans navigation)" msgstr "Crony (sans navigation)"
#: src/ui-gtk/main_window.cpp:58 src/ui-haiku/main_window.cpp:189
msgid "unknown head unit" msgid "unknown head unit"
msgstr "autoradio inconnu" msgstr "autoradio inconnu"
#: src/ui-gtk/main_window.cpp:63 src/ui-haiku/main_window.cpp:194
msgid "version %1, %2" msgid "version %1, %2"
msgstr "version %1, %2" msgstr "version %1, %2"
#: src/ui-gtk/main_window.cpp:70 src/ui-haiku/main_window.cpp:200
msgid "The update server cannot be reached. Check your Internet connection." msgid "The update server cannot be reached. Check your Internet connection."
msgstr "Le serveur de mises à jour est injoignable. Vérifiez votre connexion Internet." msgstr ""
"Le serveur de mises à jour est injoignable. Vérifiez votre connexion "
"Internet."
#: src/ui-gtk/main_window.cpp:73 src/ui-haiku/main_window.cpp:202
msgid "The update server returned an error. Try again later." msgid "The update server returned an error. Try again later."
msgstr "Le serveur de mises à jour a renvoyé une erreur. Réessayez plus tard." msgstr "Le serveur de mises à jour a renvoyé une erreur. Réessayez plus tard."
#: src/ui-gtk/main_window.cpp:75 src/ui-haiku/main_window.cpp:203
msgid "This VIN is not valid." msgid "This VIN is not valid."
msgstr "Ce VIN n'est pas valide." msgstr "Ce VIN n'est pas valide."
#: src/ui-gtk/main_window.cpp:104 src/ui-haiku/main_window.cpp:407
msgid "Your saved data cannot be read" msgid "Your saved data cannot be read"
msgstr "Vos données enregistrées sont illisibles" msgstr "Vos données enregistrées sont illisibles"
#: src/ui-gtk/main_window.cpp:109 src/ui-haiku/main_window.cpp:720
#: src/ui-haiku/main_window.cpp:807 src/ui-haiku/main_window.cpp:1071
msgid "Back" msgid "Back"
msgstr "Retour" msgstr "Retour"
msgid "About OpenPU" #: src/ui-gtk/main_window.cpp:113 src/ui-gtk/main_window.cpp:219
msgstr "À propos d'OpenPU" #: src/ui-haiku/main_window.cpp:279 src/ui-haiku/main_window.cpp:384
msgid ""
"Download Peugeot head unit updates (system and navigation map) and prepare the USB stick, on "
"Linux and Haiku.\n"
"\n"
"Independent project, not affiliated with Stellantis or Peugeot."
msgstr ""
"Téléchargez les mises à jour de l'autoradio Peugeot (système et cartographie) et préparez la "
"clé USB, sous Linux et Haiku.\n"
"\n"
"Projet indépendant, sans lien avec Stellantis ni Peugeot."
msgid "Source code"
msgstr "Code source"
msgid "Cannot save the vehicle list"
msgstr "Impossible d'enregistrer la liste des véhicules"
msgid "My vehicles"
msgstr "Mes véhicules"
msgid "Add your vehicle with its VIN (17 characters, on the registration document, field E)."
msgstr "Ajoutez votre véhicule avec son VIN (17 caractères, sur le certificat d'immatriculation, champ E)."
msgid "Add a vehicle"
msgstr "Ajouter un véhicule"
msgid "Remove"
msgstr "Supprimer"
msgid "Check for updates"
msgstr "Rechercher les mises à jour"
msgid "download not finished"
msgstr "téléchargement inachevé"
msgid "Remove %1?"
msgstr "Supprimer %1 ?"
msgid "Downloaded files that were not written to a USB stick yet are deleted too."
msgstr "Les fichiers téléchargés qui n'ont pas encore été copiés sur une clé USB seront aussi supprimés."
msgid "Cancel"
msgstr "Annuler"
msgid ""
"The VIN (vehicle identification number) is written in field E of the registration document and "
"at the bottom of the windscreen."
msgstr ""
"Le VIN (numéro d'identification du véhicule) figure au champ E du certificat d'immatriculation "
"et en bas du pare-brise."
msgid "VIN"
msgstr "VIN"
msgid "Name"
msgstr "Nom"
msgid "e.g. 208 or Family car"
msgstr "par ex. 208 ou Voiture familiale"
msgid "Add"
msgstr "Ajouter"
msgid "A VIN has 17 characters and starts with VF3 or VR3."
msgstr "Un VIN comporte 17 caractères et commence par VF3 ou VR3."
msgid "Checking the vehicle…"
msgstr "Vérification du véhicule…"
msgid "This vehicle is unknown to the update service."
msgstr "Ce véhicule est inconnu du service de mises à jour."
msgid "This vehicle has no head unit that can be updated with a USB stick."
msgstr "Ce véhicule n'a pas d'autoradio pouvant être mis à jour par clé USB."
msgid "Download folder:"
msgstr "Dossier de téléchargement :"
msgid "Change…"
msgstr "Modifier…"
msgid "Installation guide"
msgstr "Guide d'installation"
msgid "Download"
msgstr "Télécharger"
msgid "Looking for updates…"
msgstr "Recherche des mises à jour…"
msgid "No update is available: your head unit is up to date."
msgstr "Aucune mise à jour disponible : votre autoradio est à jour."
msgid "Select the updates to download:"
msgstr "Sélectionnez les mises à jour à télécharger :"
msgid "System (firmware)"
msgstr "Système (firmware)"
msgid "Navigation map"
msgstr "Cartographie"
msgid "Download folder"
msgstr "Dossier de téléchargement"
msgid "Cannot save the settings"
msgstr "Impossible d'enregistrer les réglages"
msgid "Not enough free space"
msgstr "Espace libre insuffisant"
msgid ""
"%1 are needed in %2 but only %3 are free. If a previous download of these files is already in "
"this folder, it will be resumed and may fit."
msgstr ""
"%1 sont nécessaires dans %2 mais seuls %3 sont libres. Si un téléchargement précédent de ces "
"fichiers se trouve déjà dans ce dossier, il sera repris et pourra tenir."
msgid "Download anyway"
msgstr "Télécharger quand même"
msgid "Downloading"
msgstr "Téléchargement"
msgid "You can close the application: the download will resume where it stopped next time."
msgstr "Vous pouvez fermer l'application : le téléchargement reprendra là où il s'est arrêté."
msgid "Stop"
msgstr "Arrêter"
msgid "License"
msgstr "Licence"
msgid "waiting"
msgstr "en attente"
msgid "Connecting…"
msgstr "Connexion…"
msgid "Cannot write the file: %1"
msgstr "Impossible d'écrire le fichier : %1"
msgid "The download failed: %1"
msgstr "Le téléchargement a échoué : %1"
msgid "Download interrupted"
msgstr "Téléchargement interrompu"
msgid "The files already downloaded are kept; start again to resume."
msgstr "Les fichiers déjà téléchargés sont conservés ; relancez pour reprendre."
msgid "done"
msgstr "terminé"
msgid "Time left: %1"
msgstr "Temps restant : %1"
msgid "(connection lost, attempt %1)"
msgstr "(connexion perdue, tentative %1)"
msgid "Prepare the USB stick"
msgstr "Préparer la clé USB"
msgid "This USB stick is too small."
msgstr "Cette clé USB est trop petite."
msgid "Refresh"
msgstr "Actualiser"
msgid "Erase and write"
msgstr "Effacer et écrire"
msgid "Computing the required size…"
msgstr "Calcul de la taille nécessaire…"
msgid "A downloaded file is damaged"
msgstr "Un fichier téléchargé est endommagé"
msgid "Download the update again."
msgstr "Téléchargez à nouveau la mise à jour."
msgid "Plug in a USB stick of at least %1. It will be completely erased and formatted (FAT32)."
msgstr "Branchez une clé USB d'au moins %1. Elle sera entièrement effacée et formatée (FAT32)."
msgid "USB drives cannot be listed: "
msgstr "Impossible de lister les clés USB : "
msgid "too small"
msgstr "trop petite"
msgid "No USB stick found. Plug one in, then refresh."
msgstr "Aucune clé USB trouvée. Branchez-en une, puis actualisez."
msgid "Erase %1?"
msgstr "Effacer %1 ?"
msgid "Everything on this USB stick will be lost."
msgstr "Tout le contenu de cette clé USB sera perdu."
msgid "Writing the USB stick"
msgstr "Écriture de la clé USB"
msgid "Do not unplug the USB stick."
msgstr "Ne débranchez pas la clé USB."
msgid "Checking the downloaded files…"
msgstr "Vérification des fichiers téléchargés…"
msgid "Permission to format the USB stick was refused."
msgstr "L'autorisation de formater la clé USB a été refusée."
msgid "The USB stick could not be prepared"
msgstr "La clé USB n'a pas pu être préparée"
msgid "Formatting the USB stick…"
msgstr "Formatage de la clé USB…"
msgid "Copying the license…"
msgstr "Copie de la licence…"
msgid "Copying the update…"
msgstr "Copie de la mise à jour…"
msgid "Ejecting the USB stick…"
msgstr "Éjection de la clé USB…"
msgid "The USB stick is ready"
msgstr "La clé USB est prête"
msgid ""
"You can unplug the USB stick. With the engine running, plug it into the vehicle and follow the "
"instructions on the screen. The installation can take a long time: do not stop the engine."
msgstr ""
"Vous pouvez débrancher la clé USB. Moteur tournant, branchez-la dans le véhicule et suivez les "
"instructions à l'écran. L'installation peut être longue : ne coupez pas le moteur."
msgid "Finish"
msgstr "Terminer"
msgid "Preferences" msgid "Preferences"
msgstr "Préférences" msgstr "Préférences"
#: src/ui-gtk/main_window.cpp:114 src/ui-haiku/main_window.cpp:385
msgid "Check for a new version of OpenPU" msgid "Check for a new version of OpenPU"
msgstr "Rechercher une nouvelle version d'OpenPU" msgstr "Rechercher une nouvelle version d'OpenPU"
#: src/ui-gtk/main_window.cpp:115 src/ui-haiku/main_window.cpp:382
msgid "About OpenPU"
msgstr "À propos d'OpenPU"
#: src/ui-gtk/main_window.cpp:118
msgid "Menu" msgid "Menu"
msgstr "Menu" msgstr "Menu"
#: src/ui-gtk/main_window.cpp:181 src/ui-haiku/main_window.cpp:509
msgid "OpenPU is up to date" msgid "OpenPU is up to date"
msgstr "OpenPU est à jour" msgstr "OpenPU est à jour"
#: src/ui-gtk/main_window.cpp:182 src/ui-haiku/main_window.cpp:509
msgid "Version %1 is the latest version." msgid "Version %1 is the latest version."
msgstr "La version %1 est la plus récente." msgstr "La version %1 est la plus récente."
#: src/ui-gtk/main_window.cpp:185 src/ui-haiku/main_window.cpp:513
msgid "Cannot check for a new version" msgid "Cannot check for a new version"
msgstr "Impossible de rechercher une nouvelle version" msgstr "Impossible de rechercher une nouvelle version"
#: src/ui-gtk/main_window.cpp:195 src/ui-haiku/main_window.cpp:526
msgid "OpenPU %1 is available" msgid "OpenPU %1 is available"
msgstr "OpenPU %1 est disponible" msgstr "OpenPU %1 est disponible"
#: src/ui-gtk/main_window.cpp:197 src/ui-haiku/main_window.cpp:523
msgid "You are using version %1. Do you want to download the new version?" msgid "You are using version %1. Do you want to download the new version?"
msgstr "Vous utilisez la version %1. Voulez-vous télécharger la nouvelle version ?" msgstr ""
"Vous utilisez la version %1. Voulez-vous télécharger la nouvelle version ?"
#: src/ui-gtk/main_window.cpp:201 src/ui-haiku/main_window.cpp:526
msgid "Later" msgid "Later"
msgstr "Plus tard" msgstr "Plus tard"
#: src/ui-gtk/main_window.cpp:201 src/ui-gtk/main_window.cpp:625
#: src/ui-haiku/main_window.cpp:527 src/ui-haiku/main_window.cpp:790
msgid "Download"
msgstr "Télécharger"
#: src/ui-gtk/main_window.cpp:231 src/ui-gtk/main_window.cpp:705
#: src/ui-haiku/main_window.cpp:308 src/ui-haiku/main_window.cpp:898
msgid "Download folder"
msgstr "Dossier de téléchargement"
#: src/ui-gtk/main_window.cpp:238 src/ui-gtk/main_window.cpp:608
#: src/ui-haiku/main_window.cpp:310 src/ui-haiku/main_window.cpp:803
msgid "Change…"
msgstr "Modifier…"
#: src/ui-gtk/main_window.cpp:247 src/ui-haiku/main_window.cpp:297
msgid "Language" msgid "Language"
msgstr "Langue" msgstr "Langue"
#: src/ui-gtk/main_window.cpp:252 src/ui-haiku/main_window.cpp:293
msgid "System language" msgid "System language"
msgstr "Langue du système" msgstr "Langue du système"
#: src/ui-gtk/main_window.cpp:258 src/ui-haiku/main_window.cpp:298
msgid "The new language is used the next time OpenPU starts." msgid "The new language is used the next time OpenPU starts."
msgstr "La nouvelle langue sera utilisée au prochain démarrage d'OpenPU." msgstr "La nouvelle langue sera utilisée au prochain démarrage d'OpenPU."
#: src/ui-gtk/main_window.cpp:271 src/ui-gtk/main_window.cpp:286
#: src/ui-gtk/main_window.cpp:718 src/ui-haiku/main_window.cpp:565
msgid "Cannot save the settings"
msgstr "Impossible d'enregistrer les réglages"
#: src/ui-gtk/main_window.cpp:279 src/ui-haiku/main_window.cpp:301
msgid "Check for a new version of OpenPU at startup" msgid "Check for a new version of OpenPU at startup"
msgstr "Rechercher une nouvelle version d'OpenPU au démarrage" msgstr "Rechercher une nouvelle version d'OpenPU au démarrage"
#: src/ui-gtk/main_window.cpp:338 src/ui-haiku/main_window.cpp:548
msgid ""
"Download Peugeot head unit updates (system and navigation map) and prepare "
"the USB stick, on Linux and Haiku.\n"
"\n"
"Independent project, not affiliated with Stellantis or Peugeot."
msgstr ""
"Téléchargez les mises à jour de l'autoradio Peugeot (système et "
"cartographie) et préparez la clé USB, sous Linux et Haiku.\n"
"\n"
"Projet indépendant, sans lien avec Stellantis ni Peugeot."
#: src/ui-gtk/main_window.cpp:344 src/ui-haiku/main_window.cpp:556
msgid "Source code"
msgstr "Code source"
#: src/ui-gtk/main_window.cpp:356 src/ui-haiku/main_window.cpp:574
msgid "Cannot save the vehicle list"
msgstr "Impossible d'enregistrer la liste des véhicules"
#: src/ui-gtk/main_window.cpp:370 src/ui-haiku/main_window.cpp:635
msgid "My vehicles"
msgstr "Mes véhicules"
#: src/ui-gtk/main_window.cpp:372 src/ui-haiku/main_window.cpp:623
msgid ""
"Add your vehicle with its VIN (17 characters, on the registration document, "
"field E)."
msgstr ""
"Ajoutez votre véhicule avec son VIN (17 caractères, sur le certificat "
"d'immatriculation, champ E)."
#: src/ui-gtk/main_window.cpp:392 src/ui-gtk/main_window.cpp:486
#: src/ui-haiku/main_window.cpp:640 src/ui-haiku/main_window.cpp:710
msgid "Add a vehicle"
msgstr "Ajouter un véhicule"
#: src/ui-gtk/main_window.cpp:393 src/ui-gtk/main_window.cpp:457
#: src/ui-haiku/main_window.cpp:629 src/ui-haiku/main_window.cpp:683
msgid "Remove"
msgstr "Supprimer"
#: src/ui-gtk/main_window.cpp:394 src/ui-haiku/main_window.cpp:630
msgid "Check for updates"
msgstr "Rechercher les mises à jour"
#: src/ui-gtk/main_window.cpp:425 src/ui-haiku/main_window.cpp:655
msgid "download not finished"
msgstr "téléchargement inachevé"
#: src/ui-gtk/main_window.cpp:455 src/ui-haiku/main_window.cpp:682
msgid "Remove %1?"
msgstr "Supprimer %1 ?"
#: src/ui-gtk/main_window.cpp:456 src/ui-haiku/main_window.cpp:683
msgid ""
"Downloaded files that were not written to a USB stick yet are deleted too."
msgstr ""
"Les fichiers téléchargés qui n'ont pas encore été copiés sur une clé USB "
"seront aussi supprimés."
#: src/ui-gtk/main_window.cpp:457 src/ui-gtk/main_window.cpp:741
#: src/ui-gtk/main_window.cpp:982 src/ui-haiku/main_window.cpp:683
#: src/ui-haiku/main_window.cpp:938 src/ui-haiku/main_window.cpp:1156
msgid "Cancel"
msgstr "Annuler"
#: src/ui-gtk/main_window.cpp:488 src/ui-haiku/main_window.cpp:711
msgid ""
"The VIN (vehicle identification number) is written in field E of the "
"registration document and at the bottom of the windscreen."
msgstr ""
"Le VIN (numéro d'identification du véhicule) figure au champ E du certificat "
"d'immatriculation et en bas du pare-brise."
#: src/ui-gtk/main_window.cpp:496 src/ui-haiku/main_window.cpp:699
msgid "VIN"
msgstr "VIN"
#: src/ui-gtk/main_window.cpp:498 src/ui-haiku/main_window.cpp:702
msgid "Name"
msgstr "Nom"
#: src/ui-gtk/main_window.cpp:503
msgid "e.g. 208 or Family car"
msgstr "par ex. 208 ou Voiture familiale"
#: src/ui-gtk/main_window.cpp:517 src/ui-haiku/main_window.cpp:704
msgid "Add"
msgstr "Ajouter"
#: src/ui-gtk/main_window.cpp:535 src/ui-haiku/main_window.cpp:732
msgid "A VIN has 17 characters and starts with VF3 or VR3."
msgstr "Un VIN comporte 17 caractères et commence par VF3 ou VR3."
#: src/ui-gtk/main_window.cpp:541 src/ui-haiku/main_window.cpp:737
msgid "Checking the vehicle…"
msgstr "Vérification du véhicule…"
#: src/ui-gtk/main_window.cpp:558 src/ui-haiku/main_window.cpp:753
msgid "This vehicle is unknown to the update service."
msgstr "Ce véhicule est inconnu du service de mises à jour."
#: src/ui-gtk/main_window.cpp:562 src/ui-haiku/main_window.cpp:757
msgid "This vehicle has no head unit that can be updated with a USB stick."
msgstr "Ce véhicule n'a pas d'autoradio pouvant être mis à jour par clé USB."
#: src/ui-gtk/main_window.cpp:604 src/ui-haiku/main_window.cpp:801
msgid "Download folder:"
msgstr "Dossier de téléchargement :"
#: src/ui-gtk/main_window.cpp:617 src/ui-gtk/main_window.cpp:1118
#: src/ui-haiku/main_window.cpp:789 src/ui-haiku/main_window.cpp:1287
msgid "Installation guide"
msgstr "Guide d'installation"
#: src/ui-gtk/main_window.cpp:651 src/ui-haiku/main_window.cpp:835
msgid "Looking for updates…"
msgstr "Recherche des mises à jour…"
#: src/ui-gtk/main_window.cpp:685 src/ui-haiku/main_window.cpp:867
msgid "No update is available: your head unit is up to date."
msgstr "Aucune mise à jour disponible : votre autoradio est à jour."
#: src/ui-gtk/main_window.cpp:688 src/ui-haiku/main_window.cpp:870
msgid "Select the updates to download:"
msgstr "Sélectionnez les mises à jour à télécharger :"
#: src/ui-gtk/main_window.cpp:690 src/ui-gtk/main_window.cpp:803
#: src/ui-haiku/main_window.cpp:872 src/ui-haiku/main_window.cpp:979
msgid "System (firmware)"
msgstr "Système (firmware)"
#: src/ui-gtk/main_window.cpp:695 src/ui-gtk/main_window.cpp:807
#: src/ui-haiku/main_window.cpp:877 src/ui-haiku/main_window.cpp:982
msgid "Navigation map"
msgstr "Cartographie"
#: src/ui-gtk/main_window.cpp:736 src/ui-haiku/main_window.cpp:938
msgid "Not enough free space"
msgstr "Espace libre insuffisant"
#: src/ui-gtk/main_window.cpp:738 src/ui-haiku/main_window.cpp:935
msgid ""
"%1 are needed in %2 but only %3 are free. If a previous download of these "
"files is already in this folder, it will be resumed and may fit."
msgstr ""
"%1 sont nécessaires dans %2 mais seuls %3 sont libres. Si un téléchargement "
"précédent de ces fichiers se trouve déjà dans ce dossier, il sera repris et "
"pourra tenir."
#: src/ui-gtk/main_window.cpp:741 src/ui-haiku/main_window.cpp:938
msgid "Download anyway"
msgstr "Télécharger quand même"
#: src/ui-gtk/main_window.cpp:763 src/ui-haiku/main_window.cpp:958
msgid "Downloading"
msgstr "Téléchargement"
#: src/ui-gtk/main_window.cpp:765 src/ui-haiku/main_window.cpp:954
msgid ""
"You can close the application: the download will resume where it stopped "
"next time."
msgstr ""
"Vous pouvez fermer l'application : le téléchargement reprendra là où il "
"s'est arrêté."
#: src/ui-gtk/main_window.cpp:786 src/ui-gtk/main_window.cpp:1014
#: src/ui-haiku/main_window.cpp:952 src/ui-haiku/main_window.cpp:1168
msgid "Stop"
msgstr "Arrêter"
#: src/ui-gtk/main_window.cpp:799 src/ui-gtk/main_window.cpp:849
#: src/ui-haiku/main_window.cpp:554 src/ui-haiku/main_window.cpp:976
#: src/ui-haiku/main_window.cpp:1019
msgid "License"
msgstr "Licence"
#: src/ui-gtk/main_window.cpp:799 src/ui-haiku/main_window.cpp:976
msgid "waiting"
msgstr "en attente"
#: src/ui-gtk/main_window.cpp:812 src/ui-haiku/main_window.cpp:983
msgid "Connecting…"
msgstr "Connexion…"
#: src/ui-gtk/main_window.cpp:829 src/ui-haiku/main_window.cpp:999
msgid "Cannot write the file: %1"
msgstr "Impossible d'écrire le fichier : %1"
#: src/ui-gtk/main_window.cpp:830 src/ui-haiku/main_window.cpp:1000
msgid "The download failed: %1"
msgstr "Le téléchargement a échoué : %1"
#: src/ui-gtk/main_window.cpp:839 src/ui-haiku/main_window.cpp:1009
msgid "Download interrupted"
msgstr "Téléchargement interrompu"
#: src/ui-gtk/main_window.cpp:840 src/ui-haiku/main_window.cpp:1010
msgid "The files already downloaded are kept; start again to resume."
msgstr ""
"Les fichiers déjà téléchargés sont conservés ; relancez pour reprendre."
#: src/ui-gtk/main_window.cpp:849 src/ui-haiku/main_window.cpp:1019
msgid "done"
msgstr "terminé"
#: src/ui-gtk/main_window.cpp:859 src/ui-haiku/main_window.cpp:1027
msgid "Time left: %1"
msgstr "Temps restant : %1"
#: src/ui-gtk/main_window.cpp:861 src/ui-haiku/main_window.cpp:1029
msgid "(connection lost, attempt %1)"
msgstr "(connexion perdue, tentative %1)"
#: src/ui-gtk/main_window.cpp:886 src/ui-haiku/main_window.cpp:1062
msgid "Prepare the USB stick"
msgstr "Préparer la clé USB"
#: src/ui-gtk/main_window.cpp:897 src/ui-gtk/main_window.cpp:970
#: src/ui-haiku/main_window.cpp:1147
msgid "This USB stick is too small."
msgstr "Cette clé USB est trop petite."
#: src/ui-gtk/main_window.cpp:901 src/ui-haiku/main_window.cpp:1066
msgid "Refresh"
msgstr "Actualiser"
#: src/ui-gtk/main_window.cpp:910 src/ui-gtk/main_window.cpp:982
#: src/ui-haiku/main_window.cpp:1057 src/ui-haiku/main_window.cpp:1156
msgid "Erase and write"
msgstr "Effacer et écrire"
#: src/ui-gtk/main_window.cpp:920 src/ui-haiku/main_window.cpp:1081
msgid "Computing the required size…"
msgstr "Calcul de la taille nécessaire…"
#: src/ui-gtk/main_window.cpp:934 src/ui-gtk/main_window.cpp:1055
#: src/ui-haiku/main_window.cpp:1095 src/ui-haiku/main_window.cpp:1215
msgid "A downloaded file is damaged"
msgstr "Un fichier téléchargé est endommagé"
#: src/ui-gtk/main_window.cpp:934 src/ui-gtk/main_window.cpp:1055
#: src/ui-haiku/main_window.cpp:1095 src/ui-haiku/main_window.cpp:1215
msgid "Download the update again."
msgstr "Téléchargez à nouveau la mise à jour."
#: src/ui-gtk/main_window.cpp:941 src/ui-haiku/main_window.cpp:1102
msgid ""
"Plug in a USB stick of at least %1. It will be completely erased and "
"formatted (FAT32)."
msgstr ""
"Branchez une clé USB d'au moins %1. Elle sera entièrement effacée et "
"formatée (FAT32)."
#: src/ui-gtk/main_window.cpp:956 src/ui-haiku/main_window.cpp:1118
msgid "USB drives cannot be listed: "
msgstr "Impossible de lister les clés USB : "
#: src/ui-gtk/main_window.cpp:961 src/ui-haiku/main_window.cpp:1126
msgid "too small"
msgstr "trop petite"
#: src/ui-gtk/main_window.cpp:964 src/ui-haiku/main_window.cpp:1054
#: src/ui-haiku/main_window.cpp:1134
msgid "No USB stick found. Plug one in, then refresh."
msgstr "Aucune clé USB trouvée. Branchez-en une, puis actualisez."
#: src/ui-gtk/main_window.cpp:980 src/ui-haiku/main_window.cpp:1155
msgid "Erase %1?"
msgstr "Effacer %1 ?"
#: src/ui-gtk/main_window.cpp:981 src/ui-haiku/main_window.cpp:1155
msgid "Everything on this USB stick will be lost."
msgstr "Tout le contenu de cette clé USB sera perdu."
#: src/ui-gtk/main_window.cpp:1000 src/ui-haiku/main_window.cpp:1173
msgid "Writing the USB stick"
msgstr "Écriture de la clé USB"
#: src/ui-gtk/main_window.cpp:1001 src/ui-haiku/main_window.cpp:1174
msgid "Do not unplug the USB stick."
msgstr "Ne débranchez pas la clé USB."
#: src/ui-gtk/main_window.cpp:1026 src/ui-gtk/main_window.cpp:1072
#: src/ui-haiku/main_window.cpp:1188 src/ui-haiku/main_window.cpp:1234
msgid "Checking the downloaded files…"
msgstr "Vérification des fichiers téléchargés…"
#: src/ui-gtk/main_window.cpp:1046 src/ui-haiku/main_window.cpp:1206
msgid "Permission to format the USB stick was refused."
msgstr "L'autorisation de formater la clé USB a été refusée."
#: src/ui-gtk/main_window.cpp:1061 src/ui-haiku/main_window.cpp:1221
msgid "The USB stick could not be prepared"
msgstr "La clé USB n'a pas pu être préparée"
#: src/ui-gtk/main_window.cpp:1074 src/ui-haiku/main_window.cpp:1236
msgid "Formatting the USB stick…"
msgstr "Formatage de la clé USB…"
#: src/ui-gtk/main_window.cpp:1077 src/ui-haiku/main_window.cpp:1240
msgid "Copying the license…"
msgstr "Copie de la licence…"
#: src/ui-gtk/main_window.cpp:1078 src/ui-haiku/main_window.cpp:1243
msgid "Copying the update…"
msgstr "Copie de la mise à jour…"
#: src/ui-gtk/main_window.cpp:1080 src/ui-haiku/main_window.cpp:1245
msgid "Ejecting the USB stick…"
msgstr "Éjection de la clé USB…"
#: src/ui-gtk/main_window.cpp:1111 src/ui-haiku/main_window.cpp:1281
msgid "The USB stick is ready"
msgstr "La clé USB est prête"
#: src/ui-gtk/main_window.cpp:1113 src/ui-haiku/main_window.cpp:1282
msgid ""
"You can unplug the USB stick. With the engine running, plug it into the "
"vehicle and follow the instructions on the screen. The installation can take "
"a long time: do not stop the engine."
msgstr ""
"Vous pouvez débrancher la clé USB. Moteur tournant, branchez-la dans le "
"véhicule et suivez les instructions à l'écran. L'installation peut être "
"longue : ne coupez pas le moteur."
#: src/ui-gtk/main_window.cpp:1126 src/ui-haiku/main_window.cpp:1277
msgid "Finish"
msgstr "Terminer"
#: src/ui-haiku/main_window.cpp:387
msgid "Quit"
msgstr "Quitter"
#: src/ui-haiku/main_window.cpp:897
msgid "Select"
msgstr "Sélectionner"
+165 -116
View File
@@ -1,401 +1,450 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the openpu package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: openpu\n" "Project-Id-Version: openpu\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-11-29 05:53+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
#: src\ui-gtk\main_window.cpp:54 #: src/ui-gtk/main_window.cpp:54 src/ui-haiku/main_window.cpp:185
msgid "Crony (navigation)" msgid "Crony (navigation)"
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:55 #: src/ui-gtk/main_window.cpp:55 src/ui-haiku/main_window.cpp:186
msgid "Crony (no navigation)" msgid "Crony (no navigation)"
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:58 #: src/ui-gtk/main_window.cpp:58 src/ui-haiku/main_window.cpp:189
msgid "unknown head unit" msgid "unknown head unit"
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:63 #: src/ui-gtk/main_window.cpp:63 src/ui-haiku/main_window.cpp:194
#, qt-format
msgid "version %1, %2" msgid "version %1, %2"
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:70 #: src/ui-gtk/main_window.cpp:70 src/ui-haiku/main_window.cpp:200
msgid "The update server cannot be reached. Check your Internet connection." msgid "The update server cannot be reached. Check your Internet connection."
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:73 #: src/ui-gtk/main_window.cpp:73 src/ui-haiku/main_window.cpp:202
msgid "The update server returned an error. Try again later." msgid "The update server returned an error. Try again later."
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:75 #: src/ui-gtk/main_window.cpp:75 src/ui-haiku/main_window.cpp:203
msgid "This VIN is not valid." msgid "This VIN is not valid."
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:104 #: src/ui-gtk/main_window.cpp:104 src/ui-haiku/main_window.cpp:407
msgid "Your saved data cannot be read" msgid "Your saved data cannot be read"
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:109 #: src/ui-gtk/main_window.cpp:109 src/ui-haiku/main_window.cpp:720
#: src/ui-haiku/main_window.cpp:807 src/ui-haiku/main_window.cpp:1071
msgid "Back" msgid "Back"
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:113 src\ui-gtk\main_window.cpp:219 #: src/ui-gtk/main_window.cpp:113 src/ui-gtk/main_window.cpp:219
#: src/ui-haiku/main_window.cpp:279 src/ui-haiku/main_window.cpp:384
msgid "Preferences" msgid "Preferences"
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:114 #: src/ui-gtk/main_window.cpp:114 src/ui-haiku/main_window.cpp:385
msgid "Check for a new version of OpenPU" msgid "Check for a new version of OpenPU"
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:115 #: src/ui-gtk/main_window.cpp:115 src/ui-haiku/main_window.cpp:382
msgid "About OpenPU" msgid "About OpenPU"
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:118 #: src/ui-gtk/main_window.cpp:118
msgid "Menu" msgid "Menu"
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:181 #: src/ui-gtk/main_window.cpp:181 src/ui-haiku/main_window.cpp:509
msgid "OpenPU is up to date" msgid "OpenPU is up to date"
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:182 #: src/ui-gtk/main_window.cpp:182 src/ui-haiku/main_window.cpp:509
#, qt-format
msgid "Version %1 is the latest version." msgid "Version %1 is the latest version."
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:185 #: src/ui-gtk/main_window.cpp:185 src/ui-haiku/main_window.cpp:513
msgid "Cannot check for a new version" msgid "Cannot check for a new version"
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:195 #: src/ui-gtk/main_window.cpp:195 src/ui-haiku/main_window.cpp:526
#, qt-format
msgid "OpenPU %1 is available" msgid "OpenPU %1 is available"
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:197 #: src/ui-gtk/main_window.cpp:197 src/ui-haiku/main_window.cpp:523
#, qt-format
msgid "You are using version %1. Do you want to download the new version?" msgid "You are using version %1. Do you want to download the new version?"
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:201 #: src/ui-gtk/main_window.cpp:201 src/ui-haiku/main_window.cpp:526
msgid "Later" msgid "Later"
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:201 src\ui-gtk\main_window.cpp:625 #: src/ui-gtk/main_window.cpp:201 src/ui-gtk/main_window.cpp:625
#: src/ui-haiku/main_window.cpp:527 src/ui-haiku/main_window.cpp:790
msgid "Download" msgid "Download"
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:231 src\ui-gtk\main_window.cpp:705 #: src/ui-gtk/main_window.cpp:231 src/ui-gtk/main_window.cpp:705
#: src/ui-haiku/main_window.cpp:308 src/ui-haiku/main_window.cpp:898
msgid "Download folder" msgid "Download folder"
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:238 src\ui-gtk\main_window.cpp:608 #: src/ui-gtk/main_window.cpp:238 src/ui-gtk/main_window.cpp:608
#: src/ui-haiku/main_window.cpp:310 src/ui-haiku/main_window.cpp:803
msgid "Change…" msgid "Change…"
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:247 #: src/ui-gtk/main_window.cpp:247 src/ui-haiku/main_window.cpp:297
msgid "Language" msgid "Language"
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:252 #: src/ui-gtk/main_window.cpp:252 src/ui-haiku/main_window.cpp:293
msgid "System language" msgid "System language"
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:258 #: src/ui-gtk/main_window.cpp:258 src/ui-haiku/main_window.cpp:298
msgid "The new language is used the next time OpenPU starts." msgid "The new language is used the next time OpenPU starts."
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:271 src\ui-gtk\main_window.cpp:286 src\ui-gtk\main_window.cpp:718 #: src/ui-gtk/main_window.cpp:271 src/ui-gtk/main_window.cpp:286
#: src/ui-gtk/main_window.cpp:718 src/ui-haiku/main_window.cpp:565
msgid "Cannot save the settings" msgid "Cannot save the settings"
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:279 #: src/ui-gtk/main_window.cpp:279 src/ui-haiku/main_window.cpp:301
msgid "Check for a new version of OpenPU at startup" msgid "Check for a new version of OpenPU at startup"
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:338 #: src/ui-gtk/main_window.cpp:338 src/ui-haiku/main_window.cpp:548
msgid "Download Peugeot head unit updates (system and navigation map) and prepare the USB stick, on Linux and Haiku.\n\nIndependent project, not affiliated with Stellantis or Peugeot." msgid ""
"Download Peugeot head unit updates (system and navigation map) and prepare "
"the USB stick, on Linux and Haiku.\n"
"\n"
"Independent project, not affiliated with Stellantis or Peugeot."
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:344 #: src/ui-gtk/main_window.cpp:344 src/ui-haiku/main_window.cpp:556
msgid "Source code" msgid "Source code"
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:356 #: src/ui-gtk/main_window.cpp:356 src/ui-haiku/main_window.cpp:574
msgid "Cannot save the vehicle list" msgid "Cannot save the vehicle list"
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:370 #: src/ui-gtk/main_window.cpp:370 src/ui-haiku/main_window.cpp:635
msgid "My vehicles" msgid "My vehicles"
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:372 #: src/ui-gtk/main_window.cpp:372 src/ui-haiku/main_window.cpp:623
msgid "Add your vehicle with its VIN (17 characters, on the registration document, field E)." msgid ""
"Add your vehicle with its VIN (17 characters, on the registration document, "
"field E)."
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:392 src\ui-gtk\main_window.cpp:486 #: src/ui-gtk/main_window.cpp:392 src/ui-gtk/main_window.cpp:486
#: src/ui-haiku/main_window.cpp:640 src/ui-haiku/main_window.cpp:710
msgid "Add a vehicle" msgid "Add a vehicle"
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:393 src\ui-gtk\main_window.cpp:457 #: src/ui-gtk/main_window.cpp:393 src/ui-gtk/main_window.cpp:457
#: src/ui-haiku/main_window.cpp:629 src/ui-haiku/main_window.cpp:683
msgid "Remove" msgid "Remove"
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:394 #: src/ui-gtk/main_window.cpp:394 src/ui-haiku/main_window.cpp:630
msgid "Check for updates" msgid "Check for updates"
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:425 #: src/ui-gtk/main_window.cpp:425 src/ui-haiku/main_window.cpp:655
msgid "download not finished" msgid "download not finished"
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:455 #: src/ui-gtk/main_window.cpp:455 src/ui-haiku/main_window.cpp:682
#, qt-format
msgid "Remove %1?" msgid "Remove %1?"
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:456 #: src/ui-gtk/main_window.cpp:456 src/ui-haiku/main_window.cpp:683
msgid "Downloaded files that were not written to a USB stick yet are deleted too." msgid ""
"Downloaded files that were not written to a USB stick yet are deleted too."
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:457 src\ui-gtk\main_window.cpp:741 src\ui-gtk\main_window.cpp:982 #: src/ui-gtk/main_window.cpp:457 src/ui-gtk/main_window.cpp:741
#: src/ui-gtk/main_window.cpp:982 src/ui-haiku/main_window.cpp:683
#: src/ui-haiku/main_window.cpp:938 src/ui-haiku/main_window.cpp:1156
msgid "Cancel" msgid "Cancel"
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:488 #: src/ui-gtk/main_window.cpp:488 src/ui-haiku/main_window.cpp:711
msgid "The VIN (vehicle identification number) is written in field E of the registration document and at the bottom of the windscreen." msgid ""
"The VIN (vehicle identification number) is written in field E of the "
"registration document and at the bottom of the windscreen."
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:496 #: src/ui-gtk/main_window.cpp:496 src/ui-haiku/main_window.cpp:699
msgid "VIN" msgid "VIN"
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:498 #: src/ui-gtk/main_window.cpp:498 src/ui-haiku/main_window.cpp:702
msgid "Name" msgid "Name"
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:503 #: src/ui-gtk/main_window.cpp:503
msgid "e.g. 208 or Family car" msgid "e.g. 208 or Family car"
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:517 #: src/ui-gtk/main_window.cpp:517 src/ui-haiku/main_window.cpp:704
msgid "Add" msgid "Add"
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:535 #: src/ui-gtk/main_window.cpp:535 src/ui-haiku/main_window.cpp:732
msgid "A VIN has 17 characters and starts with VF3 or VR3." msgid "A VIN has 17 characters and starts with VF3 or VR3."
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:541 #: src/ui-gtk/main_window.cpp:541 src/ui-haiku/main_window.cpp:737
msgid "Checking the vehicle…" msgid "Checking the vehicle…"
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:558 #: src/ui-gtk/main_window.cpp:558 src/ui-haiku/main_window.cpp:753
msgid "This vehicle is unknown to the update service." msgid "This vehicle is unknown to the update service."
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:562 #: src/ui-gtk/main_window.cpp:562 src/ui-haiku/main_window.cpp:757
msgid "This vehicle has no head unit that can be updated with a USB stick." msgid "This vehicle has no head unit that can be updated with a USB stick."
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:604 #: src/ui-gtk/main_window.cpp:604 src/ui-haiku/main_window.cpp:801
msgid "Download folder:" msgid "Download folder:"
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:617 src\ui-gtk\main_window.cpp:1118 #: src/ui-gtk/main_window.cpp:617 src/ui-gtk/main_window.cpp:1118
#: src/ui-haiku/main_window.cpp:789 src/ui-haiku/main_window.cpp:1287
msgid "Installation guide" msgid "Installation guide"
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:651 #: src/ui-gtk/main_window.cpp:651 src/ui-haiku/main_window.cpp:835
msgid "Looking for updates…" msgid "Looking for updates…"
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:685 #: src/ui-gtk/main_window.cpp:685 src/ui-haiku/main_window.cpp:867
msgid "No update is available: your head unit is up to date." msgid "No update is available: your head unit is up to date."
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:688 #: src/ui-gtk/main_window.cpp:688 src/ui-haiku/main_window.cpp:870
msgid "Select the updates to download:" msgid "Select the updates to download:"
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:690 src\ui-gtk\main_window.cpp:803 #: src/ui-gtk/main_window.cpp:690 src/ui-gtk/main_window.cpp:803
#: src/ui-haiku/main_window.cpp:872 src/ui-haiku/main_window.cpp:979
msgid "System (firmware)" msgid "System (firmware)"
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:695 src\ui-gtk\main_window.cpp:807 #: src/ui-gtk/main_window.cpp:695 src/ui-gtk/main_window.cpp:807
#: src/ui-haiku/main_window.cpp:877 src/ui-haiku/main_window.cpp:982
msgid "Navigation map" msgid "Navigation map"
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:736 #: src/ui-gtk/main_window.cpp:736 src/ui-haiku/main_window.cpp:938
msgid "Not enough free space" msgid "Not enough free space"
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:738 #: src/ui-gtk/main_window.cpp:738 src/ui-haiku/main_window.cpp:935
#, qt-format msgid ""
msgid "%1 are needed in %2 but only %3 are free. If a previous download of these files is already in this folder, it will be resumed and may fit." "%1 are needed in %2 but only %3 are free. If a previous download of these "
"files is already in this folder, it will be resumed and may fit."
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:741 #: src/ui-gtk/main_window.cpp:741 src/ui-haiku/main_window.cpp:938
msgid "Download anyway" msgid "Download anyway"
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:763 #: src/ui-gtk/main_window.cpp:763 src/ui-haiku/main_window.cpp:958
msgid "Downloading" msgid "Downloading"
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:765 #: src/ui-gtk/main_window.cpp:765 src/ui-haiku/main_window.cpp:954
msgid "You can close the application: the download will resume where it stopped next time." msgid ""
"You can close the application: the download will resume where it stopped "
"next time."
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:786 src\ui-gtk\main_window.cpp:1014 #: src/ui-gtk/main_window.cpp:786 src/ui-gtk/main_window.cpp:1014
#: src/ui-haiku/main_window.cpp:952 src/ui-haiku/main_window.cpp:1168
msgid "Stop" msgid "Stop"
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:799 src\ui-gtk\main_window.cpp:849 #: src/ui-gtk/main_window.cpp:799 src/ui-gtk/main_window.cpp:849
#: src/ui-haiku/main_window.cpp:554 src/ui-haiku/main_window.cpp:976
#: src/ui-haiku/main_window.cpp:1019
msgid "License" msgid "License"
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:799 #: src/ui-gtk/main_window.cpp:799 src/ui-haiku/main_window.cpp:976
msgid "waiting" msgid "waiting"
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:812 #: src/ui-gtk/main_window.cpp:812 src/ui-haiku/main_window.cpp:983
msgid "Connecting…" msgid "Connecting…"
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:829 #: src/ui-gtk/main_window.cpp:829 src/ui-haiku/main_window.cpp:999
#, qt-format
msgid "Cannot write the file: %1" msgid "Cannot write the file: %1"
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:830 #: src/ui-gtk/main_window.cpp:830 src/ui-haiku/main_window.cpp:1000
#, qt-format
msgid "The download failed: %1" msgid "The download failed: %1"
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:839 #: src/ui-gtk/main_window.cpp:839 src/ui-haiku/main_window.cpp:1009
msgid "Download interrupted" msgid "Download interrupted"
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:840 #: src/ui-gtk/main_window.cpp:840 src/ui-haiku/main_window.cpp:1010
msgid "The files already downloaded are kept; start again to resume." msgid "The files already downloaded are kept; start again to resume."
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:849 #: src/ui-gtk/main_window.cpp:849 src/ui-haiku/main_window.cpp:1019
msgid "done" msgid "done"
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:859 #: src/ui-gtk/main_window.cpp:859 src/ui-haiku/main_window.cpp:1027
#, qt-format
msgid "Time left: %1" msgid "Time left: %1"
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:861 #: src/ui-gtk/main_window.cpp:861 src/ui-haiku/main_window.cpp:1029
#, qt-format
msgid "(connection lost, attempt %1)" msgid "(connection lost, attempt %1)"
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:886 #: src/ui-gtk/main_window.cpp:886 src/ui-haiku/main_window.cpp:1062
msgid "Prepare the USB stick" msgid "Prepare the USB stick"
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:897 src\ui-gtk\main_window.cpp:970 #: src/ui-gtk/main_window.cpp:897 src/ui-gtk/main_window.cpp:970
#: src/ui-haiku/main_window.cpp:1147
msgid "This USB stick is too small." msgid "This USB stick is too small."
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:901 #: src/ui-gtk/main_window.cpp:901 src/ui-haiku/main_window.cpp:1066
msgid "Refresh" msgid "Refresh"
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:910 src\ui-gtk\main_window.cpp:982 #: src/ui-gtk/main_window.cpp:910 src/ui-gtk/main_window.cpp:982
#: src/ui-haiku/main_window.cpp:1057 src/ui-haiku/main_window.cpp:1156
msgid "Erase and write" msgid "Erase and write"
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:920 #: src/ui-gtk/main_window.cpp:920 src/ui-haiku/main_window.cpp:1081
msgid "Computing the required size…" msgid "Computing the required size…"
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:934 src\ui-gtk\main_window.cpp:1055 #: src/ui-gtk/main_window.cpp:934 src/ui-gtk/main_window.cpp:1055
#: src/ui-haiku/main_window.cpp:1095 src/ui-haiku/main_window.cpp:1215
msgid "A downloaded file is damaged" msgid "A downloaded file is damaged"
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:934 src\ui-gtk\main_window.cpp:1055 #: src/ui-gtk/main_window.cpp:934 src/ui-gtk/main_window.cpp:1055
#: src/ui-haiku/main_window.cpp:1095 src/ui-haiku/main_window.cpp:1215
msgid "Download the update again." msgid "Download the update again."
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:941 #: src/ui-gtk/main_window.cpp:941 src/ui-haiku/main_window.cpp:1102
#, qt-format msgid ""
msgid "Plug in a USB stick of at least %1. It will be completely erased and formatted (FAT32)." "Plug in a USB stick of at least %1. It will be completely erased and "
"formatted (FAT32)."
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:956 #: src/ui-gtk/main_window.cpp:956 src/ui-haiku/main_window.cpp:1118
msgid "USB drives cannot be listed: " msgid "USB drives cannot be listed: "
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:961 #: src/ui-gtk/main_window.cpp:961 src/ui-haiku/main_window.cpp:1126
msgid "too small" msgid "too small"
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:964 #: src/ui-gtk/main_window.cpp:964 src/ui-haiku/main_window.cpp:1054
#: src/ui-haiku/main_window.cpp:1134
msgid "No USB stick found. Plug one in, then refresh." msgid "No USB stick found. Plug one in, then refresh."
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:980 #: src/ui-gtk/main_window.cpp:980 src/ui-haiku/main_window.cpp:1155
#, qt-format
msgid "Erase %1?" msgid "Erase %1?"
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:981 #: src/ui-gtk/main_window.cpp:981 src/ui-haiku/main_window.cpp:1155
msgid "Everything on this USB stick will be lost." msgid "Everything on this USB stick will be lost."
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:1000 #: src/ui-gtk/main_window.cpp:1000 src/ui-haiku/main_window.cpp:1173
msgid "Writing the USB stick" msgid "Writing the USB stick"
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:1001 #: src/ui-gtk/main_window.cpp:1001 src/ui-haiku/main_window.cpp:1174
msgid "Do not unplug the USB stick." msgid "Do not unplug the USB stick."
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:1026 src\ui-gtk\main_window.cpp:1072 #: src/ui-gtk/main_window.cpp:1026 src/ui-gtk/main_window.cpp:1072
#: src/ui-haiku/main_window.cpp:1188 src/ui-haiku/main_window.cpp:1234
msgid "Checking the downloaded files…" msgid "Checking the downloaded files…"
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:1046 #: src/ui-gtk/main_window.cpp:1046 src/ui-haiku/main_window.cpp:1206
msgid "Permission to format the USB stick was refused." msgid "Permission to format the USB stick was refused."
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:1061 #: src/ui-gtk/main_window.cpp:1061 src/ui-haiku/main_window.cpp:1221
msgid "The USB stick could not be prepared" msgid "The USB stick could not be prepared"
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:1074 #: src/ui-gtk/main_window.cpp:1074 src/ui-haiku/main_window.cpp:1236
msgid "Formatting the USB stick…" msgid "Formatting the USB stick…"
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:1077 #: src/ui-gtk/main_window.cpp:1077 src/ui-haiku/main_window.cpp:1240
msgid "Copying the license…" msgid "Copying the license…"
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:1078 #: src/ui-gtk/main_window.cpp:1078 src/ui-haiku/main_window.cpp:1243
msgid "Copying the update…" msgid "Copying the update…"
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:1080 #: src/ui-gtk/main_window.cpp:1080 src/ui-haiku/main_window.cpp:1245
msgid "Ejecting the USB stick…" msgid "Ejecting the USB stick…"
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:1111 #: src/ui-gtk/main_window.cpp:1111 src/ui-haiku/main_window.cpp:1281
msgid "The USB stick is ready" msgid "The USB stick is ready"
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:1113 #: src/ui-gtk/main_window.cpp:1113 src/ui-haiku/main_window.cpp:1282
msgid "You can unplug the USB stick. With the engine running, plug it into the vehicle and follow the instructions on the screen. The installation can take a long time: do not stop the engine." msgid ""
"You can unplug the USB stick. With the engine running, plug it into the "
"vehicle and follow the instructions on the screen. The installation can take "
"a long time: do not stop the engine."
msgstr "" msgstr ""
#: src\ui-gtk\main_window.cpp:1126 #: src/ui-gtk/main_window.cpp:1126 src/ui-haiku/main_window.cpp:1277
msgid "Finish" msgid "Finish"
msgstr "" msgstr ""
#: src/ui-haiku/main_window.cpp:387
msgid "Quit"
msgstr ""
#: src/ui-haiku/main_window.cpp:897
msgid "Select"
msgstr ""
+2 -1
View File
@@ -1,3 +1,4 @@
add_executable(openpu-cli main.cpp) add_executable(openpu-cli main.cpp)
target_link_libraries(openpu-cli PRIVATE openpu_core openpu_warnings) target_link_libraries(openpu-cli PRIVATE openpu_core openpu_warnings)
install(TARGETS openpu-cli RUNTIME DESTINATION bin) include(GNUInstallDirs)
install(TARGETS openpu-cli RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+4
View File
@@ -24,6 +24,10 @@ target_link_libraries(openpu_core
# USB backend # USB backend
if(HAIKU) if(HAIKU)
target_sources(openpu_core PRIVATE usb_haiku.cpp) target_sources(openpu_core PRIVATE usb_haiku.cpp)
# The disk device API (BDiskDevice, BPartition) lives in the private Storage Kit headers.
find_path(HAIKU_PRIVATE_STORAGE DiskDevice.h PATHS /boot/system/develop/headers/private/storage REQUIRED)
target_include_directories(openpu_core SYSTEM PRIVATE ${HAIKU_PRIVATE_STORAGE}
/boot/system/develop/headers/private/shared)
target_link_libraries(openpu_core PUBLIC be) target_link_libraries(openpu_core PUBLIC be)
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux") elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
find_package(PkgConfig REQUIRED) find_package(PkgConfig REQUIRED)
+11 -3
View File
@@ -186,13 +186,21 @@ std::uint64_t tarPayloadSize(const fs::path& path)
return total; return total;
} }
void extractTar(const fs::path& path, const fs::path& destination, const ArchiveProgressCallback& onProgress, void extractTar(const fs::path& path, const fs::path& requestedDestination, const ArchiveProgressCallback& onProgress,
const CancelToken* cancel) const CancelToken* cancel)
{ {
std::error_code ec; std::error_code ec;
fs::create_directories(destination, ec); fs::create_directories(requestedDestination, ec);
if (ec) if (ec)
throw ArchiveError(ArchiveError::Kind::Io, "cannot create " + destination.string() + ": " + ec.message()); throw ArchiveError(ArchiveError::Kind::Io,
"cannot create " + requestedDestination.string() + ": " + ec.message());
// ARCHIVE_EXTRACT_SECURE_SYMLINKS rejects a symlink anywhere in the target path, including the
// destination itself (e.g. /tmp is a symlink on Haiku). Resolve the destination first so that
// only links *inside* it are refused.
const fs::path destination = fs::canonical(requestedDestination, ec);
if (ec)
throw ArchiveError(ArchiveError::Kind::Io,
"cannot resolve " + requestedDestination.string() + ": " + ec.message());
ReadPtr a = openTar(path); ReadPtr a = openTar(path);
WritePtr w(archive_write_disk_new()); WritePtr w(archive_write_disk_new());
+266
View File
@@ -0,0 +1,266 @@
// SPDX-License-Identifier: MIT
// Haiku USB backend: enumeration, FAT32 formatting, mounting and ejecting through the Storage Kit
// disk device API (BDiskDeviceRoster / BDiskDevice / BPartition), the same API DriveSetup uses.
// Haiku is single-user, so no authorisation step is involved.
#include "openpu/usb.hpp"
#include <DiskDevice.h>
#include <DiskDeviceRoster.h>
#include <DiskDeviceTypes.h>
#include <Partition.h>
#include <Path.h>
#include <String.h>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
namespace openpu {
namespace fs = std::filesystem;
namespace {
constexpr off_t kPartitionOffset = off_t{1024} * 1024; // 1 MiB, like the Linux backend
// Partition type as named by the "intel" partitioning add-on (MBR type 0x0c, as on Linux).
// Not kPartitionTypeFAT32: that one is the *file system* name ("FAT32 File System").
constexpr const char* kMbrTypeFat32Lba = "FAT 32-bit, LBA-mapped";
// The intel add-on rejects a NULL parameter string when the job runs; DriveSetup always sends this.
constexpr const char* kMbrChildParameters = "active false\n";
std::string statusText(status_t s)
{
return std::strerror(s); // NOLINT(concurrency-mt-unsafe): Haiku's strerror is thread-safe
}
[[noreturn]] void fail(const std::string& what, status_t status)
{
throw UsbError(UsbError::Kind::Failed, what + ": " + statusText(status));
}
/// Step tracing on stderr when OPENPU_DEBUG is set (diagnosing disk device jobs).
void trace(const std::string& step)
{
static const bool enabled = std::getenv("OPENPU_DEBUG") != nullptr; // NOLINT(concurrency-mt-unsafe)
if (enabled)
(void)std::fprintf(stderr, "[usb_haiku] %s\n", step.c_str());
}
bool startsWith(const char* s, const char* prefix)
{
return s != nullptr && std::strncmp(s, prefix, std::strlen(prefix)) == 0;
}
/// Calls `fn` for the device itself and every partition below it.
template <typename F>
void forEachPartition(BPartition* p, F&& fn)
{
fn(p);
for (int32 i = 0; i < p->CountChildren(); ++i)
forEachPartition(p->ChildAt(i), fn);
}
bool hostsBootVolume(BDiskDevice& device)
{
bool boot = false;
forEachPartition(&device, [&](BPartition* p) {
BPath mp;
if (p->IsMounted() && p->GetMountPoint(&mp) == B_OK && std::strcmp(mp.Path(), "/boot") == 0)
boot = true;
});
return boot;
}
partition_id parseId(const std::string& id)
{
try {
return static_cast<partition_id>(std::stoi(id));
} catch (const std::exception&) {
throw UsbError(UsbError::Kind::Failed, "invalid drive id " + id);
}
}
/// Disk systems are looked up by short name on some Haiku versions and by "pretty" name on others.
status_t initialize(BPartition* p, const char* shortName, const char* prettyName, const char* name,
const char* parameters)
{
status_t s = p->Initialize(shortName, name, parameters);
if (s != B_OK)
s = p->Initialize(prettyName, name, parameters);
return s;
}
class HaikuUsbBackend final : public UsbBackend {
public:
std::vector<UsbDrive> list() override
{
std::vector<UsbDrive> out;
BDiskDeviceRoster roster;
BDiskDevice device;
roster.RewindDevices();
while (roster.GetNextDevice(&device) == B_OK) {
BPath path;
if (device.GetPath(&path) != B_OK || !startsWith(path.Path(), "/dev/disk/usb/"))
continue;
if (!device.HasMedia() || device.IsReadOnlyMedia() || device.Size() <= 0 || hostsBootVolume(device))
continue;
UsbDrive d;
d.id = std::to_string(device.ID());
d.device = path.Path();
d.size = static_cast<std::uint64_t>(device.Size());
if (device.Name() != nullptr)
d.model = device.Name();
forEachPartition(&device, [&](BPartition* p) {
if (d.label.empty() && p->ContentType() != nullptr)
d.label = p->ContentName().String();
BPath mp;
if (p->IsMounted() && p->GetMountPoint(&mp) == B_OK)
d.mountPoints.emplace_back(mp.Path());
});
out.push_back(std::move(d));
}
return out;
}
fs::path formatFat32(const UsbDrive& drive, const std::string& label) override
{
const partition_id id = parseId(drive.id);
BDiskDeviceRoster roster;
BDiskDevice device;
status_t s = roster.GetDeviceWithID(id, &device);
if (s != B_OK)
fail("USB drive " + drive.device + " not found", s);
BPath path;
if (device.GetPath(&path) != B_OK || !startsWith(path.Path(), "/dev/disk/usb/") || hostsBootVolume(device))
throw UsbError(UsbError::Kind::Failed, drive.device + " is not a removable USB drive");
trace("unmount");
unmountAll(device);
const bool hasMbr = device.ContentType() != nullptr && std::strcmp(device.ContentType(), kPartitionTypeIntel) == 0;
trace(std::string("content type: ") + (device.ContentType() != nullptr ? device.ContentType() : "(none)"));
if (device.ContentType() != nullptr && !hasMbr) {
// Other content (GPT, a file system without partition table...): erase it in its own
// transaction. Uninitialize + Initialize in one transaction hangs the disk device
// manager on Haiku R1/beta6.
if ((s = device.PrepareModifications()) != B_OK)
fail("cannot modify " + drive.device, s);
if ((s = device.Uninitialize()) != B_OK || (s = device.CommitModifications()) != B_OK) {
device.CancelModifications();
fail("cannot erase " + drive.device, s);
}
if ((s = roster.GetDeviceWithID(id, &device)) != B_OK)
fail("USB drive " + drive.device + " not found", s);
}
if (hasMbr && device.CountChildren() > 0) {
// Keep the existing MBR and drop its partitions (Uninitialize would hang, see above).
// Own transaction too: freed space is not reusable within the same transaction.
if ((s = device.PrepareModifications()) != B_OK)
fail("cannot modify " + drive.device, s);
for (int32 i = device.CountChildren() - 1; i >= 0 && s == B_OK; --i) {
trace("delete partition " + std::to_string(i));
s = device.DeleteChild(i);
}
if (s != B_OK || (s = device.CommitModifications()) != B_OK) {
device.CancelModifications();
fail("cannot delete the existing partitions", s);
}
if ((s = roster.GetDeviceWithID(id, &device)) != B_OK)
fail("USB drive " + drive.device + " not found", s);
}
trace("prepare modifications");
if ((s = device.PrepareModifications()) != B_OK)
fail("cannot modify " + drive.device, s);
try {
if (!hasMbr) {
trace("initialize intel");
if ((s = initialize(&device, "intel", kPartitionTypeIntel, nullptr, nullptr)) != B_OK)
fail("cannot create the MBR partition table", s);
}
off_t start = kPartitionOffset;
off_t size = device.Size() - start;
BString name;
if ((s = device.ValidateCreateChild(&start, &size, kMbrTypeFat32Lba, &name, kMbrChildParameters)) != B_OK)
fail("cannot create the FAT32 partition", s);
trace("create child at " + std::to_string(start) + " size " + std::to_string(size));
if ((s = device.CreateChild(start, size, kMbrTypeFat32Lba, nullptr, kMbrChildParameters)) != B_OK)
fail("cannot create the FAT32 partition", s);
trace("commit partition table");
if ((s = device.CommitModifications()) != B_OK)
fail("cannot write the partition table to " + drive.device, s);
} catch (...) {
device.CancelModifications();
throw;
}
// Format in a separate transaction: initializing a partition created in the same
// transaction fails when the job runs ("Invalid Argument").
if ((s = roster.GetDeviceWithID(id, &device)) != B_OK || device.CountChildren() == 0)
fail("the new partition is not visible", s != B_OK ? s : B_ENTRY_NOT_FOUND);
if ((s = device.PrepareModifications()) != B_OK)
fail("cannot modify " + drive.device, s);
try {
trace("initialize fat");
// No parameters: the FAT driver picks FAT32 for volumes this size (checked by the e2e test).
if ((s = initialize(device.ChildAt(0), "fat", "FAT32 File System", label.c_str(), nullptr)) != B_OK)
fail("cannot format the FAT32 partition", s);
trace("commit format");
if ((s = device.CommitModifications()) != B_OK)
fail("cannot format " + drive.device, s);
} catch (...) {
device.CancelModifications();
throw;
}
// Mount the new file system (re-read the device: the committed state is a new snapshot).
if ((s = roster.GetDeviceWithID(id, &device)) != B_OK || device.CountChildren() == 0)
fail("the new partition is not visible", s != B_OK ? s : B_ENTRY_NOT_FOUND);
BPartition* part = device.ChildAt(0);
if (!part->IsMounted() && (s = part->Mount()) != B_OK)
fail("cannot mount the new file system", s);
BPath mountPoint;
if ((s = part->GetMountPoint(&mountPoint)) != B_OK)
fail("cannot locate the mount point", s);
return mountPoint.Path();
}
void eject(const UsbDrive& drive) override
{
BDiskDeviceRoster roster;
BDiskDevice device;
if (roster.GetDeviceWithID(parseId(drive.id), &device) != B_OK)
return; // already gone
unmountAll(device); // flushes the FAT
// Not every USB mass-storage device supports the eject command; unmounting is enough then.
(void)device.Eject(true);
}
private:
static void unmountAll(BDiskDevice& device)
{
status_t failure = B_OK;
forEachPartition(&device, [&](BPartition* p) {
if (p->IsMounted()) {
const status_t s = p->Unmount();
if (s != B_OK)
failure = s;
}
});
if (failure != B_OK)
throw UsbError(UsbError::Kind::Busy, "cannot unmount the USB drive: " + statusText(failure));
}
};
} // namespace
std::unique_ptr<UsbBackend> makeUsbBackend()
{
return std::make_unique<HaikuUsbBackend>();
}
} // namespace openpu
+18 -1
View File
@@ -9,9 +9,26 @@ add_executable(openpu
target_link_libraries(openpu PRIVATE openpu_core PkgConfig::GTKMM openpu_warnings) target_link_libraries(openpu PRIVATE openpu_core PkgConfig::GTKMM openpu_warnings)
target_compile_definitions(openpu PRIVATE target_compile_definitions(openpu PRIVATE
GETTEXT_PACKAGE="openpu" GETTEXT_PACKAGE="openpu"
OPENPU_LOCALEDIR="${CMAKE_INSTALL_FULL_LOCALEDIR}") OPENPU_LOCALEDIR="${CMAKE_INSTALL_FULL_LOCALEDIR}"
OPENPU_BUILD_ICONDIR="${CMAKE_BINARY_DIR}/icons")
# gtkmm headers trigger -Wshadow/-Wconversion noise we cannot fix. # gtkmm headers trigger -Wshadow/-Wconversion noise we cannot fix.
target_compile_options(openpu PRIVATE -Wno-shadow -Wno-conversion) target_compile_options(openpu PRIVATE -Wno-shadow -Wno-conversion)
install(TARGETS openpu RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) install(TARGETS openpu RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
install(FILES io.github.openpu.OpenPU.desktop DESTINATION ${CMAKE_INSTALL_DATADIR}/applications) install(FILES io.github.openpu.OpenPU.desktop DESTINATION ${CMAKE_INSTALL_DATADIR}/applications)
install(FILES ${PROJECT_SOURCE_DIR}/data/io.github.openpu.OpenPU.metainfo.xml
DESTINATION ${CMAKE_INSTALL_DATADIR}/metainfo)
# Application icon (data/icons, generated by tools/make_icons.py), installed in the hicolor theme
# and mirrored in the build tree so that an uninstalled binary finds it too.
set(OPENPU_ICON io.github.openpu.OpenPU)
set(OPENPU_ICONS ${PROJECT_SOURCE_DIR}/data/icons)
configure_file(${OPENPU_ICONS}/openpu.svg ${CMAKE_BINARY_DIR}/icons/hicolor/scalable/apps/${OPENPU_ICON}.svg COPYONLY)
install(FILES ${OPENPU_ICONS}/openpu.svg
DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/scalable/apps RENAME ${OPENPU_ICON}.svg)
foreach(size 16 24 32 48 64 128 256 512)
configure_file(${OPENPU_ICONS}/png/openpu-${size}.png
${CMAKE_BINARY_DIR}/icons/hicolor/${size}x${size}/apps/${OPENPU_ICON}.png COPYONLY)
install(FILES ${OPENPU_ICONS}/png/openpu-${size}.png
DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/${size}x${size}/apps RENAME ${OPENPU_ICON}.png)
endforeach()
+24 -3
View File
@@ -5,9 +5,32 @@
#include <clocale> #include <clocale>
#include <cstdlib> #include <cstdlib>
#include <filesystem>
#include <string>
#include <system_error>
#include <glibmm/i18n.h> #include <glibmm/i18n.h>
#include <gtkmm/application.h> #include <gtkmm/application.h>
namespace {
/// Translations directory: OPENPU_LOCALEDIR (build tree), else <prefix>/share/locale next to the
/// executable when it exists (relocatable installs such as the AppImage), else the configured one.
std::string localeDir()
{
if (const char* dir = std::getenv("OPENPU_LOCALEDIR")) // NOLINT(concurrency-mt-unsafe): no thread yet
return dir;
std::error_code ec;
const auto exe = std::filesystem::read_symlink("/proc/self/exe", ec);
if (!ec) {
const auto dir = exe.parent_path().parent_path() / "share" / "locale";
if (std::filesystem::is_directory(dir, ec))
return dir.string();
}
return OPENPU_LOCALEDIR;
}
} // namespace
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
// A language chosen in the settings overrides the session language (gettext reads LANGUAGE). // A language chosen in the settings overrides the session language (gettext reads LANGUAGE).
@@ -19,9 +42,7 @@ int main(int argc, char* argv[])
// dismissed: the window reports unreadable settings itself // dismissed: the window reports unreadable settings itself
} }
(void)std::setlocale(LC_ALL, ""); // NOLINT(concurrency-mt-unsafe): no thread yet (void)std::setlocale(LC_ALL, ""); // NOLINT(concurrency-mt-unsafe): no thread yet
// OPENPU_LOCALEDIR lets a build-tree binary find its translations. bindtextdomain(GETTEXT_PACKAGE, localeDir().c_str());
const char* localeDir = std::getenv("OPENPU_LOCALEDIR"); // NOLINT(concurrency-mt-unsafe)
bindtextdomain(GETTEXT_PACKAGE, localeDir != nullptr ? localeDir : OPENPU_LOCALEDIR);
bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
textdomain(GETTEXT_PACKAGE); textdomain(GETTEXT_PACKAGE);
+5
View File
@@ -94,6 +94,11 @@ MainWindow::MainWindow()
{ {
set_title("OpenPU"); set_title("OpenPU");
set_default_size(640, 520); set_default_size(640, 520);
// Installed icon from the hicolor theme; the build tree has a copy for uninstalled runs.
auto theme = Gtk::IconTheme::get_for_display(get_display());
if (!theme->has_icon("io.github.openpu.OpenPU"))
theme->add_search_path(OPENPU_BUILD_ICONDIR);
set_icon_name("io.github.openpu.OpenPU");
try { try {
store_.load(); store_.load();
+54
View File
@@ -0,0 +1,54 @@
include(GNUInstallDirs)
add_executable(OpenPU
main.cpp
main_window.cpp
)
find_library(INTL_LIBRARY intl)
target_link_libraries(OpenPU PRIVATE openpu_core openpu_warnings be tracker shared
$<$<BOOL:${INTL_LIBRARY}>:${INTL_LIBRARY}>)
target_compile_definitions(OpenPU PRIVATE
GETTEXT_PACKAGE="openpu"
OPENPU_LOCALEDIR="${CMAKE_INSTALL_PREFIX}/data/locale")
# BeAPI headers trigger -Wshadow/-Wconversion noise we cannot fix.
target_compile_options(OpenPU PRIVATE -Wno-shadow -Wno-conversion)
# Application resources: signature, version, flags (Haiku rc + xres).
# The vector icon (data/icons/openpu.hvif, generated by tools/make_icons.py) is embedded as hex.
set(OPENPU_HVIF ${PROJECT_SOURCE_DIR}/data/icons/openpu.hvif)
file(READ ${OPENPU_HVIF} OPENPU_HVIF_HEX HEX)
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${OPENPU_HVIF})
configure_file(OpenPU.rdef.in ${CMAKE_CURRENT_BINARY_DIR}/OpenPU.rdef @ONLY)
find_program(HAIKU_RC rc)
find_program(HAIKU_XRES xres)
find_program(HAIKU_MIMESET mimeset)
if(HAIKU_RC AND HAIKU_XRES)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/OpenPU.rsrc
COMMAND ${HAIKU_RC} -o ${CMAKE_CURRENT_BINARY_DIR}/OpenPU.rsrc ${CMAKE_CURRENT_BINARY_DIR}/OpenPU.rdef
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/OpenPU.rdef)
add_custom_target(OpenPU_rsrc DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/OpenPU.rsrc)
add_dependencies(OpenPU OpenPU_rsrc)
# Relink (and so re-attach the resources) when only the resources change.
set_target_properties(OpenPU PROPERTIES LINK_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/OpenPU.rsrc)
add_custom_command(TARGET OpenPU POST_BUILD
COMMAND ${HAIKU_XRES} -o $<TARGET_FILE:OpenPU> ${CMAKE_CURRENT_BINARY_DIR}/OpenPU.rsrc
COMMAND ${HAIKU_MIMESET} -f $<TARGET_FILE:OpenPU>)
endif()
# Haiku package layout: the application in apps/, a link in the Deskbar's Applications menu.
install(TARGETS OpenPU RUNTIME DESTINATION apps)
if(HAIKU_RC AND HAIKU_XRES)
# `cmake --install --strip` rewrites the ELF file and drops the appended resources (icon,
# signature, version): attach them again to the installed copy.
install(CODE "
set(app \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/apps/OpenPU\")
execute_process(COMMAND ${HAIKU_XRES} -o \"\${app}\" ${CMAKE_CURRENT_BINARY_DIR}/OpenPU.rsrc
COMMAND_ERROR_IS_FATAL ANY)
execute_process(COMMAND ${HAIKU_MIMESET} -f \"\${app}\")
")
endif()
install(CODE "
set(menu \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/data/deskbar/menu/Applications\")
file(MAKE_DIRECTORY \"\${menu}\")
file(CREATE_LINK ../../../../apps/OpenPU \"\${menu}/OpenPU\" SYMBOLIC)
")
+17
View File
@@ -0,0 +1,17 @@
/* SPDX-License-Identifier: MIT */
resource app_signature "application/x-vnd.openpu-OpenPU";
resource app_flags B_SINGLE_LAUNCH;
resource vector_icon $"@OPENPU_HVIF_HEX@";
resource app_version {
major = @PROJECT_VERSION_MAJOR@,
middle = @PROJECT_VERSION_MINOR@,
minor = @PROJECT_VERSION_PATCH@,
variety = B_APPV_FINAL,
internal = 0,
short_info = "OpenPU @PROJECT_VERSION@",
long_info = "OpenPU @PROJECT_VERSION@ - Peugeot head unit updates on a USB stick. MIT license."
};
+34
View File
@@ -0,0 +1,34 @@
// SPDX-License-Identifier: MIT
#pragma once
// gettext, with the same message catalogs as the GTK interface (po/).
#include <libintl.h>
#include <initializer_list>
#include <string>
#define _(text) gettext(text)
namespace openpu::haiku {
/// Replaces %1..%9 in `format` (same placeholders as Glib::ustring::compose, so the translations
/// are shared with the GTK interface).
inline std::string compose(const std::string& format, std::initializer_list<std::string> args)
{
std::string out;
out.reserve(format.size());
for (std::size_t i = 0; i < format.size(); ++i) {
const char c = format[i];
if (c == '%' && i + 1 < format.size() && format[i + 1] >= '1' && format[i + 1] <= '9') {
const auto index = static_cast<std::size_t>(format[i + 1] - '1');
if (index < args.size())
out += *(args.begin() + index);
++i;
continue;
}
out.push_back(c);
}
return out;
}
} // namespace openpu::haiku
+88
View File
@@ -0,0 +1,88 @@
// SPDX-License-Identifier: MIT
#include "main_window.hpp"
#include "openpu/storage.hpp"
#include <Application.h>
#include <LocaleRoster.h>
#include <Message.h>
#include <Path.h>
#include <PathFinder.h>
#include "i18n.hpp"
#include <cctype>
#include <clocale>
#include <cstdlib>
#include <string>
namespace {
constexpr const char* kSignature = "application/x-vnd.openpu-OpenPU";
/// First preferred language of the Locale preferences ("fr", "en_US"...), empty if unknown.
std::string preferredLanguage()
{
BMessage languages;
if (BLocaleRoster::Default()->GetPreferredLanguages(&languages) != B_OK)
return {};
const char* language = nullptr;
if (languages.FindString("language", 0, &language) != B_OK || language == nullptr)
return {};
return language;
}
/// Translations directory: OPENPU_LOCALEDIR (build tree), else data/locale of the installation
/// location holding the application (system or user packages), else the configured one.
std::string localeDir()
{
if (const char* dir = std::getenv("OPENPU_LOCALEDIR")) // NOLINT(concurrency-mt-unsafe): no thread yet
return dir;
BPath path;
if (BPathFinder().FindPath(B_FIND_PATH_DATA_DIRECTORY, "locale", B_FIND_PATH_EXISTING_ONLY, path) == B_OK)
return path.Path();
return OPENPU_LOCALEDIR;
}
class App : public BApplication {
public:
explicit App(std::string language) : BApplication(kSignature), language_(std::move(language)) {}
void ReadyToRun() override { (new openpu::haiku::MainWindow(language_))->Show(); }
private:
std::string language_;
};
} // namespace
int main()
{
// A language chosen in the settings overrides the one of the Locale preferences.
std::string language;
try {
language = openpu::Settings::load(openpu::paths::configDir() / "config.json").language;
} catch (const openpu::StorageError&) {
// dismissed: the window reports unreadable settings itself
}
if (language.empty())
language = preferredLanguage();
if (language.empty())
language = "en";
// gettext follows LANGUAGE, but only when the message locale is not "C".
(void)setenv("LANGUAGE", language.c_str(), 1); // NOLINT(concurrency-mt-unsafe): no thread yet
(void)setenv("LC_MESSAGES", "en_US.UTF-8", 0); // NOLINT(concurrency-mt-unsafe)
(void)std::setlocale(LC_ALL, ""); // NOLINT(concurrency-mt-unsafe)
bindtextdomain(GETTEXT_PACKAGE, localeDir().c_str());
bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
textdomain(GETTEXT_PACKAGE);
std::string twoLetters;
for (char c : language.substr(0, 2))
twoLetters.push_back(static_cast<char>(std::tolower(static_cast<unsigned char>(c))));
App app(twoLetters);
app.Run();
return 0;
}
File diff suppressed because it is too large. Load diff
+167
View File
@@ -0,0 +1,167 @@
// SPDX-License-Identifier: MIT
#pragma once
#include "ui_queue.hpp"
#include "openpu/api_client.hpp"
#include "openpu/app_update.hpp"
#include "openpu/job.hpp"
#include "openpu/storage.hpp"
#include "openpu/usb.hpp"
#include <Messenger.h>
#include <Window.h>
#include <memory>
#include <optional>
#include <string>
#include <thread>
#include <vector>
class BButton;
class BCardView;
class BCheckBox;
class BFilePanel;
class BListView;
class BMenuField;
class BPopUpMenu;
class BStatusBar;
class BStringView;
class BTextControl;
class BTextView;
class BView;
namespace openpu::haiku {
/// Messages shared with the preferences window.
enum : uint32 {
kMsgChooseFolder = 'chfd', ///< main window: open the folder panel
kMsgSetLanguage = 'slng', ///< main window: "language" (string, empty = system)
kMsgSetAutoCheck = 'sach', ///< main window: "value" (bool)
kMsgFolderChanged = 'fdch',///< preferences window: "path" (string)
};
class MainWindow : public BWindow {
public:
/// `language`: two-letter language of the interface (for the guide links).
explicit MainWindow(std::string language);
~MainWindow() override;
MainWindow(const MainWindow&) = delete;
MainWindow& operator=(const MainWindow&) = delete;
void MessageReceived(BMessage* message) override;
bool QuitRequested() override;
private:
enum Page : int32 { Vehicles, Add, Updates, Download, Usb, Write, Done };
// pages
BView* buildVehiclesPage();
BView* buildAddPage();
BView* buildUpdatesPage();
BView* buildDownloadPage();
BView* buildUsbPage();
BView* buildWritePage();
BView* buildDonePage();
void show(Page page);
// vehicles
void refreshVehicles();
std::optional<Vehicle> selectedVehicle() const;
void onVehicleSelected();
void onAddVehicle();
void onRemoveVehicle();
void onCheckUpdates();
// updates / download
void showUpdates(const AvailableUpdates& updates);
void updateDownloadButton();
void onChooseFolder();
void onFolderChosen(BMessage* message);
void onStartDownload();
void startDownload(const DownloadPlan& plan);
void onDownloadProgress(const JobProgress& p);
void onDownloaded(const DownloadedFiles& files);
// usb
void enterUsbPage();
void refreshDrives();
void onDriveSelected();
void onPrepareUsb();
void startWrite(const UsbDrive& drive);
void onWriteProgress(const UsbProgress& p);
void onWritten();
// helpers
template <typename F>
void runAsync(F&& work);
void joinWorker();
void showError(const std::string& title, const std::string& detail);
void showAbout();
void showPreferences();
void openGuide();
void checkAppUpdate(bool manual);
void offerAppUpdate(const AppRelease& release);
void saveVehicles();
void saveSettings();
void updateDownloadDirLabel();
UiQueue ui_;
std::string language_;
std::unique_ptr<Transport> transport_;
std::unique_ptr<ApiClient> api_;
std::unique_ptr<UsbBackend> usb_;
VehicleStore store_;
Settings settings_;
std::filesystem::path settingsFile_;
std::thread worker_;
std::thread updateThread_; // OpenPU new-version check, independent of the main flow
bool updateCheckRunning_ = false;
CancelToken cancel_;
BMessenger preferences_;
BFilePanel* folderPanel_ = nullptr;
// flow state
std::optional<Vehicle> current_;
AvailableUpdates updates_;
DownloadedFiles files_;
std::vector<UsbDrive> drives_;
std::int32_t selectedDrive_ = -1;
std::uint64_t payload_ = 0;
// widgets
BCardView* cards_ = nullptr;
BListView* vehicleList_ = nullptr;
BTextView* vehiclesEmpty_ = nullptr;
BButton *removeButton_ = nullptr, *checkButton_ = nullptr;
BTextControl *vinEntry_ = nullptr, *nameEntry_ = nullptr;
BStringView* addStatus_ = nullptr;
BButton* addConfirm_ = nullptr;
BStringView* updatesTitle_ = nullptr;
BTextView* updatesStatus_ = nullptr;
BCheckBox *firmwareCheck_ = nullptr, *mapCheck_ = nullptr;
BStringView* downloadDirLabel_ = nullptr;
BButton *downloadButton_ = nullptr, *guideButton_ = nullptr;
BStringView* licenseLabel_ = nullptr;
BStatusBar *firmwareBar_ = nullptr, *mapBar_ = nullptr;
BStringView* etaLabel_ = nullptr;
BButton* cancelDownload_ = nullptr;
BTextView* usbInfo_ = nullptr;
BPopUpMenu* driveMenu_ = nullptr;
BMenuField* driveField_ = nullptr;
BStringView* usbStatus_ = nullptr;
BButton* prepareButton_ = nullptr;
BStatusBar* writeBar_ = nullptr;
BStringView* writeDetail_ = nullptr;
BButton* cancelWrite_ = nullptr;
BButton* doneButton_ = nullptr;
};
} // namespace openpu::haiku
+55
View File
@@ -0,0 +1,55 @@
// SPDX-License-Identifier: MIT
#pragma once
#include <Messenger.h>
#include <atomic>
#include <deque>
#include <functional>
#include <mutex>
namespace openpu::haiku {
/// Runs closures posted from worker threads on a window's thread.
/// post() never blocks: a single kMessage is in flight at a time and drain() runs everything queued.
class UiQueue {
public:
static constexpr uint32 kMessage = 'uiqd';
void setTarget(const BMessenger& target) { target_ = target; }
void post(std::function<void()> fn)
{
{
std::scoped_lock lock(mutex_);
queue_.push_back(std::move(fn));
}
if (!pending_.exchange(true)) {
BMessage message(kMessage);
// Zero timeout: a worker must never wait for the window (it may be joining the worker).
if (target_.SendMessage(&message, static_cast<BHandler*>(nullptr), 0) != B_OK)
pending_ = false;
}
}
/// Called by the target window when it receives kMessage.
void drain()
{
pending_ = false;
std::deque<std::function<void()>> local;
{
std::scoped_lock lock(mutex_);
local.swap(queue_);
}
for (auto& fn : local)
fn();
}
private:
BMessenger target_;
std::atomic<bool> pending_{false};
std::mutex mutex_;
std::deque<std::function<void()>> queue_;
};
} // namespace openpu::haiku
+3
View File
@@ -16,6 +16,9 @@ find_package(LibArchive REQUIRED)
target_link_libraries(openpu_tests PRIVATE openpu_core openpu_warnings LibArchive::LibArchive) target_link_libraries(openpu_tests PRIVATE openpu_core openpu_warnings LibArchive::LibArchive)
if(TARGET doctest::doctest) if(TARGET doctest::doctest)
target_link_libraries(openpu_tests PRIVATE doctest::doctest) target_link_libraries(openpu_tests PRIVATE doctest::doctest)
else()
# Bundled single header (third_party/doctest, MIT) when the system has no doctest package.
target_include_directories(openpu_tests SYSTEM PRIVATE ${PROJECT_SOURCE_DIR}/third_party)
endif() endif()
target_compile_definitions(openpu_tests PRIVATE OPENPU_FIXTURES_DIR="${CMAKE_CURRENT_SOURCE_DIR}/fixtures") target_compile_definitions(openpu_tests PRIVATE OPENPU_FIXTURES_DIR="${CMAKE_CURRENT_SOURCE_DIR}/fixtures")
+21
View File
@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2016-2023 Viktor Kirilov
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+2
View File
@@ -0,0 +1,2 @@
doctest 2.4.12 single header (https://github.com/doctest/doctest), MIT license.
Used by the unit tests only when no system doctest package is found (e.g. Haiku).
+7134
View File
File diff suppressed because it is too large. Load diff
+42
View File
@@ -0,0 +1,42 @@
#!/bin/sh
# SPDX-License-Identifier: MIT
# Builds OpenPU-<version>-<arch>.AppImage (GTK interface + openpu-cli) with linuxdeploy and its GTK
# plugin, in the current directory. Runs on x86_64 and aarch64; no FUSE needed.
#
# usage: tools/appimage.sh [build-dir]
# The linuxdeploy tools are downloaded once into $OPENPU_APPIMAGE_TOOLS (default ~/.cache/openpu-appimage).
set -eu
SRC=$(cd "$(dirname "$0")/.." && pwd)
BUILD=${1:-$SRC/../build-openpu/appimage}
OUT=$(pwd)
ARCH=$(uname -m)
TOOLS=${OPENPU_APPIMAGE_TOOLS:-$HOME/.cache/openpu-appimage}
LINUXDEPLOY=$TOOLS/linuxdeploy-$ARCH.AppImage
GTK_PLUGIN=$TOOLS/linuxdeploy-plugin-gtk.sh
mkdir -p "$TOOLS"
fetch() { # url file
[ -s "$2" ] || { curl -fsSL -o "$2.part" "$1" && mv "$2.part" "$2"; }
chmod +x "$2"
}
fetch "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-$ARCH.AppImage" "$LINUXDEPLOY"
fetch "https://raw.githubusercontent.com/linuxdeploy/linuxdeploy-plugin-gtk/master/linuxdeploy-plugin-gtk.sh" "$GTK_PLUGIN"
cmake -S "$SRC" -B "$BUILD" -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr \
-DOPENPU_UI_GTK=ON -DOPENPU_BUILD_TESTS=OFF
cmake --build "$BUILD"
APPDIR=$BUILD/AppDir
rm -rf "$APPDIR"
DESTDIR=$APPDIR cmake --install "$BUILD" --strip
VERSION=$("$APPDIR/usr/bin/openpu-cli" --version | awk '{print $2}')
ID=io.github.openpu.OpenPU
cd "$OUT"
# linuxdeploy finds its plugins next to itself or in PATH.
PATH=$TOOLS:$PATH APPIMAGE_EXTRACT_AND_RUN=1 DEPLOY_GTK_VERSION=4 LINUXDEPLOY_OUTPUT_VERSION=$VERSION \
"$LINUXDEPLOY" --appdir "$APPDIR" --plugin gtk --output appimage \
--executable "$APPDIR/usr/bin/openpu" --executable "$APPDIR/usr/bin/openpu-cli" \
--desktop-file "$APPDIR/usr/share/applications/$ID.desktop" \
--icon-file "$APPDIR/usr/share/icons/hicolor/256x256/apps/$ID.png"
ls -l "$OUT"/OpenPU-*.AppImage
+2 -1
View File
@@ -28,7 +28,8 @@ fi
if command -v clang-tidy >/dev/null; then if command -v clang-tidy >/dev/null; then
step "clang-tidy" step "clang-tidy"
# Only our sources; compile_commands.json comes from the debug build. # Only our sources; compile_commands.json comes from the debug build.
find "$SRC/src" -name '*.cpp' -not -path '*/ui-*' -print0 | # Only files of this build: usb_haiku.cpp / usb_none.cpp are not compiled on Linux.
find "$SRC/src" -name '*.cpp' -not -path '*/ui-*' -not -name 'usb_haiku.cpp' -not -name 'usb_none.cpp' -print0 |
xargs -0 clang-tidy -p "$OUT/debug" --quiet --warnings-as-errors='*' xargs -0 clang-tidy -p "$OUT/debug" --quiet --warnings-as-errors='*'
fi fi
+61
View File
@@ -0,0 +1,61 @@
#!/bin/sh
# SPDX-License-Identifier: MIT
# Builds openpu-<version>-1-x86_64.hpkg on Haiku from the working tree: release build, staged
# install (apps/OpenPU, bin/openpu-cli, data/locale, Deskbar link), .PackageInfo, `package create`.
# The HaikuPorts recipe (packaging/haiku) is the way to publish; this script is for testing and
# for attaching a package to a GitHub release.
#
# usage: tools/haiku-package.sh [build-dir] (output in the current directory)
set -eu
SRC=$(cd "$(dirname "$0")/.." && pwd)
BUILD=${1:-$SRC/../build-openpu/hpkg}
OUT=$(pwd)
ARCH=$(getarch)
STAGE=$BUILD/stage
cmake -S "$SRC" -B "$BUILD" -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/boot/system \
-DOPENPU_BUILD_TESTS=OFF
cmake --build "$BUILD"
rm -rf "$STAGE"
# Files are staged relative to the installation location (the package's root).
cmake --install "$BUILD" --strip --prefix "$STAGE"
# Package versions cannot contain '+' or '.' after the micro number: a development build
# 0.2.0+3.gabc1234.dirty becomes 0.2.0_git3_gabc1234_dirty; a tagged build stays 0.2.0.
DESCRIPTION=$("$STAGE/bin/openpu-cli" --version | awk '{print $2}')
VERSION=$(echo "$DESCRIPTION" | sed -e 's/+/_git/' -e 's/\./_/3g')
cat > "$STAGE/.PackageInfo" <<EOF
name openpu
version $VERSION-1
architecture $ARCH
summary "Download Peugeot head unit updates and prepare the USB stick"
description "OpenPU downloads the firmware and navigation map updates of Peugeot \\
head units (NAC, RCC, AIO, Crony) and prepares the installation USB stick: FAT32 formatting, \\
license and update files. Downloads resume where they stopped. Graphical application and \\
command-line tool (openpu-cli). Independent project, not affiliated with Stellantis or Peugeot."
packager "OpenPU contributors <https://github.com/yann64/openpu>"
vendor "OpenPU contributors"
licenses { "MIT" }
copyrights { "2026 yann64 and the OpenPU contributors" }
urls { "https://github.com/yann64/openpu" }
provides {
openpu = $VERSION
app:OpenPU = $VERSION
cmd:openpu_cli = $VERSION
}
requires {
haiku >= r1~beta6
lib:libarchive >= 13
lib:libcurl >= 4
lib:libgcc_s >= 1
lib:libintl >= 8
lib:libstdc++
}
EOF
PACKAGE=$OUT/openpu-$VERSION-1-$ARCH.hpkg
rm -f "$PACKAGE"
package create -C "$STAGE" "$PACKAGE"
package list "$PACKAGE"
+88
View File
@@ -0,0 +1,88 @@
#!/bin/sh
# SPDX-License-Identifier: MIT
# Haiku R1/beta6 x86_64 development VM under QEMU (Linux / WSL2, KVM when available).
#
# tools/haiku-vm.sh fetch download + verify the official anyboot image
# tools/haiku-vm.sh install boot the image with an empty 20 GB disk (run the Installer, see docs)
# tools/haiku-vm.sh start boot the installed system (headless, VNC on 127.0.0.1:5901)
# tools/haiku-vm.sh stop ACPI power-off (hard kill after 60 s)
# tools/haiku-vm.sh ssh [cmd] ssh into the VM (port 2222, user "user")
# tools/haiku-vm.sh status
#
# A 16 GB sparse raw image is attached as a USB mass-storage device ("the stick"), so the
# Haiku USB backend can be tested end to end; inspect it from Linux with mtools.
# The VM is driven with tools/qmp.py (screenshots, clicks, typing) through $VM_DIR/qmp.sock.
set -eu
VM_DIR=${OPENPU_VM_DIR:-$HOME/openpu-vm}
RELEASE=r1beta6
ISO=$VM_DIR/haiku-$RELEASE-x86_64-anyboot.iso
ISO_SHA256=bb7743474fd175aea511be1799764ba054465285bbdf54c4722ca61d1fb4f5c9
ISO_URL=https://mirrors.rit.edu/haiku/$RELEASE/haiku-$RELEASE-x86_64-anyboot.iso
DISK=$VM_DIR/haiku.qcow2
STICK=$VM_DIR/haiku-usb.img
QMP=$VM_DIR/qmp.sock
PIDFILE=$VM_DIR/qemu.pid
SSH_PORT=${OPENPU_VM_SSH_PORT:-2222}
mkdir -p "$VM_DIR"
running() { [ -f "$PIDFILE" ] && kill -0 "$(cat "$PIDFILE")" 2>/dev/null; }
qemu() {
accel="-accel tcg"
[ -w /dev/kvm ] && accel="-accel kvm -cpu host"
[ -f "$STICK" ] || truncate -s 16G "$STICK"
# shellcheck disable=SC2086
qemu-system-x86_64 $accel -machine q35 -smp 4 -m 4096 \
-drive file="$DISK",format=qcow2,if=none,id=hd0 -device ide-hd,drive=hd0,bus=ide.0 \
-nic user,model=e1000,hostfwd=tcp:127.0.0.1:"$SSH_PORT"-:22 \
-device qemu-xhci,id=xhci -device usb-tablet,bus=xhci.0 \
-drive file="$STICK",format=raw,if=none,id=stick \
-device usb-storage,bus=xhci.0,drive=stick,removable=on \
-display none -vnc 127.0.0.1:1 \
-qmp unix:"$QMP",server=on,wait=off \
-daemonize -pidfile "$PIDFILE" "$@"
}
case "${1:-}" in
fetch)
[ -f "$ISO" ] || curl -fL -o "$ISO.part" "$ISO_URL" && { [ -f "$ISO" ] || mv "$ISO.part" "$ISO"; }
echo "$ISO_SHA256 $ISO" | sha256sum -c -
;;
install)
running && { echo "VM already running" >&2; exit 1; }
[ -f "$DISK" ] || qemu-img create -f qcow2 "$DISK" 20G
qemu -drive file="$ISO",media=cdrom,if=none,id=cd -device ide-cd,drive=cd,bus=ide.1 -boot d
echo "installer booted (VNC 127.0.0.1:5901, QMP $QMP)"
;;
start)
running && { echo "VM already running"; exit 0; }
qemu -boot c
echo "VM started (VNC 127.0.0.1:5901, ssh -p $SSH_PORT user@127.0.0.1)"
;;
stop)
running || { echo "VM not running"; exit 0; }
python3 "$(dirname "$0")/qmp.py" --socket "$QMP" powerdown || true
for _ in $(seq 60); do running || { echo "stopped"; exit 0; }; sleep 1; done
kill "$(cat "$PIDFILE")"; echo "killed"
;;
ssh)
shift
exec ssh -p "$SSH_PORT" -i "$VM_DIR/id_ed25519" -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR \
user@127.0.0.1 "$@"
;;
sync)
# Copy the working tree (without .git) to ~/openpu in the VM.
SRC=$(cd "$(dirname "$0")/.." && pwd)
tar -C "$SRC" --exclude=.git -cf - . | "$0" ssh "mkdir -p openpu && tar -xf - -C openpu"
echo "synced $SRC -> VM:~/openpu"
;;
status)
running && echo "running (pid $(cat "$PIDFILE"))" || echo "stopped"
;;
*)
sed -n '3,12p' "$0" >&2
exit 2
;;
esac
+369
View File
@@ -0,0 +1,369 @@
# SPDX-License-Identifier: MIT
"""Generates the OpenPU application icon (original artwork) in every format the project needs.
One description of the shapes (64x64 grid, the native grid of HVIF) produces:
data/icons/openpu.svg master SVG
data/icons/openpu-small.svg simplified variant for 16 and 24 px
data/icons/openpu.hvif Haiku Vector Icon Format (embedded in the Haiku executable)
data/icons/png/openpu-N.png PNG renderings, N in SIZES
Standard library only: the PNGs come from a small antialiased rasterizer below, so no SVG tool
is required. Run from the repository root: python3 -I tools/make_icons.py
"""
import math
import os
import struct
import sys
import zlib
SIZES = (16, 24, 32, 48, 64, 128, 256, 512)
SMALL_SIZES = (16, 24)
GRADIENT_TOP = (0x25, 0x63, 0xB8)
GRADIENT_BOTTOM = (0x16, 0x3A, 0x6B)
WHITE = (0xFF, 0xFF, 0xFF)
ARROW = (0x8E, 0xC5, 0xFF)
GRADIENT_Y = (4.0, 60.0) # vertical extent of the gradient, in icon units
# --- geometry ------------------------------------------------------------------------------------
# A path is a closed list of points (x, y, in_handle, out_handle); a None handle means a straight
# segment on that side. The segment from p[i] to p[i+1] uses p[i].out and p[i+1].in.
def pt(x, y, hin=None, hout=None):
return (x, y, hin, hout)
def shield():
return [
pt(12, 4, hin=(9.8, 4)),
pt(52, 4, hout=(54.2, 4)),
pt(56, 8, hin=(56, 5.8)),
pt(56, 34, hout=(56, 49)),
pt(32, 61, hin=(45, 57), hout=(19, 57)),
pt(8, 34, hin=(8, 49)),
pt(8, 8, hout=(8, 5.8)),
]
def transform(path, fn):
def f(h):
return None if h is None else fn(*h)
return [(*fn(x, y), f(hin), f(hout)) for x, y, hin, hout in path]
def scaled(path, s, cx=32.0, cy=32.5):
return transform(path, lambda x, y: (cx + s * (x - cx), cy + s * (y - cy)))
def moved(path, dx, dy):
return transform(path, lambda x, y: (x + dx, y + dy))
def letter_p():
return [
pt(16, 15),
pt(24, 15, hout=(27.9, 15)),
pt(30, 22, hin=(30, 18.1), hout=(30, 25.9)),
pt(24, 29, hin=(27.9, 29)),
pt(22, 29),
pt(22, 37),
pt(16, 37),
]
def letter_p_counter():
return [
pt(22, 20),
pt(24, 20, hout=(25.1, 20)),
pt(26, 22, hin=(26, 20.9), hout=(26, 23.1)),
pt(24, 24, hin=(25.1, 24)),
pt(22, 24),
]
def letter_u():
return [
pt(34, 15),
pt(40, 15),
pt(40, 29, hout=(40, 30.1)),
pt(42, 31, hin=(40.9, 31), hout=(43.1, 31)),
pt(44, 29, hin=(44, 30.1)),
pt(44, 15),
pt(50, 15),
pt(50, 29, hout=(50, 33.4)),
pt(42, 37, hin=(46.4, 37), hout=(37.6, 37)),
pt(34, 29, hin=(34, 33.4)),
]
def arrow():
return [pt(30, 41), pt(34, 41), pt(34, 47), pt(39, 47), pt(32, 54), pt(25, 47), pt(30, 47)]
def layers(small):
"""(style, path) pairs, painted in order. Holes are painted over with the background style,
so every path is a simple filled outline (same result in SVG, HVIF and the rasterizer)."""
dy = 4 if small else 0 # without the arrow, the letters move down to the optical centre
letters = [
("white", moved(letter_p(), -1, dy)),
("gradient", moved(letter_p_counter(), -1, dy)),
("white", moved(letter_u(), -1, dy)),
]
out = [("gradient", shield())]
if not small:
out += [("white", scaled(shield(), 0.90)), ("gradient", scaled(shield(), 0.86))]
out += letters
if not small:
out.append(("arrow", arrow()))
return out
# --- SVG -----------------------------------------------------------------------------------------
def fmt(v):
return ("%.2f" % v).rstrip("0").rstrip(".")
def svg_path(path):
x0, y0 = path[0][:2]
d = ["M%s %s" % (fmt(x0), fmt(y0))]
for i in range(len(path)):
a, b = path[i], path[(i + 1) % len(path)]
if a[3] is None and b[2] is None:
if i + 1 < len(path):
d.append("L%s %s" % (fmt(b[0]), fmt(b[1])))
continue
c1 = a[3] or a[:2]
c2 = b[2] or b[:2]
d.append("C%s %s %s %s %s %s" % (fmt(c1[0]), fmt(c1[1]), fmt(c2[0]), fmt(c2[1]), fmt(b[0]), fmt(b[1])))
return " ".join(d) + "Z"
def hexcolor(c):
return "#%02x%02x%02x" % c
def write_svg(file, small):
fills = {"gradient": "url(#bg)", "white": hexcolor(WHITE), "arrow": hexcolor(ARROW)}
lines = [
'<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 64 64">',
" <title>OpenPU</title>",
" <defs>",
' <linearGradient id="bg" gradientUnits="userSpaceOnUse" x1="32" y1="%s" x2="32" y2="%s">'
% (fmt(GRADIENT_Y[0]), fmt(GRADIENT_Y[1])),
' <stop offset="0" stop-color="%s"/>' % hexcolor(GRADIENT_TOP),
' <stop offset="1" stop-color="%s"/>' % hexcolor(GRADIENT_BOTTOM),
" </linearGradient>",
" </defs>",
]
for style, path in layers(small):
lines.append(' <path fill="%s" d="%s"/>' % (fills[style], svg_path(path)))
lines.append("</svg>")
with open(file, "w", encoding="utf-8", newline="\n") as f:
f.write("\n".join(lines) + "\n")
# --- HVIF ----------------------------------------------------------------------------------------
# Format of Haiku's FlatIconImporter: "ncif", then styles, paths and shapes, each list prefixed
# with a uint8 count. Coordinates: one byte (value + 32) for integers in -32..95, otherwise two
# bytes, 0x8000 | round((value + 128) * 102). Matrices use 24-bit floats.
STYLE_SOLID_NO_ALPHA = 3
STYLE_GRADIENT = 2
GRADIENT_LINEAR = 0
GRADIENT_FLAG_TRANSFORM = 1 << 1
GRADIENT_FLAG_NO_ALPHA = 1 << 2
PATH_FLAG_CLOSED = 1 << 1
PATH_FLAG_NO_CURVES = 1 << 3
SHAPE_TYPE_PATH_SOURCE = 10
def hvif_coord(v):
if abs(v - round(v)) < 1e-9 and -32 <= round(v) <= 95:
return bytes([int(round(v)) + 32])
n = int(round((v + 128.0) * 102.0))
if not 0 <= n < 0x8000:
raise ValueError("coordinate out of range: %r" % v)
return bytes([0x80 | (n >> 8), n & 0xFF])
def float24(v):
if v == 0:
return b"\0\0\0"
bits = struct.unpack("<I", struct.pack("<f", v))[0]
sign = bits >> 31
exponent = ((bits >> 23) & 0xFF) - 127 + 32
if not 0 <= exponent < 64:
raise ValueError("float out of range: %r" % v)
value = (sign << 23) | (exponent << 17) | ((bits & 0x7FFFFF) >> 6)
return bytes([(value >> 16) & 0xFF, (value >> 8) & 0xFF, value & 0xFF])
def hvif_path(path):
curved = any(p[2] is not None or p[3] is not None for p in path)
out = bytearray([PATH_FLAG_CLOSED | (0 if curved else PATH_FLAG_NO_CURVES), len(path)])
for x, y, hin, hout in path:
hin = hin or (x, y)
hout = hout or (x, y)
values = (x, y, *hin, *hout) if curved else (x, y)
for v in values:
out += hvif_coord(v)
return bytes(out)
def write_hvif(file, small):
# Linear gradients run from -64 to 64 on their own x axis: map it to the vertical extent.
half = (GRADIENT_Y[1] - GRADIENT_Y[0]) / 128.0
mid = (GRADIENT_Y[0] + GRADIENT_Y[1]) / 2.0
matrix = (0.0, half, -half, 0.0, 32.0, mid) # agg::trans_affine: sx, shy, shx, sy, tx, ty
gradient = bytearray([STYLE_GRADIENT, GRADIENT_LINEAR, GRADIENT_FLAG_TRANSFORM | GRADIENT_FLAG_NO_ALPHA, 2])
for m in matrix:
gradient += float24(m)
gradient += bytes([0, *GRADIENT_TOP, 255, *GRADIENT_BOTTOM])
styles = {
"gradient": bytes(gradient),
"white": bytes([STYLE_SOLID_NO_ALPHA, *WHITE]),
"arrow": bytes([STYLE_SOLID_NO_ALPHA, *ARROW]),
}
used = []
for style, _ in layers(small):
if style not in used:
used.append(style)
data = bytearray(b"ncif")
data.append(len(used))
for s in used:
data += styles[s]
ls = layers(small)
data.append(len(ls))
for _, path in ls:
data += hvif_path(path)
data.append(len(ls))
for i, (style, _) in enumerate(ls):
data += bytes([SHAPE_TYPE_PATH_SOURCE, used.index(style), 1, i, 0])
with open(file, "wb") as f:
f.write(data)
return len(data)
# --- rasterizer and PNG ----------------------------------------------------------------------------
def flatten(path, steps=24):
poly = []
for i in range(len(path)):
a, b = path[i], path[(i + 1) % len(path)]
poly.append(a[:2])
if a[3] is None and b[2] is None:
continue
c1, c2 = a[3] or a[:2], b[2] or b[:2]
for k in range(1, steps):
t = k / steps
u = 1 - t
poly.append((
u ** 3 * a[0] + 3 * u * u * t * c1[0] + 3 * u * t * t * c2[0] + t ** 3 * b[0],
u ** 3 * a[1] + 3 * u * u * t * c1[1] + 3 * u * t * t * c2[1] + t ** 3 * b[1],
))
return poly
def coverage(poly, size, sub=16):
"""Antialiased non-zero coverage (0..1) of a polygon given in 64-unit coordinates."""
scale = size / 64.0
pts = [(x * scale, y * scale) for x, y in poly]
edges = []
for i in range(len(pts)):
(x0, y0), (x1, y1) = pts[i], pts[(i + 1) % len(pts)]
if y0 != y1:
edges.append((x0, y0, x1, y1, 1 if y1 > y0 else -1))
cov = [0.0] * (size * size)
w = 1.0 / sub
for row in range(size):
base = row * size
for s in range(sub):
y = row + (s + 0.5) / sub
crossings = []
for x0, y0, x1, y1, d in edges:
if (y0 <= y < y1) or (y1 <= y < y0):
crossings.append((x0 + (y - y0) * (x1 - x0) / (y1 - y0), d))
crossings.sort()
winding = 0
for i in range(len(crossings) - 1):
winding += crossings[i][1]
if winding == 0:
continue
xa, xb = max(crossings[i][0], 0.0), min(crossings[i + 1][0], float(size))
if xb <= xa:
continue
ia, ib = int(xa), int(xb)
if ia == ib:
cov[base + ia] += (xb - xa) * w
continue
cov[base + ia] += (ia + 1 - xa) * w
for px in range(ia + 1, min(ib, size)):
cov[base + px] += w
if ib < size:
cov[base + ib] += (xb - ib) * w
return cov
def render(size, small):
rgba = [[0.0, 0.0, 0.0, 0.0] for _ in range(size * size)] # premultiplied
for style, path in layers(small):
cov = coverage(flatten(path), size)
for i, c in enumerate(cov):
if c <= 0:
continue
a = min(c, 1.0)
if style == "gradient":
y = ((i // size) + 0.5) * 64.0 / size
t = min(max((y - GRADIENT_Y[0]) / (GRADIENT_Y[1] - GRADIENT_Y[0]), 0.0), 1.0)
color = [GRADIENT_TOP[k] + (GRADIENT_BOTTOM[k] - GRADIENT_TOP[k]) * t for k in range(3)]
else:
color = WHITE if style == "white" else ARROW
p = rgba[i]
for k in range(3):
p[k] = color[k] / 255.0 * a + p[k] * (1 - a)
p[3] = a + p[3] * (1 - a)
return rgba
def write_png(file, size, rgba):
raw = bytearray()
for row in range(size):
raw.append(0)
for p in rgba[row * size:(row + 1) * size]:
a = p[3]
if a <= 0:
raw += b"\0\0\0\0"
continue
raw += bytes([min(255, int(round(p[k] / a * 255))) for k in range(3)] + [int(round(a * 255))])
def chunk(kind, payload):
body = kind + payload
return struct.pack(">I", len(payload)) + body + struct.pack(">I", zlib.crc32(body) & 0xFFFFFFFF)
with open(file, "wb") as f:
f.write(b"\x89PNG\r\n\x1a\n")
f.write(chunk(b"IHDR", struct.pack(">IIBBBBB", size, size, 8, 6, 0, 0, 0)))
f.write(chunk(b"IDAT", zlib.compress(bytes(raw), 9)))
f.write(chunk(b"IEND", b""))
def main():
root = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "data", "icons")
os.makedirs(os.path.join(root, "png"), exist_ok=True)
write_svg(os.path.join(root, "openpu.svg"), small=False)
write_svg(os.path.join(root, "openpu-small.svg"), small=True)
n = write_hvif(os.path.join(root, "openpu.hvif"), small=False)
print("openpu.hvif: %d bytes" % n)
sizes = [int(a) for a in sys.argv[1:]] or SIZES
for size in sizes:
write_png(os.path.join(root, "png", "openpu-%d.png" % size), size, render(size, size in SMALL_SIZES))
print("openpu-%d.png" % size)
if __name__ == "__main__":
main()
+174
View File
@@ -0,0 +1,174 @@
# SPDX-License-Identifier: MIT
"""Drive a headless QEMU VM through QMP: screenshots, absolute clicks, typing, power-off.
usage: python3 tools/qmp.py [--socket PATH] COMMAND...
shot OUT.png screenshot (PNG, no external dependency)
click X Y [right|double] click at screen pixel X,Y (needs a usb-tablet device)
move X Y move the pointer
type TEXT type text with a US keyboard layout
typefile FILE type the content of FILE (newlines press Return)
key COMBO... press key combos, e.g. ret, tab, ctrl-alt-delete, alt-f4
powerdown ACPI power button
hmp COMMAND human monitor command (prints the answer)
"""
import json
import os
import socket
import struct
import sys
import time
import zlib
class Qmp:
def __init__(self, path):
self.sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
self.sock.connect(path)
self.buf = b""
self._read() # greeting
self.cmd("qmp_capabilities")
def _read(self):
while b"\n" not in self.buf:
chunk = self.sock.recv(65536)
if not chunk:
raise RuntimeError("QMP connection closed")
self.buf += chunk
line, self.buf = self.buf.split(b"\n", 1)
return json.loads(line)
def cmd(self, name, **args):
self.sock.sendall(json.dumps({"execute": name, "arguments": args}).encode() + b"\n")
while True:
msg = self._read()
if "return" in msg:
return msg["return"]
if "error" in msg:
raise RuntimeError(f"{name}: {msg['error'].get('desc')}")
# asynchronous events are ignored
def ppm_to_png(ppm, png):
data = open(ppm, "rb").read()
fields, pos = [], 0
while len(fields) < 4: # P6, width, height, maxval
while data[pos:pos + 1].isspace():
pos += 1
if data[pos:pos + 1] == b"#":
pos = data.index(b"\n", pos) + 1
continue
end = pos
while not data[end:end + 1].isspace():
end += 1
fields.append(data[pos:end])
pos = end
width, height = int(fields[1]), int(fields[2])
pixels = data[pos + 1:]
stride = width * 3
raw = b"".join(b"\x00" + pixels[y * stride:(y + 1) * stride] for y in range(height))
def chunk(kind, payload):
body = kind + payload
return struct.pack(">I", len(payload)) + body + struct.pack(">I", zlib.crc32(body) & 0xFFFFFFFF)
with open(png, "wb") as f:
f.write(b"\x89PNG\r\n\x1a\n")
f.write(chunk(b"IHDR", struct.pack(">IIBBBBB", width, height, 8, 2, 0, 0, 0)))
f.write(chunk(b"IDAT", zlib.compress(raw, 6)))
f.write(chunk(b"IEND", b""))
return width, height
def screen_size(q):
tmp = f"/tmp/qmp-size-{os.getpid()}.ppm"
q.cmd("screendump", filename=tmp)
with open(tmp, "rb") as f:
head = f.read(64).split()
os.unlink(tmp)
return int(head[1]), int(head[2])
def move(q, x, y):
w, h = screen_size(q)
q.cmd("input-send-event", events=[
{"type": "abs", "data": {"axis": "x", "value": int(x * 32767 / max(1, w - 1))}},
{"type": "abs", "data": {"axis": "y", "value": int(y * 32767 / max(1, h - 1))}},
])
def click(q, x, y, mode="left"):
move(q, x, y)
button = "right" if mode == "right" else "left"
for _ in range(2 if mode == "double" else 1):
for down in (True, False):
q.cmd("input-send-event", events=[{"type": "btn", "data": {"down": down, "button": button}}])
time.sleep(0.05)
SHIFTED = {"_": "minus", ":": "semicolon", "\"": "apostrophe", "<": "comma", ">": "dot", "?": "slash",
"!": "1", "@": "2", "#": "3", "$": "4", "%": "5", "^": "6", "&": "7", "*": "8", "(": "9",
")": "0", "+": "equal", "{": "bracket_left", "}": "bracket_right", "|": "backslash", "~": "grave_accent"}
PLAIN = {" ": "spc", "-": "minus", ".": "dot", "/": "slash", ",": "comma", ";": "semicolon", "'": "apostrophe",
"=": "equal", "[": "bracket_left", "]": "bracket_right", "\\": "backslash", "`": "grave_accent",
"\n": "ret", "\t": "tab"}
def keys_for(ch):
if ch.isalpha() and ch.isascii():
return (["shift"] if ch.isupper() else []) + [ch.lower()]
if ch.isdigit():
return [ch]
if ch in PLAIN:
return [PLAIN[ch]]
if ch in SHIFTED:
return ["shift", SHIFTED[ch]]
raise ValueError(f"cannot type {ch!r}")
def press(q, names):
# send-key returns before QEMU replays the keys: wait longer than the hold time, or
# consecutive keys overlap (and a held shift leaks into the next characters).
q.cmd("send-key", keys=[{"type": "qcode", "data": n} for n in names], **{"hold-time": 30})
time.sleep(0.08)
def main():
args = sys.argv[1:]
path = os.path.expanduser("~/openpu-vm/qmp.sock")
if args[:1] == ["--socket"]:
path, args = args[1], args[2:]
if not args:
print(__doc__, file=sys.stderr)
sys.exit(2)
q = Qmp(path)
cmd, rest = args[0], args[1:]
if cmd == "shot":
tmp = os.path.abspath(rest[0]) + ".ppm"
q.cmd("screendump", filename=tmp)
w, h = ppm_to_png(tmp, rest[0])
os.unlink(tmp)
print(f"{rest[0]} {w}x{h}")
elif cmd == "click":
click(q, int(rest[0]), int(rest[1]), rest[2] if len(rest) > 2 else "left")
elif cmd == "move":
move(q, int(rest[0]), int(rest[1]))
elif cmd == "type":
for ch in " ".join(rest):
press(q, keys_for(ch))
elif cmd == "typefile":
with open(rest[0], encoding="utf-8") as f:
for ch in f.read():
press(q, keys_for(ch))
elif cmd == "key":
for combo in rest:
press(q, combo.split("-"))
elif cmd == "powerdown":
q.cmd("system_powerdown")
elif cmd == "hmp":
print(q.cmd("human-monitor-command", **{"command-line": " ".join(rest)}))
else:
print(__doc__, file=sys.stderr)
sys.exit(2)
main()
+15 -2
View File
@@ -25,10 +25,18 @@ grep -q "^project(openpu VERSION $VERSION " CMakeLists.txt || { echo "cannot upd
sed -i "s/^## \[Unreleased\]$/## [Unreleased]\n\n## [$VERSION] - $TODAY/" CHANGELOG.md sed -i "s/^## \[Unreleased\]$/## [Unreleased]\n\n## [$VERSION] - $TODAY/" CHANGELOG.md
sed -i "s|^\[Unreleased\]: \(.*\)/compare/v[0-9.]*\.\.\.HEAD$|[Unreleased]: \1/compare/v$VERSION...HEAD\n[$VERSION]: \1/releases/tag/v$VERSION|" CHANGELOG.md sed -i "s|^\[Unreleased\]: \(.*\)/compare/v[0-9.]*\.\.\.HEAD$|[Unreleased]: \1/compare/v$VERSION...HEAD\n[$VERSION]: \1/releases/tag/v$VERSION|" CHANGELOG.md
git add CMakeLists.txt CHANGELOG.md # AppStream metadata lists the releases, newest first.
sed -i "s|^ <releases>$| <releases>\n <release version=\"$VERSION\" date=\"$TODAY\"/>|" data/io.github.openpu.OpenPU.metainfo.xml
grep -q "<release version=\"$VERSION\"" data/io.github.openpu.OpenPU.metainfo.xml || { echo "cannot update the metainfo" >&2; exit 1; }
git add CMakeLists.txt CHANGELOG.md data/io.github.openpu.OpenPU.metainfo.xml
# RELEASE_TRAILER: optional trailer lines appended to the release commit message (e.g. co-authors). # RELEASE_TRAILER: optional trailer lines appended to the release commit message (e.g. co-authors).
git commit -q -m "release: v$VERSION" ${RELEASE_TRAILER:+-m "$RELEASE_TRAILER"} git commit -q -m "release: v$VERSION" ${RELEASE_TRAILER:+-m "$RELEASE_TRAILER"}
NOTES=$(awk -v v="$VERSION" '$0 ~ "^## \\[" v "\\]" {on=1; next} on && /^(## |\[)/ {exit} on {print}' CHANGELOG.md) # Plain string comparison (not a regex: "[" and "." in the heading would be special).
NOTES=$(awk -v v="$VERSION" 'index($0, "## [" v "]") == 1 {on=1; next}
on && (index($0, "## ") == 1 || index($0, "[") == 1) {exit}
on {print}' CHANGELOG.md | sed -e '/./,$!d')
[ -n "$NOTES" ] || { echo "no release notes found for $VERSION in CHANGELOG.md" >&2; exit 1; }
git tag -a "v$VERSION" -m "OpenPU $VERSION" -m "$NOTES" git tag -a "v$VERSION" -m "OpenPU $VERSION" -m "$NOTES"
echo "tagged v$VERSION (previous: ${PREVIOUS:-none})" echo "tagged v$VERSION (previous: ${PREVIOUS:-none})"
@@ -39,7 +47,12 @@ done
GH=$(command -v gh || command -v gh.exe || true) GH=$(command -v gh || command -v gh.exe || true)
[ -z "$GH" ] && [ -x "/c/Program Files/GitHub CLI/gh.exe" ] && GH="/c/Program Files/GitHub CLI/gh.exe" [ -z "$GH" ] && [ -x "/c/Program Files/GitHub CLI/gh.exe" ] && GH="/c/Program Files/GitHub CLI/gh.exe"
if [ -n "$GH" ]; then if [ -n "$GH" ]; then
# The release workflow may have created the release already (to attach the binaries).
if "$GH" release view "v$VERSION" >/dev/null 2>&1; then
printf '%s\n' "$NOTES" | "$GH" release edit "v$VERSION" --title "OpenPU $VERSION" --notes-file -
else
printf '%s\n' "$NOTES" | "$GH" release create "v$VERSION" --verify-tag --title "OpenPU $VERSION" --notes-file - printf '%s\n' "$NOTES" | "$GH" release create "v$VERSION" --verify-tag --title "OpenPU $VERSION" --notes-file -
fi
else else
echo "gh not found: create the GitHub release for v$VERSION by hand" >&2 echo "gh not found: create the GitHub release for v$VERSION by hand" >&2
fi fi