HID: hid-wiimote: print small buffers via %*phC
Instead of passing each byte through stack let's use %*phC specifier to dump buffer as a hex string. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: David Herrmann <dh.herrmann@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
This commit is contained in:
committed by
Jiri Kosina
parent
8e22ecb603
commit
95f712662d
@@ -441,8 +441,7 @@ static __u8 wiimote_cmd_read_ext(struct wiimote_data *wdata, __u8 *rmem)
|
|||||||
if (ret != 6)
|
if (ret != 6)
|
||||||
return WIIMOTE_EXT_NONE;
|
return WIIMOTE_EXT_NONE;
|
||||||
|
|
||||||
hid_dbg(wdata->hdev, "extension ID: %02x:%02x %02x:%02x %02x:%02x\n",
|
hid_dbg(wdata->hdev, "extension ID: %6phC\n", rmem);
|
||||||
rmem[0], rmem[1], rmem[2], rmem[3], rmem[4], rmem[5]);
|
|
||||||
|
|
||||||
if (rmem[0] == 0xff && rmem[1] == 0xff && rmem[2] == 0xff &&
|
if (rmem[0] == 0xff && rmem[1] == 0xff && rmem[2] == 0xff &&
|
||||||
rmem[3] == 0xff && rmem[4] == 0xff && rmem[5] == 0xff)
|
rmem[3] == 0xff && rmem[4] == 0xff && rmem[5] == 0xff)
|
||||||
@@ -520,14 +519,12 @@ static bool wiimote_cmd_read_mp(struct wiimote_data *wdata, __u8 *rmem)
|
|||||||
if (ret != 6)
|
if (ret != 6)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
hid_dbg(wdata->hdev, "motion plus ID: %02x:%02x %02x:%02x %02x:%02x\n",
|
hid_dbg(wdata->hdev, "motion plus ID: %6phC\n", rmem);
|
||||||
rmem[0], rmem[1], rmem[2], rmem[3], rmem[4], rmem[5]);
|
|
||||||
|
|
||||||
if (rmem[5] == 0x05)
|
if (rmem[5] == 0x05)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
hid_info(wdata->hdev, "unknown motion plus ID: %02x:%02x %02x:%02x %02x:%02x\n",
|
hid_info(wdata->hdev, "unknown motion plus ID: %6phC\n", rmem);
|
||||||
rmem[0], rmem[1], rmem[2], rmem[3], rmem[4], rmem[5]);
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -543,8 +540,7 @@ static __u8 wiimote_cmd_read_mp_mapped(struct wiimote_data *wdata)
|
|||||||
if (ret != 6)
|
if (ret != 6)
|
||||||
return WIIMOTE_MP_NONE;
|
return WIIMOTE_MP_NONE;
|
||||||
|
|
||||||
hid_dbg(wdata->hdev, "mapped motion plus ID: %02x:%02x %02x:%02x %02x:%02x\n",
|
hid_dbg(wdata->hdev, "mapped motion plus ID: %6phC\n", rmem);
|
||||||
rmem[0], rmem[1], rmem[2], rmem[3], rmem[4], rmem[5]);
|
|
||||||
|
|
||||||
if (rmem[0] == 0xff && rmem[1] == 0xff && rmem[2] == 0xff &&
|
if (rmem[0] == 0xff && rmem[1] == 0xff && rmem[2] == 0xff &&
|
||||||
rmem[3] == 0xff && rmem[4] == 0xff && rmem[5] == 0xff)
|
rmem[3] == 0xff && rmem[4] == 0xff && rmem[5] == 0xff)
|
||||||
@@ -1138,9 +1134,8 @@ static void wiimote_init_hotplug(struct wiimote_data *wdata)
|
|||||||
wiimote_ext_unload(wdata);
|
wiimote_ext_unload(wdata);
|
||||||
|
|
||||||
if (exttype == WIIMOTE_EXT_UNKNOWN) {
|
if (exttype == WIIMOTE_EXT_UNKNOWN) {
|
||||||
hid_info(wdata->hdev, "cannot detect extension; %02x:%02x %02x:%02x %02x:%02x\n",
|
hid_info(wdata->hdev, "cannot detect extension; %6phC\n",
|
||||||
extdata[0], extdata[1], extdata[2],
|
extdata);
|
||||||
extdata[3], extdata[4], extdata[5]);
|
|
||||||
} else if (exttype == WIIMOTE_EXT_NONE) {
|
} else if (exttype == WIIMOTE_EXT_NONE) {
|
||||||
spin_lock_irq(&wdata->state.lock);
|
spin_lock_irq(&wdata->state.lock);
|
||||||
wdata->state.exttype = WIIMOTE_EXT_NONE;
|
wdata->state.exttype = WIIMOTE_EXT_NONE;
|
||||||
|
Reference in New Issue
Block a user