Page 1 of 1

PS/2 Mouse Change Sample Rate (Command 0xF3)

Posted: Thu Jul 11, 2013 12:55 am
by Geometrian
Hi,

I am trying to change the mode of the PS/2 mouse to a PS/2 scrollwheel mouse or PS/2 5-button mouse, which is done by changing the sampling rate three times in a row.

To send a command to the mouse, one must prefix the command by a command to the PS/2 controller on port 0x0064 to tell it that the next byte (on port 0x0060) is to go to device 1 instead of to device 0. So, a command (e.g. 0xF2) to the mouse should look like:
  • 0xD4 -> 0x0064
  • 0xF2 -> 0x0060
  • 0xFA <- 0x0060
Based on the Wiki page, I would have expected changing the rate (e.g. to 200) to look something like this:
  • 0xD4 -> 0x0064
  • 0xF3 -> 0x0060
  • 200 -> 0x0060
  • 0xFA <- 0x0060
When I try this, I get a response of 0xFE--which I wasn't aware was even possible from the mouse--on the last operation of the second time I set the rate.

After a bit of looking, I found this page, which suggests that one should send two bytes to the mouse, receiving an ACK after each one. So, I tried:
  • 0xD4 -> 0x0064
  • 0xF3 -> 0x0060
  • 0xFA <- 0x0060
  • 200 -> 0x0060
  • 0xFA <- 0x0060
When I try this, I again get a response of 0xFE on the last operation.

I then tried making both bytes into PS/2 controller commands. This doesn't quite make sense to me since PS/2 controller command 200=0xC8 isn't anything, but perhaps it's better to interpret it as a single command split into two pieces?:
  • 0xD4 -> 0x0064
  • 0xF3 -> 0x0060
  • 0xFA <- 0x0060
  • 0xD4 -> 0x0064
  • 200 -> 0x0060
  • 0xFA <- 0x0060
When I tried this, it appears to work (i.e. nothing erroneous happens; I have yet to discover whether it actually does change the sampling rate.

So my question: is this last way that I stumbled on really correct?

Note: On VirtualBox, the changing of the sampling rates in the final way doesn't change the device ID of the mouse. I'm not sure whether that's to be expected on VB. I haven't tested it elsewhere.
Note: The PS/2 controller was thoroughly initialized by the method suggested here

Thanks,