I don't think it's necessary to add a pair of begin/end prints like that. However, I can print out the size of the report descriptor through i2c_hid_dbg. And print_hex_dump_debug prints each line with a "Report Descriptor" prefix and an offset, so it's easy to know if the descriptor dump is complete.
On Wed, 16 Aug, 2023 16:38:19 +0800 "Riwen Lu" <luriwen@xxxxxxxxxxx> wrote:
From: Riwen Lu <luriwen@xxxxxxxxxx>
The format '%*ph' print up to 64 bytes long as a hex string with ' '
sepatator. Usually the size of report descriptor is larger than 64
bytes, so consider using print_hex_dump_debug to print out all of it for
better debugging.
Signed-off-by: Riwen Lu <luriwen@xxxxxxxxxx>
---
v1->v2:
- Add a prefix for the hex dump.
---
drivers/hid/i2c-hid/i2c-hid-core.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/hid/i2c-hid/i2c-hid-core.c b/drivers/hid/i2c-hid/i2c-hid-core.c
index efbba0465eef..fd82e9042da5 100644
--- a/drivers/hid/i2c-hid/i2c-hid-core.c
+++ b/drivers/hid/i2c-hid/i2c-hid-core.c
@@ -772,7 +772,9 @@ static int i2c_hid_parse(struct hid_device *hid)
}
}
- i2c_hid_dbg(ihid, "Report Descriptor: %*ph\n", rsize, rdesc);
+ i2c_hid_dbg(ihid, "Report Descriptor\n");
Instead of just indicating that the report descriptor dump begins with
the above print, I think it makes more sense for the print to be changed
to a pair of begin/end or "cut here" prints similar to what you see in
oops messages. This will help individuals reading reports copied by bug
reporters validate that the complete descriptor dump is present.
Something along the lines of what is done in sound/soc/sof/debug.c.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/sound/soc/sof/debug.c?id=4853c74bd7ab7fdb83f319bd9ace8a08c031e9b6#n407
+ print_hex_dump_debug("Report Descriptor: ", DUMP_PREFIX_OFFSET, 16, 1,
+ rdesc, rsize, false);
--
Thanks,
Rahul Rameshbabu