diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 9b2bd1d1..45779248 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -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)
@@ -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
diff --git a/Apps/FirmwareUpdater/Assets.xcassets/AppIcon.appiconset/icon_128x128@1x.png b/Apps/FirmwareUpdater/Assets.xcassets/AppIcon.appiconset/icon_128x128@1x.png
index 06197761..2cbada98 100644
Binary files a/Apps/FirmwareUpdater/Assets.xcassets/AppIcon.appiconset/icon_128x128@1x.png and b/Apps/FirmwareUpdater/Assets.xcassets/AppIcon.appiconset/icon_128x128@1x.png differ
diff --git a/Apps/FirmwareUpdater/Assets.xcassets/AppIcon.appiconset/icon_128x128@2x.png b/Apps/FirmwareUpdater/Assets.xcassets/AppIcon.appiconset/icon_128x128@2x.png
index de104b91..681cc9f9 100644
Binary files a/Apps/FirmwareUpdater/Assets.xcassets/AppIcon.appiconset/icon_128x128@2x.png and b/Apps/FirmwareUpdater/Assets.xcassets/AppIcon.appiconset/icon_128x128@2x.png differ
diff --git a/Apps/FirmwareUpdater/Assets.xcassets/AppIcon.appiconset/icon_16x16@1x.png b/Apps/FirmwareUpdater/Assets.xcassets/AppIcon.appiconset/icon_16x16@1x.png
index 22582fd5..4676acf3 100644
Binary files a/Apps/FirmwareUpdater/Assets.xcassets/AppIcon.appiconset/icon_16x16@1x.png and b/Apps/FirmwareUpdater/Assets.xcassets/AppIcon.appiconset/icon_16x16@1x.png differ
diff --git a/Apps/FirmwareUpdater/Assets.xcassets/AppIcon.appiconset/icon_16x16@2x.png b/Apps/FirmwareUpdater/Assets.xcassets/AppIcon.appiconset/icon_16x16@2x.png
index 38c50ebf..2b51505a 100644
Binary files a/Apps/FirmwareUpdater/Assets.xcassets/AppIcon.appiconset/icon_16x16@2x.png and b/Apps/FirmwareUpdater/Assets.xcassets/AppIcon.appiconset/icon_16x16@2x.png differ
diff --git a/Apps/FirmwareUpdater/Assets.xcassets/AppIcon.appiconset/icon_256x256@1x.png b/Apps/FirmwareUpdater/Assets.xcassets/AppIcon.appiconset/icon_256x256@1x.png
index de104b91..681cc9f9 100644
Binary files a/Apps/FirmwareUpdater/Assets.xcassets/AppIcon.appiconset/icon_256x256@1x.png and b/Apps/FirmwareUpdater/Assets.xcassets/AppIcon.appiconset/icon_256x256@1x.png differ
diff --git a/Apps/FirmwareUpdater/Assets.xcassets/AppIcon.appiconset/icon_256x256@2x.png b/Apps/FirmwareUpdater/Assets.xcassets/AppIcon.appiconset/icon_256x256@2x.png
index 9433befd..8db232ec 100644
Binary files a/Apps/FirmwareUpdater/Assets.xcassets/AppIcon.appiconset/icon_256x256@2x.png and b/Apps/FirmwareUpdater/Assets.xcassets/AppIcon.appiconset/icon_256x256@2x.png differ
diff --git a/Apps/FirmwareUpdater/Assets.xcassets/AppIcon.appiconset/icon_32x32@1x.png b/Apps/FirmwareUpdater/Assets.xcassets/AppIcon.appiconset/icon_32x32@1x.png
index 38c50ebf..2b51505a 100644
Binary files a/Apps/FirmwareUpdater/Assets.xcassets/AppIcon.appiconset/icon_32x32@1x.png and b/Apps/FirmwareUpdater/Assets.xcassets/AppIcon.appiconset/icon_32x32@1x.png differ
diff --git a/Apps/FirmwareUpdater/Assets.xcassets/AppIcon.appiconset/icon_32x32@2x.png b/Apps/FirmwareUpdater/Assets.xcassets/AppIcon.appiconset/icon_32x32@2x.png
index 5d943826..17e5b9b6 100644
Binary files a/Apps/FirmwareUpdater/Assets.xcassets/AppIcon.appiconset/icon_32x32@2x.png and b/Apps/FirmwareUpdater/Assets.xcassets/AppIcon.appiconset/icon_32x32@2x.png differ
diff --git a/Apps/FirmwareUpdater/Assets.xcassets/AppIcon.appiconset/icon_512x512@1x.png b/Apps/FirmwareUpdater/Assets.xcassets/AppIcon.appiconset/icon_512x512@1x.png
index 9433befd..8db232ec 100644
Binary files a/Apps/FirmwareUpdater/Assets.xcassets/AppIcon.appiconset/icon_512x512@1x.png and b/Apps/FirmwareUpdater/Assets.xcassets/AppIcon.appiconset/icon_512x512@1x.png differ
diff --git a/Apps/FirmwareUpdater/Assets.xcassets/AppIcon.appiconset/icon_512x512@2x.png b/Apps/FirmwareUpdater/Assets.xcassets/AppIcon.appiconset/icon_512x512@2x.png
index 7bcd2528..69e4a95f 100644
Binary files a/Apps/FirmwareUpdater/Assets.xcassets/AppIcon.appiconset/icon_512x512@2x.png and b/Apps/FirmwareUpdater/Assets.xcassets/AppIcon.appiconset/icon_512x512@2x.png differ
diff --git a/Apps/FirmwareUpdater/README.md b/Apps/FirmwareUpdater/README.md
index 313d5d9a..74bc5d1c 100644
--- a/Apps/FirmwareUpdater/README.md
+++ b/Apps/FirmwareUpdater/README.md
@@ -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.
@@ -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)
diff --git a/Apps/FirmwareUpdater/Sources/BackupView.swift b/Apps/FirmwareUpdater/Sources/BackupView.swift
index 28ff669b..469f1f8d 100644
--- a/Apps/FirmwareUpdater/Sources/BackupView.swift
+++ b/Apps/FirmwareUpdater/Sources/BackupView.swift
@@ -1,5 +1,6 @@
import AppKit
import FirmwareCatalog
+import LC6000Update
import SwiftUI
import UnitCheck
@@ -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)
}
@@ -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)
}
}
diff --git a/Apps/FirmwareUpdater/Sources/FirmwareUpdaterApp.swift b/Apps/FirmwareUpdater/Sources/FirmwareUpdaterApp.swift
index 4c958ca1..7ece6e28 100644
--- a/Apps/FirmwareUpdater/Sources/FirmwareUpdaterApp.swift
+++ b/Apps/FirmwareUpdater/Sources/FirmwareUpdaterApp.swift
@@ -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
diff --git a/Apps/FirmwareUpdater/Sources/Info.plist b/Apps/FirmwareUpdater/Sources/Info.plist
index e127d1df..0c10c41b 100644
--- a/Apps/FirmwareUpdater/Sources/Info.plist
+++ b/Apps/FirmwareUpdater/Sources/Info.plist
@@ -13,7 +13,7 @@
CFBundleInfoDictionaryVersion
6.0
CFBundleName
- Firmware Updater
+ DeckBridge Firmware Updater
CFBundlePackageType
APPL
CFBundleShortVersionString
diff --git a/Apps/FirmwareUpdater/Sources/UpdateView.swift b/Apps/FirmwareUpdater/Sources/UpdateView.swift
index cadcaa43..1d60375e 100644
--- a/Apps/FirmwareUpdater/Sources/UpdateView.swift
+++ b/Apps/FirmwareUpdater/Sources/UpdateView.swift
@@ -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))
}
}
diff --git a/Apps/FirmwareUpdater/project.yml b/Apps/FirmwareUpdater/project.yml
index 5ff4fc94..3ce2a17f 100644
--- a/Apps/FirmwareUpdater/project.yml
+++ b/Apps/FirmwareUpdater/project.yml
@@ -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.
diff --git a/GLOSSARY.md b/GLOSSARY.md
index 3b79ba9b..4ec0e5eb 100644
--- a/GLOSSARY.md
+++ b/GLOSSARY.md
@@ -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**:
diff --git a/Packages/ControllerBridgeKit/Sources/ControllerBridgeCore/CableFeedStatus.swift b/Packages/ControllerBridgeKit/Sources/ControllerBridgeCore/CableFeedStatus.swift
index 73128a91..f0c8708c 100644
--- a/Packages/ControllerBridgeKit/Sources/ControllerBridgeCore/CableFeedStatus.swift
+++ b/Packages/ControllerBridgeKit/Sources/ControllerBridgeCore/CableFeedStatus.swift
@@ -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"
}
}
}
diff --git a/Packages/ControllerBridgeKit/Tests/ControllerBridgeCoreTests/CableFeedStatusTests.swift b/Packages/ControllerBridgeKit/Tests/ControllerBridgeCoreTests/CableFeedStatusTests.swift
index 8ba12f6e..0c0596e0 100644
--- a/Packages/ControllerBridgeKit/Tests/ControllerBridgeCoreTests/CableFeedStatusTests.swift
+++ b/Packages/ControllerBridgeKit/Tests/ControllerBridgeCoreTests/CableFeedStatusTests.swift
@@ -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")
diff --git a/Packages/FirmwareUpdaterKit/Sources/LC6000Update/UpdateFlow.swift b/Packages/FirmwareUpdaterKit/Sources/LC6000Update/UpdateFlow.swift
index ee2a85c2..42e2d5d3 100644
--- a/Packages/FirmwareUpdaterKit/Sources/LC6000Update/UpdateFlow.swift
+++ b/Packages/FirmwareUpdaterKit/Sources/LC6000Update/UpdateFlow.swift
@@ -59,10 +59,10 @@ 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 "
@@ -70,22 +70,46 @@ public struct UpdateFlow: Sendable {
}
}
- /// 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) {
diff --git a/Packages/FirmwareUpdaterKit/Sources/PanelFlasher/PanelUpdate.swift b/Packages/FirmwareUpdaterKit/Sources/PanelFlasher/PanelUpdate.swift
index 87c52986..625bbd9a 100644
--- a/Packages/FirmwareUpdaterKit/Sources/PanelFlasher/PanelUpdate.swift
+++ b/Packages/FirmwareUpdaterKit/Sources/PanelFlasher/PanelUpdate.swift
@@ -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 {
@@ -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."
diff --git a/Packages/FirmwareUpdaterKit/Sources/UpdaterScreen/Updater.swift b/Packages/FirmwareUpdaterKit/Sources/UpdaterScreen/Updater.swift
index 191c21c5..e7ba065b 100644
--- a/Packages/FirmwareUpdaterKit/Sources/UpdaterScreen/Updater.swift
+++ b/Packages/FirmwareUpdaterKit/Sources/UpdaterScreen/Updater.swift
@@ -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 {
diff --git a/Packages/FirmwareUpdaterKit/Sources/UpdaterScreen/UpdaterScreen+Handoff.swift b/Packages/FirmwareUpdaterKit/Sources/UpdaterScreen/UpdaterScreen+Handoff.swift
index f4e7fcf7..a3b7fe0b 100644
--- a/Packages/FirmwareUpdaterKit/Sources/UpdaterScreen/UpdaterScreen+Handoff.swift
+++ b/Packages/FirmwareUpdaterKit/Sources/UpdaterScreen/UpdaterScreen+Handoff.swift
@@ -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? {
diff --git a/Packages/FirmwareUpdaterKit/Sources/UpdaterScreen/UpdaterScreen.swift b/Packages/FirmwareUpdaterKit/Sources/UpdaterScreen/UpdaterScreen.swift
index 484d7628..afbc1f41 100644
--- a/Packages/FirmwareUpdaterKit/Sources/UpdaterScreen/UpdaterScreen.swift
+++ b/Packages/FirmwareUpdaterKit/Sources/UpdaterScreen/UpdaterScreen.swift
@@ -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 {
@@ -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).
diff --git a/Packages/FirmwareUpdaterKit/Tests/LC6000UpdateTests/UpdateFlowTests.swift b/Packages/FirmwareUpdaterKit/Tests/LC6000UpdateTests/UpdateFlowTests.swift
index 8fcfbc62..1939f819 100644
--- a/Packages/FirmwareUpdaterKit/Tests/LC6000UpdateTests/UpdateFlowTests.swift
+++ b/Packages/FirmwareUpdaterKit/Tests/LC6000UpdateTests/UpdateFlowTests.swift
@@ -48,7 +48,7 @@ struct UpdateFlowTests {
@Test("Already patched: up to date, and nothing to confirm")
func upToDate() throws {
let flow = try Self.flow(patched: true)
- #expect(flow.status == "Up to date: 00.50 with this app's patch")
+ #expect(flow.status == "Up to date: 00.50 with DeckBridge's display firmware")
#expect(!flow.canConfirm)
}
@@ -64,7 +64,7 @@ struct UpdateFlowTests {
func mismatchThenRestore() throws {
var flow = try Self.flow()
flow.finished(.mismatch(at: 0x0800_BDA4))
- #expect(flow.status == "The chip read back different at 0x0800BDA4, so the update didn't take. Restore your backup now.")
+ #expect(flow.status == "The chip read back different, so the update didn't take. Restore your backup now.")
#expect(flow.canRestore && flow.restoreButton == "Restore backup" && !flow.canConfirm)
#expect(flow.restorePlan == flow.plan?.restore)
flow.finished(.written)
@@ -95,7 +95,7 @@ struct UpdateFlowTests {
let known = KnownNumbers(display: [:], topPanel: [PatchStateTests.sha(stock): "00.31"])
let flow = UpdateFlow(chip: .topPanel, backup: ChipRead(kind: .topPanel, settings: [], app: patched),
backupTakenThisSession: true, edits: edits, known: known)
- #expect(flow.status == "Up to date: 00.31 with this app's patch")
+ #expect(flow.status == "Up to date: 00.31 with DeckBridge's top panel firmware")
#expect(!flow.canConfirm)
}
@@ -109,11 +109,45 @@ struct UpdateFlowTests {
let flow = UpdateFlow(chip: .topPanel, backup: read, backupTakenThisSession: true, edits: edits, known: known)
let unknown = Identified(kind: .topPanel, version: nil, refusal: "The top panel chip runs firmware this app doesn't know. Updates are off; a backup is still allowed.")
#expect(flow.backupLine(files: 2, identified: unknown)
- == "Backup saved: read twice and the same, 2 files.\nTop panel chip: firmware 00.31, with this app's patch.")
+ == "Backup saved: read twice and the same, 2 files.\nTop panel chip: firmware 00.31, with DeckBridge's top panel firmware.")
let stockFlow = UpdateFlow(chip: .topPanel, backup: ChipRead(kind: .topPanel, settings: [], app: stock),
backupTakenThisSession: true, edits: edits, known: known)
let found = Identified(kind: .topPanel, version: "00.31", refusal: nil)
#expect(stockFlow.backupLine(files: 2, identified: found)
== "Backup saved: read twice and the same, 2 files.\nTop panel chip: firmware 00.31.")
}
+
+ @Test("The log line for each outcome: fixed words, and where a read-back differed (#763: the address is log only)")
+ func logLines() throws {
+ let flow = try Self.flow()
+ #expect(flow.logLine(.written) == "LC6000 display chip: update written and read back equal")
+ #expect(flow.logLine(.mismatch(at: 0x0800_BDA4)) == "LC6000 display chip: update read back different at 0x0800BDA4")
+ #expect(flow.logLine(.noAnswer) == "LC6000 display chip: update the chip stopped answering")
+ #expect(flow.logLine(.refused) == "LC6000 display chip: update not sent")
+ }
+
+ @Test("No status the owner reads has a hex address (#763)")
+ func noStatusHasHex() throws {
+ var mismatch = try Self.flow()
+ mismatch.finished(.mismatch(at: 0x0800_BDA4))
+ var recovery = try Self.flow()
+ recovery.finished(.noAnswer)
+ var done = try Self.flow()
+ done.finished(.written)
+ for flow in [try Self.flow(patched: true), mismatch, recovery, done] {
+ #expect(flow.status.map { !$0.contains("0x") } ?? true)
+ }
+ }
+
+ /// The backup's line with no update to agree with (the app's own copy before #763): the same words.
+ @Test("A backup with no flow: a chip already running ours says so in the chip's own words (#763)")
+ func backupLineWithoutFlow() {
+ let display = Identified(kind: .display, version: "00.50", refusal: nil, ours: true)
+ #expect(UpdateFlow.backupLine(files: 3, identified: display)
+ == "Backup saved: read twice and the same, 3 files.\nDisplay chip: firmware 00.50, with DeckBridge's display firmware already on it.")
+ let topPanel = Identified(kind: .topPanel, version: "00.31", refusal: nil, ours: true)
+ #expect(UpdateFlow.backupLine(files: 2, identified: topPanel)
+ == "Backup saved: read twice and the same, 2 files.\nTop panel chip: firmware 00.31, with DeckBridge's top panel firmware already on it.")
+ #expect(UpdateFlow.backupLine(files: 2, identified: nil) == "Backup saved: read twice and the same, 2 files.")
+ }
}
diff --git a/Packages/FirmwareUpdaterKit/Tests/PanelFlasherTests/StepTextTests.swift b/Packages/FirmwareUpdaterKit/Tests/PanelFlasherTests/StepTextTests.swift
index 2ef7cbae..5113eb3d 100644
--- a/Packages/FirmwareUpdaterKit/Tests/PanelFlasherTests/StepTextTests.swift
+++ b/Packages/FirmwareUpdaterKit/Tests/PanelFlasherTests/StepTextTests.swift
@@ -21,8 +21,8 @@ func eachStepReadsPlainly(step: PanelUpdate.Step, text: String) {
(.wrongBoard("chip id 5"), "This board isn't a deck panel (chip id 5). Nothing was written."),
(.notADeckPanel, "This board doesn't have the deck panel's layout. Nothing was written."),
(.noBootloader, "The panel didn't answer. Unplug it, plug it back in, and try again."),
- (.writeFailed(address: 0x10400), "Writing failed at 0x10400. The panel may not start: try again before unplugging it."),
- (.verifyFailed(address: 0x10000), "The written firmware didn't check out. The panel may not start: try again before unplugging it."),
+ (.writeFailed(address: 0x10400), "Writing stopped partway. The panel may not start: try again before you unplug it."),
+ (.verifyFailed(address: 0x10000), "The written firmware didn't check out. The panel may not start: try again before you unplug it."),
(.canceled, "Canceled. The panel was restarted."),
(.lineLost, "The cable was lost. Plug the panel back in and try again."),
(.notAPanelImage, "The firmware file isn't a deck panel image. Nothing was written."),
@@ -30,3 +30,12 @@ func eachStepReadsPlainly(step: PanelUpdate.Step, text: String) {
func eachFailureSaysWhatHappenedAndWhatToDo(error: FlashError, text: String) {
#expect(PanelUpdate.Step.failed(error).text == text)
}
+
+/// No hex address in what the owner reads (#763): an address goes to the log only.
+@Test(arguments: [
+ FlashError.portBusy, .wrongBoard("chip id 5"), .notADeckPanel, .noBootloader, .refused(op: 0x02, reason: 0x05), .noAnswer(op: 0x03),
+ .writeFailed(address: 0x10400), .verifyFailed(address: 0x10000), .canceled, .lineLost, .notAPanelImage,
+])
+func noFailureTextHasHex(error: FlashError) {
+ #expect(!PanelUpdate.Step.failed(error).text.contains("0x"))
+}
diff --git a/Packages/FirmwareUpdaterKit/Tests/UpdaterScreenTests/BrandWordingTests.swift b/Packages/FirmwareUpdaterKit/Tests/UpdaterScreenTests/BrandWordingTests.swift
new file mode 100644
index 00000000..0bfc8ef7
--- /dev/null
+++ b/Packages/FirmwareUpdaterKit/Tests/UpdaterScreenTests/BrandWordingTests.swift
@@ -0,0 +1,27 @@
+import PanelFlasher
+import Testing
+import UpdaterScreen
+
+/// The brand review's words (#763): what the owner reads names Denon's part plainly.
+@Suite("Updater: brand wording")
+struct BrandWordingTests {
+ @Test("The LC6000 warning says Denon doesn't make, support or endorse it")
+ func denonLine() {
+ #expect(UpdaterScreen.lc6000Warning.contains("It is not made, supported or endorsed by Denon."))
+ }
+
+ /// Every line that sends the owner to DeckBridge's switch quotes it the same way.
+ @Test("Each cable line has the one quoted sentence", arguments: [
+ UpdaterScreen.portBusy,
+ UpdaterScreen.deckBridgeNoAnswer,
+ PanelUpdate.Step.failed(.portBusy).text,
+ ])
+ func oneCableSentence(line: String) {
+ #expect(line.contains("Turn off \"Send over the USB cable\" in DeckBridge"))
+ }
+
+ @Test("The window is titled with the app's whole name (#763)")
+ func appName() {
+ #expect(UpdaterScreen.appName == "DeckBridge Firmware Updater")
+ }
+}
diff --git a/Packages/FirmwareUpdaterKit/Tests/UpdaterScreenTests/HandoffScreenTests.swift b/Packages/FirmwareUpdaterKit/Tests/UpdaterScreenTests/HandoffScreenTests.swift
index cfb7346b..d0f81e0d 100644
--- a/Packages/FirmwareUpdaterKit/Tests/UpdaterScreenTests/HandoffScreenTests.swift
+++ b/Packages/FirmwareUpdaterKit/Tests/UpdaterScreenTests/HandoffScreenTests.swift
@@ -8,7 +8,7 @@ struct HandoffScreenTests {
@Test("No answer: say plainly to turn off Send over the USB cable or quit DeckBridge; lent: nothing to say")
func noAnswer() {
#expect(UpdaterScreen.handoff(.noAnswer)
- == "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.")
+ == "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.")
#expect(UpdaterScreen.handoff(.lent) == nil)
}
}
diff --git a/Packages/FirmwareUpdaterKit/Tests/UpdaterScreenTests/PanelUpdateFlowTests.swift b/Packages/FirmwareUpdaterKit/Tests/UpdaterScreenTests/PanelUpdateFlowTests.swift
index a2d3a691..49c776f5 100644
--- a/Packages/FirmwareUpdaterKit/Tests/UpdaterScreenTests/PanelUpdateFlowTests.swift
+++ b/Packages/FirmwareUpdaterKit/Tests/UpdaterScreenTests/PanelUpdateFlowTests.swift
@@ -126,13 +126,24 @@ struct PanelUpdateFlowTests {
#expect(updater.screen.panel.detail == "Build 2b7e9c1")
}
+ @Test("A write that stops partway: the screen has no address, the log has it (#763)")
+ func writeFailedAddressInLogOnly() async {
+ let rig = Rig()
+ let updater = Updater(finder: rig.finder, changes: AsyncStream { $0.finish() }, log: rig.log,
+ borrow: StubDeckBridge(answers: true).borrow,
+ flasher: StubFlasher([.connecting, .writing(0.3), .failed(.writeFailed(address: 0x10400))]))
+ await updater.updatePanel()
+ #expect(updater.screen.update == "Writing stopped partway. The panel may not start: try again before you unplug it.")
+ #expect(rig.log.lines.contains("deck panel: writing stopped at 0x10400"))
+ }
+
@Test("A failure: its text shows, the port still goes back once, and the next update can start")
func failure() async {
let deckBridge = StubDeckBridge(answers: true)
let flasher = StubFlasher([.connecting, .failed(.verifyFailed(address: 0x10000))])
let updater = Self.updater(deckBridge, flasher)
await updater.updatePanel()
- #expect(updater.screen.update == "The written firmware didn't check out. The panel may not start: try again before unplugging it.")
+ #expect(updater.screen.update == "The written firmware didn't check out. The panel may not start: try again before you unplug it.")
#expect(deckBridge.posted == [.release, .done])
await updater.updatePanel()
#expect(flasher.started == 2)
diff --git a/Packages/FirmwareUpdaterKit/Tests/UpdaterScreenTests/UpdaterScreenTests.swift b/Packages/FirmwareUpdaterKit/Tests/UpdaterScreenTests/UpdaterScreenTests.swift
index b3023e76..47cfc970 100644
--- a/Packages/FirmwareUpdaterKit/Tests/UpdaterScreenTests/UpdaterScreenTests.swift
+++ b/Packages/FirmwareUpdaterKit/Tests/UpdaterScreenTests/UpdaterScreenTests.swift
@@ -141,7 +141,7 @@ struct UpdaterScreenTests {
rig.serial.busy = [Self.port]
let screen = await rig.screen()
#expect(screen.panel.status == "Deck panel found")
- #expect(screen.panel.detail == "DeckBridge is using the panel's USB cable. Turn off Send over the USB cable in DeckBridge, then look again.")
+ #expect(screen.panel.detail == "DeckBridge is using the panel's USB cable. Turn off \"Send over the USB cable\" in DeckBridge, then look again.")
#expect(UpdaterScreen.portBusy == screen.panel.detail)
#expect(rig.serial.bauds == [921_600])
#expect(rig.log.text.contains("deck panel: on USB 1A86:7522, serial port busy (another app has it)"))
diff --git a/design/icon/updater-download.svg b/design/icon/updater-download.svg
index ae2ea6c8..96922303 100644
--- a/design/icon/updater-download.svg
+++ b/design/icon/updater-download.svg
@@ -18,9 +18,10 @@
-
+
-
+
diff --git a/scripts/check_app_icon.py b/scripts/check_app_icon.py
index 4b70f265..0b4d8a6c 100755
--- a/scripts/check_app_icon.py
+++ b/scripts/check_app_icon.py
@@ -1,8 +1,9 @@
#!/usr/bin/env python3
"""Checks an app icon set and a built app bundle (#733): every macOS size is in the set at the right pixel size, and
-the built app names its icon and carries it. Exits 1 and prints each problem.
-Run: python3 -I scripts/check_app_icon.py --iconset Path/AppIcon.appiconset --app Path/Name.app"""
-import argparse, json, os, plistlib, struct, sys
+the built app names its icon and carries it. With --badge, the updater's badge is that color (#763). Exits 1 and
+prints each problem.
+Run: python3 -I scripts/check_app_icon.py --iconset Path/AppIcon.appiconset [--badge 62929E] --app Path/Name.app"""
+import argparse, json, os, plistlib, struct, sys, zlib
REQUIRED = [(size, scale) for size in (16, 32, 128, 256, 512) for scale in (1, 2)]
@@ -48,12 +49,62 @@ def app_problems(app):
return problems
+# Inside the updater's badge (design/icon/updater-download.svg: center 752,752, r 134), left of its white arrow.
+BADGE_POINT = (652, 752)
+
+
+def png_pixel(path, x, y):
+ """The RGB at x, y of an 8-bit RGBA, non-interlaced PNG (what render_app_icon.swift writes)."""
+ with open(path, "rb") as f:
+ data = f.read()
+ at, idat, width = 8, b"", 0
+ while at < len(data):
+ n, kind = struct.unpack(">I4s", data[at:at + 8])
+ body = data[at + 8:at + 8 + n]
+ if kind == b"IHDR":
+ width, _, depth, color, _, _, interlace = struct.unpack(">IIBBBBB", body)
+ if (depth, color, interlace) != (8, 6, 0):
+ raise ValueError(f"{path}: not 8-bit RGBA non-interlaced")
+ elif kind == b"IDAT":
+ idat += body
+ at += 12 + n
+ raw, stride, prior = zlib.decompress(idat), 4 * width, bytearray(4 * width)
+ for row in range(y + 1):
+ kind, line = raw[row * (stride + 1)], bytearray(raw[row * (stride + 1) + 1:(row + 1) * (stride + 1)])
+ for i in range(stride):
+ a = line[i - 4] if i >= 4 else 0
+ b, c = prior[i], prior[i - 4] if i >= 4 else 0
+ if kind == 1:
+ line[i] = (line[i] + a) & 0xFF
+ elif kind == 2:
+ line[i] = (line[i] + b) & 0xFF
+ elif kind == 3:
+ line[i] = (line[i] + (a + b) // 2) & 0xFF
+ elif kind == 4:
+ p = a + b - c
+ pa, pb, pc = abs(p - a), abs(p - b), abs(p - c)
+ line[i] = (line[i] + (a if pa <= pb and pa <= pc else b if pb <= pc else c)) & 0xFF
+ prior = line
+ return tuple(prior[4 * x:4 * x + 3])
+
+
+def badge_problems(iconset, color, tolerance=6):
+ want = tuple(int(color[i:i + 2], 16) for i in (0, 2, 4))
+ got = png_pixel(os.path.join(iconset, "icon_512x512@2x.png"), *BADGE_POINT)
+ if all(abs(g - w) <= tolerance for g, w in zip(got, want)):
+ return []
+ return ["the badge is #%02X%02X%02X, needs #%s" % (*got, color.upper())]
+
+
def main(argv):
p = argparse.ArgumentParser(description=__doc__)
p.add_argument("--iconset")
p.add_argument("--app")
+ p.add_argument("--badge", help="the badge's color as RRGGBB, read from the set's 1024 px icon")
a = p.parse_args(argv)
problems = (iconset_problems(a.iconset) if a.iconset else []) + (app_problems(a.app) if a.app else [])
+ if a.badge and a.iconset and not problems:
+ problems += badge_problems(a.iconset, a.badge)
for problem in problems:
print(problem, file=sys.stderr)
return 1 if problems else 0
diff --git a/scripts/check_updater_name.py b/scripts/check_updater_name.py
new file mode 100755
index 00000000..05189729
--- /dev/null
+++ b/scripts/check_updater_name.py
@@ -0,0 +1,29 @@
+#!/usr/bin/env python3
+"""Checks the built updater's name (#763): "DeckBridge Firmware Updater" is the .app file, CFBundleName (the app menu,
+About and Quit), CFBundleDisplayName (the Dock) and the binary. Exits 1 and prints each problem.
+Run: python3 -I scripts/check_updater_name.py "Path/DeckBridge Firmware Updater.app\""""
+import os, plistlib, sys
+
+NAME = "DeckBridge Firmware Updater"
+
+
+def problems(app):
+ found = []
+ file = os.path.basename(os.path.normpath(app))
+ if file != f"{NAME}.app":
+ found.append(f'the app is "{file}", needs "{NAME}.app"')
+ with open(os.path.join(app, "Contents", "Info.plist"), "rb") as f:
+ info = plistlib.load(f)
+ for key in ("CFBundleName", "CFBundleDisplayName"):
+ if info.get(key) != NAME:
+ found.append(f'{key} is "{info.get(key)}", needs "{NAME}"')
+ binary = info.get("CFBundleExecutable", "")
+ if not os.path.isfile(os.path.join(app, "Contents", "MacOS", binary)):
+ found.append(f'no binary "{binary}" in Contents/MacOS')
+ return found
+
+
+if __name__ == "__main__":
+ found = problems(sys.argv[1])
+ print("\n".join(found))
+ sys.exit(1 if found else 0)
diff --git a/scripts/test_check_app_icon.py b/scripts/test_check_app_icon.py
index 1f4e2e6a..183ece32 100755
--- a/scripts/test_check_app_icon.py
+++ b/scripts/test_check_app_icon.py
@@ -10,16 +10,33 @@
SIZES = [(16, 1), (16, 2), (32, 1), (32, 2), (128, 1), (128, 2), (256, 1), (256, 2), (512, 1), (512, 2)]
-def png(path, px):
- """A plain px-by-px PNG, enough for a size check."""
+def png(path, px, rgba=(0, 0, 0, 0), filters=(0,), color=None):
+ """A px-by-px PNG: one color, or `color(x, y)` per pixel, its rows filtered in turn with `filters` (0 none, 1 sub,
+ 2 up, 3 average, 4 paeth; AppKit's PNGs use them all)."""
def chunk(kind, data):
return struct.pack(">I", len(data)) + kind + data + struct.pack(">I", zlib.crc32(kind + data) & 0xFFFFFFFF)
- rows = b"".join(b"\x00" + b"\x00\x00\x00\x00" * px for _ in range(px))
+ rows, prior = [], bytes(4 * px)
+ for y in range(px):
+ raw = bytes(rgba) * px if color is None else b"".join(bytes(color(x, y)) for x in range(px))
+ kind = filters[y % len(filters)]
+ def left(i): return raw[i - 4] if i >= 4 else 0
+ def upleft(i): return prior[i - 4] if i >= 4 else 0
+ predict = {0: lambda i: 0, 1: left, 2: lambda i: prior[i], 3: lambda i: (left(i) + prior[i]) // 2,
+ 4: lambda i: paeth(left(i), prior[i], upleft(i))}[kind]
+ rows.append(bytes([kind]) + bytes((raw[i] - predict(i)) & 0xFF for i in range(len(raw))))
+ prior = raw
+ rows = b"".join(rows)
with open(path, "wb") as f:
f.write(b"\x89PNG\r\n\x1a\n" + chunk(b"IHDR", struct.pack(">IIBBBBB", px, px, 8, 6, 0, 0, 0))
+ chunk(b"IDAT", zlib.compress(rows)) + chunk(b"IEND", b""))
+def paeth(a, b, c):
+ p = a + b - c
+ pa, pb, pc = abs(p - a), abs(p - b), abs(p - c)
+ return a if pa <= pb and pa <= pc else b if pb <= pc else c
+
+
def iconset(root, sizes=SIZES, wrong=None):
"""An AppIcon.appiconset holding `sizes`; `wrong` = (size, scale) drawn at the wrong pixel size."""
d = os.path.join(root, "AppIcon.appiconset")
@@ -60,6 +77,47 @@ def test_a_full_set_has_no_problems(self):
self.assertEqual(check_app_icon.iconset_problems(iconset(self.tmp.name)), [])
+TEAL, GREEN = (0x62, 0x92, 0x9E, 0xFF), (0x3F, 0xB2, 0x7F, 0xFF)
+
+
+def badge_set(root, rgba, filters=(0,), varied=False):
+ """An icon set whose 1024 px icon is one color, as if the badge filled it. `varied`: every other pixel differs from
+ its neighbors (so each filter's predictor matters), and only the badge's point is `rgba`."""
+ d = iconset(root)
+ def color(x, y):
+ if (x, y) == check_app_icon.BADGE_POINT:
+ return rgba
+ return ((x * 7 + y * 3) % 256, (x * 13 + y * 5) % 256, (x * 3 + y * 11) % 256, 255)
+ png(os.path.join(d, "icon_512x512@2x.png"), 1024, rgba, filters, color if varied else None)
+ return d
+
+
+class BadgeTests(unittest.TestCase):
+ """The updater's badge is the ring's teal (#763), read from the 1024 px icon inside the badge, clear of the arrow."""
+
+ def setUp(self):
+ self.tmp = tempfile.TemporaryDirectory()
+ self.addCleanup(self.tmp.cleanup)
+
+ def test_a_teal_badge_passes(self):
+ self.assertEqual(check_app_icon.badge_problems(badge_set(self.tmp.name, TEAL), "62929E"), [])
+
+ def test_the_old_green_badge_is_named(self):
+ self.assertEqual(check_app_icon.badge_problems(badge_set(self.tmp.name, GREEN), "62929E"),
+ ["the badge is #3FB27F, needs #62929E"])
+
+ def test_rows_with_every_filter_read_right(self):
+ for filters in [(1,), (2,), (3,), (4,), (1, 2, 3, 4, 0)]:
+ d = badge_set(tempfile.mkdtemp(dir=self.tmp.name), GREEN, filters, varied=True)
+ self.assertEqual(check_app_icon.badge_problems(d, "62929E"), ["the badge is #3FB27F, needs #62929E"], filters)
+
+ def test_the_command_checks_the_badge(self):
+ script = os.path.join(os.path.dirname(os.path.abspath(__file__)), "check_app_icon.py")
+ r = subprocess.run([sys.executable, "-I", script, "--iconset", badge_set(self.tmp.name, GREEN), "--badge", "62929E"],
+ capture_output=True, text=True)
+ self.assertEqual((r.returncode, r.stderr.strip()), (1, "the badge is #3FB27F, needs #62929E"))
+
+
def app(root, info, resources=()):
"""A bare Name.app with this Info.plist and these empty files in Resources."""
contents = os.path.join(root, "Name.app", "Contents")
diff --git a/scripts/test_check_updater_name.py b/scripts/test_check_updater_name.py
new file mode 100755
index 00000000..f645316f
--- /dev/null
+++ b/scripts/test_check_updater_name.py
@@ -0,0 +1,63 @@
+#!/usr/bin/env python3
+"""Tests for scripts/check_updater_name.py: the built updater is "DeckBridge Firmware Updater" wherever the owner sees
+its name: the .app file, the app menu, About and Quit (CFBundleName) and the Dock (CFBundleDisplayName) (#763).
+Run: python3 -I scripts/test_check_updater_name.py"""
+import os, plistlib, subprocess, sys, tempfile, unittest
+
+sys.dont_write_bytecode = True
+sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
+import check_updater_name
+
+NAME = "DeckBridge Firmware Updater"
+SCRIPT = os.path.join(os.path.dirname(os.path.abspath(__file__)), "check_updater_name.py")
+
+
+def app(root, file=NAME, bundle=NAME, display=NAME, executable=NAME):
+ """A built app bundle: its file name, the two Info.plist names and its binary."""
+ path = os.path.join(root, f"{file}.app")
+ os.makedirs(os.path.join(path, "Contents", "MacOS"))
+ with open(os.path.join(path, "Contents", "Info.plist"), "wb") as f:
+ plistlib.dump({"CFBundleName": bundle, "CFBundleDisplayName": display, "CFBundleExecutable": executable}, f)
+ open(os.path.join(path, "Contents", "MacOS", executable), "w").close()
+ return path
+
+
+class CheckUpdaterNameTests(unittest.TestCase):
+ def setUp(self):
+ self.tmp = tempfile.TemporaryDirectory()
+
+ def tearDown(self):
+ self.tmp.cleanup()
+
+ def test_the_named_app_passes(self):
+ self.assertEqual(check_updater_name.problems(app(self.tmp.name)), [])
+
+ def test_the_old_short_menu_name_is_a_problem(self):
+ self.assertEqual(check_updater_name.problems(app(self.tmp.name, bundle="Firmware Updater")),
+ ['CFBundleName is "Firmware Updater", needs "DeckBridge Firmware Updater"'])
+
+ def test_the_old_file_name_is_a_problem(self):
+ self.assertEqual(check_updater_name.problems(app(self.tmp.name, file="FirmwareUpdater")),
+ ['the app is "FirmwareUpdater.app", needs "DeckBridge Firmware Updater.app"'])
+
+ def test_a_dock_name_that_differs_is_a_problem(self):
+ self.assertEqual(check_updater_name.problems(app(self.tmp.name, display="Updater")),
+ ['CFBundleDisplayName is "Updater", needs "DeckBridge Firmware Updater"'])
+
+ def test_a_binary_the_plist_names_but_the_app_lacks_is_a_problem(self):
+ path = app(self.tmp.name)
+ os.remove(os.path.join(path, "Contents", "MacOS", NAME))
+ self.assertEqual(check_updater_name.problems(path), [f'no binary "{NAME}" in Contents/MacOS'])
+
+ def test_the_command_exits_1_and_prints_each_problem(self):
+ path = app(self.tmp.name, bundle="Firmware Updater", display="Updater")
+ run = subprocess.run([sys.executable, "-I", SCRIPT, path], capture_output=True, text=True)
+ self.assertEqual(run.returncode, 1)
+ self.assertEqual(run.stdout.splitlines(), [
+ 'CFBundleName is "Firmware Updater", needs "DeckBridge Firmware Updater"',
+ 'CFBundleDisplayName is "Updater", needs "DeckBridge Firmware Updater"',
+ ])
+
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/scripts/test_updater_smoke.py b/scripts/test_updater_smoke.py
index a1187362..56449862 100644
--- a/scripts/test_updater_smoke.py
+++ b/scripts/test_updater_smoke.py
@@ -28,7 +28,7 @@ def setUp(self):
root = self.tmp.name
self.bin = os.path.join(root, "bin")
os.makedirs(self.bin)
- self.app = os.path.join(root, "FirmwareUpdater.app")
+ self.app = os.path.join(root, "DeckBridge Firmware Updater.app") # #763's name, its binary too
os.makedirs(os.path.join(self.app, "Contents", "MacOS"))
self.log = os.path.join(root, "updater.log")
self.ran = os.path.join(root, "ran")
@@ -42,7 +42,7 @@ def usb(self, listing):
def stand_in(self, body):
"""The app's binary: notes its arguments, then does `body` with $LOG as the log file."""
- executable(os.path.join(self.app, "Contents", "MacOS", "FirmwareUpdater"),
+ executable(os.path.join(self.app, "Contents", "MacOS", "DeckBridge Firmware Updater"),
f'#!/bin/bash\necho "$@" > "{self.ran}"\nLOG="{self.log}"\n{body}\n')
def run_smoke(self, timeout="5"):
diff --git a/scripts/updater.sh b/scripts/updater.sh
index 279079ea..77d1afd6 100755
--- a/scripts/updater.sh
+++ b/scripts/updater.sh
@@ -7,6 +7,6 @@ command -v xcodegen >/dev/null || { echo "Needs XcodeGen: brew install xcodegen"
xcodegen generate -q
xcodebuild -project FirmwareUpdater.xcodeproj -scheme FirmwareUpdater -configuration Debug -derivedDataPath build \
-quiet build
-app=build/Build/Products/Debug/FirmwareUpdater.app
+app="build/Build/Products/Debug/DeckBridge Firmware Updater.app"
[[ "${1:-}" == build ]] || open "$app"
echo "$app"
diff --git a/scripts/updater_smoke.sh b/scripts/updater_smoke.sh
index e5613a6b..6a9d7ee2 100755
--- a/scripts/updater_smoke.sh
+++ b/scripts/updater_smoke.sh
@@ -5,7 +5,7 @@
# "deck panel not found, LC6000 not found". A device line from the finder would mean it found, and maybe opened, a
# device.
#
-# Usage: scripts/updater_smoke.sh [path/to/FirmwareUpdater.app]
+# Usage: scripts/updater_smoke.sh ["path/to/DeckBridge Firmware Updater.app"]
# Default app: the Release ad-hoc build from .github/workflows/ci.yml (Apps/FirmwareUpdater/build).
#
# It needs nothing plugged in: it reads the USB device list (ioreg) first, and stops without starting the app if a
@@ -16,8 +16,9 @@
set -euo pipefail
cd "$(dirname "$0")/.."
-app="${1:-Apps/FirmwareUpdater/build/Build/Products/Release/FirmwareUpdater.app}"
-binary="$app/Contents/MacOS/FirmwareUpdater"
+app="${1:-Apps/FirmwareUpdater/build/Build/Products/Release/DeckBridge Firmware Updater.app}"
+# The binary has the app's name (#763: PRODUCT_NAME names both).
+binary="$app/Contents/MacOS/$(basename "$app" .app)"
[ -x "$binary" ] || { echo "No app at $app. Build it first (see .github/workflows/ci.yml)."; exit 2; }
log="${UPDATER_LOG:-$HOME/Library/Logs/FirmwareUpdater/updater.log}"
timeout="${UPDATER_SMOKE_TIMEOUT:-60}"