From 4863a3be2c3b97daa2bd6c2e3880b1870f28f25b Mon Sep 17 00:00:00 2001 From: zxystd <1051244836@qq.com> Date: Tue, 6 Feb 2024 18:32:47 +0800 Subject: [PATCH] Print firmware SHA1. Intel Read Version event contains a TLV(0x32) having firmware sha1 in operational image. --- IntelBluetoothFirmware/BtIntel.h | 1 + IntelBluetoothFirmware/IntelBluetoothOpsGen3.cpp | 6 ++++++ IntelBluetoothFirmware/IntelBluetoothOpsGen3.hpp | 3 ++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/IntelBluetoothFirmware/BtIntel.h b/IntelBluetoothFirmware/BtIntel.h index 6c0d38e..5dc1365 100644 --- a/IntelBluetoothFirmware/BtIntel.h +++ b/IntelBluetoothFirmware/BtIntel.h @@ -76,6 +76,7 @@ typedef struct __attribute__((packed)) { uint8_t min_fw_build_yy; uint8_t limited_cce; uint8_t sbe_type; + uint32_t git_sha1; bdaddr_t otp_bd_addr; } IntelVersionTLV; diff --git a/IntelBluetoothFirmware/IntelBluetoothOpsGen3.cpp b/IntelBluetoothFirmware/IntelBluetoothOpsGen3.cpp index 3737355..b770b2f 100644 --- a/IntelBluetoothFirmware/IntelBluetoothOpsGen3.cpp +++ b/IntelBluetoothFirmware/IntelBluetoothOpsGen3.cpp @@ -555,6 +555,9 @@ parseVersionTLV(IntelVersionTLV *version, const uint8_t *versionDataPtr, int len case INTEL_TLV_OTP_BDADDR: memcpy(&version->otp_bd_addr, tlv->val, tlv->len); break; + case INTEL_TLV_GIT_SHA1: + version->git_sha1 = get_unaligned_le32(tlv->val); + break; default: /* Ignore rest of information */ break; @@ -680,6 +683,9 @@ versionInfoTLV(IntelVersionTLV *version) 2000 + (version->timestamp >> 8), version->timestamp & 0xff, version->build_type, version->build_num); + if (version->img_type == 0x03) + XYLog("Firmware SHA1: 0x%8.8x\n", version->git_sha1); + return true; } diff --git a/IntelBluetoothFirmware/IntelBluetoothOpsGen3.hpp b/IntelBluetoothFirmware/IntelBluetoothOpsGen3.hpp index 4b4f918..6b1a42a 100644 --- a/IntelBluetoothFirmware/IntelBluetoothOpsGen3.hpp +++ b/IntelBluetoothFirmware/IntelBluetoothOpsGen3.hpp @@ -46,7 +46,8 @@ enum { INTEL_TLV_LIMITED_CCE, INTEL_TLV_SBE_TYPE, INTEL_TLV_OTP_BDADDR, - INTEL_TLV_UNLOCKED_STATE + INTEL_TLV_UNLOCKED_STATE, + INTEL_TLV_GIT_SHA1 }; class IntelBluetoothOpsGen3 : public IntelBluetoothOpsGen2 {