summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Wu <lekensteyn@gmail.com>2013-09-02 10:47:03 +0200
committerMartin Pitt <martinpitt@gnome.org>2013-09-03 08:31:28 +0200
commit16544c135590d8c653cb83eec3f8e4395687a4d8 (patch)
tree2fed66991a764560dcb7e5b5bca7aad68952a75e
parenta7766cfde93974e05ae3fa87a41191a5542cf7bc (diff)
hidpp: ignore remaining garbage for debug print
HidppMessage is currently of size 20 ("long message"). Since short messages are always of size 7, do not bother printing the remaining 13 bytes. This code path is currently only used by hidpp-test (not installed). Reported-by: Martin Pitt <martin.pitt@ubuntu.com> Signed-off-by: Peter Wu <lekensteyn@gmail.com>
-rw-r--r--src/linux/hidpp-device.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/linux/hidpp-device.c b/src/linux/hidpp-device.c
index ea0f3e8..899b0f3 100644
--- a/src/linux/hidpp-device.c
+++ b/src/linux/hidpp-device.c
@@ -250,12 +250,14 @@ hidpp_device_map_get_by_idx (HidppDevice *device, gint idx)
static void
hidpp_device_print_buffer (HidppDevice *device, const HidppMessage *msg)
{
- guint i;
+ guint i, mlen;
const HidppDeviceMap *map;
if (!device->priv->enable_debug)
return;
- for (i = 0; i < sizeof (*msg); i++)
+
+ mlen = HIDPP_MSG_LENGTH(msg);
+ for (i = 0; i < mlen; i++)
g_print ("%02x ", ((const guchar*) msg)[i]);
g_print ("\n");