add Features.model field (set to "T")

pull/25/head
Pavol Rusnak 7 years ago
parent 18fcf826d6
commit 04d980f8f0
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D

@ -213,6 +213,7 @@ void process_msg_Initialize(uint8_t iface_num, uint32_t msg_size, uint8_t *buf,
MSG_SEND_ASSIGN_VALUE(patch_version, VERSION_PATCH);
MSG_SEND_ASSIGN_VALUE(bootloader_mode, true);
MSG_SEND_ASSIGN_VALUE(firmware_present, firmware_present);
MSG_SEND_ASSIGN_STRING(model, "T");
// TODO: pass info about installed firmware (vendor, version, etc.)
MSG_SEND(Features);
}

@ -4,6 +4,7 @@ Features.language max_size:17
Features.label max_size:33
Features.revision max_size:20
Features.bootloader_hash max_size:32
Features.model max_size:17
Ping.message max_size:256

@ -18,7 +18,7 @@ const pb_field_t GetFeatures_fields[1] = {
PB_LAST_FIELD
};
const pb_field_t Features_fields[18] = {
const pb_field_t Features_fields[19] = {
PB_FIELD( 1, STRING , OPTIONAL, STATIC , FIRST, Features, vendor, vendor, 0),
PB_FIELD( 2, UINT32 , OPTIONAL, STATIC , OTHER, Features, major_version, vendor, 0),
PB_FIELD( 3, UINT32 , OPTIONAL, STATIC , OTHER, Features, minor_version, major_version, 0),
@ -36,6 +36,7 @@ const pb_field_t Features_fields[18] = {
PB_FIELD( 16, BOOL , OPTIONAL, STATIC , OTHER, Features, pin_cached, imported, 0),
PB_FIELD( 17, BOOL , OPTIONAL, STATIC , OTHER, Features, passphrase_cached, pin_cached, 0),
PB_FIELD( 18, BOOL , OPTIONAL, STATIC , OTHER, Features, firmware_present, passphrase_cached, 0),
PB_FIELD( 21, STRING , OPTIONAL, STATIC , OTHER, Features, model, firmware_present, 0),
PB_LAST_FIELD
};

@ -103,6 +103,8 @@ typedef struct _Features {
bool passphrase_cached;
bool has_firmware_present;
bool firmware_present;
bool has_model;
char model[17];
/* @@protoc_insertion_point(struct:Features) */
} Features;
@ -151,7 +153,7 @@ typedef struct _Success {
/* Initializer values for message structs */
#define Initialize_init_default {0}
#define GetFeatures_init_default {0}
#define Features_init_default {false, "", false, 0, false, 0, false, 0, false, 0, false, "", false, 0, false, 0, false, "", false, "", false, 0, false, {0, {0}}, false, {0, {0}}, false, 0, false, 0, false, 0, false, 0}
#define Features_init_default {false, "", false, 0, false, 0, false, 0, false, 0, false, "", false, 0, false, 0, false, "", false, "", false, 0, false, {0, {0}}, false, {0, {0}}, false, 0, false, 0, false, 0, false, 0, false, ""}
#define Ping_init_default {false, "", false, 0, false, 0, false, 0}
#define Success_init_default {false, ""}
#define Failure_init_default {false, (FailureType)0, false, ""}
@ -162,7 +164,7 @@ typedef struct _Success {
#define FirmwareUpload_init_default {{{NULL}, NULL}, false, {0, {0}}}
#define Initialize_init_zero {0}
#define GetFeatures_init_zero {0}
#define Features_init_zero {false, "", false, 0, false, 0, false, 0, false, 0, false, "", false, 0, false, 0, false, "", false, "", false, 0, false, {0, {0}}, false, {0, {0}}, false, 0, false, 0, false, 0, false, 0}
#define Features_init_zero {false, "", false, 0, false, 0, false, 0, false, 0, false, "", false, 0, false, 0, false, "", false, "", false, 0, false, {0, {0}}, false, {0, {0}}, false, 0, false, 0, false, 0, false, 0, false, ""}
#define Ping_init_zero {false, "", false, 0, false, 0, false, 0}
#define Success_init_zero {false, ""}
#define Failure_init_zero {false, (FailureType)0, false, ""}
@ -194,6 +196,7 @@ typedef struct _Success {
#define Features_pin_cached_tag 16
#define Features_passphrase_cached_tag 17
#define Features_firmware_present_tag 18
#define Features_model_tag 21
#define FirmwareErase_length_tag 1
#define FirmwareRequest_offset_tag 1
#define FirmwareRequest_length_tag 2
@ -208,7 +211,7 @@ typedef struct _Success {
/* Struct field encoding specification for nanopb */
extern const pb_field_t Initialize_fields[1];
extern const pb_field_t GetFeatures_fields[1];
extern const pb_field_t Features_fields[18];
extern const pb_field_t Features_fields[19];
extern const pb_field_t Ping_fields[5];
extern const pb_field_t Success_fields[2];
extern const pb_field_t Failure_fields[3];
@ -221,7 +224,7 @@ extern const pb_field_t FirmwareUpload_fields[3];
/* Maximum encoded size of messages (where known) */
#define Initialize_size 0
#define GetFeatures_size 0
#define Features_size 209
#define Features_size 229
#define Ping_size 265
#define Success_size 259
#define Failure_size 270

@ -55,6 +55,9 @@ message Features {
optional bool pin_cached = 16; // is PIN already cached in session?
optional bool passphrase_cached = 17; // is passphrase already cached in session?
optional bool firmware_present = 18; // is valid firmware loaded?
// optional bool needs_backup = 19; // does storage need backup? (equals to Storage.needs_backup)
// optional uint32 flags = 20; // device flags (equals to Storage.flags)
optional string model = 21; // device hardware model
}
/**

@ -15,6 +15,7 @@ async def respond_Features(ctx, msg):
f.major_version = 2
f.minor_version = 0
f.patch_version = 0
f.model = 'T'
f.coins = coins.COINS
f.device_id = storage.get_device_id()

@ -14,4 +14,5 @@ class CoinType(p.MessageType):
10: ('xprv_magic', p.UVarintType, 0), # default=76066276
11: ('segwit', p.BoolType, 0),
12: ('forkid', p.UVarintType, 0),
13: ('force_bip143', p.BoolType, 0),
}

@ -25,5 +25,6 @@ class Features(p.MessageType):
18: ('firmware_present', p.BoolType, 0),
19: ('needs_backup', p.BoolType, 0),
20: ('flags', p.UVarintType, 0),
21: ('model', p.UnicodeType, 0),
}
MESSAGE_WIRE_TYPE = 17

@ -1 +1 @@
Subproject commit 9c1e61e4608e1d49043fb668eb9c7621fcc20648
Subproject commit 8e96b42260b84e1e0f0b00a5e528d19258c57031
Loading…
Cancel
Save