mirror of
https://github.com/charlesvestal/fm1-x0x.git
synced 2026-12-05 12:24:35 +01:00
M-VAVE's M-UPGRADE 3.11.0318 (built 2026-11-03) checks the identity a device answers to its 0x11 handshake
against [^_\t\r\n]+_[0-9]{1,3} and refuses a longer one ("Invalid device identity", then "A USB MIDI device is
present but did not answer"). Every X0X release is FM-1_9 + XXYYZZ (1.2.0: FM-1_9010200), so M-UPGRADE found
none of them, and nobody could go back to the stock firmware with it.
firmware/src/ota.c, as felucca-bsp's chip/ota.c (41a6e86): ota_reply_identity(full) cuts the plain answer
("FM-1_9010200" -> "FM-1_901"; three digits or fewer stay) and ota_hs tells the plain query from the one with
the one-byte body 01, which gets the whole identity; ota_read answers both between reads as ota_service does.
The update loader (FELUCCA_LOADER) answers the plain query only, with its whole identity ("ota-FM-1_900" passes).
tools/fm1_install.py, web/fm1ota.js, web/backup/index.html, as fm1-base's (3c4a57e): HS_FULL; the handshake asks
with it when the plain answer is NAME_ and three digits (not a loader), and keeps the plain answer when nothing
answers in 0.6 s (M-VAVE's firmware, older builds), so the check after an install and the backup page's X0X
check still see the whole identity. The identity's text is read up to its first zero (felucca-bsp#29 puts the
flash's JEDEC id in bytes 24..26). The installer page, the landing page and the manual: M-UPGRADE 3.11 finds
this version, not older ones (docs/manual.html regenerated, with the PING WIDTH sentence it lacked).
Tests: tests/ota_hs_test.c (felucca-bsp's tests/ota_test.c: a release's identity, a dev build's, the loader;
run_tests.sh's ota-hs-*), ota_test.c (a release's identity: FM-1_901 to the plain query, the whole to 01),
install_test.py, tests/host/installer_hs_test.mjs (fm1-base's: the web handshake against releases and dev
builds with and without the fix, M-VAVE's firmware, the loader, #29's bytes), backup_page_test.mjs,
x0x_backup_test.py's delays. LICENSING.md: the two test files, MPL-2.0.
The scheme is PERF-1's (deamonSLINKY/PERF-1 775106b), so its installers and ours read each other's firmwares.
276 lines
18 KiB
HTML
276 lines
18 KiB
HTML
<!doctype html>
|
||
<!-- SPDX-License-Identifier: GPL-3.0-only
|
||
Copyright (C) 2026 Leo Kuroshita (@kurogedelic), Hügelton Instruments
|
||
X0X: Felucca's installer page (web/index_pkg.html), branded for X0X, English first, no editor.
|
||
tools/make_pages.py inlines fm1pkg.js and fm1ota.js and the package's metadata. -->
|
||
<html lang="en">
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||
<title>Install · X0X</title>
|
||
<style>
|
||
:root { --bg: #fff; --fg: #000; --dim: #6b6b6b; }
|
||
@media (prefers-color-scheme: dark) {
|
||
:root:not([data-theme="light"]) { --bg: #000; --fg: #fff; --dim: #888; }
|
||
}
|
||
:root[data-theme="dark"] { --bg: #000; --fg: #fff; --dim: #888; }
|
||
body { margin: 0; background: var(--bg); color: var(--fg);
|
||
font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif; }
|
||
main { max-width: 520px; margin: 0 auto; padding: 48px 16px; }
|
||
h1 { font-size: 24px; font-weight: 600; margin: 0 0 24px; }
|
||
.lang { float: right; font-size: 13px; color: var(--dim); cursor: pointer; text-decoration: underline; background: none; padding: 0; color: var(--dim); }
|
||
p { margin: 0 0 16px; }
|
||
button { font: inherit; background: var(--fg); color: var(--bg); border: 0; padding: 8px 20px; cursor: pointer; }
|
||
button:disabled { opacity: .3; cursor: default; }
|
||
#status { margin-top: 16px; min-height: 1.6em; }
|
||
.small { color: var(--dim); font-size: 13px; }
|
||
progress { width: 100%; height: 4px; margin-top: 16px; }
|
||
pre { color: var(--dim); font-size: 12px; white-space: pre-wrap; margin-top: 16px; }
|
||
h2 { font-size: 18px; font-weight: 600; margin: 40px 0 12px; }
|
||
ol { margin: 0 0 16px; padding-left: 20px; }
|
||
input[type=file] { font: inherit; font-size: 13px; color: var(--dim); max-width: 100%; }
|
||
.home { display: inline-block; font-weight: 700; letter-spacing: .03em; color: var(--dim); text-decoration: none; margin: 0 0 12px; }
|
||
.home:hover, .home:focus-visible { color: var(--fg); }
|
||
:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }
|
||
#alert { font-weight: 600; }
|
||
#alert:empty { display: none; }
|
||
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
|
||
</style>
|
||
</head>
|
||
<body>
|
||
<main>
|
||
<button class="lang" id="lang"></button>
|
||
<a class="home" href="../">X0X</a>
|
||
<h1>Install X0X</h1>
|
||
<p data-t="intro"></p>
|
||
<p data-t="warn"></p>
|
||
<p class="small" data-t="direct"></p>
|
||
<p class="small" data-t="untested"></p>
|
||
<p class="small" data-t="beta"></p>
|
||
<p class="small"><span data-t="brick"></span>
|
||
<a href="../manual/#recovering-an-fm-1-that-won-t-start" style="color:inherit" data-t="bricklink"></a></p>
|
||
<p class="small" data-t="back"></p>
|
||
<p class="small"><a href="https://www.m-vave.com/download" target="_blank" rel="noopener" style="color:inherit">www.m-vave.com/download<span class="sr" data-t="newtab"></span></a></p>
|
||
<p><button id="go" disabled data-t="install"></button></p>
|
||
<progress id="bar" max="100" value="0" data-t-label="progress"></progress>
|
||
<p id="status" role="status"></p>
|
||
<p id="alert" role="alert"></p>
|
||
<pre id="log"></pre>
|
||
<h2 data-t="stockh"></h2>
|
||
<p class="small" data-t="stockwhy"></p>
|
||
<p class="small"><span data-t="keep"></span> <a href="../backup/" style="color:inherit" data-t="keeplink"></a></p>
|
||
<ol class="small">
|
||
<li><span data-t="stock1"></span> <a id="stocklink" href="https://yms-file-store.oss-cn-hongkong.aliyuncs.com/software/firmware/FM-1.fwsc" style="color:inherit">FM-1.fwsc</a> (V16)<br><span data-t="stock1b"></span> <a id="stocklink15" href="https://web.archive.org/web/20261009203224id_/https://yms-file-store.oss-cn-hongkong.aliyuncs.com/software/firmware/FM-1.fwsc" style="color:inherit">FM-1.fwsc</a> (V15)</li>
|
||
<li><label for="stockfile" data-t="stock2"></label><br><input type="file" id="stockfile" accept=".fwsc"></li>
|
||
<li data-t="stock3"></li>
|
||
</ol>
|
||
<p><button id="stockgo" disabled data-t="stockinstall"></button></p>
|
||
<p><a href="../manual/" style="color:inherit" data-t="manual"></a></p>
|
||
<p class="small">X0X is built on Felucca by Leo Kuroshita (@kurogedelic), <a href="https://hugelton.com" target="_blank" rel="noopener" style="color:inherit">Hügelton Instruments<span class="sr" data-t="newtab"></span></a>,
|
||
with the 909 from 9W9 and ER-99, the 808 from 8W8, the 303 from schwung-303 (Open303), TB-3PO, and BB Gen's break generator. The manual's Credits list them all.<br>
|
||
Fonts: Barlow Semi Condensed and Terminus (SIL OFL 1.1). M-VAVE and FM-1 are trademarks of their respective owners.<br>
|
||
<span data-t="license"></span> <a href="https://github.com/charlesvestal/fm1-x0x" target="_blank" rel="noopener" style="color:inherit">github.com/charlesvestal/fm1-x0x<span class="sr" data-t="newtab"></span></a></p>
|
||
</main>
|
||
<script type="module">
|
||
/*LIB*/
|
||
const $ = (id) => document.getElementById(id);
|
||
const TEXT = {
|
||
ja: {
|
||
intro: "FM-1 を USB で接続してください。(Chrome か Edge で使えます)",
|
||
warn: "書き込み中は USB を抜かないでください。",
|
||
install: "インストール", other: "English",
|
||
manual: "マニュアル(英語)",
|
||
untested: "X0X はベータ版です。FM-1 で動作しますが、全パートを同時に密に鳴らすと処理が追いつかないことがあります。",
|
||
direct: "USB ケーブルはパソコンに直接つないでください。Probe や Transporter などの機材は不要です。",
|
||
brick: "万一 FM-1 が起動しなくなった場合は、Mac から標準ファームウェアに戻せます:",
|
||
bricklink: "起動しない FM-1 の復旧(マニュアル)",
|
||
beta: "これはベータ版で、不安定な場合があります。このカスタムファームウェアを使ったことで FM-1 が壊れたり不具合が起きたりしても、作者は一切の責任を負いません。自己責任でお使いください。",
|
||
back: "公式ファームウェアに戻すには、このページ下の「純正ファームウェアに戻す」か、M-VAVE 公式のアップデーター M-UPGRADE(Downloads → PC Software → M-UPGRADE)を使います。M-UPGRADE 3.11 はこのページのバージョンを見つけますが、それより古いバージョンは見つけられません(「A USB MIDI device is present but did not answer」と表示されます)。その場合はこのページ下のボタンを使ってください。",
|
||
stockh: "純正ファームウェアに戻す",
|
||
stockwhy: "M-VAVE の FM-1 ファームウェア(V15 または V16)を、X0X(またはそのセーフモード)から同じ USB ケーブルで書き込みます。X0X で保存したパターンは消えることがあります。",
|
||
keep: "他のファームウェアを入れると、X0X のプロジェクトは消えます。先にファイルに保存しておけます:",
|
||
keeplink: "プロジェクトのバックアップ",
|
||
stock1: "M-VAVE の FM-1 ファームウェアをダウンロード:",
|
||
stock1b: "FM-1 が受け付けない場合は V15(Internet Archive):",
|
||
stock2: "ダウンロードしたファイルを選ぶ:",
|
||
stock3: "FM-1 を USB で接続し、下のボタンを押す。",
|
||
stockinstall: "純正ファームウェアを書き込む",
|
||
stockok: "M-VAVE の FM-1 ファームウェア({V})です。ボタンを押してください。",
|
||
stockbad: "これは M-VAVE の FM-1 V15 / V16 のファイルではありません。上のリンクのファイルを選んでください。",
|
||
stockhead: "何も書き込まれていません。FM-1 は、すでに入っているブートローダーと同じバージョンしか受け付けません。もう一方のファイル(V15 または V16)を選んで、もう一度ボタンを押してください。",
|
||
stockdone: "完了。FM-1 は純正ファームウェアで起動しました。",
|
||
nomidi: "このブラウザでは使えません。Chrome か Edge で開いてください。", loadfail: "読み込めませんでした: ",
|
||
start: "開始します", verify: "確認中", loader: "書き込みモードに切り替え中", write: "書き込み中",
|
||
reboot: "再起動中", done: "完了しました", stopped: "途中で止まりました。USB を挿し直してもう一度押してください。",
|
||
error: "エラー: ",
|
||
denied: "MIDI(SysEx)の使用が許可されませんでした。アドレスバーのサイト設定で MIDI を許可して、もう一度押してください。",
|
||
notfound: "FM-1 が見つかりません。USB ケーブル(データ通信用か)を確かめ、MIDI を使う他のアプリを閉じてから、もう一度押してください。",
|
||
model: "接続されている機器は FM-1 ではありません。",
|
||
lost: "USB の接続が切れました。挿し直してもう一度押してください。",
|
||
noloader: "書き込みモードの FM-1 が見つかりません。USB を挿し直してもう一度押してください(終わるまで書き込みモードのままです)。",
|
||
noreturn: "FM-1 が戻ってきません。電源を入れ直してください。",
|
||
mismatch: "書き込みは終わりましたが、FM-1 が別のバージョンを報告しています: ",
|
||
badpkg: "インストールするファイルが壊れています。ページを再読み込みしてください。",
|
||
leave: "書き込み中です。ページを閉じないでください。",
|
||
license: "GPL-3.0、無保証。ソース:",
|
||
newtab: "(新しいタブで開きます)", progress: "書き込みの進み具合", percent: "%",
|
||
},
|
||
en: {
|
||
intro: "Connect the FM-1 by USB. (Works in Chrome or Edge.)",
|
||
warn: "Do not unplug the USB cable while writing.",
|
||
install: "Install", other: "日本語",
|
||
manual: "The manual",
|
||
untested: "X0X is a beta. It runs on the FM-1, but every part playing a dense pattern at once can still overload it.",
|
||
direct: "Connect the USB cable directly to the computer. No probe or Transporter is needed.",
|
||
brick: "If the FM-1 no longer starts, a Mac can put the stock firmware back:",
|
||
bricklink: "recovering an FM-1 that won't start (manual)",
|
||
beta: "This is a beta and may be unstable. The author accepts no responsibility if your FM-1 is damaged or misbehaves because of this custom firmware. Use it at your own risk.",
|
||
back: "To go back to the official firmware, use \"Back to the stock firmware\" below, or M-VAVE's own updater, M-UPGRADE (Downloads → PC Software → M-UPGRADE). M-UPGRADE 3.11 finds the version on this page, not older ones (it says \"A USB MIDI device is present but did not answer\"): use the button below for those.",
|
||
stockh: "Back to the stock firmware",
|
||
stockwhy: "This writes M-VAVE's own FM-1 firmware (V15 or V16) back, from X0X (or its safe mode, or Felucca) over the same USB cable. Patterns saved in X0X may be lost.",
|
||
keep: "Installing other firmware replaces X0X's project. To keep it, save it to a file first:",
|
||
keeplink: "back up your project",
|
||
stock1: "Download M-VAVE's FM-1 firmware:",
|
||
stock1b: "If the FM-1 doesn't take it, V15 (Internet Archive):",
|
||
stock2: "Choose the file you downloaded:",
|
||
stock3: "Connect the FM-1 by USB and press the button below.",
|
||
stockinstall: "Install the stock firmware",
|
||
stockok: "That is M-VAVE's FM-1 {V}. Press the button to install it.",
|
||
stockbad: "That is not M-VAVE's FM-1 V15 or V16 file. Choose a file from the links above.",
|
||
stockhead: "Nothing was written. The FM-1 takes only the version whose bootloader it already has: choose the other file (V15 or V16) and press the button again.",
|
||
stockdone: "Done. The FM-1 has restarted with its original firmware.",
|
||
nomidi: "This browser cannot do it. Open the page in Chrome or Edge.", loadfail: "Could not load: ",
|
||
start: "Starting", verify: "Verifying", loader: "Switching to update mode", write: "Writing",
|
||
reboot: "Restarting", done: "Done", stopped: "Stopped. Replug the USB cable and press Install again.",
|
||
error: "Error: ",
|
||
denied: "MIDI (SysEx) access was not allowed. Allow MIDI in the site settings (address bar) and press Install again.",
|
||
notfound: "FM-1 not found. Check the USB cable (a data cable), close other apps that use MIDI, and press Install again.",
|
||
model: "The connected device is not an FM-1.",
|
||
lost: "The USB connection was lost. Replug it and press Install again.",
|
||
noloader: "The FM-1 in update mode was not found. Replug the USB cable and press Install again (it stays in update mode until it is finished).",
|
||
noreturn: "The FM-1 did not come back. Power-cycle it.",
|
||
mismatch: "Written, but the FM-1 reports another version: ",
|
||
badpkg: "The file to install is damaged. Reload the page.",
|
||
leave: "Writing. Do not close the page.",
|
||
license: "GPL-3.0, no warranty. Source:",
|
||
newtab: " (opens in a new tab)", progress: "Install progress", percent: " percent",
|
||
},
|
||
};
|
||
let lang = "en"; /* X0X: English first (the manual is English); 日本語 is a click away */
|
||
let stockV = ""; /* the stock version chosen: {V} in the texts */
|
||
const t = (k) => (TEXT[lang][k] || "").replace("{V}", stockV);
|
||
let lastKey = null, lastArg = "";
|
||
function applyLang() {
|
||
document.documentElement.lang = lang;
|
||
document.querySelectorAll("[data-t]").forEach((e) => { e.textContent = t(e.dataset.t); });
|
||
document.querySelectorAll("[data-t-label]").forEach((e) => e.setAttribute("aria-label", t(e.dataset.tLabel)));
|
||
$("lang").textContent = t("other");
|
||
$("lang").lang = lang === "ja" ? "en" : "ja";
|
||
if (lastKey) show(t(lastKey) + lastArg, FAILS.has(lastKey));
|
||
}
|
||
$("lang").addEventListener("click", () => { lang = lang === "ja" ? "en" : "ja"; applyLang(); });
|
||
applyLang();
|
||
/* the step in words in a status region (polite), a failure in an alert; progress at most every 2 s or 10 percent */
|
||
const FAILS = new Set(["nomidi", "loadfail", "stopped", "error", "denied", "notfound", "model", "lost", "noloader", "noreturn",
|
||
"mismatch", "badpkg", "stockbad", "stockhead"]);
|
||
function show(txt, fail) {
|
||
$(fail ? "status" : "alert").textContent = "";
|
||
$(fail ? "alert" : "status").textContent = txt;
|
||
}
|
||
const sayK = (k, arg = "") => { lastKey = k; lastArg = arg; shown = { k, at: performance.now(), pct: -100 }; show(t(k) + arg, FAILS.has(k)); };
|
||
const say = (txt) => { lastKey = null; show(txt, false); };
|
||
let shown = { k: null, at: 0, pct: -100 };
|
||
function sayPct(k, pct) {
|
||
const now = performance.now();
|
||
if (shown.k === k && now - shown.at < 2000 && pct - shown.pct < 10) return;
|
||
lastKey = k; lastArg = `, ${Math.floor(pct)}${t("percent")}`;
|
||
shown = { k, at: now, pct };
|
||
show(t(k) + lastArg, false);
|
||
}
|
||
const log = (t) => { $("log").textContent += t + "\n"; };
|
||
let image = null;
|
||
const meta = /*META*/;
|
||
|
||
let writing = false;
|
||
window.addEventListener("beforeunload", (e) => { if (writing) { e.preventDefault(); e.returnValue = t("leave"); } });
|
||
|
||
(async () => {
|
||
if (!navigator.requestMIDIAccess) { sayK("nomidi"); return; }
|
||
try {
|
||
const r = await fetch(meta.pkg);
|
||
if (!r.ok) throw new Error(`${meta.pkg}: HTTP ${r.status}`);
|
||
const pkg = new Uint8Array(await r.arrayBuffer());
|
||
if (productOf(pkg) !== meta.product) { sayK("badpkg"); return; }
|
||
image = logicalImage(pkg);
|
||
say(`X0X ${meta.version}`);
|
||
$("go").disabled = false;
|
||
} catch (e) { sayK("loadfail", e.message); }
|
||
})();
|
||
|
||
/* stock firmware: M-VAVE's FM-1 V15 or V16, chosen by the user (M-VAVE's server allows no cross-site
|
||
download) and checked against its SHA-256 before anything is written. The FM-1 takes only the one whose
|
||
flash head it has (firmware/src/ota.c: M-VAVE's loader rewrites the head; M-UPGRADE gives V16 its own) */
|
||
const STOCK = {
|
||
"db1642b2b6fa5c2cccb11ffd13878068bb28601678d3644049f99dc40e7edb8a": "V15",
|
||
"d017fb65e70aca97ee29d944470c3515a74581df5c0576bf70de917c7b2b61d5": "V16",
|
||
};
|
||
let stock = null;
|
||
$("stockfile").addEventListener("change", async (e) => {
|
||
stock = null;
|
||
$("stockgo").disabled = true;
|
||
const f = e.target.files && e.target.files[0];
|
||
if (!f) return;
|
||
try {
|
||
const raw = new Uint8Array(await f.arrayBuffer());
|
||
const hex = [...new Uint8Array(await crypto.subtle.digest("SHA-256", raw))].map((b) => b.toString(16).padStart(2, "0")).join("");
|
||
if (!STOCK[hex]) { sayK("stockbad"); return; }
|
||
stock = { image: logicalImage(raw), product: productOf(raw) };
|
||
$("stockgo").disabled = writing;
|
||
stockV = STOCK[hex];
|
||
sayK("stockok");
|
||
} catch (err) { sayK("error", err && err.message); }
|
||
});
|
||
|
||
async function run(img, product, isStock) {
|
||
let midi;
|
||
try { midi = await navigator.requestMIDIAccess({ sysex: true }); }
|
||
catch (e) { sayK("denied"); return; }
|
||
writing = true;
|
||
$("go").disabled = $("stockgo").disabled = true;
|
||
try {
|
||
const up = new Updater(midi, log);
|
||
const total = 74 + 1167;
|
||
const step = (k, a) => {
|
||
log(`${k} ${a ?? ""}`);
|
||
if (k === "start") sayK("start");
|
||
if (k === "verify") { $("bar").value = (a / total) * 100; sayPct("verify", $("bar").value); }
|
||
if (k === "loader") sayK("loader");
|
||
if (k === "write") { $("bar").value = ((74 + a) / total) * 100; sayPct("write", $("bar").value); }
|
||
if (k === "reboot") sayK("reboot");
|
||
if (k === "done") { $("bar").value = 100; sayK(isStock ? "stockdone" : "done"); }
|
||
};
|
||
const ota = await up.find((id) => /^ota-/i.test(id.model));
|
||
if (ota) {
|
||
ota.link.close();
|
||
sayK((await up.resume(img, step)) ? (isStock ? "stockdone" : "done") : "stopped");
|
||
} else {
|
||
await up.install(img, product, step);
|
||
}
|
||
} catch (e) {
|
||
if (isStock && e && e.code === "mismatch") { $("bar").value = 100; sayK("stockdone"); } /* stock names itself its own way */
|
||
else if (isStock && e && e.code === "stopped" && e.step === 1) sayK("stockhead"); /* the other version's head */
|
||
else if (e && e.code && TEXT[lang][e.code]) sayK(e.code, e.detail || "");
|
||
else sayK("error", e && e.message);
|
||
log(String(e && e.stack || e));
|
||
}
|
||
writing = false;
|
||
$("go").disabled = !image;
|
||
$("stockgo").disabled = !stock;
|
||
}
|
||
|
||
$("go").addEventListener("click", () => run(image, meta.product, false));
|
||
$("stockgo").addEventListener("click", () => { if (stock) run(stock.image, stock.product, true); });
|
||
</script>
|
||
</body>
|
||
</html>
|