HID Firmware

The HID firmware acts as a USB HID Keyboard and a Vendor-Specific HID device. The device scans for new tags and types the UID (or UID+SAK or the specified block) of a found tag by using virtual keystrokes.

Device modes

RFID device can be in two modes: scanning and application controlled mode. The default mode (i.e. then device mode after POR) is selected via the device settings. Factory defaults set it to scanning mode.

HID Reports

This firmware has two reports

Custom HID commands

Custom HID commands are sent and received via HID report with ID 2. The report always consists of 63 bytes. The report ID is prepended to the data, therefore the full report length is 64 bytes. The first byte (after the ID one) is the command ID. Valid commands are listed below. The next bytes are command parameters. If the command parameters occupy less than 62 bytes, the remaining unused bytes are a padding and can have any arbitrary values that have no meaning.

The device answers with a report, where the first byte (after the report ID) is the command id (the same as the request), the next 4 bytes are the error code (32bit unsigned integer, little endian), and the following bytes are command specific. If the command parameters occupy less than 62 bytes, the remaining unused bytes are padding and can have any arbitrary values. If the error code is not zero, the following command-specific bytes cannot be trusted and must be regarded as meaningless.

The error code has the following bit fields:

The error code of 0 is OK (i.e. no error). ATTENTION: the data following the error code bytes is valid only if the error code is 0.

Command list:

Abberviations:

Several commands have one 1byte parameter (bValue), that controlls a device state or setting. It can be one of the following:

QUERY 0 query the current state/value
ON 1 enable
OFF 2 disable
SWITCH 3 switch state
DEFAULT 4 relinquish control to the firmware
----- other values treated as QUERY

Device Information

This command queries the firmware version of the device.

LED Control

Buzzer Control

Inventory Scan (all tags)

Enumerates all the tags currently visible by the reader. All the tags are reset after the scan.

One or mode IN reports will be sent by the device. Params:

Inventory Scan (the first tag)

Selects the first tag (according to the anti-collision procedure). The tag (if present) will be set as the current one and halted.

Inventory Scan (select the next tag)

Halts the currently selected tag (if any) and selects the next tag (if any) according to the anti-collision procedure. The new tag will be set as the current one and halted.

Check Tag Presence

Checks whether a tag with the specified UID is present. If the query succeeds, the tag will not be set as the current one. The tag will be halted.

Select Tag

The tag with the specified UID will be set as the current one and halted.

Get Current Tag Information

If no tag is selected as the current one, the Inventory Scan (the first tag) command will be executed first. If the current tag fails to respond, the next one will be selected and queried.

Recognized tag types

Read Data Block

A tag must be selected prior to executing this command (either by calling Inventory Scan (the first tag), Inventory Scan (select the next tag), Select Tag, or Tag Info ). The block number must be within the range supported by the tag.

Write Data Block

A tag must be selected prior to executing this command (either by calling Inventory Scan (the first tag), Inventory Scan (select the next tag), Select Tag, or Tag Info ). The block number must be within the range supported by the tag. Data size must be equal to the block size value returned by the tag info command.

Device Settings

The following commands change various device settings. The are executed regardless of the scanning mode. Individual commands change only in-RAM settings. In order to save the current settings to ROM, execute the Settings Write command.

Enable/Disable the LED

This command enables/disables the LED. This setting only affects whether the firmware switches the LED when a tag is detected/lost. Regardless of this setting, you can switch the LED on and off using LED Control command.

Enable/Disable the Buzzer

This command enables/disables the buzzer. This setting only affects whether the firmware switches the buzzer on when a tag is detected or not. Regardless of this setting, you can switch the buzzer on and off using BUZZ Control command.

RFID Receiver Gain

The recevier gain is measured in dBm. The valid range is [18;48]dBm. The default value is 33dBm.

The valid gain values are

If any other value is passed, it will be rounded (to the nearest available value greater than the one pased).

Tag Presence Query Frequency

When in scanning mode, the device queries the tag presence every N ms (default value: 1000ms). This command controls the query frequency (i.e. the interval N). Valid range is [250-65535] ms. Values smaller than the minimum one will be accepted and silently increased to fit in the range. Values greater then the aximum one will result in an error.

Mifare Authentication Key

Mifare Classic tags need an authentication key to be read/written. The following command sets the key (the key type and 6 bytes long key itself), which will be used to authenticate connected Mifare Classic tags. The default value is FF

UID in Uppercase/Lowercase (keyboard mode)

Append/Omit Carriage Return (keyboard mode)

deprecated since version 1.2

Append/Omit SAK (keyboard mode)

deprecated since version 1.2

Data selection (scanning mode)

deprecated since version 1.2

This setting controls data (UID or block) printed when a new tag is detected.

Block number selection (scanning mode)

deprecated since version 1.2

In scanning mode the device continuously scans whether an RFID tag is present and prints UID or the selected block. This setting controls the block number being printed:

If the block does not exist or cannot be read (ex. due to an authorization failure) nothing is printed.

Set output format

supported since version 1.2

In scanning mode the ontinuously scans whether an RFID tag is present and prints the data read from the discovered tag using the specified format.

Format string syntax:

The default mode (i.e. before the first occurrence of a, d, h, or H switch) is the hexadecimal one. The upper or lower case depends on the Uppercase/Lowercase settings (code 0x35).

Syntax:

Write settings to ROM

This command saves the current in-RAM setting to ROM, i.e. makes them permanent

Device Control

The following commands control the RFID reader device itself:

Enable/Disable RF Field

RFID Mode Control

Device Reboot

Reboot the device.

Firmware Update

Reboot the device and start the bootloader (this command may not be supported by some devices. If not supported, acts as Device Reboot ).

Other commands - RFU

*Params (IN) (4 bytes) error code 0x800 - Generic communication error.