diff --git a/native/waze-on-cluster/Makefile b/native/waze-on-cluster/Makefile index b0f14f1b..5b9380fd 100644 --- a/native/waze-on-cluster/Makefile +++ b/native/waze-on-cluster/Makefile @@ -5,7 +5,7 @@ # make test host build + NAL, RTP, the SPS fields, the decoder # against a fake MSDK, receive queue and catch-up, stream health, # keyframe wait, the turn-box setting, the map's saved settings, -# the local conf and opt-in settings, the map feed +# the opt-in settings, the map feed # against the shared renderer, the kit's tests, patcher, # the aapd locator on every build in AAPD_BIN and # AAPD_BINS, patchd patch/install activation/DLT/restart/driver profiles, the CarPlay @@ -52,7 +52,7 @@ VERSION := $(shell sed -n 's/^ *"version": *"\([^"]*\)".*/\1/p' component.json) # The capture, decode and map feed (own files), the kit's atlas, packing and # geometry, and the shared renderer's client. WOC_SRC = src/main.cpp src/refused.cpp src/video_producer.cpp src/freeze_watch.cpp src/alt_screen.cpp src/map_feed.cpp src/map_feeds.cpp src/atlas_scale.cpp src/control.cpp src/h264_source.cpp \ - src/guide_setting.cpp src/map_state.cpp src/local_conf.cpp \ + src/guide_setting.cpp src/map_state.cpp src/opt_in.cpp \ src/udp_source.cpp src/avb_source.cpp src/framing_probe.cpp src/rtp_h264.cpp src/sps_info.cpp \ src/decoder_msdk.cpp src/nal_reader.cpp src/stream_health.cpp $(KIT)/map_geometry.cpp $(KIT)/yuv_atlas.cpp \ $(KIT)/block_pack.cpp @@ -66,7 +66,7 @@ CPP_TESTS = $(BUILD)/host/nal_reader_test $(BUILD)/host/rtp_h264_test $(BUILD)/h $(BUILD)/host/alt_screen_test $(BUILD)/host/packet_queue_test \ $(BUILD)/host/stream_health_test $(BUILD)/host/source_crop_test \ $(BUILD)/host/map_rect_test $(BUILD)/host/guide_setting_test $(BUILD)/host/decoder_test \ - $(BUILD)/host/map_state_test $(BUILD)/host/local_conf_test $(BUILD)/host/atlas_scale_test $(BUILD)/host/sps_info_test \ + $(BUILD)/host/map_state_test $(BUILD)/host/opt_in_test $(BUILD)/host/atlas_scale_test $(BUILD)/host/sps_info_test \ $(BUILD)/host/picture_pace_test # The control socket (accept4) and the producer (pipe2) are Linux's: built and run on Linux only # (make test-x86). @@ -131,7 +131,7 @@ test-cpp: $(CPP_TESTS) $(BUILD)/host/guide_setting_test $(BUILD)/host/decoder_test $(BUILD)/host/map_state_test - $(BUILD)/host/local_conf_test + $(BUILD)/host/opt_in_test $(BUILD)/host/atlas_scale_test $(BUILD)/host/sps_info_test $(if $(LINUX_TESTS),$(foreach t,$(LINUX_TESTS),$(t) &&) true,@echo 'refused_test, video_producer_test: Linux only (make test-x86)') @@ -256,9 +256,9 @@ $(BUILD)/host/map_state_test: test/map_state_test.cpp src/map_state.cpp src/map_ mkdir -p $(@D) $(CXX) $(CXXFLAGS) -Isrc -I$(CR)/src -o $@ test/map_state_test.cpp src/map_state.cpp $(CR)/src/config.cpp $(CR)/src/log.cpp -lpthread -$(BUILD)/host/local_conf_test: test/local_conf_test.cpp src/local_conf.cpp src/local_conf.h $(CR)/src/config.cpp $(CR)/src/log.cpp +$(BUILD)/host/opt_in_test: test/opt_in_test.cpp src/opt_in.cpp src/opt_in.h $(CR)/src/config.cpp $(CR)/src/log.cpp mkdir -p $(@D) - $(CXX) $(CXXFLAGS) -Isrc -I$(CR)/src -o $@ test/local_conf_test.cpp src/local_conf.cpp $(CR)/src/config.cpp $(CR)/src/log.cpp -lpthread + $(CXX) $(CXXFLAGS) -Isrc -I$(CR)/src -o $@ test/opt_in_test.cpp src/opt_in.cpp $(CR)/src/config.cpp $(CR)/src/log.cpp -lpthread # ---- target binary (in Docker) -------------------------------------------- target: diff --git a/native/waze-on-cluster/README.md b/native/waze-on-cluster/README.md index 0ad77c57..b6b16f72 100644 --- a/native/waze-on-cluster/README.md +++ b/native/waze-on-cluster/README.md @@ -110,9 +110,6 @@ unless **Keep HUD map over BMW's pop-ups** is ticked. **Own settings for this driver** gives the driver profile in use its own copy of these settings. -From a shell, `waze-on-cluster -c run map|panel` sets the cluster -target until the service restarts and prints the status. - **Inside another app's scene.** An app that shows a scene file on a target with `layers` 1 can host the map there (cluster-render PROTOCOL.md "Hosting another target"): the map is then drawn only in the rect it @@ -122,12 +119,16 @@ hosted_vpp_scale and always_packed" below). ### Settings -Settings are in `waze-on-cluster.conf` (documented inline). Overrides go in -`/var/opt/waze-on-cluster/waze-on-cluster.local.conf`, which updates keep; -the app's map settings are in `/var/opt/waze-on-cluster/map.state.conf`, and -the opt-in settings in `/var/opt/waze-on-cluster/features.conf`. A key the -local conf has that this version does not know is left out with a warning -in the log. +Settings are in `waze-on-cluster.conf` (documented inline), which each +install writes anew. Besides it and the command line (the Android Auto +crop, PATCH.md), the service reads only the app's saved choices +(`/var/opt/waze-on-cluster/map.state.conf` and the turn-box setting) and +the opt-in settings in `/var/opt/waze-on-cluster/features.conf`. On the +cluster the map goes on its map slot, or into a hosting app's scene. + +`/var/opt/waze-on-cluster/waze-on-cluster.local.conf`, which versions up to +0.10.9 read, is not read; it stays on the unit for a downgrade, and the log +names it at each start. ### Map size and upload @@ -140,7 +141,7 @@ The map covers the cluster's central map area, 1088x480 on the 1920x720 panel. The patch advertises exactly that, so `tex_size` must equal it. `src_crop` takes part of a picture of one size and scales it to `tex_size` (Android Auto's 1280x720 stream has its map in the top 1280x564). -`map_rect` draws the map stretched into a rect of the current target. +`map_rect` draws the map stretched into a rect of the map slot. `target_fps` (30) caps the frame rate; `picture_fps` (0: every frame) makes at most that many pictures a second, which saves CPU when the phone sends more than the cluster takes (set it to `target_fps` then). @@ -172,8 +173,8 @@ They take effect when waze-on-cluster next starts (the next head-unit start). A restart of the service applies them at once, but the map stays blank until the phone connects again. -Not in `waze-on-cluster.local.conf`: there they are left out, and patchd -moves them to `features.conf`. +patchd moves any it finds in `waze-on-cluster.local.conf` to +`features.conf`, so a downgrade never meets them there. **What they need.** - Both: a waze-on-cluster whose `waze-on-cluster.conf` has the key. An older diff --git a/native/waze-on-cluster/patch/patchd.js b/native/waze-on-cluster/patch/patchd.js index 85139952..f16d8013 100644 --- a/native/waze-on-cluster/patch/patchd.js +++ b/native/waze-on-cluster/patch/patchd.js @@ -234,7 +234,9 @@ var REBOOT_CMD = (process.env.WOC_REBOOT_CMD || '/usr/bin/nsm_control --requestR var REBOOT_CMD_TIMEOUT_MS = 30000; /* A restart NSM took that has not taken the unit down by then failed. */ var REBOOT_WAIT_MS = parseInt(process.env.WOC_REBOOT_WAIT_MS, 10) || 180000; -/* The unit's own render settings, which updates keep. */ +/* The local conf waze-on-cluster up to 0.10.9 reads over its configuration; + * later versions do not read it. It stays on the unit for a downgrade, kept + * one every release starts with (moveMapSettings, moveFeatures). */ var LOCAL_CONF = process.env.WOC_LOCAL_CONF || '/var/opt/waze-on-cluster/waze-on-cluster.local.conf'; /* Where the map shows and the HUD map's size, place and whether it stays * shown over BMW's pop-ups, as the app chose them: the render reads this file (its map_state_file) over its @@ -244,7 +246,7 @@ var MAP_STATE = path.join(STATE_DIR, 'map.state.conf'); var MAP_KEYS = ['cluster', 'hud', 'hud_width_pct', 'hud_offset_x', 'hud_offset_y', 'hud_keep_shown']; /* The opt-in settings: the render reads this file (its features_file) over * its configuration. Not in LOCAL_CONF, which every release up to 0.10.7 - * refuses to start with any of FEATURE_KEYS in; no release before this one + * refuses to start with any of FEATURE_KEYS in; no release before 0.10.9 * reads FEATURES. */ var FEATURES = path.join(STATE_DIR, 'features.conf'); var FEATURE_KEYS = ['hosted_vpp_scale', 'always_packed']; @@ -1622,8 +1624,8 @@ function aaRevert(noRestart, dropBackup, done) { function saveFile(f, text) { try { fs.mkdirSync(STATE_DIR, 0o755); } catch (e) { if (e.code !== 'EEXIST') throw e; } var fd = fs.openSync(f + '.tmp', 'w', 0o644); - /* The capture (hmi_5000) reads waze-on-cluster.local.conf and the map - * settings, whatever umask the caller (an install hook) has. */ + /* The render (hmi_5000) reads the map settings, and an earlier version + * the local conf, whatever umask the caller (an install hook) has. */ try { fs.fchmodSync(fd, 0o644); fs.writeSync(fd, text); fs.fsyncSync(fd); } finally { fs.closeSync(fd); } fs.renameSync(f + '.tmp', f); } diff --git a/native/waze-on-cluster/patch/test/rollback_conf_test.js b/native/waze-on-cluster/patch/test/rollback_conf_test.js index 2b16b0d2..fb84fed2 100644 --- a/native/waze-on-cluster/patch/test/rollback_conf_test.js +++ b/native/waze-on-cluster/patch/test/rollback_conf_test.js @@ -2,14 +2,17 @@ // SPDX-License-Identifier: GPL-3.0-or-later // Copyright (C) 2026 Robert Nisipeanu /* Every released waze-on-cluster against the settings files this version - * leaves: with the opt-in keys (hosted_vpp_scale, always_packed) turned on, - * waze-on-cluster.local.conf stays one each release starts with, through - * an install or update (patchd activate), a head-unit start (patchd's - * daemon), Undo update, Remove and removal (patchd deactivate), a reinstall, - * an update cut short or undone, and a move cut short between its two - * writes; a removal is refused while the local conf cannot be rewritten; - * and every release whose code reads features.conf, where the keys live, - * knows them. + * leaves. This version does not read waze-on-cluster.local.conf; earlier + * ones do, so it stays on the unit, one each release starts with: with the + * opt-in keys (hosted_vpp_scale, always_packed) turned on, and on a car whose + * local conf has the owner's settings, the app's map settings and the opt-in + * keys, through an install or update (patchd activate), a head-unit start + * (patchd's daemon), a downgrade (Undo update), Remove and uninstall (patchd + * deactivate), a reinstall, an update cut short or undone, and a move cut + * short between its two writes; a removal is refused while the local conf + * cannot be rewritten; a unit without a local conf is left without one; and + * every release whose code reads features.conf, where the keys live, knows + * them. * * A release loads its shipped waze-on-cluster.conf first and refuses to * start with a key it does not know, so a key that file sets is one the @@ -53,7 +56,8 @@ if (!list.length) { list = tags() || []; } var RELEASES = list.map(function (t) { return t.slice('waze-on-cluster@'.length); }).filter(function (v) { return /^\d+\.\d+\.\d+$/.test(v); }).sort(cmp); -ok('every release from 0.5.0 to 0.10.7 is at hand', RELEASES.indexOf('0.5.0') >= 0 && RELEASES.indexOf('0.10.7') >= 0, RELEASES.join(' ')); +ok('every release from 0.5.0 to 0.10.9 is at hand', ['0.5.0', '0.10.7', '0.10.8', '0.10.9'].every(function (v) { return RELEASES.indexOf(v) >= 0; }), + RELEASES.join(' ')); if (!RELEASES.length) process.exit(1); /* A conf's lines as Config::load reads them: [key, value] or [null, line] @@ -117,6 +121,7 @@ process.on('exit', function () { try { cp.execFileSync('rm', ['-rf', dir]); } catch (e) {} }); var STATE = path.join(dir, 'state'), LOCAL = path.join(STATE, 'waze-on-cluster.local.conf'), FEATURES = path.join(STATE, 'features.conf'); +var MAP_STATE = path.join(STATE, 'map.state.conf'); var SOCK = path.join(dir, 'shm', 'patch.sock'); fs.mkdirSync(STATE); var ENV = Object.assign({}, process.env, { @@ -248,6 +253,39 @@ var ON = 'hosted_vpp_scale = 1\nalways_packed = 1\n'; check('the move cut short between its writes', USER, null, out); fs.rmdirSync(FEATURES + '.tmp'); + /* 5. A car with a local conf: the owner's settings (a target, a frame + * rate), the app's map settings and an opt-in key, which releases up to + * 0.8.8 and 0.10.7 refuse. The first install moves those two into their + * files; the owner's lines stay in the local conf, which every release + * starts with, through every step after. */ + var OWN = '# mine\ntarget = panel\ntarget_fps = 20\n'; + var CAR_LOCAL = OWN + 'cluster = 0\nhud_width_pct = 50\nhosted_vpp_scale = 1\n'; + var CAR_MAP = 'cluster = 0\nhud_width_pct = 50\n', CAR_FEAT = 'hosted_vpp_scale = 1\n'; + ok('every release starts with the owner\'s settings', refusing(OWN).length === 0, refusing(OWN).join(' ')); + ok('releases refuse the car\'s local conf as it was', refusing(CAR_LOCAL).length > 0); + var life = [['an update to this version', 'activate'], ['a head-unit start', 'boot'], ['a downgrade', 'deactivate'], + ['an update to this version again', 'activate'], ['a head-unit start', 'boot'], ['Remove', 'deactivate'], + ['a reinstall', 'activate'], ['a head-unit start', 'boot'], ['uninstall', 'deactivate'], ['a reinstall', 'activate']]; + async function step(which) { return which === 'boot' ? boot() : hook(which); } + set(CAR_LOCAL, null); + try { fs.unlinkSync(MAP_STATE); } catch (e) {} + for (i = 0; i < life.length; i++) { + out = await step(life[i][1]); + var map = read(MAP_STATE); + check('a car with a local conf, ' + life[i][0], OWN, CAR_FEAT, out); + ok('a car with a local conf, ' + life[i][0] + ': the app\'s map settings in map.state.conf', map === CAR_MAP, + JSON.stringify(map)); + } + + /* 6. No local conf (every Store install): none made, nor any other + * settings file, through every step. */ + [LOCAL, FEATURES, MAP_STATE].forEach(function (f) { try { fs.unlinkSync(f); } catch (e) {} }); + for (i = 0; i < life.length; i++) { + out = await step(life[i][1]); + ok('no local conf, ' + life[i][0] + ': none made, no settings file', read(LOCAL) === null && read(FEATURES) === null && + read(MAP_STATE) === null, out.slice(-300)); + } + process.stdout.write(fails ? ('\n' + fails + ' check(s) failed\n') : '\nall checks passed\n'); process.exit(fails ? 1 : 0); })().catch(function (e) { process.stdout.write('FAIL ' + (e.stack || e) + '\n'); process.exit(1); }); diff --git a/native/waze-on-cluster/src/control.h b/native/waze-on-cluster/src/control.h index 46b05755..500ad744 100644 --- a/native/waze-on-cluster/src/control.h +++ b/native/waze-on-cluster/src/control.h @@ -1,10 +1,9 @@ // SPDX-License-Identifier: GPL-3.0-or-later // Copyright (C) 2026 Robert Nisipeanu -/* The control socket: newline-delimited JSON between its owner (the app, or - * `waze-on-cluster run`) and the tool (README.md "Using it"). +/* The control socket: newline-delimited JSON between its owner (the app) + * and the tool (README.md "Using it"). * - * owner -> tool {"cmd":"start","target":"sail"|"map"|"panel"} - * {"cmd":"cluster","on":"0"|"1"} the map on the cluster off or on + * owner -> tool {"cmd":"cluster","on":"0"|"1"} the map on the cluster off or on * {"cmd":"hud","on":"0"|"1"} the map on the HUD off or on * {"cmd":"hud","hud_width_pct":"0"|"20".."100"} the HUD map's size * {"cmd":"hud","hud_x":"-800".."800","hud_y":...} where it is, from the centre diff --git a/native/waze-on-cluster/src/local_conf.h b/native/waze-on-cluster/src/local_conf.h deleted file mode 100644 index a2283419..00000000 --- a/native/waze-on-cluster/src/local_conf.h +++ /dev/null @@ -1,39 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// Copyright (C) 2026 Robert Nisipeanu -/* The unit's own settings over the shipped configuration. - * - * local_conf (waze-on-cluster.local.conf), which updates keep, is read line - * by line: a key this version does not know, or a line that does not read, - * is left out with a warning and the rest taken, so a local conf written for - * a later version still starts this one. Every release up to 0.10.7 refuses - * to start with a key it does not know there, so a key that release lacks - * never belongs in local_conf: the opt-in keys (kFeatureKeys) live in - * features_file instead, which no release before this one reads; found in - * local_conf they are left out with a warning (patchd moves them). - * - * features_file (features.conf) holds the opt-in keys, each 0 or 1; a valid - * value replaces the configuration's; another key, a value out of range or - * a line that does not read is left out with a warning, as is a file that - * cannot be read. */ -#ifndef WOC_LOCAL_CONF_H -#define WOC_LOCAL_CONF_H - -#include -#include - -#include "config.h" - -namespace woc { - -/* The keys features_file holds. */ -extern const char *const kFeatureKeys[2]; - -/* local_conf's settings over cfg's; a missing file is none. Each line left - * out is one entry in *warnings. */ -void load_local_conf(cld::Config *cfg, const std::string &path, std::vector *warnings); - -void load_features(cld::Config *cfg, const std::string &path); - -} // namespace woc - -#endif diff --git a/native/waze-on-cluster/src/main.cpp b/native/waze-on-cluster/src/main.cpp index 3f703ae2..d0526ba8 100644 --- a/native/waze-on-cluster/src/main.cpp +++ b/native/waze-on-cluster/src/main.cpp @@ -5,16 +5,15 @@ * which draws it in a cluster slot. The service runs from boot, so it decodes * from the stream's first keyframe; the map goes up with the first non-blank * picture and comes down when the stream ends, freezes or stays blank - * (map_feed.h, freeze_watch.h). The control socket - * reports its status and log to the app. + * (map_feed.h, freeze_watch.h). On the cluster the map goes on its map slot + * (map_feeds.h). The control socket reports its status and log to the app. * * waze-on-cluster [-c FILE] [-s key=value]... serve the control socket - * waze-on-cluster [-c FILE] run sail|map|panel - * map that target from now on, - * and follow the status from a shell - * (sail = map, the native central-map slot) * waze-on-cluster [-c FILE] bench-pack I420_FILE time the packed-motion packing * + * The settings are the shipped configuration's (-c), any -s, the app's saved + * ones (state_file, map_state_file) and the opt-in ones (features_file). + * * The H.264 reaches this tool through the sink the carplay patch points at * (patch/carplay_patch.js --sink/--capture), after the patch advertises the 2nd * display and makes CarPlay self-start the stream (PATCH.md Edits 1 and 3). It @@ -31,17 +30,15 @@ #include #include #include -#include -#include #include #include #include "alt_screen.h" #include "config.h" #include "control.h" +#include "opt_in.h" #include "guide_setting.h" #include "head_unit.h" -#include "local_conf.h" #include "log.h" #include "block_pack.h" #include "map_feed.h" @@ -66,19 +63,9 @@ using crk::texture_size_error; namespace { -/* Accepted and ignored, so a local_conf that sets them still starts the - * service: the map is drawn by the shared renderer, whose own configuration - * owns the slots, scene ids and the upload budget. */ -const char *const kIgnoredKeys[] = {"tex_format", "upload", "dirty_tiles", - "max_frame_textures", "resource_linger_ms", "resource_fetch_log", - "texture_replay", "texture_replay_frames", "mutable_r8", - "upload_kb_per_s", "upload_burst_ms"}; - -/* What load_local_conf left out, logged once the log file is open. */ -std::vector g_local_conf_warnings; - -volatile sig_atomic_t g_stop; -void on_signal(int) { g_stop = 1; } +/* The local conf earlier versions read, kept on the unit for a downgrade. + * This version does not read it. */ +const char kUnreadLocalConf[] = "/var/opt/waze-on-cluster/waze-on-cluster.local.conf"; std::string status_line(const FeedStatus &s) { @@ -102,24 +89,17 @@ class Server : public Control::Handler { Server(MapFeeds *feeds, GuideSetting *guide) : feeds_(feeds), guide_(guide) {} void set_control(Control *c) { control_ = c; } - /* start picks the cluster target the map goes to (`run`); cluster and - * hud turn the map on each off or on ("on"), hud also sizes and places - * the HUD's; the map itself - * comes and goes with the stream. guide is the app's switch for BMW's - * turn box (guide_setting.h). */ + /* cluster and hud turn the map on each off or on ("on"), hud also sizes + * and places the HUD's; the map itself comes and goes with the stream. + * guide is the app's switch for BMW's turn box (guide_setting.h). */ void on_command(const std::map &msg) override { const std::string &cmd = msg.at("cmd"); - auto it = msg.find("target"); auto hide = msg.find("hide"); auto pct = msg.find("hud_width_pct"); auto hx = msg.find("hud_x"), hy = msg.find("hud_y"), on = msg.find("on"); auto keep = msg.find("hud_keep_shown"); - if (cmd == "start" && it != msg.end()) { - log_info("start %s", it->second.c_str()); - if (!feeds_->set_target(it->second)) - log_warn("start: the cluster renderer has no cluster target %s", it->second.c_str()); - } else if (cmd == "guide" && hide != msg.end() && guide_->set(hide->second)) { + if (cmd == "guide" && hide != msg.end() && guide_->set(hide->second)) { log_info("guide: BMW's turn box %s while the map shows", guide_->hide() ? "hidden" : "shown"); feeds_->set_guide_hold(guide_->hide()); } else if (cmd == "cluster" && on != msg.end() && (on->second == "0" || on->second == "1")) { @@ -198,8 +178,8 @@ int serve(Config cfg) { if (cfg.has("log_file")) log_to_file(cfg.str("log_file"), log_file_cap(cfg.num("log_file_kb")), "waze-on-cluster", WOC_VERSION); - for (const std::string &w : g_local_conf_warnings) - log_warn("%s", w.c_str()); + if (access(kUnreadLocalConf, F_OK) == 0) + log_info("%s is not read: the shipped settings, the app's and the opt-in ones apply", kUnreadLocalConf); load_map_state(&cfg, cfg.str("map_state_file")); load_features(&cfg, cfg.str("features_file")); VideoConfig vc; @@ -218,10 +198,6 @@ int serve(Config cfg) } if (const char *why = parse_source_crop(cfg.str("src_crop"), &vc.src_crop)) log_warn("src_crop = %s is ignored: %s; the whole picture is the map", cfg.str("src_crop").c_str(), why); - for (const char *key : kIgnoredKeys) - if (cfg.has(key)) - log_warn("%s = %s is ignored: the upload budget is the cluster renderer's " - "(upload_kb_per_s in /var/opt/cluster-render/cluster-render.local.conf)", key, cfg.str(key).c_str()); struct Range { const char *key; long lo, hi; } ranges[] = { {"dirty_threshold", 0, 64}, {"dirty_settle_ms", 0, 3600000}, {"tex_level_bits", 0, 3}, {"target_fps", 0, 60}, {"picture_fps", 0, 60}, {"pan_blocks", 0, 1}, @@ -263,7 +239,6 @@ int serve(Config cfg) FeedConfig fc; fc.socket = cfg.str("render_socket"); - fc.target = cfg.str("target"); if (const char *why = parse_map_rect(cfg.str("map_rect"), &fc.rect)) log_warn("map_rect = %s is ignored: %s; the map area instead", cfg.str("map_rect").c_str(), why); fc.hud_width_pct = (unsigned)cfg.num("hud_width_pct"); @@ -429,42 +404,10 @@ int serve(Config cfg) return 0; } -int run(const Config &cfg, const char *target) -{ - struct sigaction sa; - std::memset(&sa, 0, sizeof sa); - sa.sa_handler = on_signal; - sigaction(SIGINT, &sa, nullptr); - sigaction(SIGTERM, &sa, nullptr); - - int fd = socket(AF_UNIX, SOCK_STREAM, 0); - struct sockaddr_un addr; - std::memset(&addr, 0, sizeof addr); - addr.sun_family = AF_UNIX; - std::snprintf(addr.sun_path, sizeof addr.sun_path, "%s", cfg.str("socket_path").c_str()); - if (fd < 0 || connect(fd, (struct sockaddr *)&addr, sizeof addr) < 0) { - std::fprintf(stderr, "waze-on-cluster: %s: %s\n", addr.sun_path, strerror(errno)); - return 1; - } - std::string start = "{\"cmd\":\"start\",\"target\":" + json_escape(target) + "}\n"; - if (write(fd, start.data(), start.size()) != (ssize_t)start.size()) - return 1; - char buf[1024]; - while (!g_stop) { - ssize_t n = read(fd, buf, sizeof buf); - if (n <= 0) - break; - fwrite(buf, 1, (size_t)n, stdout); - fflush(stdout); - } - close(fd); - return 0; -} - void usage() { std::fprintf(stderr, - "usage: waze-on-cluster [-c FILE] [-s key=value]... [run sail|map|panel | bench-pack I420_FILE]\n"); + "usage: waze-on-cluster [-c FILE] [-s key=value]... [bench-pack I420_FILE]\n"); } /* Times pan_blocks' packing (4:2:0 to RGB and the block fit) of each @@ -544,7 +487,6 @@ void define_keys(Config *cfg) cfg->define("gpu_copy", "1"); cfg->define("hosted_vpp_scale", "0"); cfg->define("always_packed", "0"); - cfg->define("target", "map"); cfg->define("hide_bmw_guidance", "1"); cfg->define("state_file", "/var/opt/waze-on-cluster/state/waze-on-cluster.state.conf"); cfg->define("map_state_file", "/var/opt/waze-on-cluster/map.state.conf"); @@ -562,8 +504,6 @@ void define_keys(Config *cfg) cfg->define("render_socket", "/dev/shm/cluster-render/render.sock"); cfg->define("log_file", "/var/opt/waze-on-cluster/log/waze-on-cluster.log"); cfg->define("log_file_kb", "512"); - for (const char *key : kIgnoredKeys) - cfg->define(key, ""); } int main(int argc, char **argv) @@ -577,7 +517,6 @@ int main(int argc, char **argv) bool has_arg = i + 1 < argc; if (!std::strcmp(argv[i], "-c") && has_arg) { if (!cfg.load(argv[++i], &err)) { std::fprintf(stderr, "waze-on-cluster: %s\n", err.c_str()); return 2; } - load_local_conf(&cfg, cfg.str("local_conf"), &g_local_conf_warnings); } else if (!std::strcmp(argv[i], "-s") && has_arg) { if (!cfg.set_pair(argv[++i], &err)) { std::fprintf(stderr, "waze-on-cluster: %s\n", err.c_str()); return 2; } } else { @@ -593,10 +532,6 @@ int main(int argc, char **argv) const std::string why = head_unit_refused(); return why.empty() ? serve(cfg) : serve_refused(cfg, why); } - for (const std::string &w : g_local_conf_warnings) - std::fprintf(stderr, "waze-on-cluster: %s\n", w.c_str()); - if (i + 2 == argc && !std::strcmp(argv[i], "run")) - return run(cfg, argv[i + 1]); if (i + 2 == argc && !std::strcmp(argv[i], "bench-pack")) return bench_pack(cfg, argv[i + 1]); usage(); diff --git a/native/waze-on-cluster/src/map_feed.cpp b/native/waze-on-cluster/src/map_feed.cpp index 7314286e..a255acf9 100644 --- a/native/waze-on-cluster/src/map_feed.cpp +++ b/native/waze-on-cluster/src/map_feed.cpp @@ -317,28 +317,6 @@ void MapFeed::set_hud_width(unsigned pct) make_layer(); } -bool MapFeed::set_target(const std::string &name) -{ - const std::string t = name == "sail" ? "map" : name; - uint32_t w, h; - if (client_.connected() && !target_size(client_.targets, t, &w, &h)) - return false; - if (t == cfg_.target && layer_) - return true; - if (layer_) { - keep_newest(); - client_.drop(layer_); - } - layer_ = 0; - cfg_.target = t; - auto host = client_.hosts.find(t); - host_ = host == client_.hosts.end() ? cr::Host() : host->second; - part_ = OutputPart(); /* the next layer's, if any */ - if (client_.connected()) - make_layer(); - return true; -} - void MapFeed::set_guide_hold(bool hold) { cfg_.guide_hold = hold; diff --git a/native/waze-on-cluster/src/map_feed.h b/native/waze-on-cluster/src/map_feed.h index 8a70db21..41b9e7cb 100644 --- a/native/waze-on-cluster/src/map_feed.h +++ b/native/waze-on-cluster/src/map_feed.h @@ -5,8 +5,8 @@ * * One video layer, class content and contending with the stock map, on the * target the map goes to: `map` (the native central-map slot 0x100, whose - * 1088x480 scene the map fills) unless a control start chose another; on a - * whole-panel or HUD target it is the centred map area (map_geometry.h). + * 1088x480 scene the map fills) for the cluster, `hud` for the HUD, where + * it is the centred map area (map_geometry.h). * The renderer draws every frame the way waze-on-cluster always has (one * persistent R8 atlas written in changed tiles, packed fast motion, the * frame clock, newest frame only) within the budget all its clients share, @@ -24,10 +24,10 @@ * held, and goes with the next frame or repeat; when the layer shows again * it goes (or a repeat of the last one sent) before the layer is made * visible, so the renderer never draws an older picture first. A new - * layer (another target) starts from a copy of the old one's newest. A - * layer that scales (the HUD's) keeps the newest picture whole, scales it - * once, at most video.fps a second, and sends a repeat as a repeat of its - * last scaled frame. + * layer (a host taking or dropping the map, a new size) starts from a copy + * of the old one's newest. A layer that scales (the HUD's) keeps the + * newest picture whole, scales it once, at most video.fps a second, and + * sends a repeat as a repeat of its last scaled frame. * * The app's status line follows the stream, the layer and its target: idle * until the first frame or while the stream is not live, idle with kWaiting @@ -164,10 +164,6 @@ class MapFeed { explicit MapFeed(const FeedConfig &cfg); - /* Where the map goes from now on: a renderer target, or "sail" for the - * native central-map slot. False for a name the renderer has not got - * (known once connected). */ - bool set_target(const std::string &name); /* The layer's guide_hold from now on. */ void set_guide_hold(bool hold); const std::string &target() const { return cfg_.target; } diff --git a/native/waze-on-cluster/src/map_feeds.cpp b/native/waze-on-cluster/src/map_feeds.cpp index df48daaa..cfd4f318 100644 --- a/native/waze-on-cluster/src/map_feeds.cpp +++ b/native/waze-on-cluster/src/map_feeds.cpp @@ -6,25 +6,10 @@ namespace woc { -namespace { - -/* The renderer target a cluster target names: "map" ("sail" too) or - * "panel"; empty for anything else (the HUD is its own setting). */ -std::string cluster_target(const std::string &name) -{ - return name == "map" || name == "sail" ? "map" : name == "panel" ? name : std::string(); -} - -} // namespace - MapFeeds::MapFeeds(const FeedConfig &base, bool cluster, bool hud, unsigned hud_fps) : base_(base), hud_fps_(hud_fps), cluster_on_(cluster), hud_on_(hud) { - base_.target = cluster_target(base.target); - if (base_.target.empty()) { - log_error("target %s is not the cluster's (map, panel); using map", base.target.c_str()); - base_.target = "map"; - } + base_.target = "map"; if (base_.hud_width_pct > kHudMaxPct) base_.hud_width_pct = kHudMaxPct; follow(); @@ -73,16 +58,6 @@ void MapFeeds::follow() } } -bool MapFeeds::set_target(const std::string &name) -{ - const std::string t = cluster_target(name); - if (t.empty() || (cluster_ && !cluster_->set_target(t))) - return false; - base_.target = t; - follow(); - return true; -} - void MapFeeds::set_cluster(bool on) { cluster_on_ = on; diff --git a/native/waze-on-cluster/src/map_feeds.h b/native/waze-on-cluster/src/map_feeds.h index 033db49f..92ad6a45 100644 --- a/native/waze-on-cluster/src/map_feeds.h +++ b/native/waze-on-cluster/src/map_feeds.h @@ -3,10 +3,10 @@ /* MapFeeds: the decoded map on the cluster, on the HUD, on both or on * neither, as the two settings say. * - * The cluster's feed (map_feed.h), on `map` (or `panel` from a shell), is - * there while the cluster is on; off, nothing of it exists, so the KOMBI - * shows its own content and no guide hold is asked for. The HUD's is made - * while the HUD is on, beside the cluster's on either target. Off, nothing + * The cluster's feed (map_feed.h), on `map`, is there while the cluster is + * on; off, nothing of it exists, so the KOMBI shows its own content and no + * guide hold is asked for. The HUD's is made while the HUD is on, beside + * the cluster's. Off, nothing * of it exists: no connection, no layer, no thread, no copy. With neither, * wants_frames() is false: the capture decodes without pictures. * @@ -49,9 +49,6 @@ class MapFeeds { * HUD at hud_fps frames a second at most. */ MapFeeds(const FeedConfig &base, bool cluster, bool hud, unsigned hud_fps); - /* Where the cluster's map goes ("map", "sail", "panel"); false (nothing - * changed) for a target the renderer has not got. */ - bool set_target(const std::string &name); /* The cluster and the HUD on or off, each at once. */ void set_cluster(bool on); void set_hud(bool on); @@ -95,7 +92,7 @@ class MapFeeds { MapFeed *hud_feed() { return hud_.get(); } private: - /* The HUD's feed made or dropped to match the setting and the target. */ + /* Each feed made or dropped to match its setting. */ void follow(); /* The HUD's copy of the newest picture, when it is due. */ void feed_hud(int64_t now_ms); diff --git a/native/waze-on-cluster/src/map_state.h b/native/waze-on-cluster/src/map_state.h index b7b820a1..ef96ca5b 100644 --- a/native/waze-on-cluster/src/map_state.h +++ b/native/waze-on-cluster/src/map_state.h @@ -3,11 +3,10 @@ /* Where the map shows and the HUD map's size, place and whether it stays * shown over BMW's pop-ups, as the app chose them: cluster, hud, * hud_width_pct, hud_offset_x, hud_offset_y and hud_keep_shown, which - * patchd saves in map_state_file (key = value lines), a file of its own so - * that waze-on-cluster.local.conf stays one an earlier version of this tool - * starts with. Each valid value replaces the configuration's; one out of - * range, another key or a line that does not read is left out with a - * warning, as is a file that cannot be read. */ + * patchd saves in map_state_file (key = value lines). Each valid value + * replaces the configuration's; one out of range, another key or a line + * that does not read is left out with a warning, as is a file that cannot + * be read. */ #ifndef WOC_MAP_STATE_H #define WOC_MAP_STATE_H diff --git a/native/waze-on-cluster/src/local_conf.cpp b/native/waze-on-cluster/src/opt_in.cpp similarity index 68% rename from native/waze-on-cluster/src/local_conf.cpp rename to native/waze-on-cluster/src/opt_in.cpp index ae2c54f2..fb84fc08 100644 --- a/native/waze-on-cluster/src/local_conf.cpp +++ b/native/waze-on-cluster/src/opt_in.cpp @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-3.0-or-later // Copyright (C) 2026 Robert Nisipeanu -#include "local_conf.h" +#include "opt_in.h" #include @@ -39,31 +39,6 @@ std::string key_of(const std::string &line) } // namespace -void load_local_conf(cld::Config *cfg, const std::string &path, std::vector *warnings) -{ - if (path.empty() || access(path.c_str(), F_OK) != 0) - return; - std::ifstream f(path); - if (!f) { - warnings->push_back(path + ": cannot read it: the shipped settings instead"); - return; - } - std::string line, err; - for (int n = 1; std::getline(f, line); n++) { - const size_t hash = line.find('#'); - if (hash != std::string::npos) - line.erase(hash); - line = trim(line); - if (line.empty()) - continue; - const std::string where = path + ":" + std::to_string(n) + ": "; - if (feature_key(key_of(line))) - warnings->push_back(where + key_of(line) + " is left out: it goes in features_file (patchd moves it there)"); - else if (!cfg->set_pair(line, &err)) - warnings->push_back(where + err + ": left out"); - } -} - void load_features(cld::Config *cfg, const std::string &path) { if (path.empty() || access(path.c_str(), F_OK) != 0) diff --git a/native/waze-on-cluster/src/opt_in.h b/native/waze-on-cluster/src/opt_in.h new file mode 100644 index 00000000..21bb1d17 --- /dev/null +++ b/native/waze-on-cluster/src/opt_in.h @@ -0,0 +1,27 @@ +// SPDX-License-Identifier: GPL-3.0-or-later +// Copyright (C) 2026 Robert Nisipeanu +/* The opt-in settings over the shipped configuration. + * + * features_file (features.conf) holds only the opt-in keys (kFeatureKeys), + * each 0 or 1; a valid value replaces the configuration's; another key, a + * value out of range or a line that does not read is left out with a + * warning, as is a file that cannot be read. Every release up to 0.10.7 + * refuses to start with these keys in its local conf, so they never go + * there (patchd moves any it finds there to features_file). */ +#ifndef WOC_OPT_IN_H +#define WOC_OPT_IN_H + +#include + +#include "config.h" + +namespace woc { + +/* The keys features_file holds. */ +extern const char *const kFeatureKeys[2]; + +void load_features(cld::Config *cfg, const std::string &path); + +} // namespace woc + +#endif diff --git a/native/waze-on-cluster/test/local_conf_test.cpp b/native/waze-on-cluster/test/local_conf_test.cpp deleted file mode 100644 index c980666c..00000000 --- a/native/waze-on-cluster/test/local_conf_test.cpp +++ /dev/null @@ -1,102 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// Copyright (C) 2026 Robert Nisipeanu -/* Host test of the unit's own settings (local_conf.h): local_conf's known - * keys over the shipped configuration's, a key this version does not know - * and a line that does not read left out with a warning, the opt-in keys - * left out there with a warning, a missing local_conf none; features_file's - * valid opt-in values over the configuration's, any other line left out; the - * shipped waze-on-cluster.conf loads, names the file patchd writes and has - * the opt-in keys off. */ -#include - -#include -#include -#include -#include - -#include "config.h" -#include "local_conf.h" - -using namespace woc; - -static int failures; - -static void ok(const char *name, bool cond) -{ - std::printf("%-4s %s\n", cond ? "ok" : "FAIL", name); - if (!cond) failures++; -} - -static cld::Config conf() -{ - cld::Config c; - c.define("target_fps", "30"); - c.define("src_crop", ""); - c.define("hosted_vpp_scale", "0"); - c.define("always_packed", "0"); - return c; -} - -static bool has(const std::vector &w, const std::string &s) -{ - for (const std::string &l : w) - if (l.find(s) != std::string::npos) - return true; - return false; -} - -int main() -{ - const std::string base = "/tmp/woc-local-conf-test-" + std::to_string(getpid()); - const std::string local = base + ".local.conf", feat = base + ".features.conf"; - unlink(local.c_str()); - unlink(feat.c_str()); - - cld::Config c = conf(); - std::vector w; - load_local_conf(&c, local, &w); - ok("no local conf: the configuration's, nothing to warn", c.str("target_fps") == "30" && w.empty()); - - std::ofstream(local) << "# mine\ntarget_fps = 20\nsome_later_key = 7\nhosted_vpp_scale = 1\nalways_packed += 1\n" - "garbage\n \nsrc_crop = 1280x564+0+0 # AA\n"; - c = conf(); - w.clear(); - load_local_conf(&c, local, &w); - ok("an unknown key does not stop the rest: the known keys taken", c.str("target_fps") == "20" && - c.str("src_crop") == "1280x564+0+0"); - ok("the unknown key left out with a warning naming it and its line", - has(w, local + ":3: unknown setting some_later_key")); - ok("a line that does not read left out with a warning", has(w, local + ":6: expected key=value")); - ok("the opt-in keys left out of the local conf, each with a warning", - c.str("hosted_vpp_scale") == "0" && c.str("always_packed") == "0" && - has(w, ":4: hosted_vpp_scale is left out") && has(w, ":5: always_packed is left out")); - ok("four warnings, one a line", w.size() == 4); - - c = conf(); - load_features(&c, feat); - ok("no features file: the opt-in keys off", c.str("hosted_vpp_scale") == "0" && c.str("always_packed") == "0"); - std::ofstream(feat) << "hosted_vpp_scale = 1\nalways_packed += 1 # on\n"; - c = conf(); - load_features(&c, feat); - ok("the features file's values (= and +=), over the configuration's", c.str("hosted_vpp_scale") == "1" && c.str("always_packed") == "1"); - std::ofstream(feat) << "hosted_vpp_scale = 2\nalways_packed = yes\ntarget_fps = 5\ngarbage\nalways_packed=1\n"; - c = conf(); - load_features(&c, feat); - ok("out of range, another key or a line that does not read: left out, the rest taken", - c.str("hosted_vpp_scale") == "0" && c.str("always_packed") == "1" && c.str("target_fps") == "30"); - unlink(local.c_str()); - unlink(feat.c_str()); - - /* The shipped conf: what main() loads strictly before local_conf. */ - cld::Config shipped; - shipped.define("hosted_vpp_scale", ""); - shipped.define("always_packed", ""); - shipped.define("features_file", ""); - shipped.extra_keys = [](const std::string &) { return true; }; - std::string err; - ok("shipped: waze-on-cluster.conf reads", shipped.load("waze-on-cluster.conf", &err)); - ok("shipped: features_file is the file patchd writes", shipped.str("features_file") == "/var/opt/waze-on-cluster/features.conf"); - ok("shipped: the opt-in keys off", shipped.str("hosted_vpp_scale") == "0" && shipped.str("always_packed") == "0"); - std::printf(failures ? "%d FAILED\n" : "all ok\n", failures); - return failures ? 1 : 0; -} diff --git a/native/waze-on-cluster/test/map_feed_test.cpp b/native/waze-on-cluster/test/map_feed_test.cpp index 896f83d9..726e7013 100644 --- a/native/waze-on-cluster/test/map_feed_test.cpp +++ b/native/waze-on-cluster/test/map_feed_test.cpp @@ -9,8 +9,6 @@ * - the stock map taking the slot shows as starting with that reason; the * contending map asks again, parks behind it, takes it over and is shown, * the stock map parked behind it; - * - a control start moves it to the whole panel, centred at 416,120, and an - * unknown target is refused; * - frames stopping: idle after stall_ms, the slot released; * - the renderer restarting: starting while it is gone, an error once it * stays gone 15 s, then the map again with the next frames; @@ -465,11 +463,6 @@ static void only_what_is_needed() r.pump(3000, &f2); r.drawing("map", f2, &drawn); ok("the renderer restarted: repeats alone bring the picture back", r.st().state == "showing" && drawn); - - ok("another target", r.feed->set_target("panel")); - r.pump(1500, &f2); - r.drawing("panel", f2, &drawn); - ok("another target: repeats alone bring the picture", r.st().state == "showing" && r.st().target == "panel" && drawn); } /* The w x h part at x, y of a 1088x480 atlas, as an atlas of its own. */ @@ -1022,20 +1015,6 @@ int main() } ok("frames faster than the writes: the newest is drawn", newest && !stale); - ok("an unknown target is refused", !r.feed->set_target("cockpit")); - ok("a control start moves the map to the whole panel", r.feed->set_target("panel")); - r.pump(1200, &f3); - l = r.map_layer(); - ok("centred in the 1920x720 panel at 416,120, showing", - l && l->target() == 1 && l->params.rect.x == 416 && l->params.rect.y == 120 && l->params.rect.w == 1088 && - r.st().state == "showing" && r.st().target == "panel"); - r.pump(1600); - ok("the map target, no longer wanted, is released after its linger", - r.port.releases >= 1 && !r.port.row(0x100, 0x010004f0)); - r.feed->set_target("sail"); - r.pump(1200, &f3); - ok("sail is the map slot", r.map_layer() && r.map_layer()->target() == 0 && r.st().state == "showing"); - const int releases = r.port.releases; r.pump(6100); ok("frames stop: idle after stall_ms", r.st().state == "idle"); @@ -1368,15 +1347,6 @@ int main() feeds.status("decode").hud_state == "showing"); } - ok("start: the HUD alone is no cluster target", !feeds.set_target("hud") && feeds.cluster()->target() == "map"); - ok("start: panel keeps the HUD's feed", feeds.set_target("panel") && feeds.hud_feed()); - bpump(2500, &f2); - ok("on panel: the panel and the HUD both shown, each with the map", - layer_on(1) && layer_on(2) && shown_r8("panel", f2) && feeds.status("decode").hud_state == "showing" && - b.svc->slots().status(1).state == crs::TargetState::Shown && - b.svc->slots().status(2).state == crs::TargetState::Shown); - ok("start: back on map, the HUD's feed kept", feeds.set_target("map") && feeds.hud_feed()); - bpump(2500, &f2); /* ---- the HUD map's size ---- */ const crs::Layer *hl = layer_on(2); diff --git a/native/waze-on-cluster/test/opt_in_test.cpp b/native/waze-on-cluster/test/opt_in_test.cpp new file mode 100644 index 00000000..f71bfadd --- /dev/null +++ b/native/waze-on-cluster/test/opt_in_test.cpp @@ -0,0 +1,84 @@ +// SPDX-License-Identifier: GPL-3.0-or-later +// Copyright (C) 2026 Robert Nisipeanu +/* Host test of the opt-in settings (opt_in.h): features_file's valid + * opt-in values over the configuration's, any other line left out, a + * missing file none; the shipped waze-on-cluster.conf loads, names the file + * patchd writes, has the opt-in keys off and sets neither local_conf nor + * target. */ +#include + +#include +#include +#include +#include + +#include "config.h" +#include "opt_in.h" + +using namespace woc; + +static int failures; + +static void ok(const char *name, bool cond) +{ + std::printf("%-4s %s\n", cond ? "ok" : "FAIL", name); + if (!cond) failures++; +} + +static cld::Config conf() +{ + cld::Config c; + c.define("target_fps", "30"); + c.define("hosted_vpp_scale", "0"); + c.define("always_packed", "0"); + return c; +} + +/* A key some line of the file sets, as Config::load reads it. */ +static bool sets(const std::string &path, const std::string &key) +{ + std::ifstream f(path); + std::string line; + while (std::getline(f, line)) { + line = line.substr(0, line.find('#')); + std::istringstream words(line); + std::string first; + if (words >> first && (first == key || first.rfind(key + "=", 0) == 0 || first.rfind(key + "+=", 0) == 0)) + return true; + } + return false; +} + +int main() +{ + const std::string feat = "/tmp/woc-opt-in-test-" + std::to_string(getpid()) + ".conf"; + unlink(feat.c_str()); + + cld::Config c = conf(); + load_features(&c, feat); + ok("no features file: the opt-in keys off", c.str("hosted_vpp_scale") == "0" && c.str("always_packed") == "0"); + std::ofstream(feat) << "hosted_vpp_scale = 1\nalways_packed += 1 # on\n"; + c = conf(); + load_features(&c, feat); + ok("the features file's values (= and +=), over the configuration's", c.str("hosted_vpp_scale") == "1" && c.str("always_packed") == "1"); + std::ofstream(feat) << "hosted_vpp_scale = 2\nalways_packed = yes\ntarget_fps = 5\ngarbage\nalways_packed=1\n"; + c = conf(); + load_features(&c, feat); + ok("out of range, another key or a line that does not read: left out, the rest taken", + c.str("hosted_vpp_scale") == "0" && c.str("always_packed") == "1" && c.str("target_fps") == "30"); + unlink(feat.c_str()); + + /* The shipped conf: the only configuration file main() loads. */ + cld::Config shipped; + shipped.define("hosted_vpp_scale", ""); + shipped.define("always_packed", ""); + shipped.define("features_file", ""); + shipped.extra_keys = [](const std::string &) { return true; }; + std::string err; + ok("shipped: waze-on-cluster.conf reads", shipped.load("waze-on-cluster.conf", &err)); + ok("shipped: features_file is the file patchd writes", shipped.str("features_file") == "/var/opt/waze-on-cluster/features.conf"); + ok("shipped: the opt-in keys off", shipped.str("hosted_vpp_scale") == "0" && shipped.str("always_packed") == "0"); + ok("shipped: no local_conf, no target", !sets("waze-on-cluster.conf", "local_conf") && !sets("waze-on-cluster.conf", "target")); + std::printf(failures ? "%d FAILED\n" : "all ok\n", failures); + return failures ? 1 : 0; +} diff --git a/native/waze-on-cluster/waze-on-cluster.conf b/native/waze-on-cluster/waze-on-cluster.conf index 903f86ed..a691e363 100644 --- a/native/waze-on-cluster/waze-on-cluster.conf +++ b/native/waze-on-cluster/waze-on-cluster.conf @@ -1,18 +1,14 @@ # SPDX-License-Identifier: GPL-3.0-or-later # Copyright (C) 2026 Robert Nisipeanu # waze-on-cluster settings. Values shown are the built-in defaults; any key can -# also be given on the command line as -s key=value. The unit's own settings go -# in local_conf, which updates keep; each key there replaces the value here. -# A key local_conf has that this version does not know, or a line that does -# not read, is left out with a warning in the log. +# also be given on the command line as -s key=value. Each install writes this +# file anew. Besides it and the command line, the service reads only the +# app's saved choices (state_file, map_state_file) and features_file. # "CAR-ONLY" marks values only a SOME/IP trace or a live CarPlay session on the # unit can settle. -local_conf = /var/opt/waze-on-cluster/waze-on-cluster.local.conf -# The opt-in keys hosted_vpp_scale and always_packed (below) go in this -# file, one "key = 1" line each, never in local_conf: no earlier version -# reads it, so every version starts with them set. Each valid value (0 or 1) -# replaces the one here; another line is left out with a warning. Found in -# local_conf they are left out, and patchd moves them here. +# The opt-in keys hosted_vpp_scale and always_packed (below), one "key = 0|1" +# line each. Each valid value replaces the one here; any other line is left +# out with a warning. features_file = /var/opt/waze-on-cluster/features.conf # --- control socket --------------------------------------------------------- @@ -83,11 +79,10 @@ tex_size = 1088x480 # Auto patch's picture with the turn card shown (PATCH.md "Android Auto"); # with it hidden, patchd passes its crop on the command line. src_crop = 1280x720:0,0,1280,564 -# Where the map is drawn in its target, "X,Y,W,H" in the target's pixels from -# its top-left (map: the 1088x480 slot), whichever target is current. The map -# is stretched to the rect, whatever its shape. Empty: the whole map area. One -# outside the target, or a value that cannot be used, is ignored, with a -# warning. +# Where the map is drawn in the cluster's map slot, "X,Y,W,H" in the slot's +# pixels from its top-left (1088x480). The map is stretched to the rect, +# whatever its shape. Empty: the whole map area. One outside the slot, or a +# value that cannot be used, is ignored, with a warning. map_rect = # Each Y, U and V level rounded to the nearest multiple of 2^bits as the # decoder packs the frame (0-3): at most 2^(bits-1) levels off, with 0, 128 @@ -139,11 +134,6 @@ dirty_settle_ms = 1000 # which owns the RAMSES participant, the DCSM slots, the scene ids and the one # upload budget all its clients share (its cluster-render.conf). render_socket = /dev/shm/cluster-render/render.sock -# Where the map goes on the cluster: "map" (the native central-map slot -# 0x100, whose 1088x480 scene the map fills under the gauges) or "panel" (the -# whole cluster, the map centred). A control start changes it until the -# service restarts. -target = map # 1: BMW's turn-by-turn box on the cluster stays hidden while the map shows # (the map layer's guide_hold; cluster-render README "Guide hold"); 0: it # shows. The app's switch keeps its choice in state_file, which replaces @@ -152,7 +142,8 @@ target = map hide_bmw_guidance = 1 state_file = /var/opt/waze-on-cluster/state/waze-on-cluster.state.conf # --- where the map shows ------------------------------------------------------------ -# cluster = 1: the map on the cluster (target above); 0: no map scene there, +# cluster = 1: the map on the cluster, in its central-map slot (0x100, whose +# 1088x480 scene the map fills under the gauges); 0: no map scene there, # so the KOMBI shows its own content and no guide hold is asked for. # hud = 1 (experimental): the map on the HUD too, or alone (cluster-render's # `hud` target, slot 0x323), at most hud_fps frames a second, each scaled on @@ -164,8 +155,7 @@ state_file = /var/opt/waze-on-cluster/state/waze-on-cluster.state.conf # {"cmd":"cluster"|"hud","on":"0"|"1"} changes the running one at once. # map_state_file holds what the app saved of cluster, hud, hud_width_pct, # hud_offset_x, hud_offset_y and hud_keep_shown (patchd writes it; each valid value replaces -# the one here), so they stay out of local_conf, which waze-on-cluster 0.8 -# refuses to start with. patchd moves any it finds in local_conf there. +# the one here). map_state_file = /var/opt/waze-on-cluster/map.state.conf cluster = 1 hud = 0