-
-
Notifications
You must be signed in to change notification settings - Fork 346
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
rBootHttpUpdate: Hooks added for signed and/or encrypted OTA #893
Conversation
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.
@tius2000 Please, update the Basic_rBoot example to demo OTA with signed ROM.
@@ -50,6 +50,10 @@ class rBootHttpUpdate: private HttpClient { | |||
void updateFailed(); | |||
void onItemDownloadCompleted(HttpClient& client, bool successful); | |||
|
|||
virtual void writeInit(); |
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.
Why are those methods public instead of protected?
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.
I think you are right! I will move the methods to protected and test again.
Unfortunately, this is not so easy for me to provide a full working example at the moment. In order to get OTA running with the current SDK under Windows, I had to make changes in many other places. Therefore, my version is currently not portable. However, using the hooks is quite easy. My own code currently looks like this:
Hope this helps? |
@tius2000 Ok, I will consider this PR for the next version but you should add that information/example to the WIKI or to the code documentation. |
} | ||
|
||
void rBootHttpUpdate::onTimer() { | ||
|
||
if (TcpClient::isProcessing()) return; // Will wait | ||
|
||
if (TcpClient::getConnectionState() == eTCS_Successful) { | ||
|
||
// always call writeEnd() | ||
if (!writeEnd()) writeError = 1; |
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.
@tius2000 May be a debug message on write error will be helpful here.
I moved the sample code to the wiki (https://github.com/SmingHub/Sming/wiki/Signed-OTA). May be this is useful for someone. |
@@ -57,6 +57,10 @@ class rBootHttpUpdate: private HttpClient { | |||
rboot_write_status rBootWriteStatus; | |||
uint8 romSlot; | |||
otaUpdateDelegate updateDelegate; | |||
|
|||
virtual void writeInit(); |
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.
Coding Style: Please, align the lines with the ones above.
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.
Well, they are aligned in my editor - you are right, need to change my tab settings ;-)
Also changed the base class to protected to allow better http error handling within derived classes.
The git workflow is still very new to me and I really appreciate any feedback!
rboot_write_init(), rboot_write_flash() and rboot_write_end() moved to virtual methods. This allows a subclass to implement hooks to download signed or encrypted firmware files.
Hope I got it right ;-)