Page 1 of 1

Keyboard Controller not working in Virtual PC?

Posted: Sat Mar 06, 2010 4:12 am
by SOLeonOS
Hi,

I've been trying to send some keyboard commands to the controller using virtual pc, but it doesn't seem to issue the commands i send.

I have a few functions that can be considered relevant:

Code: Select all

interrupt09:
	cli
	push ax
	push di
	push ds
	mov ax, 0x0700
	mov ds, ax
	in al, 0x60
	mov di, [ds:0x0002]
	shl di, 0x0002
	add di, 0x0E60
	call printhexbyte
	inc word [ds:0x0002]
	mov al, 0x20
	out 0x20, al
	pop ds
	pop di
	pop ax
	sti
	iret
and:

Code: Select all

kbd_update_leds:
.wait1:
	in al, 0x64
	and al, 0b00000010
	jnz .wait1
	mov al, 0xED
	out 0x60, al
.wait2:
	in al, 0x64
	and al, 0b00000010
	jnz .wait2
	mov al, 0x07
	out 0x60, al

	ret
The command to set the leds on the keyboard does work. (0xED)
- It sends two times FA (ack) to the screen
- It puts the leds on

The command to set the scancode set doesn't work! (0xF0)
- It sends two times FA (ack) to the screen
- It doesn't change anything
- When second command 0x00 is issued, there is no return code (it should return the scancodeset at the time)

Is this just me doing something stupid, or is the virtual PC controller not emulating a real controller properly??

Re: Keyboard Controller not working in Virtual PC?

Posted: Sat Mar 06, 2010 5:47 am
by osdnlo
Hi. I can tell you that VPC emulates the PS/2 controller just fine.

Re: Keyboard Controller not working in Virtual PC?

Posted: Sat Mar 06, 2010 10:07 am
by Andr3w
Well.. I hope your keyboard interrupt is called by IRQ generated, not by your kernel? Check if your IDT and ISR are fine..

Re: Keyboard Controller not working in Virtual PC?

Posted: Sat Mar 06, 2010 10:36 am
by Brendan
Hi,
SOLeonOS wrote:The command to set the scancode set doesn't work! (0xF0)
- It sends two times FA (ack) to the screen
- It doesn't change anything
- When second command 0x00 is issued, there is no return code (it should return the scancodeset at the time)
I'm not too sure about VirtualPC, but on real hardware lots of keyboards don't support anything except scancode set 2 (which is translated into scancode set 1 by the PS/2 controller).


Cheers,

Brendan

Re: Keyboard Controller not working in Virtual PC?

Posted: Sat Mar 06, 2010 2:56 pm
by SOLeonOS
Thanks for your replies,

It was just me being stupid.
I found a way to avoid using the 0xF0 command.

After a long search i found out about the command register at the keyboard controller,
i just had to disable the translation via the command byte and everything works fine now.
Finally making some progress in my keyhandler. :D

Thanks