Message ID | TYCP286MB26078CEC570EA9055D86D82DB1E4A@TYCP286MB2607.JPNP286.PROD.OUTLOOK.COM (mailing list archive) |
---|---|
State | New, archived |
Delegated to: | Jiri Kosina |
Headers | show |
Series | [v3] HID: i2c-hid: use print_hex_dump_debug to print report descriptor | expand |
On Fri, 01 Sep, 2023 16:33:56 +0800 "Riwen Lu" <luriwen@hotmail.com> wrote: > From: Riwen Lu <luriwen@kylinos.cn> > > The format '%*ph' prints up to 64 bytes long as a hex string with ' ' > separator. 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@kylinos.cn> > > --- > v1->v2: > - Add a prefix for the hex dump. > > v2->v3: > - Print the size of report descriptor. > --- > 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..dd69abdd1f0d 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 size: %#x\n", rsize); > + print_hex_dump_debug("Report Descriptor: ", DUMP_PREFIX_OFFSET, 16, 1, > + rdesc, rsize, false); > > ret = hid_parse_report(hid, rdesc, rsize); > if (!use_override) Thanks for the new version. Reviewed-by: Rahul Rameshbabu <sergeantsagara@protonmail.com>
diff --git a/drivers/hid/i2c-hid/i2c-hid-core.c b/drivers/hid/i2c-hid/i2c-hid-core.c index efbba0465eef..dd69abdd1f0d 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 size: %#x\n", rsize); + print_hex_dump_debug("Report Descriptor: ", DUMP_PREFIX_OFFSET, 16, 1, + rdesc, rsize, false); ret = hid_parse_report(hid, rdesc, rsize); if (!use_override)