if you are polling the hardware in your driver like you describe below, you are going to make the machine very very unstable for the user.? What you are doing will cause lost keystrokes and mouse strokes?that the user will perceive as hardware errors (and will never be signed by WHQL).? And as you may have guessed, this only works for ps/2 devices (and not usb, eg HID, or other input devices).
?
WDM does not cover input, so if you write a driver solution.? If all you are interested in is a particular scan code, you can install a global keyboard hook or a global low level keyboard hook and see when that key is pressed.? If you can use the user mode solution of a hook, then you will have to write 3 drivers:
?
1)? for win2k, xp, and beyond.? you can install yourself as a class lower filter below the class driver, kbdclass, and insert your own service callback into the chain.? In the KEYBOARD_INPUT_DATA range that is passed, you can find your event.? Once you find it, signal your event / complete your irp / whatever.? This will work for all keyboard architectures now and beyond.? This is covered in the XP DDK, look at the kbdfiltr example.
2)? a vxd for win9x (win ME, win 98, et al).? you will have to write a vkd filter.? don’t know how to do that
3)? a driver for NT4 and before, where you attach to \device\keyboardclass0 and filter completed read IRPs coming from the raw input thread (ie USER).? You cannot do this for win2k, xp because on NT4, there is only one virtual keyboard while on win2k/xp, each keyboard is represented individually, so you will only be filtering one device (which will most likely be the terminal services kbd on XP!) and not all of them.
?
ps/2 works the same on all machines, bit 5 means the same thing whether the machine is a 386, 486, pentium, or AMD64.
?
d
?
-----Original Message-----
From: Sundeep [mailto:xxxxx@nital.stpp.soft.net]
Sent: Mon 6/3/2002 11:51 PM
To: NT Developers Interest List
Cc:
Subject: [ntdev] RE: Identifying PS/2 mouse
Hi,
Thanks for the response.
Here is what I am trying to do:
Inside the driver, I have one loop which breaks when some specific key is
entered. For reading the key entry, I am
reading the port 0x060 ( ie?? in al, 60h ) & comparing it with required
value. I found that, when PS/2 mouse is connected,
reading 0x060, gives mouse data as well as KB data & to differentiate
between the two, I need to read 0x064.
If bit5 = 1, then it is ps/2 mouse data or else kb data. Is this valid for
all motherboards ? ( some documents indicate
bit 5 for “Transmit timeout or PS/2 mouse”).
I suppose ,since this is motherboard specific issue & I am reading straight
through the port, this code will remain same for
all OS ( win2k, win nt, win9x , XP, ME).I wish to keep the code same for all
platforms.
I wonder, if this same technique will work with old machines eg x486 which
doesnot have PS/2 implementations.
In other words, reading 0x064 on these machines will give bit5 = 0 or not.
Ports 060h & 64h give data from 8042 ports.Am I right ?
Regards,
Sundeep
----- Original Message -----
From: Doron Holan
To: NT Developers Interest List
Sent: Tuesday, June 04, 2002 11:24 AM
Subject: [ntdev] RE: Identifying PS/2 mouse
>
> If you are in windows 2000, insert yourself as a device upper filter into
the ps/2 keyboard and mouse stacks. You can get to the data in 2 ways:
> 1) via the service callback routine will give you the data as i8042prt has
interpreted it
> 2) you can insert an ISR filter and get at the raw data and do your own
processing
>
> If you are reading these ports directly w/out the cooperation of i8042prt,
you will very likely hang the machine (by freaking out the 8042 controller
which is very very touchey). I8042prt also allows you to write to the ports
in a synchronized fashion so that there is no contention among the writes
(see ntdd8042.h for the appro IOCTL and i8042prt in the DDK).
>
> The way i8042prt mouse data is identified by i8042prt is that the ISR is
signaled and then bit 5 of port 64 is set high (see I8xMouseInterruptService
for details).
>
> What exactly are you trying to do? Once explained, I can give more
concrete directions.
>
> d
>
> -----Original Message-----
> From: Sundeep [mailto:xxxxx@nital.stpp.soft.net]
> Sent: Monday, June 03, 2002 10:24 PM
> To: NT Developers Interest List
> Subject: [ntdev] Identifying PS/2 mouse
>
> Hi,
>
> In Win2000 driver, I am reading the keyboard entries directly through the
i/o port.I realised that PS/2
> mouse & PS/2 keyboard are multiplexed & status register at I/O port
address 64h (bit 5) can be used
> to differentiate between mouse data & kb data.
>
> I would like to know, –
> a) if the same code (ie bit5 of i/o port 64h) will work with old machines
, where PS/2 mouse may or may
> not be connected.
> b) is there any other way to identify ps/2 mouse data ?
>
> Thanks in advance,
> Sundeep
> —
> You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com
> To unsubscribe send a blank email to %%email.unsub%%
>
> —
> You are currently subscribed to ntdev as: xxxxx@nital.stpp.soft.net
> To unsubscribe send a blank email to %%email.unsub%%
—
You are currently subscribed to ntdev as: xxxxx@windows.microsoft.com
To unsubscribe send a blank email to %%email.unsub%%