2 - Connection Types
DynaFlex Products| Three-way Secure Card Reader Authenticators | Programmer’s Manual (COMMANDS)
Page 18 of 158 (D998200383-19)
2.1.3 How to Send Command Requests Using the USB Connection
MMS communication between the host and the device consists of Messages, which are independent of
connection type and are documented in section 3. This section focuses specifically on how to use the
device’s USB HID connection to transmit a Command to the host by composing and sending a Request
Message, then listening for and interpreting the corresponding Response Message.
When the device is connected to the host via USB, the host sends one or more Output Reports to the
device to send the requests for commands, and listens / waits for the device to send one or more Input
Reports containing a response (see section 2.1.1). All reports use Usage Page 0xFF00, Usage ID 0x20,
and no Report ID (which some platform libraries present to the calling software as Report ID 0x00).
The host may send Output Reports by using either the default Control pipe or the Interrupt OUT pipe
using a blocking call to the platform’s USB libraries. The device ACKs all Output Reports immediately.
Upon detecting the ACK for the last Output Report in the message stream, the host software can
immediately begin listening for one or more follow-up Input Reports containing the device’s response.
Some messages defined in section 3 may exceed the maximum packet length allowed by USB HID. For
this reason, MMS implements a packetizing scheme the host must use when it composes Output Reports
to send commands, and when it decomposes Input Reports to receive responses. The host should follow
this general sequence to send a request and receive a response:
1) Choose the command to invoke from section 6 Command Definitions.
2) Construct the command request message using the Request table in the command documentation.
For a deeper explanation of the contents of request tables, see section 3 Messages (Requests,
Responses, Notifications, and Files).
3) Determine the complete length of the command request message.
4) Examine the device’s Report Descriptor to determine what payload length the device expects for an
Output Report (operating system libraries may refer to this length as the “Report Length” or “Report
Count”). MMS devices using USB HID generally use a payload length of 64 bytes.
a) If the message length fits the Single Packet payload length of 62 bytes, wrap the message in the
Single Packet format shown in Table 2-1.
b) If the message length does not fit the Single Packet payload length, wrap the message in the
format of a single Multi-Packet Head, followed by zero or more Multi-Packet Middles as
necessary, followed by one Multi-Packet Tail, as shown in Table 2-2, Table 2-3, and Table 2-4.
If necessary, the host can cancel in the middle of a Multi-Packet message using the Multi-Packet
Cancel packet shown in Table 2-5.
5) For each packet, send an Output Report to the device, and wait for the device to ACK the output
report USB packet. Upon ACK, either send the next packet in the sequence (if any), or begin
listening for an Input Report containing the device’s response message [see section 2.1.4 How to
Receive Data Using the USB Connection (HID Only)]. If an ACK does not arrive, time out and
assume the command needs to be started again.
6) Strip wrappers off the device’s response in exactly the same way you constructed the command
(using either Single Packet format or Multi-Packet format), and recompose the response message. Be
sure to assemble the packets in the correct order using Packet Number, and to truncate the padding
based on Message Length or Remaining Message Length.
7) Parse the final response message using the Response table in the documentation for the command.