Hi,

I've created a keyboard driver in asm that interacts directly with IO ports 60h and 64h. It works fine with a PS\2 keyboard.

Although every manual states that USB keyboards work by emulation of a PS\2 like behaviour in order for the processor to be able to interact with it, my routine doesn't even detect any keystroke when using the USB keyboard (nothing happens at port 64h, nor port 60h). Does someone have an idea? I have to make it work..

Thanks for your help.

Nico.
Posted on 2004-11-22 04:58:53 by vandenab
The new wave of PCs are USB only. Software Developers are discouraged from programming at the hardware level.

Can you re-code using a keyboard hook?

Regards, P1 8)
Posted on 2004-11-22 15:19:15 by Pone
In order to use an USB device --> you need an USB driver.

The PS/2 driver will not do. There are some BIOSes that do such translation IF enabled in Setup... but I am uncertain if this will still work in 32 bit protected mode.
Posted on 2004-11-22 17:59:32 by BogdanOntanu
Hi,

I've created a keyboard driver in asm that interacts directly with IO ports 60h and 64h. It works fine with a PS\2 keyboard.

Although every manual states that USB keyboards work by emulation of a PS\2 like behaviour in order for the processor to be able to interact with it, my routine doesn't even detect any keystroke when using the USB keyboard (nothing happens at port 64h, nor port 60h). Does someone have an idea? I have to make it work..

Thanks for your help.

Nico.


I wrote the USB legacy code in the Dell BIOS, so I have a very firm grasp how it works.

Are you trying to do it under an OS that has support for USB such as Windows XP? If so Windows disables the BIOS USB emulation before fully booting to the OS. If you have Windows XP you will have to write your own USB driver code, which means you have to understand how USB works well enough to write a driver ( ewww).

If you are writing your own OS or using DOS, then USB emulation should work fine. Actually it will work fine under any OS without USB support. The OS won't even know USB emulation is running.




There are some BIOSes that do such translation IF enabled in Setup... but I am uncertain if this will still work in 32 bit protected mode.


It will work in 32-bit mode protected or any mode. USB is just a bunch of transactions in memory. You tell the USB controller where in memory the transactions are.
Posted on 2004-11-22 21:33:42 by mark_larson
Thanks Mark,

I'm happy you came accross my message. For the moment, I'm working on Win2K, which demands pretty much the same things as WinXP if I'm not mistaken.

My application will have to run on Win95, Win98, WinMe, Win2K and WinXP.

I've already gone through all USB spec's to try to find an approach to touch the hardware level, but in vain. It's only then that I found out about PS\2 emulation, in the spec's of OHCI and UHCI. So what you are saying is that this emulation only qualifies in the boot process, and is deactivated afterwards? What about Win95-98-Me?

That doesn't facilitate my work. Do you think, if I write a USB driver, it would be possible to come really close to the hardware level? I'm doing research work on hardware security.. Can't tell you much more because of NDA.

Thanks again for your help.

Nico.
Posted on 2004-11-23 05:09:53 by vandenab
To vandenab:

Yes, with a .SYS driver you should come as close to the hardware level as possible under Win2K or XP.

Please note that even so the OS deals with hardware before you do...and IF you make a layered filter driver... then there is always a possibility that another driver we be closer to the hardware that you are :P

IRQ's are virtualized by the Win2k/XP OS so i think you can not replace the basic OS USB keyboard and mouse drivers with your own without a reboot and/or an OS recompile....

You might have a chance if you hook the master IDT table (from your driver) but that will be error prone and probably will not work on ALL OS versions since OS will not be aware of your IDT changes and might just undo them at a later time.


To mark_larson:
So for my own SOLAR OS do you think that people should be able to use USB keyboards and mouse as if they are PS/2 if the BIOS emulation is activated at startup :-?

Do you have any additional information about how I should start doing an USB driver for my OS in 32bits protected mode?

Thank you for the info
Posted on 2004-11-23 07:11:51 by BogdanOntanu

To mark_larson:
So for my own SOLAR OS do you think that people should be able to use USB keyboards and mouse as if they are PS/2 if the BIOS emulation is activated at startup :-?

Do you have any additional information about how I should start doing an USB driver for my OS in 32bits protected mode?

Thank you for the info


Yes if BIOS UBS emulation is on people can use USB keyboard and mice under your Solar OS. That is by far the simplest method to handle USB. Although it is slower than adding USB support to the OS.

If you want to write your own code you need to look at the USB spec and the USB HID spec ( HID = human interface device). Keyboards and mice are both HIDs. Keep in mind you will probably have to support both UHCI and OHCI. Also Linux is open source so you can always look at their code, which runs in 32-bit protected mode.

You tell the USB controller a flat physical address where the transactions are, and it uses DMA to get them. So that is why it does not matter what mode the CPU is in.
Posted on 2004-11-28 08:46:16 by mark_larson