本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
使用 取得 OTA 失敗代碼 AWS CLI
-
安裝及設定 AWS CLI。
-
執行
aws configure並輸入下列資訊。$aws configure AWS Access Key ID [None]:AccessIDAWS Secret Access Key [None]:AccessKeyDefault region name [None]:RegionDefault output format [None]: json如需詳細資訊,請參閱使用 的快速組態
aws configure。 -
執行:
aws iot describe-job-execution --job-idJobID--thing-nameThingName其中
JobID是我們想要取得狀態之任務的完整任務 ID 字串 (它在建立時與 OTA 更新任務相關聯),而ThingName是裝置在 中註冊為 的 AWS IoT 物件名稱 AWS IoT -
輸出看起來像這樣:
{ "execution": { "jobId": "AFR_OTA-****************", "status": "FAILED", "statusDetails": { "detailsMap": { "reason": "0xEEEEEEEE: 0xffffffff" } }, "thingArn": "arn:aws:iot:Region:AccountID:thing/ThingName", "queuedAt": 1569519049.9, "startedAt": 1569519052.226, "lastUpdatedAt": 1569519052.226, "executionNumber": 1, "versionNumber": 2 } }在此範例輸出中,「
detailsmap」中的「reason」有兩個欄位:顯示為「0xEEEEEEEE」的欄位包含 OTA 代理程式的一般錯誤碼;顯示為「0xffffffff」的欄位則包含子代碼。一般錯誤碼列在 https://docs.aws.amazon.com/freertos/latest/lib-ref/html1/aws__ota__agent_8h.html。請參閱前綴為 "kOTA_Err_” 的錯誤代碼。子代碼可以是平台專用代碼,也可以提供一般錯誤的詳細資訊。