@nordicsemiconductor/pc-nrfconnect-shared 121.0.0 → 122.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Changelog.md +34 -0
- package/coverage/cobertura-coverage.xml +1330 -1197
- package/nrfutil/device/__mocks__/device.ts +2 -0
- package/nrfutil/device/batch.ts +18 -2
- package/nrfutil/device/common.ts +17 -38
- package/nrfutil/device/device.ts +2 -0
- package/nrfutil/device/deviceInfo.ts +70 -0
- package/nrfutil/device/erase.ts +2 -2
- package/nrfutil/device/firmwareRead.ts +2 -2
- package/nrfutil/device/getCoreInfo.ts +2 -2
- package/nrfutil/device/getFwInfo.ts +2 -2
- package/nrfutil/device/getProtectionStatus.ts +2 -2
- package/nrfutil/device/list.ts +4 -30
- package/nrfutil/device/program.ts +4 -4
- package/nrfutil/device/recover.ts +2 -2
- package/nrfutil/device/reset.ts +2 -2
- package/nrfutil/device/setMcuState.ts +2 -5
- package/nrfutil/device/setProtectionStatus.ts +2 -2
- package/nrfutil/index.ts +1 -1
- package/nrfutil/moduleVersion.ts +20 -0
- package/nrfutil/sandboxTypes.ts +14 -0
- package/package.json +1 -1
- package/src/About/DeviceCard.tsx +6 -5
- package/src/About/SupportCard.tsx +2 -2
- package/src/Device/DeviceSelector/BasicDeviceInfo.tsx +12 -6
- package/src/Device/DeviceSelector/DeviceList/AnimatedList.tsx +1 -1
- package/src/Device/DeviceSelector/DeviceList/Device.tsx +7 -5
- package/src/Device/DeviceSelector/DeviceList/DeviceList.tsx +23 -5
- package/src/Device/DeviceSelector/DeviceList/EditDeviceButtons.tsx +7 -6
- package/src/Device/DeviceSelector/DeviceList/MoreDeviceInfo.tsx +26 -30
- package/src/Device/DeviceSelector/DeviceList/edit-device-buttons.scss +1 -2
- package/src/Device/DeviceSelector/DeviceSelector.test.tsx +17 -37
- package/src/Device/DeviceSelector/DeviceSelector.tsx +38 -13
- package/src/Device/DeviceSelector/Favorite.tsx +10 -10
- package/src/Device/DeviceSelector/basic-device-info.scss +0 -12
- package/src/Device/deviceInfo/deviceInfo.ts +2 -2
- package/src/Device/deviceLister.ts +52 -43
- package/src/Device/deviceSetup.ts +27 -10
- package/src/Device/deviceSlice.ts +148 -84
- package/src/Device/jprogOperations.ts +56 -27
- package/src/Device/sdfuOperations.ts +25 -31
- package/src/InlineInput/NumberInlineInput.tsx +1 -1
- package/src/InlineInput/NumberInputWithDropdown.tsx +1 -2
- package/src/index.ts +1 -0
- package/src/logging/sendInitialLogMessages.ts +13 -9
- package/src/utils/logLibVersions.ts +1 -1
- package/src/utils/systemReport.ts +3 -3
- package/typings/generated/nrfutil/device/__mocks__/device.d.ts +1 -0
- package/typings/generated/nrfutil/device/__mocks__/device.d.ts.map +1 -1
- package/typings/generated/nrfutil/device/batch.d.ts +3 -2
- package/typings/generated/nrfutil/device/batch.d.ts.map +1 -1
- package/typings/generated/nrfutil/device/common.d.ts +6 -33
- package/typings/generated/nrfutil/device/common.d.ts.map +1 -1
- package/typings/generated/nrfutil/device/device.d.ts +13 -12
- package/typings/generated/nrfutil/device/device.d.ts.map +1 -1
- package/typings/generated/nrfutil/device/deviceInfo.d.ts +40 -0
- package/typings/generated/nrfutil/device/deviceInfo.d.ts.map +1 -0
- package/typings/generated/nrfutil/device/erase.d.ts +2 -2
- package/typings/generated/nrfutil/device/erase.d.ts.map +1 -1
- package/typings/generated/nrfutil/device/firmwareRead.d.ts +2 -2
- package/typings/generated/nrfutil/device/firmwareRead.d.ts.map +1 -1
- package/typings/generated/nrfutil/device/getCoreInfo.d.ts +2 -2
- package/typings/generated/nrfutil/device/getCoreInfo.d.ts.map +1 -1
- package/typings/generated/nrfutil/device/getFwInfo.d.ts +2 -2
- package/typings/generated/nrfutil/device/getFwInfo.d.ts.map +1 -1
- package/typings/generated/nrfutil/device/getProtectionStatus.d.ts +2 -2
- package/typings/generated/nrfutil/device/getProtectionStatus.d.ts.map +1 -1
- package/typings/generated/nrfutil/device/list.d.ts +3 -3
- package/typings/generated/nrfutil/device/list.d.ts.map +1 -1
- package/typings/generated/nrfutil/device/program.d.ts +2 -2
- package/typings/generated/nrfutil/device/program.d.ts.map +1 -1
- package/typings/generated/nrfutil/device/recover.d.ts +2 -2
- package/typings/generated/nrfutil/device/recover.d.ts.map +1 -1
- package/typings/generated/nrfutil/device/reset.d.ts +2 -2
- package/typings/generated/nrfutil/device/reset.d.ts.map +1 -1
- package/typings/generated/nrfutil/device/setMcuState.d.ts +2 -2
- package/typings/generated/nrfutil/device/setMcuState.d.ts.map +1 -1
- package/typings/generated/nrfutil/device/setProtectionStatus.d.ts +2 -2
- package/typings/generated/nrfutil/device/setProtectionStatus.d.ts.map +1 -1
- package/typings/generated/nrfutil/index.d.ts +2 -1
- package/typings/generated/nrfutil/index.d.ts.map +1 -1
- package/typings/generated/nrfutil/moduleVersion.d.ts +4 -0
- package/typings/generated/nrfutil/moduleVersion.d.ts.map +1 -1
- package/typings/generated/nrfutil/sandboxTypes.d.ts +9 -0
- package/typings/generated/nrfutil/sandboxTypes.d.ts.map +1 -1
- package/typings/generated/src/About/DeviceCard.d.ts.map +1 -1
- package/typings/generated/src/Device/DeviceSelector/BasicDeviceInfo.d.ts.map +1 -1
- package/typings/generated/src/Device/DeviceSelector/DeviceList/Device.d.ts +0 -1
- package/typings/generated/src/Device/DeviceSelector/DeviceList/Device.d.ts.map +1 -1
- package/typings/generated/src/Device/DeviceSelector/DeviceList/DeviceList.d.ts.map +1 -1
- package/typings/generated/src/Device/DeviceSelector/DeviceList/EditDeviceButtons.d.ts.map +1 -1
- package/typings/generated/src/Device/DeviceSelector/DeviceList/MoreDeviceInfo.d.ts +0 -1
- package/typings/generated/src/Device/DeviceSelector/DeviceList/MoreDeviceInfo.d.ts.map +1 -1
- package/typings/generated/src/Device/DeviceSelector/DeviceSelector.d.ts.map +1 -1
- package/typings/generated/src/Device/DeviceSelector/Favorite.d.ts +0 -1
- package/typings/generated/src/Device/DeviceSelector/Favorite.d.ts.map +1 -1
- package/typings/generated/src/Device/deviceLister.d.ts +1 -15
- package/typings/generated/src/Device/deviceLister.d.ts.map +1 -1
- package/typings/generated/src/Device/deviceSetup.d.ts +6 -5
- package/typings/generated/src/Device/deviceSetup.d.ts.map +1 -1
- package/typings/generated/src/Device/deviceSlice.d.ts +12 -15
- package/typings/generated/src/Device/deviceSlice.d.ts.map +1 -1
- package/typings/generated/src/Device/jprogOperations.d.ts.map +1 -1
- package/typings/generated/src/Device/sdfuOperations.d.ts.map +1 -1
- package/typings/generated/src/InlineInput/NumberInlineInput.d.ts +1 -1
- package/typings/generated/src/InlineInput/NumberInlineInput.d.ts.map +1 -1
- package/typings/generated/src/InlineInput/NumberInputWithDropdown.d.ts.map +1 -1
- package/typings/generated/src/index.d.ts +1 -1
- package/typings/generated/src/index.d.ts.map +1 -1
- package/typings/generated/src/logging/sendInitialLogMessages.d.ts.map +1 -1
- package/typings/generated/src/utils/systemReport.d.ts +1 -1
- package/typings/generated/src/utils/systemReport.d.ts.map +1 -1
- package/src/Device/DeviceSelector/DeviceList/device.scss +0 -28
- package/src/Device/DeviceSelector/DeviceList/more-device-info.scss +0 -33
- package/src/Device/DeviceSelector/favorite.scss +0 -17
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
const program = jest.fn();
|
|
8
8
|
const programBuffer = jest.fn();
|
|
9
|
+
const deviceInfo = jest.fn(() => Promise.resolve({}));
|
|
9
10
|
const erase = jest.fn();
|
|
10
11
|
const recover = jest.fn();
|
|
11
12
|
const reset = jest.fn();
|
|
@@ -26,6 +27,7 @@ const getModuleVersion = jest.fn();
|
|
|
26
27
|
export default {
|
|
27
28
|
program,
|
|
28
29
|
programBuffer,
|
|
30
|
+
deviceInfo,
|
|
29
31
|
erase,
|
|
30
32
|
recover,
|
|
31
33
|
reset,
|
package/nrfutil/device/batch.ts
CHANGED
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
DeviceTraits,
|
|
17
17
|
deviceTraitsToArgs,
|
|
18
18
|
getDeviceSandbox,
|
|
19
|
-
|
|
19
|
+
NrfutilDevice,
|
|
20
20
|
ResetKind,
|
|
21
21
|
} from './common';
|
|
22
22
|
import { DeviceBuffer } from './firmwareRead';
|
|
@@ -75,6 +75,16 @@ export class Batch {
|
|
|
75
75
|
this.operationBatchGeneration.push(getPromise());
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
+
public getDeviceInfo(core: DeviceCore, callbacks?: Callbacks<FWInfo>) {
|
|
79
|
+
this.enqueueBatchOperationObject(
|
|
80
|
+
'device-info',
|
|
81
|
+
core,
|
|
82
|
+
callbacks as CallbacksUnknown
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
return this;
|
|
86
|
+
}
|
|
87
|
+
|
|
78
88
|
public erase(core: DeviceCore, callbacks?: Callbacks) {
|
|
79
89
|
this.enqueueBatchOperationObject(
|
|
80
90
|
'erase',
|
|
@@ -225,9 +235,15 @@ export class Batch {
|
|
|
225
235
|
}
|
|
226
236
|
|
|
227
237
|
public async run(
|
|
228
|
-
device:
|
|
238
|
+
device: NrfutilDevice,
|
|
229
239
|
controller?: AbortController | undefined
|
|
230
240
|
): Promise<unknown[]> {
|
|
241
|
+
if (!device.serialNumber) {
|
|
242
|
+
throw new Error(
|
|
243
|
+
`Device does not have a serial number, no device operation is possible`
|
|
244
|
+
);
|
|
245
|
+
}
|
|
246
|
+
|
|
231
247
|
let currentOperationIndex = -1;
|
|
232
248
|
let lastCompletedOperationIndex = -1;
|
|
233
249
|
const results: TaskEnd<unknown>[] = [];
|
package/nrfutil/device/common.ts
CHANGED
|
@@ -42,48 +42,25 @@ export interface DeviceLeftEvent {
|
|
|
42
42
|
id: number;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
export interface
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
romPageSize: number;
|
|
49
|
-
deviceFamily: string;
|
|
50
|
-
deviceVersion: string;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export interface DfuTriggerInfo {
|
|
54
|
-
wAddress: number;
|
|
55
|
-
wVersionMajor: number;
|
|
56
|
-
wVersionMinor: number;
|
|
57
|
-
wFirmwareId: number;
|
|
58
|
-
wFlashSize: number;
|
|
59
|
-
wFlashPageSize: number;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export interface DfuTriggerVersion {
|
|
63
|
-
semVer: string;
|
|
45
|
+
export interface NordicDevKit {
|
|
46
|
+
boardVersion?: string;
|
|
47
|
+
deviceFamily?: string;
|
|
64
48
|
}
|
|
65
49
|
|
|
66
50
|
export interface NrfutilDevice {
|
|
67
51
|
id: number;
|
|
52
|
+
devkit?: NordicDevKit;
|
|
68
53
|
serialNumber?: string; // undefined in case udev is not installed
|
|
69
54
|
traits: DeviceTraits;
|
|
70
55
|
usb?: USB;
|
|
71
|
-
jlink?: JLink;
|
|
72
56
|
// non-Nordic devices may not have serialPorts property at all
|
|
73
57
|
serialPorts?: Array<SerialPort>;
|
|
74
|
-
hwInfo?: HwInfo;
|
|
75
|
-
dfuTriggerInfo?: DfuTriggerInfo;
|
|
76
|
-
dfuTriggerVersion?: DfuTriggerVersion;
|
|
77
58
|
broken?: null | {
|
|
78
59
|
description: string;
|
|
79
60
|
url: string;
|
|
80
61
|
};
|
|
81
62
|
}
|
|
82
63
|
|
|
83
|
-
export interface NrfutilDeviceWithSerialnumber extends NrfutilDevice {
|
|
84
|
-
serialNumber: string;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
64
|
export type DeviceFamily =
|
|
88
65
|
| 'NRF51_FAMILY'
|
|
89
66
|
| 'NRF52_FAMILY'
|
|
@@ -168,15 +145,6 @@ export interface USBDevice {
|
|
|
168
145
|
descriptor: USBDeviceDescriptor;
|
|
169
146
|
configList: USBConfiguration; // todo: check this prop
|
|
170
147
|
}
|
|
171
|
-
|
|
172
|
-
export interface JLink {
|
|
173
|
-
serialNumber: string;
|
|
174
|
-
boardVersion: string | null; // can be null for external jLink
|
|
175
|
-
jlinkObFirmwareVersion: string | null;
|
|
176
|
-
deviceFamily: string | null;
|
|
177
|
-
deviceVersion: string | null; // will be null if device is protected
|
|
178
|
-
}
|
|
179
|
-
|
|
180
148
|
export interface SerialPort {
|
|
181
149
|
serialNumber: string | null;
|
|
182
150
|
comName: string | null;
|
|
@@ -246,12 +214,17 @@ export const getDeviceSandbox = async () => {
|
|
|
246
214
|
};
|
|
247
215
|
|
|
248
216
|
export const deviceSingleTaskEndOperation = async <T = void>(
|
|
249
|
-
device:
|
|
217
|
+
device: NrfutilDevice,
|
|
250
218
|
command: string,
|
|
251
219
|
onProgress?: (progress: Progress) => void,
|
|
252
220
|
controller?: AbortController,
|
|
253
221
|
args: string[] = []
|
|
254
222
|
) => {
|
|
223
|
+
if (!device.serialNumber) {
|
|
224
|
+
throw new Error(
|
|
225
|
+
`Device does not have a serial number, no device operation is possible`
|
|
226
|
+
);
|
|
227
|
+
}
|
|
255
228
|
const box = await getDeviceSandbox();
|
|
256
229
|
return box.singleTaskEndOperationWithData<T>(
|
|
257
230
|
command,
|
|
@@ -262,12 +235,18 @@ export const deviceSingleTaskEndOperation = async <T = void>(
|
|
|
262
235
|
};
|
|
263
236
|
|
|
264
237
|
export const deviceSingleTaskEndOperationVoid = async (
|
|
265
|
-
device:
|
|
238
|
+
device: NrfutilDevice,
|
|
266
239
|
command: string,
|
|
267
240
|
onProgress?: (progress: Progress) => void,
|
|
268
241
|
controller?: AbortController,
|
|
269
242
|
args: string[] = []
|
|
270
243
|
) => {
|
|
244
|
+
if (!device.serialNumber) {
|
|
245
|
+
throw new Error(
|
|
246
|
+
`Device does not have a serial number, no device operation is possible`
|
|
247
|
+
);
|
|
248
|
+
}
|
|
249
|
+
|
|
271
250
|
const box = await getDeviceSandbox();
|
|
272
251
|
await box.singleTaskEndOperationOptionalData(
|
|
273
252
|
command,
|
package/nrfutil/device/device.ts
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
import { LogLevel, LogMessage } from '../sandboxTypes';
|
|
8
8
|
import { Batch } from './batch';
|
|
9
9
|
import { getDeviceSandbox } from './common';
|
|
10
|
+
import deviceInfo from './deviceInfo';
|
|
10
11
|
import erase from './erase';
|
|
11
12
|
import firmwareRead from './firmwareRead';
|
|
12
13
|
import getCoreInfo from './getCoreInfo';
|
|
@@ -43,6 +44,7 @@ const getModuleVersion = async () => {
|
|
|
43
44
|
|
|
44
45
|
export default {
|
|
45
46
|
program,
|
|
47
|
+
deviceInfo,
|
|
46
48
|
erase,
|
|
47
49
|
recover,
|
|
48
50
|
reset,
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2023 Nordic Semiconductor ASA
|
|
3
|
+
*
|
|
4
|
+
* SPDX-License-Identifier: LicenseRef-Nordic-4-Clause
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { Progress } from '../sandboxTypes';
|
|
8
|
+
import {
|
|
9
|
+
DeviceCore,
|
|
10
|
+
deviceSingleTaskEndOperation,
|
|
11
|
+
NrfutilDevice,
|
|
12
|
+
} from './common';
|
|
13
|
+
|
|
14
|
+
export interface HwInfo {
|
|
15
|
+
romSize: number;
|
|
16
|
+
ramSize: number;
|
|
17
|
+
romPageSize: number;
|
|
18
|
+
deviceFamily: string;
|
|
19
|
+
deviceVersion: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface JLinkDeviceInfo {
|
|
23
|
+
serialNumber: string;
|
|
24
|
+
boardVersion?: string;
|
|
25
|
+
jlinkObFirmwareVersion: string;
|
|
26
|
+
deviceFamily: string | null;
|
|
27
|
+
deviceVersion?: string | null;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface DfuTriggerInfo {
|
|
31
|
+
wAddress: number;
|
|
32
|
+
wVersionMajor: number;
|
|
33
|
+
wVersionMinor: number;
|
|
34
|
+
wFirmwareId: number;
|
|
35
|
+
wFlashSize: number;
|
|
36
|
+
wFlashPageSize: number;
|
|
37
|
+
}
|
|
38
|
+
export interface DfuTriggerVersion {
|
|
39
|
+
semVer: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface DeviceInfo {
|
|
43
|
+
hwInfo?: HwInfo;
|
|
44
|
+
jlink?: JLinkDeviceInfo;
|
|
45
|
+
dfuTriggerVersion?: DfuTriggerVersion;
|
|
46
|
+
dfuTriggerInfo?: DfuTriggerInfo;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface DeviceInfoRaw {
|
|
50
|
+
name: 'device-info';
|
|
51
|
+
deviceInfo: DeviceInfo;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export default async (
|
|
55
|
+
device: NrfutilDevice,
|
|
56
|
+
core?: DeviceCore,
|
|
57
|
+
onProgress?: (progress: Progress) => void,
|
|
58
|
+
controller?: AbortController
|
|
59
|
+
) =>
|
|
60
|
+
device.traits.jlink || device.traits.nordicDfu
|
|
61
|
+
? (
|
|
62
|
+
await deviceSingleTaskEndOperation<DeviceInfoRaw>(
|
|
63
|
+
device,
|
|
64
|
+
'device-info',
|
|
65
|
+
onProgress,
|
|
66
|
+
controller,
|
|
67
|
+
core ? ['--core', core] : []
|
|
68
|
+
)
|
|
69
|
+
).deviceInfo
|
|
70
|
+
: undefined;
|
package/nrfutil/device/erase.ts
CHANGED
|
@@ -8,11 +8,11 @@ import { Progress } from '../sandboxTypes';
|
|
|
8
8
|
import {
|
|
9
9
|
DeviceCore,
|
|
10
10
|
deviceSingleTaskEndOperationVoid,
|
|
11
|
-
|
|
11
|
+
NrfutilDevice,
|
|
12
12
|
} from './common';
|
|
13
13
|
|
|
14
14
|
export default (
|
|
15
|
-
device:
|
|
15
|
+
device: NrfutilDevice,
|
|
16
16
|
core?: DeviceCore,
|
|
17
17
|
onProgress?: (progress: Progress) => void,
|
|
18
18
|
controller?: AbortController
|
|
@@ -8,7 +8,7 @@ import { Progress } from '../sandboxTypes';
|
|
|
8
8
|
import {
|
|
9
9
|
DeviceCore,
|
|
10
10
|
deviceSingleTaskEndOperation,
|
|
11
|
-
|
|
11
|
+
NrfutilDevice,
|
|
12
12
|
} from './common';
|
|
13
13
|
|
|
14
14
|
export interface DeviceBuffer {
|
|
@@ -17,7 +17,7 @@ export interface DeviceBuffer {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
export default async (
|
|
20
|
-
device:
|
|
20
|
+
device: NrfutilDevice,
|
|
21
21
|
core?: DeviceCore,
|
|
22
22
|
onProgress?: (progress: Progress) => void,
|
|
23
23
|
controller?: AbortController
|
|
@@ -8,7 +8,7 @@ import { Progress } from '../sandboxTypes';
|
|
|
8
8
|
import {
|
|
9
9
|
DeviceCore,
|
|
10
10
|
deviceSingleTaskEndOperation,
|
|
11
|
-
|
|
11
|
+
NrfutilDevice,
|
|
12
12
|
} from './common';
|
|
13
13
|
|
|
14
14
|
export type DeviceCoreInfo = {
|
|
@@ -30,7 +30,7 @@ export type DeviceCoreInfo = {
|
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
export default (
|
|
33
|
-
device:
|
|
33
|
+
device: NrfutilDevice,
|
|
34
34
|
core?: DeviceCore,
|
|
35
35
|
onProgress?: (progress: Progress) => void,
|
|
36
36
|
controller?: AbortController
|
|
@@ -8,7 +8,7 @@ import { Progress } from '../sandboxTypes';
|
|
|
8
8
|
import {
|
|
9
9
|
DeviceCore,
|
|
10
10
|
deviceSingleTaskEndOperation,
|
|
11
|
-
|
|
11
|
+
NrfutilDevice,
|
|
12
12
|
} from './common';
|
|
13
13
|
|
|
14
14
|
type BootloaderType =
|
|
@@ -55,7 +55,7 @@ export interface FWInfo {
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
export default (
|
|
58
|
-
device:
|
|
58
|
+
device: NrfutilDevice,
|
|
59
59
|
core?: DeviceCore,
|
|
60
60
|
onProgress?: (progress: Progress) => void,
|
|
61
61
|
controller?: AbortController
|
|
@@ -8,7 +8,7 @@ import { Progress } from '../sandboxTypes';
|
|
|
8
8
|
import {
|
|
9
9
|
DeviceCore,
|
|
10
10
|
deviceSingleTaskEndOperation,
|
|
11
|
-
|
|
11
|
+
NrfutilDevice,
|
|
12
12
|
} from './common';
|
|
13
13
|
|
|
14
14
|
type DeviceFamily =
|
|
@@ -32,7 +32,7 @@ export interface GetProtectionStatusResult {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
export default (
|
|
35
|
-
device:
|
|
35
|
+
device: NrfutilDevice,
|
|
36
36
|
core?: DeviceCore,
|
|
37
37
|
onProgress?: (progress: Progress) => void,
|
|
38
38
|
controller?: AbortController
|
package/nrfutil/device/list.ts
CHANGED
|
@@ -4,13 +4,11 @@
|
|
|
4
4
|
* SPDX-License-Identifier: LicenseRef-Nordic-4-Clause
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import logger from '../../src/logging';
|
|
8
7
|
import {
|
|
9
8
|
DeviceTraits,
|
|
10
9
|
deviceTraitsToArgs,
|
|
11
10
|
getDeviceSandbox,
|
|
12
11
|
NrfutilDevice,
|
|
13
|
-
NrfutilDeviceWithSerialnumber,
|
|
14
12
|
} from './common';
|
|
15
13
|
|
|
16
14
|
export interface HotplugEvent {
|
|
@@ -32,10 +30,10 @@ const isHotplugEvent = (
|
|
|
32
30
|
|
|
33
31
|
export default async (
|
|
34
32
|
traits: DeviceTraits,
|
|
35
|
-
onEnumerated: (devices:
|
|
33
|
+
onEnumerated: (devices: NrfutilDevice[]) => void,
|
|
36
34
|
onError: (error: Error) => void,
|
|
37
35
|
onHotplugEvent?: {
|
|
38
|
-
onDeviceArrived: (device:
|
|
36
|
+
onDeviceArrived: (device: NrfutilDevice) => void;
|
|
39
37
|
onDeviceLeft: (id: number) => void;
|
|
40
38
|
},
|
|
41
39
|
timeout?: number
|
|
@@ -53,21 +51,7 @@ export default async (
|
|
|
53
51
|
|
|
54
52
|
const onData = (data: HotplugEvent | ListEvent) => {
|
|
55
53
|
if (isListEvent(data)) {
|
|
56
|
-
data.devices
|
|
57
|
-
.filter(d => !d.serialNumber)
|
|
58
|
-
.forEach(d => {
|
|
59
|
-
logger.warn(
|
|
60
|
-
`Device was skipped as it has no Serial number ${JSON.stringify(
|
|
61
|
-
d
|
|
62
|
-
)}`
|
|
63
|
-
);
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
onEnumerated(
|
|
67
|
-
data.devices.filter(
|
|
68
|
-
d => d.serialNumber
|
|
69
|
-
) as NrfutilDeviceWithSerialnumber[]
|
|
70
|
-
);
|
|
54
|
+
onEnumerated(data.devices);
|
|
71
55
|
|
|
72
56
|
return;
|
|
73
57
|
}
|
|
@@ -77,17 +61,7 @@ export default async (
|
|
|
77
61
|
}
|
|
78
62
|
|
|
79
63
|
if (data.event === 'Arrived' && data.device) {
|
|
80
|
-
|
|
81
|
-
onHotplugEvent.onDeviceArrived(
|
|
82
|
-
data.device as NrfutilDeviceWithSerialnumber
|
|
83
|
-
);
|
|
84
|
-
} else {
|
|
85
|
-
logger.warn(
|
|
86
|
-
`Device was skipped as it has no Serial number ${JSON.stringify(
|
|
87
|
-
data.device
|
|
88
|
-
)}`
|
|
89
|
-
);
|
|
90
|
-
}
|
|
64
|
+
onHotplugEvent.onDeviceArrived(data.device);
|
|
91
65
|
} else if (data.event === 'Left') {
|
|
92
66
|
onHotplugEvent.onDeviceLeft(data.id);
|
|
93
67
|
}
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
DeviceCore,
|
|
15
15
|
deviceSingleTaskEndOperationVoid,
|
|
16
16
|
DeviceTraits,
|
|
17
|
-
|
|
17
|
+
NrfutilDevice,
|
|
18
18
|
ResetKind,
|
|
19
19
|
} from './common';
|
|
20
20
|
|
|
@@ -99,7 +99,7 @@ export const programmingOptionsToArgs = (options?: ProgrammingOptions) => {
|
|
|
99
99
|
return args.length > 0 ? ['--options', `${args.join(',')}`] : [];
|
|
100
100
|
};
|
|
101
101
|
const program = (
|
|
102
|
-
device:
|
|
102
|
+
device: NrfutilDevice,
|
|
103
103
|
firmwarePath: string,
|
|
104
104
|
onProgress?: (progress: Progress) => void,
|
|
105
105
|
core?: DeviceCore,
|
|
@@ -121,7 +121,7 @@ const program = (
|
|
|
121
121
|
);
|
|
122
122
|
|
|
123
123
|
const programBuffer = async (
|
|
124
|
-
device:
|
|
124
|
+
device: NrfutilDevice,
|
|
125
125
|
firmware: Buffer,
|
|
126
126
|
type: FileExtensions,
|
|
127
127
|
onProgress?: (progress: Progress) => void,
|
|
@@ -157,7 +157,7 @@ const programBuffer = async (
|
|
|
157
157
|
};
|
|
158
158
|
|
|
159
159
|
export default async (
|
|
160
|
-
device:
|
|
160
|
+
device: NrfutilDevice,
|
|
161
161
|
firmware: FirmwareType,
|
|
162
162
|
onProgress?: (progress: Progress) => void,
|
|
163
163
|
core?: DeviceCore,
|
|
@@ -8,11 +8,11 @@ import { Progress } from '../sandboxTypes';
|
|
|
8
8
|
import {
|
|
9
9
|
DeviceCore,
|
|
10
10
|
deviceSingleTaskEndOperationVoid,
|
|
11
|
-
|
|
11
|
+
NrfutilDevice,
|
|
12
12
|
} from './common';
|
|
13
13
|
|
|
14
14
|
export default (
|
|
15
|
-
device:
|
|
15
|
+
device: NrfutilDevice,
|
|
16
16
|
core?: DeviceCore,
|
|
17
17
|
onProgress?: (progress: Progress) => void,
|
|
18
18
|
controller?: AbortController
|
package/nrfutil/device/reset.ts
CHANGED
|
@@ -8,12 +8,12 @@ import { Progress } from '../sandboxTypes';
|
|
|
8
8
|
import {
|
|
9
9
|
DeviceCore,
|
|
10
10
|
deviceSingleTaskEndOperationVoid,
|
|
11
|
-
|
|
11
|
+
NrfutilDevice,
|
|
12
12
|
ResetKind,
|
|
13
13
|
} from './common';
|
|
14
14
|
|
|
15
15
|
export default async (
|
|
16
|
-
device:
|
|
16
|
+
device: NrfutilDevice,
|
|
17
17
|
core?: DeviceCore,
|
|
18
18
|
resetKind?: ResetKind,
|
|
19
19
|
onProgress?: (progress: Progress) => void,
|
|
@@ -5,15 +5,12 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { Progress } from '../sandboxTypes';
|
|
8
|
-
import {
|
|
9
|
-
deviceSingleTaskEndOperationVoid,
|
|
10
|
-
NrfutilDeviceWithSerialnumber,
|
|
11
|
-
} from './common';
|
|
8
|
+
import { deviceSingleTaskEndOperationVoid, NrfutilDevice } from './common';
|
|
12
9
|
|
|
13
10
|
export type McuState = 'Application' | 'Programming';
|
|
14
11
|
|
|
15
12
|
export default (
|
|
16
|
-
device:
|
|
13
|
+
device: NrfutilDevice,
|
|
17
14
|
state: McuState,
|
|
18
15
|
onProgress?: (progress: Progress) => void,
|
|
19
16
|
controller?: AbortController
|
|
@@ -8,11 +8,11 @@ import { Progress } from '../sandboxTypes';
|
|
|
8
8
|
import {
|
|
9
9
|
DeviceCore,
|
|
10
10
|
deviceSingleTaskEndOperationVoid,
|
|
11
|
-
|
|
11
|
+
NrfutilDevice,
|
|
12
12
|
} from './common';
|
|
13
13
|
|
|
14
14
|
export default (
|
|
15
|
-
device:
|
|
15
|
+
device: NrfutilDevice,
|
|
16
16
|
region: 'All' | 'SecureRegions' | 'Region0' | 'Region0Region1',
|
|
17
17
|
core?: DeviceCore,
|
|
18
18
|
onProgress?: (progress: Progress) => void,
|
package/nrfutil/index.ts
CHANGED
|
@@ -12,9 +12,9 @@ export type {
|
|
|
12
12
|
ProtectionStatus,
|
|
13
13
|
SerialPort as DeviceSerialPort,
|
|
14
14
|
NrfutilDevice,
|
|
15
|
-
NrfutilDeviceWithSerialnumber,
|
|
16
15
|
} from './device/common';
|
|
17
16
|
|
|
17
|
+
export type { DeviceInfo } from './device/deviceInfo';
|
|
18
18
|
export type { DeviceCoreInfo } from './device/getCoreInfo';
|
|
19
19
|
export type { ImageType } from './device/getFwInfo';
|
|
20
20
|
|
package/nrfutil/moduleVersion.ts
CHANGED
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
isSemanticVersion,
|
|
12
12
|
isStringVersion,
|
|
13
13
|
SubDependency,
|
|
14
|
+
versionToString,
|
|
14
15
|
} from './sandboxTypes';
|
|
15
16
|
|
|
16
17
|
export const describeVersion = (version?: SubDependency | string) => {
|
|
@@ -51,6 +52,25 @@ const findInDependencies = (
|
|
|
51
52
|
}
|
|
52
53
|
};
|
|
53
54
|
|
|
55
|
+
export const getExpectedVersion = (dependency: Dependency) => {
|
|
56
|
+
const currentVersion = versionToString(
|
|
57
|
+
dependency.versionFormat,
|
|
58
|
+
dependency.version
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
const expectedVersion = dependency.expectedVersion
|
|
62
|
+
? versionToString(
|
|
63
|
+
dependency.expectedVersion.versionFormat,
|
|
64
|
+
dependency.expectedVersion.version
|
|
65
|
+
)
|
|
66
|
+
: currentVersion;
|
|
67
|
+
|
|
68
|
+
return {
|
|
69
|
+
isExpectedVersion: currentVersion === expectedVersion,
|
|
70
|
+
expectedVersion,
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
|
|
54
74
|
export const resolveModuleVersion = (
|
|
55
75
|
module: KnownModule,
|
|
56
76
|
versions: Dependency[] = []
|
package/nrfutil/sandboxTypes.ts
CHANGED
|
@@ -155,6 +155,10 @@ export type Dependency = {
|
|
|
155
155
|
dependencies?: SubDependency[];
|
|
156
156
|
versionFormat: VersionFormat;
|
|
157
157
|
version: VersionType;
|
|
158
|
+
expectedVersion?: {
|
|
159
|
+
versionFormat: VersionFormat;
|
|
160
|
+
version: VersionType;
|
|
161
|
+
};
|
|
158
162
|
};
|
|
159
163
|
|
|
160
164
|
export type VersionType = SemanticVersion | string | number;
|
|
@@ -165,6 +169,7 @@ export interface SubDependency {
|
|
|
165
169
|
dependencies?: SubDependency[];
|
|
166
170
|
versionFormat: VersionFormat;
|
|
167
171
|
version: VersionType;
|
|
172
|
+
expectedVersion?: { versionFormat: VersionFormat; version: VersionType };
|
|
168
173
|
}
|
|
169
174
|
|
|
170
175
|
export type ModuleVersion = {
|
|
@@ -192,3 +197,12 @@ export const isStringVersion = (
|
|
|
192
197
|
version?: SubDependency
|
|
193
198
|
): version is SubDependency & { version: string } =>
|
|
194
199
|
version?.versionFormat === 'string';
|
|
200
|
+
|
|
201
|
+
export const versionToString = (type: VersionFormat, version: VersionType) => {
|
|
202
|
+
if (type === 'incremental' || type === 'string') {
|
|
203
|
+
return `${version}`;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
const v = version as SemanticVersion;
|
|
207
|
+
return `${v.major}.${v.minor}.${v.patch}`;
|
|
208
|
+
};
|
package/package.json
CHANGED
package/src/About/DeviceCard.tsx
CHANGED
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
deviceInfo,
|
|
14
14
|
productPageUrl,
|
|
15
15
|
} from '../Device/deviceInfo/deviceInfo';
|
|
16
|
-
import { selectedDevice } from '../Device/deviceSlice';
|
|
16
|
+
import { selectedDevice, selectedDeviceInfo } from '../Device/deviceSlice';
|
|
17
17
|
import AboutButton from './AboutButton';
|
|
18
18
|
import Section from './Section';
|
|
19
19
|
|
|
@@ -27,6 +27,7 @@ const memorySize = (memoryInBytes: number) => {
|
|
|
27
27
|
|
|
28
28
|
export default () => {
|
|
29
29
|
const device = useSelector(selectedDevice);
|
|
30
|
+
const info = useSelector(selectedDeviceInfo);
|
|
30
31
|
|
|
31
32
|
if (device == null) {
|
|
32
33
|
return (
|
|
@@ -36,7 +37,7 @@ export default () => {
|
|
|
36
37
|
);
|
|
37
38
|
}
|
|
38
39
|
|
|
39
|
-
const pca = device.
|
|
40
|
+
const pca = device.devkit?.boardVersion;
|
|
40
41
|
const { name, cores } = deviceInfo(device);
|
|
41
42
|
|
|
42
43
|
return (
|
|
@@ -47,13 +48,13 @@ export default () => {
|
|
|
47
48
|
<Section title="PCA">{pca || 'Unknown'}</Section>
|
|
48
49
|
<Section title="Cores">{cores || 'Unknown'}</Section>
|
|
49
50
|
|
|
50
|
-
{
|
|
51
|
+
{info?.hwInfo && (
|
|
51
52
|
<>
|
|
52
53
|
<Section title="RAM">
|
|
53
|
-
{memorySize(
|
|
54
|
+
{memorySize(info.hwInfo.ramSize)}
|
|
54
55
|
</Section>
|
|
55
56
|
<Section title="Flash">
|
|
56
|
-
{memorySize(
|
|
57
|
+
{memorySize(info.hwInfo.romSize)}
|
|
57
58
|
</Section>
|
|
58
59
|
</>
|
|
59
60
|
)}
|
|
@@ -12,8 +12,8 @@ import NrfutilDeviceLib from '../../nrfutil/device/device';
|
|
|
12
12
|
import Button from '../Button/Button';
|
|
13
13
|
import Card from '../Card/Card';
|
|
14
14
|
import {
|
|
15
|
-
deviceInfo,
|
|
16
15
|
getDevices,
|
|
16
|
+
selectedDevice,
|
|
17
17
|
selectedSerialNumber,
|
|
18
18
|
} from '../Device/deviceSlice';
|
|
19
19
|
import { isLoggingVerbose, setIsLoggingVerbose } from '../Log/logSlice';
|
|
@@ -28,7 +28,7 @@ export default () => {
|
|
|
28
28
|
const devices = useSelector(getDevices);
|
|
29
29
|
const currentSerialNumber = useSelector(selectedSerialNumber);
|
|
30
30
|
const verboseLogging = useSelector(isLoggingVerbose);
|
|
31
|
-
const currentDevice = useSelector(
|
|
31
|
+
const currentDevice = useSelector(selectedDevice);
|
|
32
32
|
|
|
33
33
|
return (
|
|
34
34
|
<Card title="Support">
|