Re: problem of writing a virtual ps2 mouse driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Mon, Apr 27, 2009 at 03:18:07PM +0800, chang yao chung wrote:
> Hi all
>
> I want to write a virtual PS/2 mouse driver to hook to the input core,  
> after I load the driver
> The psmouse input device driver probes my virtual device as a “Generic  
> PS/2 mouse” in /dev/input/mouse1
> And sent a F4 (mouse enable command) to my pseudo device.
>
> I use a user space program to send the following mouse movement packet  
> and launch
> gpm –m /dev/input/mouse1 –t ps2
>
> but when I run the user space program , there is no mouse movement event 
> occurred,

Do you see any data coming out if you just do a 'cat /dev/input/mouse1'?
Are you positive that mouse1 is bound to your virtual device?

> is there anything wrong with my code using serio_interrupt () ?
>

...

>
> static ssize_t
> write_vms (struct device *dev, struct device_attribute *attr, const char 
> *buffer, size_t count)
> {
>         int x, y;
>         sscanf (buffer, "%x", &x);

You don't read 'y' coordinate and below pass garbage to serio, users
is likely to reject packets that are suspicious.

>         serio_interrupt (dev, 0x8, 0 , NULL);
>         serio_interrupt (dev, x, NULL);

First question - does it even compile? I don't think so given that you
trying to pass either 3 or 4 arguments to it.

>         serio_interrupt (dev, y, 0, NULL);
>         serio_interrupt (dev, 0, 0, NULL);

You also need to decide the flavor of PS/2 protocol you are trying to
support. You seem to be aiming for ImPS/2 with 0 4th byte but don't
respond to ImPS/2 probes which will confuse users.

-- 
Dmitry

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux