Esempio n. 1
0
        /// <summary>
        /// This is the required call to start
        /// the mouse receiving interrupts.
        /// </summary>
        public override void Initialize()
        {
            SendCommand(Command.Reset);
            mPS2Controller.WaitForDeviceReset();

            if (mMouseID == 0)
            {
                mMouseID = TryToEnableScrollWheel();

                mDebugger.SendInternal("(PS/2 Mouse) Mouse ID: " + mMouseID);

                if (mMouseID == 3)
                {
                    mMouseID = TryToEnableAdditionalButtons();
                }

                mDebugger.SendInternal("(PS/2 Mouse) Mouse ID: " + mMouseID);
            }

            //SendCommand(Command.SetDefaults);
            //mPS2Controller.WaitForAck();

            INTs.SetIrqHandler(12, HandleMouse);

            SendCommand(Command.EnablePacketStreaming);
            mPS2Controller.WaitForAck();
        }
Esempio n. 2
0
        private void SendCommand(Command aCommand, byte?aByte = null)
        {
            mDebugger.SendInternal("(PS/2 Keyboard) Sending command:");
            mDebugger.SendInternal("Command:");
            mDebugger.SendInternal((byte)aCommand);

            if (PS2Port == 2)
            {
                mPS2Controller.PrepareSecondPortWrite();
            }

            mPS2Controller.WaitToWrite();
            IO.Data.Byte = (byte)aCommand;

            mPS2Controller.WaitForAck();

            mDebugger.SendInternal("Command sent.");

            if (aByte.HasValue)
            {
                mDebugger.SendInternal("(PS/2 Keyboard) Sending byte after command:");
                mDebugger.SendInternal("Byte value:");
                mDebugger.SendInternal(aByte.Value);

                if (PS2Port == 2)
                {
                    mPS2Controller.PrepareSecondPortWrite();
                }

                mPS2Controller.WaitToWrite();
                IO.Data.Byte = aByte.Value;

                mPS2Controller.WaitForAck();
            }
        }