-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add application version compatibility check. #5253
Conversation
src/device/device_ledger.cpp
Outdated
if (minor < MINIMAL_MINOR_APP_VERSION) { | ||
ASSERT_X(false, MINIMAL_VERSION_ERROR_MESSAGE); | ||
} | ||
#undef MINIMAL_VERSION |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You probably want MINIMAL_VERSION_ERROR_MESSAGE here
src/device/device_ledger.cpp
Outdated
} | ||
|
||
#define MINIMAL_VERSION_ERROR_MESSAGE \ | ||
"Unsuppotred device application version: "<<major<<"."<<minor<<"."<<micro<<"."\ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unsupported
src/device/device_ledger.cpp
Outdated
|
||
#define MINIMAL_VERSION_ERROR_MESSAGE \ | ||
"Unsuppotred device application version: "<<major<<"."<<minor<<"."<<micro<<"."\ | ||
" At least " << MINIMAL_MAJOR_APP_VERSION<<"."<<MINIMAL_MINOR_APP_VERSION<<"."<<MINIMAL_MICRO_APP_VERSION << " is requiered." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
required
src/device/device_ledger.cpp
Outdated
} | ||
if (minor < MINIMAL_MINOR_APP_VERSION) { | ||
ASSERT_X(false, MINIMAL_VERSION_ERROR_MESSAGE); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That seems wrong. It will fail once you get to 2.0.0.
Maybe, eg:
ASSERT_X(major*65536+minor*256+micro >= 0x010200, MINIMAL_VERSION_ERROR_MESSAGE);
(untested)
And you also get only one line with it :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are right!.
I will take your approach with shift: (major<<24) | (minor<<16) | micro
src/device/device_ledger.cpp
Outdated
this->exchange(); | ||
this->exchange(); | ||
|
||
ASSERT_X(this->length_recv>=3, "Communication error, less than tow three bytes received. Check your application version."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tow ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
major, minor, micro : three
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I mean the "tow" seems like it's extra unneeded word here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OMG yes. It seems I'am a bit tired 😪
59109cf
to
430ff45
Compare
No description provided.