This repository has been archived by the owner on Dec 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: ignore-firmware-checksums command line argument (#2365)
Use checksum to identify installed firmware on UHK devices
- Loading branch information
Showing
6 changed files
with
48 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
packages/uhk-usb/src/utils/find-device-config-in-firmware-json.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { FirmwareJson, FirmwareJsonDevice, UhkDeviceProduct} from 'uhk-common'; | ||
|
||
export function findDeviceConfigInFirmwareJson(device: UhkDeviceProduct, firmwareJson: FirmwareJson): FirmwareJsonDevice { | ||
const deviceConfig = firmwareJson.devices.find(firmwareDevice => firmwareDevice.deviceId === device.id); | ||
|
||
if (!deviceConfig) { | ||
throw new Error(`The user config does not support: ${device.name}`); | ||
} | ||
|
||
return deviceConfig; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,10 @@ | ||
import { dirname, join } from 'path'; | ||
import { FirmwareJson, UhkDeviceProduct } from 'uhk-common'; | ||
|
||
export function getDeviceUserConfigPath(device: UhkDeviceProduct, firmwareJson: FirmwareJson): string { | ||
const deviceConfig = firmwareJson.devices.find(firmwareDevice => firmwareDevice.deviceId === device.id); | ||
import { findDeviceConfigInFirmwareJson } from './find-device-config-in-firmware-json.js'; | ||
|
||
if (!deviceConfig) { | ||
throw new Error(`The user config does not support: ${device.name}`); | ||
} | ||
export function getDeviceUserConfigPath(device: UhkDeviceProduct, firmwareJson: FirmwareJson): string { | ||
const deviceConfig = findDeviceConfigInFirmwareJson(device, firmwareJson); | ||
|
||
return join(dirname(firmwareJson.path), 'devices', deviceConfig.name, 'config.bin'); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters