> For the complete documentation index, see [llms.txt](https://developer.magtek.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.magtek.com/services/reader-management-services/linux-sample-code-manual/rms-scra-sample-code.md).

# RMS SCRA Sample Code

## Configuration Update

* Go to the folder: `rms_scra` and open a terminal.
* Connect the reader to a USB port.
* Enter command below. Enter password if prompted. This is for device port access.

```bash
$ sudo ./rms_scra_config_update
```

* A list of available configurations is returned. List depends on the firmware ID and RMS Profile. Example:

```
Device Serial Number:000F423536413943343130323432344141 Main Firmware ID:000D31303030303039323734613032
Response Code:200 ResultCode: 0 Result: Success
Configurations Available: 5
1: DataVariant
2: Mask6Zero4
3: EMVNotificationsBoth
4: Mask8Zero2Mod10
5: Mask8Asterisk4
Enter '1'...'5' to update configuration.
To force update configuration, enter '*' before the number ('*1'...'*5').
Enter '0' to exit:
```

* At the prompt, select a configuration by entering its number listed to its left. A sequence of commands are downloaded from RMS and sent to the reader. Status of the configuration is shown as updated or failed and the end of the sequence.

```
Selected Configuration 1 Configuration: DataVariant Sending command [0900]
Response: 000A9011880B56A9C4000001
Sending command [1900]
.
.
.
Done Changing to DataVariant
Configuration DataVariant has been updated.
```

* Whenever a configuration reports is up to date, it may be redone by entering `*N`, where N is the configuration. Example: `*1`

## EMV Tags/CAPKs Update

* Go to the folder: `rms_scra` and open a terminal.
* Connect the reader to a USB port.
* Enter command below. Enter password if prompted. This is for device port access.

```bash
$ sudo ./rms_scra_emvtags_capks_update
```

* The sample code downloads the sequence of commands to update the EMV Tags and CAPKs available for the reader. Example:

```
Device Response: 000D31303030303039323734613032 Main Firmware ID:000D31303030303039323734613032
Device Response: 001F423536413531313130323232344141009014500B56A5110000005344C35C6F UIK:001F423536413531313130323232344141009014500B56A5110000005344C35C6F
Get Terminal Config (0) Extended Command: 03060008010000FA03DFDF26 Extended Response: 000000180016FA820012DFDF260E4D414754454B2044454641554C54
Result Code: 0000
Value: 4D414754454B2044454641554C54
Value String: MAGTEK DEFAULT DB Name: MAGTEKDEFAULT
Get Terminal Config (1) Extended Command: 03060008010001FA03DFDF26 Extended Response: 03950000
Get Terminal Config (2) Extended Command: 03060008010002FA03DFDF26 Extended Response: 03950000
Get Terminal Config (3) Extended Command: 03060008010003FA03DFDF26 Extended Response: 03950000
Get Terminal Config (4) Extended Command: 03060008010004FA03DFDF26 Extended Response: 03950000
.
.
.
Done Loading MagTek Default Contact Tags and CAPK Configuration MAGTEKDEFAULT has been updated.
```

* Whenever a configuration result is: Configuration is up to date it may be redone by adding `-f` to force the update.

```bash
$ sudo ./rms_mms_emvtags_capks_update -f
```

## Firmware Update

* Go to the folder: `rms_scra` and open a terminal.
* Connect the reader to a USB port.
* Enter command below. Enter password if prompted. This is for device port access.

```bash
$ sudo ./rms_scra_firmware_update
```

* The parameters for the firmware update is as follows.

```
rms_scra_firmware_update TYPE
    TYPE (type of firmware): MAIN|BLE
```

* Example for updating MAIN firmware.

```
Firmware update is available.
New Firmware: Main_1000009274 version A02 firmware
.
.
.
Do you want to update the MAIN firmware? (y/N)
```

* A sequence of commands are downloaded from RMS and sent to the reader. Status of the update is shown as finished or failed and the end of the sequence.

```
Updating MAIN firmware...
Beginning mDynamo firmware Main 1000009274 version A02 firmware Updating firmware...
.
.
.
Sending command [94255A00044A6000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF FFFFFFFFF]
Response: 0000
Sending command [95015A] Response: 0000
Sending command [0200]
Response: 0000
Wait for 15000 ms... Done waiting.
Detecting device...
.
.
.
Device detected.
Sending command [970100]
Response: 0000
Finished mDynamo Firmware-1000009274-A02 Update MAIN Firmware update completed.
```

* Whenever a firmware result is: Firmware is up to date. It may be redone by adding `-f` to force the update.

```bash
$ sudo ./rms_scra_firmware_update MAIN -f
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://developer.magtek.com/services/reader-management-services/linux-sample-code-manual/rms-scra-sample-code.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
