mirror of
https://github.com/monero-project/monero.git
synced 2025-08-03 06:46:13 -04:00
Add application version compatibility check.
This commit is contained in:
parent
423d3bb86b
commit
3a981a3313
2 changed files with 30 additions and 2 deletions
|
@ -302,8 +302,24 @@ namespace hw {
|
|||
}
|
||||
|
||||
bool device_ledger::reset() {
|
||||
send_simple(INS_RESET);
|
||||
return true;
|
||||
reset_buffer();
|
||||
int offset = set_command_header_noopt(INS_RESET);
|
||||
memmove(this->buffer_send+offset, MONERO_VERSION, strlen(MONERO_VERSION));
|
||||
offset += strlen(MONERO_VERSION);
|
||||
this->buffer_send[4] = offset-5;
|
||||
this->length_send = offset;
|
||||
this->exchange();
|
||||
|
||||
ASSERT_X(this->length_recv>=3, "Communication error, less than three bytes received. Check your application version.");
|
||||
|
||||
unsigned int device_version = 0;
|
||||
device_version = VERSION(this->buffer_recv[0], this->buffer_recv[1], this->buffer_recv[2]);
|
||||
|
||||
ASSERT_X (device_version >= MINIMAL_APP_VERSION,
|
||||
"Unsupported device application version: " << VERSION_MAJOR(device_version)<<"."<<VERSION_MINOR(device_version)<<"."<<VERSION_MICRO(device_version) <<
|
||||
" At least " << MINIMAL_APP_VERSION_MAJOR<<"."<<MINIMAL_APP_VERSION_MINOR<<"."<<MINIMAL_APP_VERSION_MICRO<<" is required.");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
unsigned int device_ledger::exchange(unsigned int ok, unsigned int mask) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue