@onekeyfe/hd-transport-lowlevel 1.2.0-alpha.98 → 1.2.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.
@@ -68,12 +68,25 @@ const protocolV2Schema = {
68
68
  },
69
69
  },
70
70
  },
71
+ Failure: {
72
+ fields: {
73
+ code: {
74
+ type: 'uint32',
75
+ id: 1,
76
+ },
77
+ message: {
78
+ type: 'string',
79
+ id: 2,
80
+ },
81
+ },
82
+ },
71
83
  MessageType: {
72
84
  values: {
73
85
  MessageType_ProtocolInfoRequest: 60200,
74
86
  MessageType_ProtocolInfo: 60201,
75
87
  MessageType_Ping: 60206,
76
88
  MessageType_Success: 60207,
89
+ MessageType_Failure: 60208,
77
90
  },
78
91
  },
79
92
  },
@@ -236,7 +249,11 @@ describe('LowlevelTransport protocol framing', () => {
236
249
  );
237
250
  const plugin = createPlugin({
238
251
  devices: [{ id: 'pro2-id', name: 'OneKey Pro 2', commType: 'ble' }],
239
- responses: [...splitFrame(probeResponse, 4), ...splitFrame(callResponse, 5)],
252
+ responses: [
253
+ new Error('Protocol V1 probe timed out'),
254
+ ...splitFrame(probeResponse, 4),
255
+ ...splitFrame(callResponse, 5),
256
+ ],
240
257
  });
241
258
  const lowlevel = configureTransport(plugin);
242
259
 
@@ -256,9 +273,9 @@ describe('LowlevelTransport protocol framing', () => {
256
273
  },
257
274
  });
258
275
  expect(plugin.send).toHaveBeenCalled();
259
- const sentSeqs = plugin.send.mock.calls.map(([, hex]) =>
260
- Number.parseInt(hex.slice(12, 14), 16)
261
- );
276
+ const sentSeqs = plugin.send.mock.calls
277
+ .map(([, hex]) => Number.parseInt(hex.slice(12, 14), 16))
278
+ .filter(seq => seq > 0);
262
279
  expect(sentSeqs).toEqual([1, 2]);
263
280
  });
264
281
 
@@ -282,7 +299,7 @@ describe('LowlevelTransport protocol framing', () => {
282
299
  expect(lowlevel.getProtocolType('unknown-pro2-id')).toBe('V2');
283
300
  });
284
301
 
