Skip to content

Machine: Digitone II development link, stage two (panel keys and encoders over USB MIDI) - #1817

Open
prodbysmolec wants to merge 39 commits into
repeat98:base/digitone-ii-nextfrom
prodbysmolec:machine/digitone-ii-link-keys
Open

prodbysmolec wants to merge 39 commits into
repeat98:base/digitone-ii-nextfrom
prodbysmolec:machine/digitone-ii-link-keys

Conversation

@prodbysmolec

@prodbysmolec prodbysmolec commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator
  • What was wrong or hard: Piece 4 of the Digitone II goal: an agent could read a Digitone II over USB (Machine: Digitone II development link, stage one (read-only diagnostics over USB MIDI) #1763) but not drive it, so every test needed a hand on the unit. The Rytm's link drives its unit with keys and encoders; the Digitone II had none of the addresses that needs. Builds on Machine: Digitone II development link, stage one (read-only diagnostics over USB MIDI) #1763 (this branch holds its commits): please review it after Machine: Digitone II development link, stage one (read-only diagnostics over USB MIDI) #1763.
  • What this changes: Development bases only (base.json's dev). link.c gets the Rytm link's key, enc, release and disarm, posted on the UI task's queue as the panel's messages are (getter 0x4013747a, queue_put 0x40001896), so the UI loop plays them through the core's ev_key/ev_enc sites and stock. A key the link holds reads as held to stock's is_key_held (0x4011fac4, a 6-byte site checked by SHA-256, pointed at mw_link_held). The arm is SETTINGS > REMOTE CTRL (a row through the core's core_additem), ON at every boot; a press or turn from a person refuses the host for about three seconds and lets go of what it held. ident adds armed, person, presses by a person, posted and refused. The host gets press, hold, let, turn, release and disarm with the panel's key names; LINK.md, the goal row, tests of the names and a changelog entry. Nothing about remote YES or RAM boot yet.
  • How I checked it: npm run pr:ready (Ready). The addresses come from stock 1.12 on my computer and from the unit: with stage one's mem I read the UI queue's ring while the developer pressed and turned, which gave the message format, the key ids and the encoder numbers (A to H 1 to 8, LEVEL 9, each turned alone).
  • Tested on a unit: development base 300c83be with hello-marker-dn2 (.syx 4fd37eac), my Digitone II on OS 1.12, flashed over USB: encoder A turned Attack Time up to 127 and back to 0 (read on the screen through screen), PLAY and STOP ran and stopped the pattern, REMOTE CTRL: ON showed in SETTINGS and OFF refused keys (not armed), a key from a person refused the host (status 5) and one 3.5 s later went through, while the link held FUNC the ATK label read DEL (stock saw the hold through is_key_held), and 650 posted events counted no person (record). Not tested: a held key with a second key from the host, a full queue, long sessions. The host names 35 panel keys, each read from the panel on the unit.
    Edge cases
Case Why this change makes it a risk How run Result
Keys and encoders posted as the panel's stock must take them as its own press PLAY and STOP, turns of A, on the unit pass
Arm off the host must be refused REMOTE CTRL OFF, then press STOP pass: not armed
A person at the panel the host must back off a key pressed by the developer while armed pass: status 5, then accepted 3.5 s later
A held key stock must read it held FUNC held over the link, the SYN page pass: DEL shown, ATK after let
A second key while one is held, a full queue combinations and back-pressure not run not run: the unit is on stock 1.12 for music right now; the full queue is covered on the host (next row)
Disarm with a held key and a full queue disarm used to clear held keys and the retry, so stock could keep a key down host test dn2_link_host.c: fill the queue, disarm, let the loop catch up pass: the release delivered exactly once, no new press taken
A remote YES at UPGRADE OS NOW? a remote key could confirm a flash host test: stock's upload buffer complete, then key, enc and a held key pass: key and enc refused (status 6), the held key no longer reads held, release allowed; on a unit: not run, unit on stock 1.12
  • What the guides lacked or got wrong, and where I fixed it: LINK.md said keys and encoders were not ported; it now gives their messages, the arm and the person rule.

🤖 Generated with Claude Code

prodbysmolec and others added 18 commits November 19, 2026 03:03
…SB MIDI SysEx

Development bases (base.json's dev) observe stock's SysEx router at 0x4012197a (core-dn2 0.3's ev_sysex site) and
answer the Analog Rytm MKII link's ident and mem requests from ev_tick through stock's sysex_send on USB. A host
(tools/dn2_link.py) with a test of its frames, LINK.md, the goal row and a changelog entry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The status byte of stock's USB MIDI receive parser, 0x445090ac on OS 1.12, reads 0xF0 while a SysEx message arrives.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…, not yet on a unit)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@gitguardian

gitguardian Bot commented Nov 19, 2026

Copy link
Copy Markdown

⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

Since your pull request originates from a forked repository, GitGuardian is not able to associate the secrets uncovered with secret incidents on your GitGuardian dashboard.
Skipping this check run and merging your pull request will create secret incidents on your GitGuardian dashboard.

🔎 Detected hardcoded secret in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
40376663 Triggered Generic High Entropy Secret 19be13a src/community/agent-sessions.test.ts View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secret safely. Learn here the best practices.
  3. Revoke and rotate this secret.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

prodbysmolec and others added 2 commits November 19, 2026 22:41
…host on a unit

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…and the encoder pushes

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for stage two of the Digitone II link. Two things before this can go further:

  1. GitGuardian flagged one possible secret. Please open its details and remove it from the commits if it is real. If it is a false positive (for example a test byte pattern), say so here.
  2. Please merge the current main into your branch and run npm run pr:ready until it says Ready, so the pull request only holds this change.

@repeat98

Copy link
Copy Markdown
Owner

Please keep pending key releases alive when remote control is switched off. When the pending queue is full, release_all() marks a held key for retry, but disarm() immediately clears both the held bits and the retry flag. The UI can receive the original key-down without its matching key-up.

Please let the UI tick finish queued releases after disarming, while continuing to refuse new presses. A host test that disarms with a held key and a full queue should see the release delivered once when space opens. Please also verify that confirming a flash still requires a physical panel press when remote panel keys are enabled.

prodbysmolec and others added 4 commits November 22, 2026 18:08
…m reply only for its address and exact length

A late reply to the previous chunk or a short reply could reach the screen decoder. Host tests cover both without
a unit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-keys

# Conflicts:
#	sdk/machines/digitone-ii/tools/dn2_link.py
#	sdk/tests/test_dn2_link.py
…upload waits for YES

disarm() cleared the held keys and the retry flag, so with a full queue stock could keep a key down the link had
pressed. Now new presses stop at once and the UI tick posts the waiting releases when there is room. While stock's
upload buffer holds a complete OS upload (UPGRADE OS NOW?), key and enc are refused (status 6) and is_key_held stops
seeing the link's holds: only a person confirms a flash. Host test dn2_link_host.c compiles link.c with stubs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@prodbysmolec

Copy link
Copy Markdown
Collaborator Author

Thanks, both fixed in 9d1971f:

  • Releases survive disarm. disarm() now only turns the arm off and calls release_all(); a release the queue cannot take stays held and due, and mw_link_tick() posts it when there is room. New presses are refused from the moment of disarm (status 1).
  • A flash needs a person. Checked: stock's UPGRADE OS NOW? takes YES from the UI queue, so a remote key could have confirmed it. While stock's upload buffer (OS 1.12, 0x4038bec0, from 0x40122574) has header byte 0 = 3, a complete OS upload, key and enc are refused with a new status 6 and mw_link_held() stops reporting the link's holds to is_key_held, so a key held before the upload finished cannot count either. release stays allowed. Boot clears the buffer.
  • Host test sdk/tests/dn2_link_host.c (run by test_dn2_link.py) compiles link.c for the host with stock's queue, key tables and upload buffer stubbed: disarm with a held key and a full queue → no release, the key still held, a new press refused → the loop catches up → the release delivered exactly once; the upload staged → no hold, key and enc refused, release allowed. Against the old link.c it fails at those checks.
  • The dev base still builds for the unit (machine:base -- digitone-ii --dev, 16 sites). Not tested on a unit yet: the unit is on stock 1.12 right now; I'll run it on the next flash.

GitGuardian: false positive (the scrubber test's made-up tokens in src/community/agent-sessions.test.ts, already in main). Merged #1763's fixes, base/digitone-ii-next and main; pr:ready Ready.

@repeat98

Copy link
Copy Markdown
Owner

Thanks for fixing the release retries. I checked what happens to a remote press that's already queued when the OS confirmation opens. The new guard blocks incoming presses, but the host fixture shows the queued press can still reach stock once the confirmation is open.

Could you check this at dispatch too, and cover the transition in the host fixture? Physical confirmation and key releases should still work.

@repeat98
repeat98 dismissed github-actions[bot]’s stale review November 24, 2026 08:35

Out of date: the branch has caught up with main since, and the GitGuardian find was explained as a false positive (made-up tokens in a test from main). What is still open is in the latest owner comment.

prodbysmolec and others added 7 commits November 25, 2026 11:22
…chine/digitone-ii-link

# Conflicts:
#	sdk/machines/digitone-ii/GOAL.md
…screen), no read at a client's address

mem (0x21) is gone. screen OFF (0x20) copies the frame on the screen at OFF 0 and sends
eight 128-byte parts of that copy with its number, after checking stock's frame pointer
lies wholly in DDR. A host C test compiles link.c and covers both requests and every
refusal: offsets past or between parts, a part before any copy, a pointer outside DDR,
the old mem at any address, every other command and another link version.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n command, eight parts of one copy

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…OW? opened is taken at dispatch, never reaching the prompt

A person's press at the prompt always reaches stock now, even while the link holds keys.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…chine/digitone-ii-link-keys

# Conflicts:
#	sdk/machines/digitone-ii/GOAL.md
@prodbysmolec

Copy link
Copy Markdown
Collaborator Author

Fixed in 6f2fbba (then merged main and base/digitone-ii-next). What changed: a press or turn the link posted before the upload completed, and still in stock's queue when UPGRADE OS NOW? opens, is now stopped at dispatch. Physical confirmation and the link's releases still reach stock. Not run on a unit yet.

  • Dispatch check. mw_link_key/mw_link_enc run at order 1, before stock. When the event is the link's own (ours() pops it) and an upload waits, they take a press or turn, so stock never sees it, and count it as refused. A release the link posted passes as before.

  • A person's press at the prompt. human() used to take a person's first press whenever the link still held a key, which at the prompt would have eaten their YES. At the prompt it now lets the link's keys go and passes the press on.

  • Host fixture (dn2_link_host.c). The transition:

    • a YES press and an encoder turn posted (status OK, queued);
    • the upload completes (upload[0] = 3);
    • at dispatch both are taken (ev_key/ev_enc return 1), refused_count +2, and the queue is empty, so the next event isn't mistaken for the link's;
    • the link's release passes;
    • a person's YES and a person's other key (NO) pass;
    • the link presses nothing more.

    Plus a person's YES at the prompt while the link holds key 9: it passes, and key 9 is released. Against the old dispatch both checks fail.

  • The dev base builds (16 sites); test_dn2_link.py and sdk:check pass.

Guides: LINK.md status 6 says what happens to a queued event.

prodbysmolec and others added 2 commits November 25, 2026 12:08
… key link

link.c keeps the keys and turns and takes repeat98#1763's screen in place of mem; one host fixture covers both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…n names

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
prodbysmolec added a commit to prodbysmolec/modwerk that referenced this pull request Nov 25, 2026
…omes in parts the unit reads itself (log OFF)

mem is gone, so link.c answers log OFF (0x24) with up to 128 bytes of diag.c's log and its seq; dn2_link.py diag --save
and the site's readLog read part 0, the rest, then part 0 again, and keep only a log that stood still.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
prodbysmolec added a commit to prodbysmolec/modwerk that referenced this pull request Nov 25, 2026
…t: bootdiag gets its own request

With mem gone, bootdiag (0x25) sends the gate's 15 words and the two marks the base itself writes; the host reads them
with one request.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
prodbysmolec added a commit to prodbysmolec/modwerk that referenced this pull request Nov 25, 2026
…nto the loader: ident sends the modules' test value itself

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@repeat98

Copy link
Copy Markdown
Owner

Thanks. Taking the link's queued press or turn at dispatch, and letting a person's YES through at the prompt, is what I asked for, and the transition case in dn2_link_host.c covers it.

Before this goes into base/digitone-ii-next (after #1763):

  1. A unit run on this head. The record is for 300c83be… from 19 November, before disarm() kept releases due, before status 6 and before the dispatch check in mw_link_key/mw_link_enc. Please flash this head's dev package, put its SHA-256 in the record, and run:
    • hold a key, then disarm: stock gets the release once;
    • an OS upload completed, then press YES and a turn from the link: both refused with status 6, and the prompt still waits;
    • your own YES and NO at UPGRADE OS NOW? while the link holds a key: both reach stock.
  2. One case I couldn't settle from the code. The link's release still reaches stock at the prompt. If the link holds YES while an upload completes and you then let YES, stock gets a YES key-up with UPGRADE OS NOW? open. Please check on the unit that the prompt stays open. If stock acts on YES's release, the link needs to hold that release back at the prompt too.
  3. The description. The edge-case table has no rows for the dispatch check or for a person's YES at the prompt while the link holds a key, and "Tested on a unit" still names 300c83be. Please refresh it after the run.

prodbysmolec and others added 5 commits November 26, 2026 10:30
…chine/digitone-ii-link

# Conflicts:
#	src/engine/elektron/dn2-link.ts
The unit refuses 0x21 since the link became bounded, so mem, MEM_MAX,
read() and the readLog that read through them are gone, with their
tests. repeat98#1820 brings the log back through log OFF (0x24). The fake unit
now refuses every command link.c does not serve.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On a unit, the link held YES while an OS upload completed, then
'release' posted YES's key-up, and stock started the flash: it answers
the prompt on the release as on the press. At the prompt mw_link_key now
takes every key event the link posted, releases included, and counts it
as refused; a person's YES and NO still reach stock. The host test
asserted the old behaviour and now checks the release is taken (it fails
against the old dispatch).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
prodbysmolec added a commit to prodbysmolec/modwerk that referenced this pull request Nov 26, 2026
With the link's releases held back at UPGRADE OS NOW? (repeat98#1817), ramboot's
YES would be held back too: until now its press was taken at dispatch
and only its release reached stock, which answered the prompt with it.
The two events ramboot posts for the upload it checked (length and
CRC32) are now marked in the pending queue and pass; any other key event
the link posted is still taken. The host test checks both reach stock,
and fails when the release is posted unmarked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants