Skip to content

Commit

Permalink
hww.c: extend REQ_INFO with the BitBox02 Plus platform
Browse files Browse the repository at this point in the history
Based on the newly added memory flag.
  • Loading branch information
benma committed Feb 12, 2025
1 parent 4d3fa3b commit 23a7d69
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions src/hww.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <memory/memory.h>
#include <version.h>

#include <memory/memory_shared.h>
#include <platform_config.h>
#include <rust/rust.h>
#include <usb/usb_packet.h>
Expand Down Expand Up @@ -60,8 +61,9 @@ typedef struct {
* 1 byte: platform code:
* - 0x00 - BitBox02
* - 0x01 - BitBoxBase (deprecated)
* - 0x02 - BitBox02Plus
* 1 byte: edition code:
* - For the BitBox02 edition:
* - For the BitBox02 and BitBox02Plus edition:
* - - 0x00 - Multi
* - - 0x01 - Bitcoin-only
* - For the BitBoxBase platform (deprecated):
Expand All @@ -84,14 +86,21 @@ static size_t _api_info(uint8_t* buf)
memcpy((char*)current, DIGITAL_BITBOX_VERSION_SHORT, version_string_len);
current += version_string_len;

// 1 byte platform code and 1 byte edition code
#if PRODUCT_BITBOX_MULTI == 1 || PRODUCT_BITBOX02_FACTORYSETUP == 1
*current = 0x00;
// 1 byte platform code
switch (memory_get_platform()) {
case MEMORY_PLATFORM_BITBOX02_PLUS:
*current = 0x02;
break;
default:
*current = 0x00;
break;
}
current++;

// 1 byte edition code
#if PRODUCT_BITBOX_MULTI == 1 || PRODUCT_BITBOX02_FACTORYSETUP == 1
*current = 0x00;
#elif PRODUCT_BITBOX_BTCONLY == 1
*current = 0x00;
current++;
*current = 0x01;
#endif
current++;
Expand Down

0 comments on commit 23a7d69

Please sign in to comment.