From: Tedd Ho-Jeong An <hj.tedd.an@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ v4 1/2] tools/bluemoon: Display FW version of firmware file
Date: Mon, 1 Feb 2021 19:40:04 -0800 [thread overview]
Message-ID: <20210202034005.27697-1-hj.tedd.an@gmail.com> (raw)
From: Tedd Ho-Jeong An <tedd.an@intel.com>
This patch displays a FW version after parsing the WRITE_BOOT_PARAMS
command in the firmeare file. It also change the display type for
Module vendor and Date in the CSS header to hex for easy read.
---
tools/bluemoon.c | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/tools/bluemoon.c b/tools/bluemoon.c
index 8b62b1e7b..382c76c69 100644
--- a/tools/bluemoon.c
+++ b/tools/bluemoon.c
@@ -805,8 +805,10 @@ static void analyze_firmware(const char *path)
le32_to_cpu(css->header_version) >> 16,
le32_to_cpu(css->header_version) & 0xffff);
printf("Module ID:\t%u\n", le32_to_cpu(css->module_id));
- printf("Module vendor:\t%u\n", le32_to_cpu(css->module_vendor));
- printf("Date:\t\t%u\n", le32_to_cpu(css->date));
+ printf("Module vendor:\t0x%x\n", le32_to_cpu(css->module_vendor));
+ printf("Date:\t\t%04x-%02x-%02x\n", le32_to_cpu(css->date) >> 16,
+ le32_to_cpu(css->date) >> 8 & 0xff,
+ le32_to_cpu(css->date) & 0xff);
printf("Size:\t\t%u DWORDs / %u bytes\n", le32_to_cpu(css->size),
le32_to_cpu(css->size) * 4);
printf("Key size:\t%u DWORDs / %u bytes\n",
@@ -840,13 +842,23 @@ static void analyze_firmware(const char *path)
while (firmware_offset < firmware_size) {
uint16_t opcode;
uint8_t dlen;
+ struct cmd_write_boot_params *params;
opcode = get_le16(firmware_data + firmware_offset);
dlen = firmware_data[firmware_offset + 2];
switch (opcode) {
- case CMD_NO_OPERATION:
case CMD_WRITE_BOOT_PARAMS:
+ params = (void *)&firmware_data[firmware_offset + 3];
+ printf("Boot Parameters\n");
+ printf("Boot Address:\t0x%08x\n",
+ le32_to_cpu(params->boot_addr));
+ printf("Firmware build:\t%u-%u.%u\n",
+ params->fw_build_nn,
+ params->fw_build_cw,
+ 2000 + params->fw_build_yy);
+ printf("\n");
+ case CMD_NO_OPERATION:
case CMD_MEMORY_WRITE:
break;
default:
--
2.25.1
next reply other threads:[~2021-02-02 3:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-02 3:40 Tedd Ho-Jeong An [this message]
2021-02-02 3:40 ` [PATCH BlueZ v4 2/2] tools/bluemoon: Add support for checking other firmware file types Tedd Ho-Jeong An
2021-02-02 4:07 ` [BlueZ,v4,1/2] tools/bluemoon: Display FW version of firmware file bluez.test.bot
2021-02-03 19:08 ` Luiz Augusto von Dentz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210202034005.27697-1-hj.tedd.an@gmail.com \
--to=hj.tedd.an@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).