Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ jobs:
python3 -I scripts/test_ci_profile.py
python3 -I scripts/test_testflight_distribute.py
python3 -I scripts/test_check_app_icon.py
python3 -I scripts/test_check_updater_name.py

app:
name: App build (Release, ad-hoc)
Expand Down Expand Up @@ -224,15 +225,17 @@ jobs:
xcodegen generate
xcodebuild -project FirmwareUpdater.xcodeproj -scheme FirmwareUpdater -configuration Release \
-derivedDataPath build CODE_SIGN_IDENTITY=- CODE_SIGN_STYLE=Manual DEVELOPMENT_TEAM= build
app=build/Build/Products/Release/FirmwareUpdater.app
app="build/Build/Products/Release/DeckBridge Firmware Updater.app"
info=$(codesign -dv "$app" 2>&1); echo "$info"
[[ "$info" == *"flags="*"runtime"* ]] || { echo "hardened runtime missing"; exit 1; }
if codesign -d --entitlements - --xml "$app" 2>/dev/null | grep -q app-sandbox; then echo "sandboxed"; exit 1; fi
# Its own icon (#733): every size in the set, and the built app names and carries it.
python3 -I ../../scripts/check_app_icon.py --iconset Assets.xcassets/AppIcon.appiconset --app "$app"
python3 -I ../../scripts/check_app_icon.py --iconset Assets.xcassets/AppIcon.appiconset --badge 62929E --app "$app"
# Its name (#763): the file, the app menu, About, Quit and the Dock.
python3 -I ../../scripts/check_updater_name.py "$app"
# It starts with nothing plugged in, logs its first look ("not found" for both sections) and quits (#734).
- name: Firmware updater launch smoke
run: UPDATER_SMOKE_TIMEOUT=60 scripts/updater_smoke.sh Apps/FirmwareUpdater/build/Build/Products/Release/FirmwareUpdater.app
run: UPDATER_SMOKE_TIMEOUT=60 scripts/updater_smoke.sh "Apps/FirmwareUpdater/build/Build/Products/Release/DeckBridge Firmware Updater.app"
# A gate since #46: it passed on the 10 main runs from 99545f9 to 23a8788 (virtual MIDI and loopback UDP work on
# hosted macos-26 runners). A failure fails this job, which is a required check.
- name: Smoke
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions Apps/FirmwareUpdater/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Firmware updater

