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
This commit is contained in:
yann64andClaude Opus 5.5 committed 2026-11-28 23:50:13 +01:00
1 parent 962343f220
commit 9a24c2eb61
5 files changed
+166 -159

No files matched your search

+1 -1
View File
@@ -45,7 +45,7 @@ complete; every release is an annotated git tag `vX.Y.Z` (see `tools/release.sh`
## [0.1.0] - 2026-11-28 ## [0.1.0] - 2026-11-28
### Added ### Added
- Analysis of "Peugeot Update" 1.6.1 (`docs/analysis/`, in French). - Analysis of "Peugeot Update" 1.6.1 (`docs/analysis/`).
- `libopenpu`: Majestic API client (VIN, head units, updates), resumable downloads (HTTP Range), - `libopenpu`: Majestic API client (VIN, head units, updates), resumable downloads (HTTP Range),
license download (including the empty placeholder Majestic returns while generating it), tar license download (including the empty placeholder Majestic returns while generating it), tar
archives (integrity check, safe extraction skipping `UpdateInfo.xml`), settings and vehicles archives (integrity check, safe extraction skipping `UpdateInfo.xml`), settings and vehicles
+1 -1
View File
@@ -13,7 +13,7 @@ It is an alternative to the official "Peugeot Update" application (Windows/macOS
- 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
+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 `=` / `&` 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.
+39 -32
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.
+38 -38
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).