Mouse PS2 USB emulation on real hardware
Mouse PS2 USB emulation on real hardware
So I followed the steps in the mouse forum post to initialise the mouse and enable IRQs but my question is how do I get those interrupts/irqs from USB mice? Emulators work fine however testing it on my machine yields no input. I do see it says I must receive such data streams from the "USB bus" but is there any general guidance towards specifically getting that work for USB mice? I'd rather avoid writing a full fledged USB driver until I really have to. Thanks.
Re: Mouse PS2 USB emulation on real hardware
Well, it depends. Are you still in real-mode? If so, getting mouse movements from a USB mouse is emulated and programmed just like getting mouse movements from a PS2 mouse, as long as the hardware emulates the mouse. Most, if not all modern machines do this.YDeeps1 wrote:So I followed the steps in the mouse forum post to initialise the mouse and enable IRQs but my question is how do I get those interrupts/irqs from USB mice? Emulators work fine however testing it on my machine yields no input. I do see it says I must receive such data streams from the "USB bus" but is there any general guidance towards specifically getting that work for USB mice? I'd rather avoid writing a full fledged USB driver until I really have to. Thanks.
If you have moved to protected mode, you probably don't want to hear it, but you will have to write a (mostly) <quote>full fledged USB driver until I really have to.</quote>
What hardware do you have, which of the four controllers do you wish to use, and how much effort do you wish to put into USB? Depending on your answer, I have different recommendations.
If you don't want to put much effort into USB, stick with the xHCI controller and forget about the other three. If you wish to learn about USB, I would start with UHCI (and possibly OHCI), skip EHCI altogether, and then go to xHCI.
I have written a book that describes all four controllers and one of the chapters is specifically for USB mice.
Whether you read my book or not, I try to help with every USB question on this forum. After reading other documentation, the wiki for this site for instance, and other resources, start building your base, and when you have a question, feel free to ask.
Ben
- http://www.fysnet.net/the_universal_serial_bus.htm
-
- Member
- Posts: 5563
- Joined: Mon Mar 25, 2013 7:01 pm
Re: Mouse PS2 USB emulation on real hardware
Which forum post?YDeeps1 wrote:the mouse forum post
Does the emulated PS/2 controller act like a mouse is attached when you initialize it? Does it act like a mouse is attached when you poll for input without using IRQ12?
Have you checked the firmware settings to make sure USB legacy support is enabled? There may be a separate option for mouse support.
Does your firmware support mouse emulation? (I don't know how you would check this!)
Re: Mouse PS2 USB emulation on real hardware
Octocontrabass wrote:Which forum post?YDeeps1 wrote:the mouse forum post
Does the emulated PS/2 controller act like a mouse is attached when you initialize it? Does it act like a mouse is attached when you poll for input without using IRQ12?
Have you checked the firmware settings to make sure USB legacy support is enabled? There may be a separate option for mouse support.
Does your firmware support mouse emulation? (I don't know how you would check this!)
https://wiki.osdev.org/Mouse_InputWhich forum post?
I tried polling it for input but that too returned nothing. Looks like there is no emulation going on with the mouse.Does the emulated PS/2 controller act like a mouse is attached when you initialize it? Does it act like a mouse is attached when you poll for input without using IRQ12?
Checked the BIOS and there is a "USB legacy" option which is turned on but does not mention the mouse.Have you checked the firmware settings to make sure USB legacy support is enabled? There may be a separate option for mouse support.
Your guess is as good as mine but from the information here it does not look like it.Does your firmware support mouse emulation? (I don't know how you would check this!)
Re: Mouse PS2 USB emulation on real hardware
I am in fact in protected mode.BenLunt wrote:Well, it depends. Are you still in real-mode? If so, getting mouse movements from a USB mouse is emulated and programmed just like getting mouse movements from a PS2 mouse, as long as the hardware emulates the mouse. Most, if not all modern machines do this.YDeeps1 wrote:So I followed the steps in the mouse forum post to initialise the mouse and enable IRQs but my question is how do I get those interrupts/irqs from USB mice? Emulators work fine however testing it on my machine yields no input. I do see it says I must receive such data streams from the "USB bus" but is there any general guidance towards specifically getting that work for USB mice? I'd rather avoid writing a full fledged USB driver until I really have to. Thanks.
If you have moved to protected mode, you probably don't want to hear it, but you will have to write a (mostly) <quote>full fledged USB driver until I really have to.</quote>
What hardware do you have, which of the four controllers do you wish to use, and how much effort do you wish to put into USB? Depending on your answer, I have different recommendations.
If you don't want to put much effort into USB, stick with the xHCI controller and forget about the other three. If you wish to learn about USB, I would start with UHCI (and possibly OHCI), skip EHCI altogether, and then go to xHCI.
I have written a book that describes all four controllers and one of the chapters is specifically for USB mice.
Whether you read my book or not, I try to help with every USB question on this forum. After reading other documentation, the wiki for this site for instance, and other resources, start building your base, and when you have a question, feel free to ask.
Ben
- http://www.fysnet.net/the_universal_serial_bus.htm
Haha I haven't even begun with USB barebone basics since I wasn't expecting I'd mess with the USB quite early (well not so early) so I don't know (still would like to exhaust all other available options).What hardware do you have, which of the four controllers do you wish to use, and how much effort do you wish to put into USB?
But if I had to pick an approach I'd go with the most basic since I don't think I'll be making use of the USB outside of this instance.
Re: Mouse PS2 USB emulation on real hardware
Depending on the BIOS, and more importantly, the System Management Firmware, the PS2 emulation may or may not continue to work after the move to protected mode. It is assumed that if your software is capable of protected mode code, it is capable of loading a USB driver. :-)YDeeps1 wrote:Haha I haven't even begun with USB barebone basics since I wasn't expecting I'd mess with the USB quite early (well not so early) so I don't know (still would like to exhaust all other available options).
But if I had to pick an approach I'd go with the most basic since I don't think I'll be making use of the USB outside of this instance.
Good luck,
Ben
Re: Mouse PS2 USB emulation on real hardware
I'll give it a shot. Do you mind giving me a vague list of steps in getting this to work? From my little USB knowledge I believe I need to first establish a connection with a version both the host and device support and then somehow get an interrupt transfer in place in order to receive data from the mouse in real time.BenLunt wrote:Depending on the BIOS, and more importantly, the System Management Firmware, the PS2 emulation may or may not continue to work after the move to protected mode. It is assumed that if your software is capable of protected mode code, it is capable of loading a USB driver.YDeeps1 wrote:Haha I haven't even begun with USB barebone basics since I wasn't expecting I'd mess with the USB quite early (well not so early) so I don't know (still would like to exhaust all other available options).
But if I had to pick an approach I'd go with the most basic since I don't think I'll be making use of the USB outside of this instance.
Good luck,
Ben
Re: Mouse PS2 USB emulation on real hardware
Hi,YDeeps1 wrote:I'll give it a shot. Do you mind giving me a vague list of steps in getting this to work? From my little USB knowledge I believe I need to first establish a connection with a version both the host and device support and then somehow get an interrupt transfer in place in order to receive data from the mouse in real time.
I am sorry to say, there is no vague list of steps to get USB working. You must setup the controller, create a periodic stack, send and then receive descriptor requests, initialize the mouse, etc, before you can even think of receiving mouse packets.
On top of that, a mouse movement will not trigger an interrupt as you think it will. i.e.: it won't fire an interrupt to the PIC on every movement like you expect the PS2 would. Your stack contains a flag that will tell the controller to generate an interrupt at the end of the frame. This frame could have had 100 or more packets from various devices, some not at all related to the mouse. Your code then has to determine which packet has been received and which has yet to be received.
All of that doesn't even mention enumerating the PCI(e) to find the USB controller(s).
I am sorry, but there is no vague list of steps to take. You step in to USB and you better be ready to swim. :-)
So, to answer your question, you either need to build a USB driver or forget about the USB mouse. One or the other.
Sorry,
Ben