9
Key Number Mode Examples
Generation of keystrokes on the target computer is done through
the sending of special one byte codes to the USBtoUSB Com Port
when in the Key Number Mode.
Each standard key of the computer keyboard is assigned a “make”
code to emulate the press of a key, and a “break” code, which
results in the release of the key. The Key Number Table on page
7 lists each of the supported keys and their corresponding make
and break codes.
From the keycode table, the value of
2
(0x02) can be sent to the
Com Port on the unit to generate the “make” or press and hold
of the “1” key on the target computer. Sending a byte to the
USBtoUSB Com Port with a value of
130
(0x82) will result in the
release of the “1” key on the target computer.
Important:
For any key that has been previously sent a “make”
code, a “break” code of that key must be sent at a later time.
Failure to send the corresponding break code will leave the key
in the down state on the target computer, which may result in
unintended keystrokes when new actions are sent. The last key
left in the make state without a break will generally repeat until
the break code is sent. Never command more than 60 keys in
the “make” state at the same time as this will exceed the standard
USB protocol keyboard buffer length for the USBtoUSB device.
The use of make and break codes allows the user to create virtu-
ally any keystroke combination. For example, if a sequence of
CTRL+ALT+F1 was needed, the following decimal codes would
be sent;
58
(Make L Ctrl),
60
(Make L Alt),
112
(Make F1),
240
(Break F1),
188
(Break L Alt),
186
(Break L Ctrl). Note that the
values shown in the example are the decimal values of a single
byte to be sent for each of the key actions for make and break.
Producing Mouse Action on the Target PC
The USBtoUSB is capable of controlling the mouse cursor and mouse
button states of the target computer through a special six byte command
sequence. This same command sequence sent to the Com Port of the
USBtoUSB can be used in any of the operating modes.
The six byte mouse control sequence is construced as follows:
Byte#1 Byte#2 Byte#3 Byte#4 Byte#5 Byte#6
[Start] [X PosMS] [X PosLS] [Y PosMS] [Y PosLS] [Scroll/Buttons]
Byte #1 - Always a 0x00 value, indicates start of packet.
Byte #2 & #3 - A two byte value which dictates the X axis position
of the mouse cursor on the screen. A value of 0 will send the
cursor to the leftmost screen position. Byte #2 is the Most
Siginificant (MS) byte of the X position value, and Byte #3 is the
Least Significant (LS) part of the X position value.
Byte #4 & #5 - A two byte value which dicatates the Y axis position
of the mouse cursor on the screen. A value of 0 will send the
cursor to the top of the screen. Byte #4 is the MS byte of the Y
position value, and Byte #5 is the LS part of the Y position value.
Byte #6 - Byte for Scroll Wheel movement and mouse button
control. The upper 4 bits of this byte contain a signed value for
scroll wheel movement, while the lower 3 bits command the mouse
Left, Right, and Middle button activation and deactivation.
This Byte #6 is constructed as shown,
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
[Ws] [W2] [W1] [W0] [1] [MM] [MR] [ML]
[Ws] - The sign of the scroll wheel movement. A zero in this bit
commands up movement on the scroll wheel, a one in this bit
produces down scroll wheel movement. Movement magnitude
based on the signed value in Ws through W0 values.
10