285
- test('retains the Protocol V2 hint and sequence cursor across release and reacquire', async () => {
302
+ test('detects Protocol V2 again after release without a name-derived hint', async () => {
286
303
  const probeResponse = ProtocolV2.encodeFrame(
287
304
  schemas,
288
305
  'Success',
@@ -291,7 +308,12 @@ describe('LowlevelTransport protocol framing', () => {
291
308
  );
292
309
  const plugin = createPlugin({
293
310
  devices: [{ id: 'reconnect-pro2-id', name: 'OneKey Pro 2', commType: 'ble' }],
294
- responses: [bytesToHex(probeResponse), bytesToHex(probeResponse)],
311
+ responses: [
312
+ new Error('Protocol V1 probe timed out'),
313
+ bytesToHex(probeResponse),
314
+ new Error('Protocol V1 probe timed out'),
315
+ bytesToHex(probeResponse),
316
+ ],
295
317
  });
296
318
  const lowlevel = configureTransport(plugin);
297
319
 
@@ -306,9 +328,9 @@ describe('LowlevelTransport protocol framing', () => {
306
328
  protocolType: 'V2',
307
329
  });
308
330
 
309
- const sentSeqs = plugin.send.mock.calls.map(([, hex]) =>
310
- Number.parseInt(hex.slice(12, 14), 16)
311
- );
331
+ const sentSeqs = plugin.send.mock.calls
332
+ .map(([, hex]) => Number.parseInt(hex.slice(12, 14), 16))
333
+ .filter(seq => seq > 0);
312
334
  expect(sentSeqs).toEqual([1, 2]);
313
335
  });
314
336
 
@@ -373,6 +395,33 @@ describe('LowlevelTransport protocol framing', () => {
373
395
  expect(plugin.receive).toHaveBeenCalledTimes(1);
374
396
  });
375
397
 
398
+ test('disconnects and clears a lowlevel connection when Protocol V2 reports link disabled', async () => {
399
+ const failureResponse = ProtocolV2.encodeFrame(
400
+ schemas,
401
+ 'Failure',
402
+ { code: 5, message: 'link disabled' },
403
+ { router: PROTOCOL_V2_CHANNEL_BLE_UART }
404
+ );
405
+ const plugin = createPlugin({
406
+ devices: [{ id: 'usb-owned-id', name: 'OneKey Pro 2', commType: 'ble' }],
407
+ responses: [bytesToHex(failureResponse)],
408
+ });
409
+ const lowlevel = configureTransport(plugin);
410
+
411
+ await expect(
412
+ lowlevel.acquire({ uuid: 'usb-owned-id', expectedProtocol: 'V2' })
413
+ ).rejects.toMatchObject({
414
+ name: 'ProtocolV2LinkDisabledError',
415
+ failureCode: 5,
416
+ firmwareMessage: 'link disabled',
417
+ });
418
+
419
+ expect(plugin.disconnect).toHaveBeenCalledWith('usb-owned-id');
420
+ expect(lowlevel.connectedDevices.has('usb-owned-id')).toBe(false);
421
+ expect(lowlevel.getProtocolType('usb-owned-id')).toBeUndefined();
422
+ expect(lowlevel.protocolV2Assemblers.has('usb-owned-id')).toBe(false);
423
+ });
424
+
376
425
  test('resets the lowlevel connection before probing Protocol V2 after a V1 timeout', async () => {
377
426
  const probeResponse = ProtocolV2.encodeFrame(
378
427
  schemas,
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as transport from '@onekeyfe/hd-transport';
2
- import transport__default, { ProtocolType, LowlevelTransportSharedPlugin, LowLevelDevice, TransportCallOptions } from '@onekeyfe/hd-transport';
2
+ import transport__default, { ProtocolType, LowlevelTransportSharedPlugin, TransportCallOptions } from '@onekeyfe/hd-transport';
3
3
  import EventEmitter from 'events';
4
4
 
5
5
  type LowLevelAcquireInput = {
@@ -36,13 +36,14 @@ declare class LowlevelTransport {
36
36
  configure(signedData: any): void;
37
37
  configureProtocolV2(signedData: any): void;
38
38
  listen(): void;
39
- enumerate(): Promise<LowLevelDevice[]>;
39
+ enumerate(): Promise<transport.LowLevelDevice[]>;
40
40
  acquire(input: LowLevelAcquireInput): Promise<{
41
41
  uuid: string;
42
42
  protocolType: ProtocolType;
43
43
  }>;
44
44
  release(uuid: string): Promise<boolean>;
45
45
  call(uuid: string, name: string, data: Record<string, unknown>, options?: TransportCallOptions): Promise<transport.MessageFromOneKey>;
46
+ post(uuid: string, name: string, data: Record<string, unknown>): Promise<void>;
46
47
  private callProtocolV1;
47
48
  private createProtocolTimeoutError;
48
49
  private createProtocolMismatchError;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[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AA2B;IAOnC,OAAO,CAAC,4BAA4B;IAOpC,OAAO,CAAC,kBAAkB;YAMZ,cAAc;YA2Cd,yBAAyB;YAiCzB,eAAe;YAgBf,eAAe;YA6Bf,UAAU;YAUV,qBAAqB;YAmBrB,mBAAmB;YAqBnB,oBAAoB;YAgBpB,cAAc;IAwB5B,OAAO,CAAC,uBAAuB;IAgC/B,OAAO,CAAC,2BAA2B;IAMnC,MAAM;CAGP"}
package/dist/index.js CHANGED
@@ -53,9 +53,6 @@ function shouldLogFirmwareUploadProgress({ percent, lastLoggedPercent, now, last
53
53
  function getProtocolV1SendOptions(name) {
54
54
  return name === 'FirmwareUpload' ? { withoutResponse: false } : undefined;
55
55
  }
56
- function inferProtocolHintFromDeviceName(name) {
57
- return /\bpro\s*2\b/i.test(name !== null && name !== void 0 ? name : '') ? 'V2' : undefined;
58
- }
59
56
  function isProtocolV1TransportChunk(data) {
60
57
  return data.length >= 9 && data[0] === 0x3f && data[1] === 0x23 && data[2] === 0x23;
61
58
  }
@@ -135,17 +132,11 @@ class LowlevelTransport {
135
132
  enumerate() {
136
133
  return __awaiter(this, void 0, void 0, function* () {
137
134
  const devices = yield this.plugin.enumerate();
138
- return devices.map((device) => {
139
- const protocolHint = inferProtocolHintFromDeviceName(device.name);
140
- if (protocolHint) {
141
- this.deviceProtocolHints.set(device.id, protocolHint);
142
- }
143
- return device;
144
- });
135
+ return devices;
145
136
  });
146
137
  }
147
138
  acquire(input) {
148
- var _a, _b;
139
+ var _a, _b, _c, _d;
149
140
  return __awaiter(this, void 0, void 0, function* () {
150
141
  const alreadyConnected = this.connectedDevices.has(input.uuid);
151
142
  try {
@@ -164,8 +155,31 @@ class LowlevelTransport {
164
155
  const protocolHint = input.expectedProtocol
165
156
  ? undefined
166
157
  : (_b = input.protocolHint) !== null && _b !== void 0 ? _b : this.deviceProtocolHints.get(input.uuid);
167
- const protocolType = yield this.detectProtocol(input.uuid, input.expectedProtocol, protocolHint);
168
- return { uuid: input.uuid, protocolType };
158
+ try {
159
+ const protocolType = yield this.detectProtocol(input.uuid, input.expectedProtocol, protocolHint);
160
+ return { uuid: input.uuid, protocolType };
161
+ }
162
+ catch (error) {
163
+ try {
164
+ yield this.protocolV2Links.invalidateLink(input.uuid, 'Lowlevel transport acquire failed');
165
+ }
166
+ catch (cleanupError) {
167
+ (_c = this.Log) === null || _c === void 0 ? void 0 : _c.debug('[LowlevelTransport] acquire link cleanup failed:', cleanupError);
168
+ }
169
+ try {
170
+ yield this.plugin.disconnect(input.uuid);
171
+ }
172
+ catch (cleanupError) {
173
+ (_d = this.Log) === null || _d === void 0 ? void 0 : _d.debug('[LowlevelTransport] acquire disconnect failed:', cleanupError);
174
+ }
175
+ finally {
176
+ this.connectedDevices.delete(input.uuid);
177
+ this.deviceProtocol.delete(input.uuid);
178
+ this.protocolV2Assemblers.delete(input.uuid);
179
+ this.advanceProtocolV2Generation(input.uuid);
180
+ }
181
+ throw error;
182
+ }
169
183
  });
170
184
  }
171
185
  release(uuid) {
@@ -193,13 +207,21 @@ class LowlevelTransport {
193
207
  if (!protocol) {
194
208
  throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, `Device protocol has not been detected for ${uuid}`);
195
209
  }
196
- this.Log.debug('transport call', { name, protocol });
197
210
  if (protocol === 'V2') {
198
211
  return this.callProtocolV2(uuid, name, data, options);
199
212
  }
200
213
  return this.callProtocolV1(uuid, name, data, options);
201
214
  });
202
215
  }
216
+ post(uuid, name, data) {
217
+ return __awaiter(this, void 0, void 0, function* () {
218
+ if (this.getProtocolType(uuid) === 'V2') {
219
+ yield this.protocolV2Links.sendFlowControl(uuid, () => this.createProtocolV2Adapter(uuid), name, data);
220
+ return;
221
+ }
222
+ yield this.callProtocolV1(uuid, name, data);
223
+ });
224
+ }
203
225
  callProtocolV1(uuid, name, data, options) {
204
226
  var _a;
205
227
  return __awaiter(this, void 0, void 0, function* () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/hd-transport-lowlevel",
3
- "version": "1.2.0-alpha.98",
3
+ "version": "1.2.0",
4
4
  "homepage": "https://github.com/OneKeyHQ/hardware-js-sdk#readme",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -20,8 +20,8 @@
20
20
  "lint:fix": "eslint . --fix"
21
21
  },
22
22
  "dependencies": {
23
- "@onekeyfe/hd-shared": "1.2.0-alpha.98",
24
- "@onekeyfe/hd-transport": "1.2.0-alpha.98"
23
+ "@onekeyfe/hd-shared": "1.2.0",
24
+ "@onekeyfe/hd-transport": "1.2.0"
25
25
  },
26
- "gitHead": "10f2dcaecec17a629216c2402cc9ab8801987297"
26
+ "gitHead": "cc51df0a415bead21304ad1d8bc92b5312c91344"
27
27
  }
package/src/index.ts CHANGED
@@ -15,7 +15,6 @@ import transport, {
15
15
 
16
16
  import type EventEmitter from 'events';
17
17
  import type {
18
- LowLevelDevice,
19
18
  LowlevelTransportSharedPlugin,
20
19
  ProtocolType,
21
20
  ProtocolV2CallContext,
@@ -53,10 +52,6 @@ export function getProtocolV1SendOptions(name: string) {
53
52
  return name === 'FirmwareUpload' ? { withoutResponse: false } : undefined;
54
53
  }
55
54
 
56
- function inferProtocolHintFromDeviceName(name?: string | null): ProtocolType | undefined {
57
- return /\bpro\s*2\b/i.test(name ?? '') ? 'V2' : undefined;
58
- }
59
-
60
55
  function isProtocolV1TransportChunk(data: Uint8Array) {
61
56
  return data.length >= 9 && data[0] === 0x3f && data[1] === 0x23 && data[2] === 0x23;
62
57
  }
@@ -161,13 +156,7 @@ export default class LowlevelTransport {
161
156
 
162
157
  async enumerate() {
163
158
  const devices = await this.plugin.enumerate();
164
- return devices.map((device: LowLevelDevice) => {
165
- const protocolHint = inferProtocolHintFromDeviceName(device.name);
166
- if (protocolHint) {
167
- this.deviceProtocolHints.set(device.id, protocolHint);
168
- }
169
- return device;
170
- });
159
+ return devices;
171
160
  }
172
161
 
173
162
  async acquire(input: LowLevelAcquireInput) {
@@ -194,12 +183,31 @@ export default class LowlevelTransport {
194
183
  const protocolHint = input.expectedProtocol
195
184
  ? undefined
196
185
  : input.protocolHint ?? this.deviceProtocolHints.get(input.uuid);
197
- const protocolType = await this.detectProtocol(
198
- input.uuid,
199
- input.expectedProtocol,
200
- protocolHint
201
- );
202
- return { uuid: input.uuid, protocolType };
186
+ try {
187
+ const protocolType = await this.detectProtocol(
188
+ input.uuid,
189
+ input.expectedProtocol,
190
+ protocolHint
191
+ );
192
+ return { uuid: input.uuid, protocolType };
193
+ } catch (error) {
194
+ try {
195
+ await this.protocolV2Links.invalidateLink(input.uuid, 'Lowlevel transport acquire failed');
196
+ } catch (cleanupError) {
197
+ this.Log?.debug('[LowlevelTransport] acquire link cleanup failed:', cleanupError);
198
+ }
199
+ try {
200
+ await this.plugin.disconnect(input.uuid);
201
+ } catch (cleanupError) {
202
+ this.Log?.debug('[LowlevelTransport] acquire disconnect failed:', cleanupError);
203
+ } finally {
204
+ this.connectedDevices.delete(input.uuid);
205
+ this.deviceProtocol.delete(input.uuid);
206
+ this.protocolV2Assemblers.delete(input.uuid);
207
+ this.advanceProtocolV2Generation(input.uuid);
208
+ }
209
+ throw error;
210
+ }
203
211
  }
204
212
 
205
213
  async release(uuid: string) {
@@ -208,8 +216,7 @@ export default class LowlevelTransport {
208
216
  await this.plugin.disconnect(uuid);
209
217
  this.connectedDevices.delete(uuid);
210
218
  this.deviceProtocol.delete(uuid);
211
- // A name-derived protocol hint survives disconnect and lets fast reconnect probe
212
- // Protocol V2 first without sending a redundant V1 Initialize.
219
+ // Confirmed protocol stays on the device endpoint; BLE names are not a probe hint.
213
220
  this.protocolV2Assemblers.delete(uuid);
214
221
  return true;
215
222
  } catch (error) {
@@ -235,8 +242,6 @@ export default class LowlevelTransport {
235
242
  `Device protocol has not been detected for ${uuid}`
236
243
  );
237
244
  }
238
- this.Log.debug('transport call', { name, protocol });
239
-
240
245
  if (protocol === 'V2') {
241
246
  return this.callProtocolV2(uuid, name, data, options);
242
247
  }
@@ -244,6 +249,19 @@ export default class LowlevelTransport {
244
249
  return this.callProtocolV1(uuid, name, data, options);
245
250
  }
246
251
 
252
+ async post(uuid: string, name: string, data: Record<string, unknown>) {
253
+ if (this.getProtocolType(uuid) === 'V2') {
254
+ await this.protocolV2Links.sendFlowControl(
255
+ uuid,
256
+ () => this.createProtocolV2Adapter(uuid),
257
+ name,
258
+ data
259
+ );
260
+ return;
261
+ }
262
+ await this.callProtocolV1(uuid, name, data);
263
+ }
264
+
247
265
  private async callProtocolV1(
248
266
  uuid: string,
249
267
  name: string,