blob: 4a1e65dc2f44679a518bf11628ea292a0b4dece0 [file] [log] [blame] [view]
Trevor Holbrooka648ef72021-08-19 15:24:40 -07001# ota-provider-app
2
3This is a reference application that implements an example of an OTA Provider
4Cluster Server.
5
Carol Yangbab351f2022-03-25 19:57:36 -07006## Build
Trevor Holbrookcb9100c2021-09-08 15:24:32 -07007
8Suggest doing the following:
Carol Yang6380d382022-02-10 20:09:59 -08009
10```
11scripts/examples/gn_build_example.sh examples/ota-provider-app/linux out/debug chip_config_network_layer_ble=false
12```
Trevor Holbrookcb9100c2021-09-08 15:24:32 -070013
Trevor Holbrooka648ef72021-08-19 15:24:40 -070014## Usage
15
Carol Yangd42cf542022-04-04 10:53:00 -070016| Command Line Options | Description |
17| ------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
18| -a, --applyUpdateAction \<proceed \| awaitNextAction \| discontinue\> | Value for the Action field in the first ApplyUpdateResponse.<br>For all subsequent responses, the value of proceed will be used. |
19| -c, --userConsentNeeded | If supplied, value of the UserConsentNeeded field in the QueryImageResponse is set to true. This is only applicable if value of the RequestorCanConsent field in QueryImage Command is true.<br>Otherwise, value of the UserConsentNeeded field is false. |
20| -f, --filepath \<file path\> | Path to a file containing an OTA image |
Carol Yangb63d8972022-04-13 12:02:25 -070021| -i, --imageUri \<uri\> | Value for the ImageURI field in the QueryImageResponse. If none is supplied, a valid URI is generated. |
Carol Yangd42cf542022-04-04 10:53:00 -070022| -o, --otaImageList \<file path\> | Path to a file containing a list of OTA images |
23| -p, --delayedApplyActionTimeSec \<time in seconds\> | Value for the DelayedActionTime field in the first ApplyUpdateResponse.<br>For all subsequent responses, the value of zero will be used. |
24| -q, --queryImageStatus \<updateAvailable \| busy \| updateNotAvailable\> | Value for the Status field in the first QueryImageResponse.<br>For all subsequent responses, the value of updateAvailable will be used. |
25| -t, --delayedQueryActionTimeSec <time> | Value for the DelayedActionTime field in the first QueryImageResponse.<br>For all subsequent responses, the value of zero will be used. |
26| -u, --userConsentState \<granted \| denied \| deferred\> | The user consent state for the first QueryImageResponse. For all subsequent responses, the value of granted will be used.<br>Note that --queryImageStatus overrides this option.<li> granted: Status field in the first QueryImageResponse is set to updateAvailable <li> denied: Status field in the first QueryImageResponse is set to updateNotAvailable <li> deferred: Status field in the first QueryImageResponse is set to busy |
27| -x, --ignoreQueryImage \<ignore count\> | The number of times to ignore the QueryImage Command and not send a response |
28| -y, --ignoreApplyUpdate \<ignore count\> | The number of times to ignore the ApplyUpdate Request and not send a response |
Stefan Bauer-Schwan1f1986b2022-05-13 18:15:55 +020029| -P, --pollInterval <milliseconds> | Poll interval for the BDX transfer. |
Trevor Holbrooka648ef72021-08-19 15:24:40 -070030
Carol Yang6380d382022-02-10 20:09:59 -080031**Using `--filepath` and `--otaImageList`**
Trevor Holbrooka648ef72021-08-19 15:24:40 -070032
Carol Yang6380d382022-02-10 20:09:59 -080033- The two options cannot be supplied together
Carol Yangbab351f2022-03-25 19:57:36 -070034- At least one option must be supplied
Carol Yang6380d382022-02-10 20:09:59 -080035- If `--filepath` is supplied, the application will automatically serve that
Carol Yangbab351f2022-03-25 19:57:36 -070036 file to the OTA Requestor
Carol Yang6380d382022-02-10 20:09:59 -080037- If `--otaImageList` is supplied, the application will parse the JSON file
38 and extract all required data. The most recent/valid software version will
39 be selected and the corresponding OTA file will be sent to the OTA Requestor
Carol Yanga9bca9b2022-03-22 15:42:33 -070040- The SoftwareVersion and SoftwareVersionString sent in the QueryImageResponse
41 is derived from the OTA image header. Please note that if the version in the
Carol Yangbab351f2022-03-25 19:57:36 -070042 `--otaImageList` JSON file does not match that in the image header, the
Carol Yanga9bca9b2022-03-22 15:42:33 -070043 application will terminate.
Harsha Rajendran0cd16202022-01-27 13:51:35 -050044
Carol Yang6380d382022-02-10 20:09:59 -080045An example of the `--otaImageList` file contents:
Harsha Rajendran0cd16202022-01-27 13:51:35 -050046
Carol Yang6380d382022-02-10 20:09:59 -080047```
48{ "foo": 1, // ignored by parser
49 "deviceSoftwareVersionModel":
50 [
Carol Yangbab351f2022-03-25 19:57:36 -070051 { "vendorId": 1, "productId": 1, "softwareVersion": 10, "softwareVersionString": "1.0.0", "cDVersionNumber": 18, "softwareVersionValid": true, "minApplicableSoftwareVersion": 0, "maxApplicableSoftwareVersion": 100, "otaURL": "/tmp/ota_v10.bin" },
52 { "vendorId": 1, "productId": 1, "softwareVersion": 20, "softwareVersionString": "1.0.1", "cDVersionNumber": 18, "softwareVersionValid": false, "minApplicableSoftwareVersion": 0, "maxApplicableSoftwareVersion": 100, "otaURL": "/tmp/ota_v20.bin" },
53 { "vendorId": 1, "productId": 1, "softwareVersion": 30, "softwareVersionString": "1.0.2", "cDVersionNumber": 18, "softwareVersionValid": true, "minApplicableSoftwareVersion": 0, "maxApplicableSoftwareVersion": 100, "otaURL": "/tmp/ota_v30.bin" },
54 { "vendorId": 1, "productId": 1, "softwareVersion": 40, "softwareVersionString": "1.1.0", "cDVersionNumber": 18, "softwareVersionValid": true, "minApplicableSoftwareVersion": 0, "maxApplicableSoftwareVersion": 100, "otaURL": "/tmp/ota_v40.bin" },
55 { "vendorId": 1, "productId": 1, "softwareVersion": 50, "softwareVersionString": "1.1.1", "cDVersionNumber": 18, "softwareVersionValid": false, "minApplicableSoftwareVersion": 0, "maxApplicableSoftwareVersion": 100, "otaURL": "/tmp/ota_v50.bin" }
Carol Yang6380d382022-02-10 20:09:59 -080056 ]
57}
58```
Harsha Rajendran0cd16202022-01-27 13:51:35 -050059
Carol Yangbab351f2022-03-25 19:57:36 -070060## Software Image Header
61
62All Matter software images must contain a header as defined in section 11.21.1
63of the specification. The
64[ota_image_tool](https://github.com/project-chip/connectedhomeip/blob/master/src/app/ota_image_tool.py)
65is available for generating the required header on a software image.
66
67All images supplied to the OTA Provider application (via `--filepath` or
68`--otaImageList`) must contain the software image header. The OTA Provider
69application will use the software version specified in the header to set the
70`SoftwareVersion` field of the QueryImageResponse. For instance, if the image
71supplied represents an image with software version 2, the tool can be used as
72follows:
73
74```
75src/app/ota_image_tool.py create -v 0xDEAD -p 0xBEEF -vn 2 -vs "2.0" -da sha256 firmware.bin firmware.ota
76```
77
78Please see this
79[section](https://github.com/project-chip/connectedhomeip/tree/master/examples/ota-requestor-app/linux#generate-images)
80for information on building an OTA Requestor application with a specific
81software version.
82
Carol Yangc2367062022-02-23 18:09:32 -080083## Access Control Requirements
84
85Commissioner or Administrator SHOULD install necessary ACL entries at
86commissioning time or later to enable processing of QueryImage commands from OTA
87Requestors on their fabric, otherwise that OTA Provider will not be usable by
88OTA Requestors.
89
90Since the ACL attribute contains a list of ACL entries, writing of the attribute
91should not just contain the values for the new entry. Any existing entries
92should be read and included as part of the write. Below is an example of how to
93write the ACL attribute with two entries:
94
95```
96out/chip-tool accesscontrol write acl '[{"fabricIndex": 1, "privilege": 5, "authMode": 2, "subjects": [112233], "targets": null}, {"fabricIndex": 1, "privilege": 3, "authMode": 2, "subjects": null, "targets": [{"cluster": 41, "endpoint": null, "deviceType": null}]}]' 0xDEADBEEF 0
97```
98
99- Entry 1: This is the original entry created as part of commissioning which
100 grants administer privilege to the node ID 112233 (default controller node
101 ID) for all clusters on every endpoint
102- Entry 2: This is the new entry being added which grants operate privileges
103 to all nodes for the OTA Provider cluster (0x0029) on every endpoint
104
105In the example above, the provider is on fabric index 1 with provider node ID
Andrei Litvina76f75e2022-04-13 08:34:42 -1000106being `0xDEADBEEF` on endpoint 0.
Carol Yangc2367062022-02-23 18:09:32 -0800107
Carol Yang6380d382022-02-10 20:09:59 -0800108## Current Limitations
Trevor Holbrooka648ef72021-08-19 15:24:40 -0700109
110- Synchronous BDX transfer only
Carol Yang6380d382022-02-10 20:09:59 -0800111- Does not check VID/PID
Carol Yang6380d382022-02-10 20:09:59 -0800112- Only one transfer at a time (does not check incoming `UpdateTokens`)