Commands, Command number, Data length – MagTek P-SERIES USB User Manual
Page 40: Data

P-Series USB Insertion Reader
32
COMMANDS
Command requests and responses are sent to and received from the device using feature reports.
Command requests are sent to the device using the HID class specific request Set_Report. The
response to a command is retrieved from the device using the HID class specific request
Get_Report. These requests are sent over the default control pipe. When a command request is
sent, the device will Nak the Status stage of the Set_Report request until the command is
completed. This insures that as soon as the Set_Report request is completed, the Get_Report
request can be sent to get the command response. The usage ID for the command message was
shown previously in the Usage Table.
The following table shows how the feature report is structured for command requests:
Offset
Field Name
0
Command Number
1
Data Length
2 – 23
Data
The following table shows how the feature report is structured for command responses.
Offset
Field Name
0
Result Code
1
Data Length
2 – 23
Data
COMMAND NUMBER
This one-byte field contains the value of the requested command number. The following table
lists all the existing commands.
Value
Command Number
Description
0
GET_PROPERTY
Gets a property from the device
1
SET_PROPERTY
Sets a property in the device
2
RESET_DEVICE
Resets the device
3
GET_KEYMAP_ITEM
Gets a key map item
4
SET_KEYMAP_ITEM
Sets a key map item
5
SAVE_CUSTOM_KEYMAP
Saves the custom key map
DATA LENGTH
This one-byte field contains the length of the valid data contained in the Data field.
DATA
This multi-byte field contains command data if any. Note that the length of this field is fixed at
22 bytes. Valid data should be placed in the field starting at offset 2. Any remaining data after
the valid data should be set to zero. This entire field must always be set even if there is no valid
data. The HID specification requires that Reports be fixed in length. Command data may vary
in length. Therefore, the Report should be filled with zeros after the valid data.