USB or PS/2 for a keyboard emulator?
I was prompted to write this article for two reasons: Firstly because I
am often asked the question: "should I use USB or PS/2 for my I-PAC" and also
because there is some mis-information out there on certain sites which suggest
there is a performance problem with USB. Let's look at the performance issue
first. The idea that there is some problem with USB in this area is absurd. As
far as transmission "on the wire" is concerned, USB as used by keyboards is
about 50 times faster than the PS/2 interface. So is this speed increase of any
benefit? (it certainly is no disadvantage!) well, you woudn't really notice it
in normal usage. The PS/2 interface is perfectly adequate for most gaming use.
It is a very economical interface with virtually no overhead in terms of extra
data to support the protocol. Despite technically unsupported (it was
originally defined by IBM in the PS/2 technical reference manual but then
disowned by them in 1984) it has stood the test of time.
Some of the larger
manufacturers such as HP have deviated from the IBM standard and this has been
known to cause problems, but nothing which affects actual speed of operation
(most of the problems are start-up related).
In terms of speed there is
one area where USB really scores. This is with fighting games and "special
moves". These games have special actions which are triggered when 2 or more
switch closures happen at exactly the same time. Pressing and holding buttons
one after the other does not work, they have to be seen as being pressed
exactly together. USB scores here. This is because the way a batch of keycodes
is sent to the PC over USB is in one single "report". Although on the wire,
these are sent serially (at a very high speed) the way in which the report is
built up in the encoder and received by the PC as one "unit" means that for
this purpose the interface can be considered as a pseudo-parallel interface,
just as a real game board would have a parallel control interface.
There is another factor to consider with USB. One of the principles of USB is
that the device tells the host (the PC) how to communicate with it. There is a
USB parameter called "poll rate". Put simply, this is a factor which informs
Windows how much attention it needs to pay to the device. The device can ramp
up this figure as, for gameplay we clearly want to take more notice of the
keyboard than, for example, typing a letter.
Another USB issue which is
the subject of misinformation is the number of simultaneously-pressed keys
which can be recognised. There is one very important fact to understand here:
This is a function of the device not of USB nor Windows. As I
mentioned above, the device can tell the PC exactly what kind of data it is
going to send. So if the device wants to send 92 simultaneously pressed keys,
provided the host is aware of this there is no problem. Windows just has to
deal with it, beacuse that's the wonder of USB, the device is king and Windows
must toe the line!
What about connecting multiple devices such as USB
hard drives to the same bus as a keyboard device? No problem at all. There are
three types of transfer available in USB. One of them, known as an "interrupt
transfer" can override and stop anything else going on. If a disk (disks use
Bulk Transfers) is busy at the time, it just can damn well wait until the
interrupt transfer has finished! No prizes for guessing which type of transfer
that USB keyboard devices use!
So you may now be wondering (I hope!)
why these USB "performance issues" rumours arose? Well I have a possible
explanation. The answer lies in DOS and BIOS support for USB. All PCs have a
level of BIOS support for USB keyboards and mice. This is primarily to enable
the CMOS configuration screens and other boot screens to be accessed if a USB
keyboard is being used. The BIOS implementation of USB is extremely basic and
is also, yes you guessed it, slow! So USB should not be used in DOS. This also
has a remote bearing on Windows 98. If a Windows 98 PC has a broken USB
controller, for whatever reason, be it hardware or missing driver files
(indicated by a yellow exclamation mark in Device Manager), then Windows 98
does not completely give up on USB keyboards. (all other USB devices will stop
working though!) It actually tries to carry on using the keyboard by going into
what's known as "port 60-64 emulation mode" which is basically DOS USB support.
So we are back to BIOS again, as I just mentioned.
In later Windows versions
such as XP, in this situation all the USB devices simply stop working, but 98
tries to soldier on regardless if a USB controller problem exists. This can
certainly produce a false indication of a performance problem, but the problem
is not USB itself, nor the USB device. It's a basic Windows install error or a
hardware problem, and would prevent any other USB devices from working at
all.
To summarize, there is absolutely no chance of ever having
any performance problem with USB in Windows 2000 or XP. In Windows 98 an
potential problem can only arise if there is some major failure with the USB
controller. In fact USB produces a performance advantage.
Assuming we
have killed off any so-called "performance issues" what about the benefits of
USB? Well apart from performance, as already covered, there are:
No
need to disturb existing PS/2 keyboard connectivity.
Ability to
hot-plug.
Ability to connect as many devices as required
Longer max cable
length (using a hub if required)
Future-proof. Note I mention this last.
Mark Twain said "rumours of my death are greatly exaggerated" and this could
apply to the PS/2 interface. USB was supposed to kill off the PS/2 interface
when it first came out but it's only in the last few months (weeks) that tiny
motherboards are appearing without PS/2 and I would expect it do be around for
many years yet!
Why you can't use a third-party PS/2 to USB adaptor:
The I-PAC is a native USB device which auto-detects the interface (USB or PS/2) and invokes a completely different
firmware module in the chip accordingly.
Some converters are made by companies such as Belkin, which have chips which convert PS/2 into USB.
These cannot be used. To understand why, we have to realize that the way in which keystrokes are sent
via PS/2 is different to USB. PS/2 protocol sends "Key Down" and "Key Up" commands. In USB, the
data sent to the PC is a description of all keys which are pressed at the time.
For this reason, the designers of these converters are faced with a problem of potential
"stuck keys" in USB, beacuse many PS/2 keyboards intermittently fail to send all of the "key up" commands.
A missing "key up" will cause a stuck key in USB which will repeat forever and completely mess
up the PC. So what the converters do is cancel all pressed keys from the USB packet every 5 seconds or so, just
in case any "key up" commands were missed. So if you are holding the joystick in one
direction, the movement will stop after a few seconds.
Also, the USB converters suffer from the same 6-key-pressed limit of standard USB keyboards, whic
the I-PAC, in USB mode, does not suffer from.