Keyboard Controller not working in Virtual PC?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
SOLeonOS
Posts: 4
Joined: Sat Mar 06, 2010 3:47 am
Location: Enschede, NL

Keyboard Controller not working in Virtual PC?

Post 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??
currently working on: Keyboard driver/interrupt, creating a filesystem, floppy disk driver

done: Video driver, timer interrupt, debugger interrupt , debugger memory (sending memory to the screen)
User avatar
osdnlo
Member
Member
Posts: 136
Joined: Thu Feb 25, 2010 5:39 pm

Re: Keyboard Controller not working in Virtual PC?

Post by osdnlo »

Hi. I can tell you that VPC emulates the PS/2 controller just fine.
Yes, I see that you have proven it, but my question was, 'How did you know that would work?'.
User avatar
Andr3w
Member
Member
Posts: 76
Joined: Tue Jun 09, 2009 4:09 am
Location: Somewhere

Re: Keyboard Controller not working in Virtual PC?

Post 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..
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re: Keyboard Controller not working in Virtual PC?

Post 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
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
User avatar
SOLeonOS
Posts: 4
Joined: Sat Mar 06, 2010 3:47 am
Location: Enschede, NL

Re: Keyboard Controller not working in Virtual PC?

Post 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
currently working on: Keyboard driver/interrupt, creating a filesystem, floppy disk driver

done: Video driver, timer interrupt, debugger interrupt , debugger memory (sending memory to the screen)
Post Reply