X-Git-Url: https://git.karo-electronics.de/?a=blobdiff_plain;f=drivers%2Fhid%2Fhid-wiimote-debug.c;h=c13fb5bd79e8f461212c14e4febc3717e1077cb9;hb=8133633368760656c76b8302dbd4bfa20f887df6;hp=90124ffaa2a5211f3e7e11ec7c4a21aedd18b054;hpb=8fa48cbdfb0b7c2e39a8f2a46f987afe9b9c0579;p=karo-tx-linux.git 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 */ /* @@ -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;