Skip to content

Commit 0eedab7

Browse files
marvintwentyfourgregkh
authored andcommitted
staging: nvec: ps2: add some more debug functions
This can print the mouse traffic which goes over the i2c bus. Make mouse debugging messages configurable and disable them by default. Signed-off-by: Marc Dietrich <[email protected]> Signed-off-by: Julian Andres Klode <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 4b625c3 commit 0eedab7

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

drivers/staging/nvec/nvec_ps2.c

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@
2525
#define STOP_STREAMING {'\x06', '\x04'}
2626
#define SEND_COMMAND {'\x06', '\x01', '\xf4', '\x01'}
2727

28+
#ifdef NVEC_PS2_DEBUG
29+
#define NVEC_PHD(str, buf, len) \
30+
print_hex_dump(KERN_DEBUG, str, DUMP_PREFIX_NONE, \
31+
16, 1, buf, len, false)
32+
#else
33+
#define NVEC_PHD(str, buf, len)
34+
#endif
35+
2836
static const unsigned char MOUSE_RESET[] = {'\x06', '\x01', '\xff', '\x03'};
2937

3038
struct nvec_ps2 {
@@ -67,18 +75,18 @@ static int nvec_ps2_notifier(struct notifier_block *nb,
6775
case NVEC_PS2_EVT:
6876
for (i = 0; i < msg[1]; i++)
6977
serio_interrupt(ps2_dev.ser_dev, msg[2 + i], 0);
78+
NVEC_PHD("ps/2 mouse event: ", &msg[2], msg[1]);
7079
return NOTIFY_STOP;
7180

7281
case NVEC_PS2:
73-
if (msg[2] == 1)
82+
if (msg[2] == 1) {
7483
for (i = 0; i < (msg[1] - 2); i++)
7584
serio_interrupt(ps2_dev.ser_dev, msg[i + 4], 0);
76-
else if (msg[1] != 2) { /* !ack */
77-
print_hex_dump(KERN_WARNING, "unhandled mouse event: ",
78-
DUMP_PREFIX_NONE, 16, 1,
79-
msg, msg[1] + 2, true);
85+
NVEC_PHD("ps/2 mouse reply: ", &msg[4], msg[1] - 2);
8086
}
8187

88+
else if (msg[1] != 2) /* !ack */
89+
NVEC_PHD("unhandled mouse event: ", msg, msg[1] + 2);
8290
return NOTIFY_STOP;
8391
}
8492

0 commit comments

Comments
 (0)