aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-wiimote-debug.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hid/hid-wiimote-debug.c')
-rw-r--r--drivers/hid/hid-wiimote-debug.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/hid/hid-wiimote-debug.c b/drivers/hid/hid-wiimote-debug.c
index 90124ffaa2a5..c13fb5bd79e8 100644
--- a/drivers/hid/hid-wiimote-debug.c
+++ b/drivers/hid/hid-wiimote-debug.c
@@ -1,6 +1,6 @@
/*
- * Debug support for HID Nintendo Wiimote devices
- * Copyright (c) 2011 David Herrmann
+ * Debug support for HID Nintendo Wii / Wii U peripherals
+ * Copyright (c) 2011-2013 David Herrmann <dh.herrmann@gmail.com>
*/
/*
@@ -127,7 +127,8 @@ static int wiidebug_drm_open(struct inode *i, struct file *f)
static ssize_t wiidebug_drm_write(struct file *f, const char __user *u,
size_t s, loff_t *off)
{
- struct wiimote_debug *dbg = f->private_data;
+ struct seq_file *sf = f->private_data;
+ struct wiimote_debug *dbg = sf->private;
unsigned long flags;
char buf[16];
ssize_t len;
@@ -140,7 +141,7 @@ static ssize_t wiidebug_drm_write(struct file *f, const char __user *u,
if (copy_from_user(buf, u, len))
return -EFAULT;
- buf[15] = 0;
+ buf[len] = 0;
for (i = 0; i < WIIPROTO_REQ_MAX; ++i) {
if (!wiidebug_drmmap[i])
@@ -150,10 +151,13 @@ static ssize_t wiidebug_drm_write(struct file *f, const char __user *u,
}
if (i == WIIPROTO_REQ_MAX)
- i = simple_strtoul(buf, NULL, 10);
+ i = simple_strtoul(buf, NULL, 16);
spin_lock_irqsave(&dbg->wdata->state.lock, flags);
+ dbg->wdata->state.flags &= ~WIIPROTO_FLAG_DRM_LOCKED;
wiiproto_req_drm(dbg->wdata, (__u8) i);
+ if (i != WIIPROTO_REQ_NULL)
+ dbg->wdata->state.flags |= WIIPROTO_FLAG_DRM_LOCKED;
spin_unlock_irqrestore(&dbg->wdata->state.lock, flags);
return len;