A separate Mac app (spec #684) with two sections, deck panel and LC6000. Today it only looks: it says what is plugged
**DeckBridge Firmware Updater** (#763): the .app file, the app menu, the Dock and the window all use that name. The
bundle ID stays `dev.ericdahl.FirmwareUpdater`, and so does the log folder below. A separate Mac app (spec #684) with two sections, deck panel and LC6000. Today it only looks: it says what is plugged
in. Its one write is the text line `version` to the deck panel's own console (#715); nothing goes to the LC6000. It is not part of DeckBridge or its App Store build, and shares nothing
with it at runtime.

Expand All @@ -25,7 +26,7 @@ Needs Xcode 26 and XcodeGen (`brew install xcodegen`). The logic lives in `Packa

## Log

`~/Library/Logs/FirmwareUpdater/updater.log`: a "first look" line per launch, in status words only (#734), and one line per device found. No serial numbers, port paths, MAC addresses
`~/Library/Logs/FirmwareUpdater/updater.log` (the folder name didn't change with the app's name, #763): a "first look" line per launch, in status words only (#734), and one line per device found. No serial numbers, port paths, MAC addresses
or Wi-Fi details.

## Launch smoke check (#734)
Expand Down
14 changes: 3 additions & 11 deletions Apps/FirmwareUpdater/Sources/BackupView.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import AppKit
import FirmwareCatalog
import LC6000Update
import SwiftUI
import UnitCheck

Expand Down Expand Up @@ -61,7 +62,7 @@ final class BackupModel {
let report = await UnitCheck(known: Self.known, log: FileLog.shared)
.backUp(devices: [one.device], transport: ReadOnlyTransport(usb), into: folder, stamp: Self.stamp())
update = report.read.map { UpdateModel(read: $0) }
// With a read, the update's view of it: a chip already running this app's patch is said to (#748).
// With a read, the update's view of it: a chip already running DeckBridge's firmware is said to (#748).
result = update.map { $0.flow.backupLine(files: report.files.count, identified: report.identified) } ?? Self.text(report)
}

Expand All @@ -78,16 +79,7 @@ final class BackupModel {
}

static func text(_ report: UnitCheck.Result) -> String {
if let refusal = report.refusal { return refusal }
var lines = ["Backup saved: read twice and the same, \(report.files.count) files."]
if let found = report.identified {
let chip = found.kind == .display ? "Display chip" : "Top panel chip"
if let version = found.version {
lines.append("\(chip): firmware \(version)\(found.ours ? ", with DeckBridge's changes already on it" : "").")
}
if let refusal = found.refusal { lines.append(refusal) }
}
return lines.joined(separator: "\n")
report.refusal ?? UpdateFlow.backupLine(files: report.files.count, identified: report.identified)
}
}

Expand Down
2 changes: 1 addition & 1 deletion Apps/FirmwareUpdater/Sources/FirmwareUpdaterApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ struct FirmwareUpdaterApp: App {
@State private var model = Self.makeModel()

var body: some Scene {
Window("Firmware Updater", id: "updater") {
Window(UpdaterScreen.appName, id: "updater") {
UpdaterView(model: model)
.task {
#if DEBUG
Expand Down
2 changes: 1 addition & 1 deletion Apps/FirmwareUpdater/Sources/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>Firmware Updater</string>
<string>DeckBridge Firmware Updater</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
Expand Down
12 changes: 1 addition & 11 deletions Apps/FirmwareUpdater/Sources/UpdateView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,7 @@ final class UpdateModel {
defer { running = false }
let outcome = await ChipWriter(transport: usb).write(plan, confirmed: Confirmation(plan))
flow.finished(outcome)
FileLog.shared.log("LC6000 \(flow.chip == .display ? "display" : "top panel") chip: update \(Self.word(outcome))")
}

/// The log's fixed words: never bytes or addresses beyond the outcome.
static func word(_ outcome: WriteOutcome) -> String {
switch outcome {
case .written: "written and read back equal"
case .mismatch: "read back different"
case .noAnswer: "the chip stopped answering"
case .refused: "not sent"
}
FileLog.shared.log(flow.logLine(outcome))
}
}

Expand Down
4 changes: 3 additions & 1 deletion Apps/FirmwareUpdater/project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,13 @@ targets:
CFBundleShortVersionString: $(MARKETING_VERSION)
CFBundleVersion: $(CURRENT_PROJECT_VERSION)
CFBundleDisplayName: DeckBridge Firmware Updater
CFBundleName: Firmware Updater
CFBundleName: DeckBridge Firmware Updater
LSApplicationCategoryType: public.app-category.utilities
settings:
base:
PRODUCT_BUNDLE_IDENTIFIER: dev.ericdahl.FirmwareUpdater
# The name the owner sees (#763): the .app file and its binary. The bundle ID stays.
PRODUCT_NAME: DeckBridge Firmware Updater
ASSETCATALOG_COMPILER_APPICON_NAME: AppIcon
# Notarized from the site, not the App Store: hardened runtime, no sandbox. USB, serial and MIDI reads need
# no entitlement outside the sandbox.
Expand Down
14 changes: 14 additions & 0 deletions GLOSSARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,20 @@ _Avoid_: hook, patch
The drawn display's drawing, kept in the display's spare flash beside Denon's firmware; block A and block B must come from the same build, or the display stays silent.
_Avoid_: upper block

### LC6000 firmware updates

**Display chip**:
The LC6000's chip that runs the jog display: Denon's firmware, with DeckBridge's display firmware (block A, and block B once installed) when the owner has put it there. The firmware updater backs it up and updates it.
_Avoid_: WD chip, jog display chip

**Top panel chip**:
The LC6000's chip that runs the controls on its top, such as the pads and the deck select. Always "top panel chip" in full, never "top panel" alone (see **Panel**). DeckBridge's top panel firmware is one small change to Denon's.
_Avoid_: TP chip, top panel (alone), main chip

**Update mode**:
A chip restarted into ST's own bootloader (USB 0483:DF11), where it can be read and written over USB and runs nothing else. Entering it writes nothing; a power cycle ends it. The updater works on one chip in update mode at a time.
_Avoid_: DFU mode, bootloader mode, flash mode

### Deck display

**Display feed**:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ public struct CableFeedStatus: Equatable, Sendable {
switch port {
case .noPanel: return "No deck panel plugged into this Mac"
case .open: return "Sending to the deck panel on USB"
case .busy: return "Not sending: another app has the panel's port open, such as the Firmware Updater or a serial monitor"
case .busy: return "Not sending: another app has the panel's port open, such as the DeckBridge Firmware Updater or a serial monitor"
case .failed(let reason): return "Not sending: \(reason)"
case .lent: return "Paused: the Firmware Updater is using the panel's USB cable"
case .lent: return "Paused: the DeckBridge Firmware Updater is using the panel's USB cable"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ struct CableFeedStatusTests {
#expect(CableFeedStatus(cable: true, port: .noPanel).text == "No deck panel plugged into this Mac")
#expect(CableFeedStatus(cable: true, port: .open).text == "Sending to the deck panel on USB")
#expect(CableFeedStatus(cable: true, port: .busy).text
== "Not sending: another app has the panel's port open, such as the Firmware Updater or a serial monitor")
== "Not sending: another app has the panel's port open, such as the DeckBridge Firmware Updater or a serial monitor")
#expect(CableFeedStatus(cable: true, port: .failed("Permission denied")).text == "Not sending: Permission denied")
#expect(CableFeedStatus(cable: true, port: .lent).text == "Paused: the Firmware Updater is using the panel's USB cable")
#expect(CableFeedStatus(cable: true, port: .lent).text == "Paused: the DeckBridge Firmware Updater is using the panel's USB cable")
}

@Test("Only busy and failed are problems")
Expand Down
46 changes: 35 additions & 11 deletions Packages/FirmwareUpdaterKit/Sources/LC6000Update/UpdateFlow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,33 +59,57 @@ public struct UpdateFlow: Sendable {
public var status: String? {
switch phase {
case .ready:
if case .alreadyPatched(let version) = state { return "Up to date: \(version) with this app's patch" }
if case .alreadyPatched(let version) = state { return "Up to date: \(version) with \(Self.ours(chip))" }
return nil
case .mismatch(let at):
return "The chip read back different at \(WritePlan.hex(at)), so the update didn't take. Restore your backup now."
case .mismatch:
return "The chip read back different, so the update didn't take. Restore your backup now."
case .done(let text): return text
case .recovery:
return "The chip stopped answering during the update, so the LC6000 may not start. Leave it plugged in and "
+ "follow the recovery guide."
}
}

/// The backup's result line, agreeing with this flow: a chip that already runs this app's patch is said to, not
/// called firmware the app doesn't know (its hash or CRC is no longer stock's).
/// Our firmware change on a chip, in the one wording the app uses (#763).
static func ours(_ chip: ChipKind) -> String {
chip == .display ? "DeckBridge's display firmware" : "DeckBridge's top panel firmware"
}

static func chipName(_ chip: ChipKind) -> String { chip == .display ? "Display chip" : "Top panel chip" }

/// The backup's result line, agreeing with this flow: a chip that already runs DeckBridge's firmware is said to,
/// not called firmware the app doesn't know (its hash or CRC is no longer stock's).
public func backupLine(files: Int, identified: Identified?) -> String {
var lines = ["Backup saved: read twice and the same, \(files) files."]
let chipName = chip == .display ? "Display chip" : "Top panel chip"
if case .alreadyPatched(let version) = state {
lines.append("\(chipName): firmware \(version), with this app's patch.")
} else if let found = identified {
guard case .alreadyPatched(let version) = state else { return Self.backupLine(files: files, identified: identified) }
return Self.saved(files) + "\n\(Self.chipName(chip)): firmware \(version), with \(Self.ours(chip))."
}

/// The backup's result line when no update is open for the chip: what the read identified.
public static func backupLine(files: Int, identified: Identified?) -> String {
var lines = [saved(files)]
if let found = identified {
if let version = found.version {
lines.append("\(chipName): firmware \(version)\(found.ours ? ", with DeckBridge's changes already on it" : "").")
lines.append("\(chipName(found.kind)): firmware \(version)\(found.ours ? ", with \(ours(found.kind)) already on it" : "").")
}
if let refusal = found.refusal { lines.append(refusal) }
}
return lines.joined(separator: "\n")
}

static func saved(_ files: Int) -> String { "Backup saved: read twice and the same, \(files) files." }

/// The log's line for a write's outcome: fixed words, and the first address that read back different. The
/// address is for the log only; the screen never shows hex (#763).
public func logLine(_ outcome: WriteOutcome) -> String {
let word = switch outcome {
case .written: "written and read back equal"
case .mismatch(let at): "read back different at \(WritePlan.hex(at))"
case .noAnswer: "the chip stopped answering"
case .refused: "not sent"
}
return "LC6000 \(name): update \(word)"
}

/// The writer's outcome: of the update, or of the restore after a mismatch.
public mutating func finished(_ outcome: WriteOutcome) {
switch (phase, outcome) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ public struct PanelUpdate: Sendable {
}
}

extension PanelUpdate {
/// The one sentence that sends the owner to DeckBridge's switch, always quoted (#763).
public static let turnOffCable = "Turn off \"Send over the USB cable\" in DeckBridge"
}

extension PanelUpdate.Step {
/// What the owner reads for this step: what is happening, or what went wrong and what to do.
public var text: String {
Expand All @@ -114,14 +119,14 @@ extension PanelUpdate.Step {
}

static func text(for error: FlashError) -> String {
let mayNotStart = "The panel may not start: try again before unplugging it."
let mayNotStart = "The panel may not start: try again before you unplug it."
switch error {
case .portBusy:
return "DeckBridge is using the panel's cable. Turn off \"Send over the USB cable\" in DeckBridge, then try again."
return "DeckBridge is using the panel's cable. \(PanelUpdate.turnOffCable), then try again."
case .wrongBoard(let what): return "This board isn't a deck panel (\(what)). Nothing was written."
case .notADeckPanel: return "This board doesn't have the deck panel's layout. Nothing was written."
case .noBootloader, .refused, .noAnswer: return "The panel didn't answer. Unplug it, plug it back in, and try again."
case .writeFailed(let address): return "Writing failed at 0x\(String(address, radix: 16, uppercase: true)). \(mayNotStart)"
case .writeFailed: return "Writing stopped partway. \(mayNotStart)" // the address goes to the log (#763)
case .verifyFailed: return "The written firmware didn't check out. \(mayNotStart)"
case .canceled: return "Canceled. The panel was restarted."
case .lineLost: return "The cable was lost. Plug the panel back in and try again."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ public final class Updater {
}
for await next in steps {
if case .writing = next { canCancel = false }
// The screen says only "partway" (#763); where it stopped is for the log.
if case .failed(.writeFailed(let address)) = next {
log?.log("deck panel: writing stopped at 0x\(String(address, radix: 16, uppercase: true))")
}
if case .failed(.portBusy) = next, let text = UpdaterScreen.handoff(outcome) {
updateText = text
} else {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
// What the screen says when the updater asks DeckBridge for the panel's port (#710). Its own file, so UpdaterScreen.swift
// (#700, #726) is untouched.
import PanelFlasher
import PortHandoff

extension UpdaterScreen {
/// No answer from DeckBridge: the port isn't forced, so the owner frees it by hand.
public static let deckBridgeNoAnswer = "DeckBridge didn't let go of the panel's USB cable. Turn off Send over the USB "
+ "cable in DeckBridge, or quit DeckBridge, then look again."
public static let deckBridgeNoAnswer = "DeckBridge didn't let go of the panel's USB cable. \(PanelUpdate.turnOffCable), "
+ "or quit DeckBridge, then look again."

/// The line for a borrow's outcome; nil when DeckBridge let go.
public static func handoff(_ outcome: PortBorrow.Outcome) -> String? {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import DeviceFinder
import Foundation
import PanelFlasher

/// Steps to install a missing USB driver (#688): plain text, and the maker's own download page.
public struct DriverGuide: Sendable, Equatable {
Expand Down Expand Up @@ -40,15 +41,18 @@ public struct UpdaterScreen: Sendable, Equatable {
public let panel: DeviceSection
public let lc6000: DeviceSection

/// The app's name wherever the owner sees it (#763): the window title here; project.yml names the rest.
public static let appName = "DeckBridge Firmware Updater"

/// The LC6000 section's own warning (#685, spec #684 story 9), so someone who owns only a panel never starts on it.
public static let lc6000Warning = """
This section changes the firmware inside a Denon LC6000 PRIME. It is not made or supported by Denon. \
This section changes the firmware inside a Denon LC6000 PRIME. It is not made, supported or endorsed by Denon. \
If a change goes wrong, the unit may stop working, and the worst case needs a hardware debug probe to \
recover. If you only have a deck panel, you don't need this section.
"""

/// When DeckBridge holds the panel's port (#710's interim, cos): the one sentence, shared with the panel flasher (#687).
public static let portBusy = "DeckBridge is using the panel's USB cable. Turn off Send over the USB cable in DeckBridge, then look again."
public static let portBusy = "DeckBridge is using the panel's USB cable. \(PanelUpdate.turnOffCable), then look again."

/// `panelWaiting`: the panel is on USB with no serial port yet, and its driver may still make one (#700).
/// `deckBridgeSilent`: the port is busy, and DeckBridge didn't let go of it when asked (#710).
Expand Down
Loading
Loading