From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: chang yao chung <yaochung@cic.org.tw>
Cc: linux-input@vger.kernel.org
Subject: Re: problem of writing a virtual ps2 mouse driver
Date: Tue, 28 Apr 2009 06:18:24 -0700 [thread overview]
Message-ID: <200904280618.24663.dmitry.torokhov@gmail.com> (raw)
In-Reply-To: <9A03B08F-52D1-4A83-B060-D0DE111E0064@cic.org.tw>
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@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
prev parent reply other threads:[~2009-04-28 13:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-27 7:18 problem of writing a virtual ps2 mouse driver chang yao chung
2009-04-28 13:18 ` Dmitry Torokhov [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200904280618.24663.dmitry.torokhov@gmail.com \
--to=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=yaochung@cic.org.tw \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).