# Re: \[PATCH v6.2 1/1\] Input: Add userio module

- From: Lyude \<hidden\>
- Date: 2015-10-26 13:52:05 
- List: linux-input
- Page: https://ratatoskr.run/linux-input/2015/10/4607015
- Thread: https://ratatoskr.run/linux-input/2015/09/4578274/t.md

```text
Hi! So, I'm guessing you want me to merge this with the patch I've got
right now and post the new version? (Just making sure since I'm a bit
new to this :)

On Sat, 2015-10-24 at 15:40 -0700, Dmitry Torokhov wrote:
> Hi Stephen,
> 
> On Fri, Oct 23, 2015 at 04:47:46PM -0400, cpaul@redhat.com wrote:
> > From: Stephen Chandler Paul <redacted>
> > 
> > Debugging input devices, specifically laptop touchpads, can be
> > tricky
> > without having the physical device handy. Here we try to remedy
> > that
> > with userio. This module allows an application to connect to a
> > character
> > device provided by the kernel, and emulate any serio device. In
> > combination with userspace programs that can record PS/2 devices
> > and
> > replay them through the /dev/userio device, this allows developers
> > to
> > debug driver issues on the PS/2 level with devices simply by
> > requesting
> > a recording from the user experiencing the issue without having to
> > have
> > the physical hardware in front of them.
> > 
> > Signed-off-by: Stephen Chandler Paul <redacted>
> > Reviewed-by: David Herrmann <redacted>
> > ---
> > 				    Changes
> > * Remove the if (!userio) { return -1; } check that somehow got
> > left in.
> > 
> > Sorry this took so long! I was wondering why you hadn't replied
> > yet, only to
> > notice I only made this change on my own tree and never sent out a
> > response
> > patch. Oops.
> 
> Thank you for making all the changes.
> 
> > +
> > +static ssize_t userio_char_read(struct file *file, char __user
> > *user_buffer,
> > +				size_t count, loff_t *ppos)
> > +{
> > +	struct userio_device *userio = file->private_data;
> > +	int ret;
> > +	size_t nonwrap_len, copylen;
> > +	unsigned char buf[USERIO_BUFSIZE];
> > +	unsigned long flags;
> > +
> > +	if (!count)
> > +		return 0;
> 
> This is not quite right: read of size 0 should still check if there
> is
> data in the buffer and return -EAGAIN for non-blocking descriptors.
> 
> I cooked a patch (below) that should adjust the read behavior (_+ a
> coupe of formatting changes), please take a look.
> 
> Thanks!
> 
-- 
Cheers,
	Lyude
```
