--- zzzz-none-000/linux-3.10.107/drivers/hid/hid-wiimote-debug.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/drivers/hid/hid-wiimote-debug.c 2021-02-04 17:41:59.000000000 +0000 @@ -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 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 @@ 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 @@ } 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;