|
1 | 1 | // Copyright 2018-2019 Shift Cryptosecurity AG
|
| 2 | +// Copyright 2025 Shift Crypto AG |
2 | 3 | //
|
3 | 4 | // Licensed under the Apache License, Version 2.0 (the "License");
|
4 | 5 | // you may not use this file except in compliance with the License.
|
@@ -27,28 +28,57 @@ const (
|
27 | 28 | // ProductBitBox02BTCOnly is the btc-only edition of the BitBox02, restricting functionality to
|
28 | 29 | // Bitcoin.
|
29 | 30 | ProductBitBox02BTCOnly Product = "bitbox02-btconly"
|
| 31 | + |
| 32 | + // ProductBitBox02PlusMulti is the multi edition of the BitBox02 Plus. |
| 33 | + ProductBitBox02PlusMulti Product = "bitbox02-plus-multi" |
| 34 | + // ProductBitBox02PlusBTCOnly is the btc-only edition of the BitBox02 Plus, restricting |
| 35 | + // functionality to Bitcoin. |
| 36 | + ProductBitBox02PlusBTCOnly Product = "bitbox02-plus-btconly" |
30 | 37 | )
|
31 | 38 |
|
32 | 39 | const (
|
33 |
| - // FirmwareHIDProductStringStandard is the hid product string of the standard edition firmware. |
34 |
| - FirmwareHIDProductStringStandard = "BitBox02" |
35 |
| - // FirmwareHIDProductStringBTCOnly is the hid product string of the btc-only edition firmware. |
36 |
| - FirmwareHIDProductStringBTCOnly = "BitBox02BTC" |
37 |
| - |
38 |
| - // BootloaderHIDProductStringStandard is the hid product string of the standard edition bootloader. |
39 |
| - BootloaderHIDProductStringStandard = "bb02-bootloader" |
40 |
| - // BootloaderHIDProductStringBTCOnly is the hid product string of the btc-only edition bootloader. |
41 |
| - BootloaderHIDProductStringBTCOnly = "bb02btc-bootloader" |
| 40 | + // FirmwareDeviceProductStringBitBox02Multi is the product string of the BitBox02 multi edition |
| 41 | + // firmware. It appears in the HID descriptor. |
| 42 | + FirmwareDeviceProductStringBitBox02Multi = "BitBox02" |
| 43 | + // FirmwareDeviceProductStringBitBox02BTCOnly is the product string of the BitBox02 btc-only |
| 44 | + // edition firmware. It appears in the HID descriptor. |
| 45 | + FirmwareDeviceProductStringBitBox02BTCOnly = "BitBox02BTC" |
| 46 | + |
| 47 | + // BootloaderDeviceProductStringBitBox02Multi is the product string of the BitBox02 multi |
| 48 | + // edition bootloader. It appears in the HID descriptor. |
| 49 | + BootloaderDeviceProductStringBitBox02Multi = "bb02-bootloader" |
| 50 | + // BootloaderDeviceProductStringBitBox02BTCOnly is the product string of the BitBox02 btc-only |
| 51 | + // edition bootloader. It appears in the HID descriptor. |
| 52 | + BootloaderDeviceProductStringBitBox02BTCOnly = "bb02btc-bootloader" |
| 53 | + |
| 54 | + // FirmwareDeviceProductStringBitBox02PlusMulti the product string of the "BitBox02 Plus" multi |
| 55 | + // edition firmware. It appears in the HID descriptor and the Bluetooth characteristic. |
| 56 | + FirmwareDeviceProductStringBitBox02PlusMulti = "bb02p-multi" |
| 57 | + // FirmwareDeviceProductStringBitBox02PlusBTCOnly is the product string of the "BitBox02 Plus" |
| 58 | + // btc-only edition firmware. It appears in the HID descriptor and the Bluetooth characteristic. |
| 59 | + FirmwareDeviceProductStringBitBox02PlusBTCOnly = "bb02p-btconly" |
| 60 | + |
| 61 | + // BootloaderDeviceProductStringBitBox02Multi is the product string of the "BitBox02 Plus" multi |
| 62 | + // edition bootloader. It appears in the HID descriptor and the Bluetooth characteristic. |
| 63 | + BootloaderDeviceProductStringBitBox02PlusMulti = "bb02p-bl-multi" |
| 64 | + // BootloaderDeviceProductStringBitBox02BTCOnly is the product string of the "BitBox02 Plus" |
| 65 | + // btc-only edition bootloader. It appears in the HID descriptor and the Bluetooth |
| 66 | + // characteristic. |
| 67 | + BootloaderDeviceProductStringBitBox02PlusBTCOnly = "bb02p-bl-btconly" |
42 | 68 | )
|
43 | 69 |
|
44 |
| -// ProductFromHIDProductString returns the firmware or bootloader product based on the usb HID |
| 70 | +// ProductFromDeviceProductString returns the firmware or bootloader product based on the usb Device |
45 | 71 | // product string. Returns an error for an invalid/unrecognized product string.
|
46 |
| -func ProductFromHIDProductString(productString string) (Product, error) { |
| 72 | +func ProductFromDeviceProductString(productString string) (Product, error) { |
47 | 73 | switch productString {
|
48 |
| - case FirmwareHIDProductStringStandard, BootloaderHIDProductStringStandard: |
| 74 | + case FirmwareDeviceProductStringBitBox02Multi, BootloaderDeviceProductStringBitBox02Multi: |
49 | 75 | return ProductBitBox02Multi, nil
|
50 |
| - case FirmwareHIDProductStringBTCOnly, BootloaderHIDProductStringBTCOnly: |
| 76 | + case FirmwareDeviceProductStringBitBox02BTCOnly, BootloaderDeviceProductStringBitBox02BTCOnly: |
51 | 77 | return ProductBitBox02BTCOnly, nil
|
| 78 | + case FirmwareDeviceProductStringBitBox02PlusMulti, BootloaderDeviceProductStringBitBox02PlusMulti: |
| 79 | + return ProductBitBox02PlusMulti, nil |
| 80 | + case FirmwareDeviceProductStringBitBox02PlusBTCOnly, BootloaderDeviceProductStringBitBox02PlusBTCOnly: |
| 81 | + return ProductBitBox02PlusBTCOnly, nil |
52 | 82 | default:
|
53 | 83 | return "", errp.New("unrecognized product")
|
54 | 84 | }
|
|
0 commit comments