Page 1 of 1
USB Mouse IRQ
Posted: Wed Apr 29, 2009 3:58 am
by purage
Hi,
Any chance someone here happens to know which IRQ the USB mouse would use? Is it typically the same IRQ number or different. And, if it is different, how could I find out programmatically which IRQ the USB mouse is using? Thanks
Re: USB Mouse IRQ
Posted: Wed Apr 29, 2009 4:25 am
by giszo
purage wrote:Hi,
Any chance someone here happens to know which IRQ the USB mouse would use? Is it typically the same IRQ number or different. And, if it is different, how could I find out programmatically which IRQ the USB mouse is using? Thanks
AFAIK the USB mouse won't use a separate IRQ, it will "use" the same IRQ as the USB controller uses (with any other device connected to the same USB controller).
Re: USB Mouse IRQ
Posted: Wed Apr 29, 2009 7:39 am
by bewing
When the machine boots, a USB mouse is in "SMM PS2 emulation mode", and it will use IRQ12 like a normal PS2 mouse. But it doesn't work very well, and it is very slow.
Your USB mouse driver will have the ability to turn OFF the PS2 emulation, and you really should do this immediately. After that, as said above -- the mouse data will use the standard shared USB IRQ. You will need to use standard USB-stack packet decoding to find out which of them come from the mouse.
Re: USB Mouse IRQ
Posted: Wed Apr 29, 2009 1:34 pm
by purage
Hi,
How would I determine at boot which kind of mouse the user has? I assume if they use the same IRQ that I can still use the same handler, I would just need to handle the packets differently, but I would need to know what type of mouse they have before I could do any of that.
Re: USB Mouse IRQ
Posted: Wed Apr 29, 2009 1:57 pm
by bewing
That's the problem. There is really no way to know. So either:
1) you can't use a mouse until the system has booted far enough to get all the USB drivers running (and the USB driver can determine if a mouse is attached to the USB bus and turn emulation mode off)
or,
2) you have to assume that it's a USB mouse in SMM PS2 emulation mode, and keep the mouse and keyboard drivers separate, and only read one mouse byte at a time on an IRQ12, and only read one keyboard byte at a time on an IRQ1. That is, you can't use the "mouse bit" (IIRC port 0x64 bit 5) to determine where a byte comes from.
Re: USB Mouse IRQ
Posted: Wed Apr 29, 2009 2:18 pm
by purage
OIC. Thanks for the help.