How to Build a Smart Card Testing Application
← Back to the smart card SDK and developer centre
How do you build a smart card testing application? Build it in four parts: a PC/SC layer that finds readers and watches cards, a command whitelist that lets the tool send only a fixed set of read-only commands, a user interface that shows reader and card status, and a result log that can be exported as a test report. The tool reads the reader list, the ATR, the card UID and the reader's firmware version. It never writes to a card, loads keys or changes reader settings unless someone deliberately builds a separate tool for that.
This page is the design guide: requirements, architecture, safe-command rules, a test-case table for ACS readers and cards, and how to package and install the finished tool. It does not repeat the code from our C# series. It points to the parts you reuse: the PC/SC layer from the C# tutorial, reader detection, UID reading and the .NET Windows Forms reader application, which already has the threading, the log and CSV export. The only new code here is a short command-whitelist class. BSD Infotech is an independent ACS supplier and integrator, not the manufacturer.
Not yet tested by BSD on a reader. The whitelist class below compiles (C# 14, .NET 10, 0 warnings, 0 errors, built by BSD on 1 Dec 2026). The test-case table lists the results expected from ACS's manuals, not BSD results. We will add our own results after testing on our ACS readers.
Requirements: What a Reader Test Tool Must Do
A test tool answers one question for a technician or support person: is the reader, its driver and Windows working, and can the reader see this card? It is not a card-programming tool. Write the requirements down before any code, because they decide what the tool is not allowed to do as much as what it does.
| Requirement | How the tool does it | Where the code already is |
|---|---|---|
| Detect readers, including plug and unplug while the tool runs | SCardListReaders, then SCardGetStatusChange on the readers plus the \\?PnP?\Notification entry | Detect an ACS reader in C# |
| Show status: Smart Card service, reader present, card present, card mute, card in use | Reader state flags (EMPTY, PRESENT, MUTE, INUSE, UNAVAILABLE) and the service error codes | PC/SC reader states, service stop and restart |
| Read the ATR | Windows already has it in the reader state or SCardStatus. No command is sent. | Parse an ATR |
| Read the UID of a contactless card | Get Data FF CA 00 00 00 on the PICC (contactless) interface only | Read a card UID in C# |
| Read the firmware version | The model's documented Get Firmware Version command (see the whitelist) | Firmware command per reader |
| Log results with time, reader, card, command and result | One record per test step, kept in memory and shown in a grid | Scan log in the .NET app |
| Export a report to send to support | CSV (RFC 4180, UTF-8) plus a short header: PC name, Windows version, tool version, date | CSV export |
Non-requirements (write them down too): no card writes, no key loading or authentication, no reader configuration changes (LED, buzzer, polling, keyboard mode), no free-typed APDU box, no network access, and no installation of drivers by the tool itself. Each of these is explained in safe-command design.
Architecture: Four Layers
Keep each layer in its own files so that the PC/SC code can be reused and the safety rules sit in one place that is easy to review:
+--------------------------------------------------------------+
| UI (UI thread) |
| reader list + status colours, card panel (ATR, UID, type), |
| "Run tests" button, result grid, "Export report" |
+----------------------------^---------------------------------+
| Progress<T> (post, never block)
+----------------------------+---------------------------------+
| Test runner (reader thread, owns its PC/SC context) |
| waits for readers/cards, runs the test plan per reader |
| writes one ResultRecord per step -> result log |
+----------------------------+---------------------------------+
| SafeCommand ids only, never bytes
+----------------------------v---------------------------------+
| Command whitelist (SafeCommands.cs) |
| fixed read-only commands, exact byte match, per-model list |
+----------------------------+---------------------------------+
|
+----------------------------v---------------------------------+
| PC/SC layer (WinScard.cs + Pcsc.cs from the C# tutorial) |
| SCardEstablishContext, ListReaders, GetStatusChange, |
| Connect, Status, Transmit (+ SCardControl for escapes) |
+----------------------------+---------------------------------+
v
winscard.dll -> Smart Card service -> ACS driver -> reader
1. PC/SC layer (reused)
Use the two shared files from the C# PC/SC tutorial unchanged: WinScard.cs (the P/Invoke declarations) and Pcsc.cs (a small disposable context, connection and error layer). They already handle the details a test tool must get right: error codes, disconnecting with SCARD_LEAVE_CARD so other programs' sessions are not reset, and cancelling a wait with SCardCancel. The how-and-why of the layers below your code is in PC/SC architecture explained.
2. Command whitelist (new)
The only place that knows command bytes. The test runner asks for a command by name (an enum value), and the whitelist sends the fixed bytes for it. There is no method that takes bytes from the UI, a file or the command line, so nothing outside the whitelist can make the tool send a write. The C# class is below.
3. Test runner and UI (reused pattern)
Copy the threading design of our .NET NFC reader application: one background thread owns the PC/SC context and does all waiting and card I/O; the window only displays what it is told through Progress<T>. The test tool replaces that app's "read the UID on each tap" step with "run the test plan for this reader". Show each reader as a row with a status colour (no service, no reader, ready, card present, error), so a technician sees the problem without reading text.
4. Result log and report
Every step produces one record, pass or fail, and failures keep the PC/SC error name or status word. A support person learns more from SCARD_W_REMOVED_CARD or 63 00 than from "failed". Details in log and report.
Safe-Command Design: Why a Test Tool Must Never Write by Default
A test tool is run by people who are diagnosing a problem, often on a customer's live cards and on a PC they do not know. Anything the tool sends must be harmless if it is sent to the wrong card, on the wrong reader, a hundred times. That rules out three groups of commands:
- Writes to card memory. One wrong block on a MIFARE Classic card can overwrite a sector trailer, and wrong access bits lock that sector for good (see changing MIFARE keys). On SLE4442 and SLE4428 memory cards, every wrong security-code presentation uses up a try from the card's error counter (see the SLE test plan).
- Key loading and authentication. Keys typed into a test tool end up in logs, screenshots and support e-mails, and a reader test does not need keys at all.
- Reader configuration (polling settings, LED and buzzer behaviour, keyboard emulation). A changed setting outlives the test and can make the reader behave differently in the customer's application afterwards.
Two more rules follow. No free-typed APDU box in a tool that is handed to users: a hex input field turns a read-only tool into a write tool for anyone who pastes the wrong line from a forum. Developers who need to send any APDU should use a developer tool on purpose, such as the ACS Script Tool or the ACS Web APDU Tool. And never recover or guess keys: a test tool that cannot read a card's data because the keys are not the factory ones should say so and stop.
The whitelist for ACS readers
| Test | Command (hex) | How it is sent | Readers | Card needed? |
|---|---|---|---|---|
| Read ATR | none | Reader state or SCardStatus | All | Yes |
| Get UID | FF CA 00 00 00 | SCardTransmit, PICC interface only | Contactless readers: ACR1252U, ACR1552U, ACR122U | Yes (contactless) |
| Get firmware version | E0 00 00 18 00 | SCardControl, code SCARD_CTL_CODE(3500), direct connection | ACR1252U, ACR1552U | No |
| Get firmware version | FF 00 48 00 00 | SCardTransmit with a card connected | ACR122U | Yes, in this design |
The firmware commands and their replies come from the ACS manuals; our firmware version guide explains how to decode them. The ACR39U contact reader gets the ATR test only in this design: contact cards have no anti-collision UID (see why contact cards have no UID). Matching the reader by name follows the rules in recognising ACS readers by name: an ACR1252U also lists a SAM entry, and that entry gets the ATR test only.
Adding a command to the whitelist should be a code change that someone reviews, not a setting a user can change.
The Command Whitelist in C# (.NET 10)
Language: C# 14 on .NET 10, Windows only. Prerequisites: a .NET 10 console or Windows Forms project with WinScard.cs and Pcsc.cs from the C# PC/SC tutorial (unchanged); an ACS reader with the ACS driver installed for a real run.
SafeCommands.cs holds the four commands, an exact-match check, the per-reader command list and a runner that only accepts a SafeCommand value. The escape route opens its own short direct connection, like the firmware C# example, so it works with no card on the reader and never disturbs the test runner's card connection.
Compiled by BSD; not yet tested on a reader. Built for net10.0 on 1 Dec 2026 with the .NET 10 SDK: 0 warnings, 0 errors, warnings treated as errors, together with the tutorial's WinScard.cs and Pcsc.cs. Run once on a Windows 11 PC with no ACS reader: the self-check passed and the only reader, a Windows Hello virtual smart card, got the ATR test only. It has not been run with an ACS reader yet.
// SafeCommands.cs: the command whitelist of a read-only reader test tool. C# 14, .NET 10, Windows only.
// Needs WinScard.cs and Pcsc.cs from the BSD C# PC/SC tutorial. Compiled by BSD; not yet tested on a reader.
// The tool can send only the commands listed here, byte for byte. No method accepts command bytes from outside.
using System.Runtime.InteropServices;
using System.Text;
using System.Text.RegularExpressions;
using Bsd.Pcsc;
namespace Bsd.ReaderTest;
/// <summary>Every command the test tool knows. There is no "custom" entry on purpose.</summary>
public enum SafeCommand { ReadAtr, GetUid, FirmwareEscape, FirmwarePseudoApdu }
/// <summary>How a command reaches the reader: none (Windows already has the data), SCardTransmit or SCardControl.</summary>
public enum Route { NoCommand, Transmit, Escape }
public sealed record CommandInfo(SafeCommand Id, string Name, Route Route, byte[] Bytes, string Source)
{
public string Hex => Bytes.Length == 0 ? "(no command)" : Apdu.HexSpaced(Bytes);
}
public static partial class CommandWhitelist
{
// Read-only commands only: nothing here writes, loads a key, authenticates or changes a reader setting.
private static readonly CommandInfo[] Commands =
[
new(SafeCommand.ReadAtr, "Read ATR", Route.NoCommand, [],
"SCardStatus / reader state; the card is not sent anything"),
new(SafeCommand.GetUid, "Get UID", Route.Transmit, [0xFF, 0xCA, 0x00, 0x00, 0x00],
"PC/SC Part 3 Get Data (contactless cards)"),
new(SafeCommand.FirmwareEscape, "Get firmware version", Route.Escape, [0xE0, 0x00, 0x00, 0x18, 0x00],
"ACR1252U API manual v1.17 s5.4.1; ACR1552U reference manual v1.09 s6.2.1"),
new(SafeCommand.FirmwarePseudoApdu, "Get firmware version", Route.Transmit, [0xFF, 0x00, 0x48, 0x00, 0x00],
"ACR122U API manual v2.04 s6.3"),
];
public static IReadOnlyList<CommandInfo> All => Commands;
public static CommandInfo Get(SafeCommand id) =>
Array.Find(Commands, c => c.Id == id) ?? throw new ArgumentOutOfRangeException(nameof(id));
/// <summary>True only for an exact copy of a listed command on its own route.</summary>
public static bool IsAllowed(Route route, ReadOnlySpan<byte> bytes)
{
if (route == Route.NoCommand) return false;
foreach (var c in Commands)
if (c.Route == route && bytes.SequenceEqual(c.Bytes)) return true;
return false;
}
/// <summary>The commands to offer for one PC/SC reader entry, chosen from its name.
/// Unknown readers get the ATR only, plus Get UID on a contactless (PICC) entry.</summary>
public static IReadOnlyList<SafeCommand> ForReader(string readerName)
{
bool picc = readerName.Contains("PICC", StringComparison.OrdinalIgnoreCase);
var list = new List<SafeCommand> { SafeCommand.ReadAtr };
if (Acr1252Or1552().IsMatch(readerName))
{
if (picc) list.AddRange([SafeCommand.GetUid, SafeCommand.FirmwareEscape]); // SAM entry: ATR only
}
else if (Acr122().IsMatch(readerName))
{
list.AddRange([SafeCommand.GetUid, SafeCommand.FirmwarePseudoApdu]);
}
else if (picc)
{
list.Add(SafeCommand.GetUid);
}
return list;
}
[GeneratedRegex(@"\bACR(1252|1552)U?\b", RegexOptions.IgnoreCase)]
private static partial Regex Acr1252Or1552();
// Matches "ACR122" and "ACR122U" but not "ACR1222L".
[GeneratedRegex(@"\bACR122U?\b", RegexOptions.IgnoreCase)]
private static partial Regex Acr122();
}
/// <summary>Sends whitelisted commands only. Callers pass a SafeCommand, never bytes.</summary>
public static class SafeRunner
{
/// <summary>SCARD_CTL_CODE(3500), written as in the ACS manuals.</summary>
public const uint AcsEscape = 0x310000 + 3500 * 4;
/// <summary>Sends a Transmit-route command to the card connection (a card must be present).</summary>
public static byte[] Transmit(CardConnection card, SafeCommand id)
{
var c = CommandWhitelist.Get(id);
if (c.Route != Route.Transmit) throw new InvalidOperationException($"{c.Name} is not sent with SCardTransmit.");
byte[] bytes = (byte[])c.Bytes.Clone();
if (!CommandWhitelist.IsAllowed(Route.Transmit, bytes)) throw new InvalidOperationException("Command not on the whitelist.");
return card.Transmit(bytes);
}
/// <summary>Sends an Escape-route command with SCardControl over a direct connection (no card needed).
/// Uses its own short-lived context, so it never disturbs the caller's card connection.</summary>
public static byte[] Escape(string reader, SafeCommand id)
{
var c = CommandWhitelist.Get(id);
if (c.Route != Route.Escape) throw new InvalidOperationException($"{c.Name} is not an escape command.");
byte[] bytes = (byte[])c.Bytes.Clone();
if (!CommandWhitelist.IsAllowed(Route.Escape, bytes)) throw new InvalidOperationException("Command not on the whitelist.");
int rc = WinScard.SCardEstablishContext(WinScard.SCARD_SCOPE_USER, IntPtr.Zero, IntPtr.Zero, out IntPtr context);
if (rc != WinScard.SCARD_S_SUCCESS) throw new PcscException("SCardEstablishContext", rc);
try
{
rc = WinScard.SCardConnect(context, reader, WinScard.SCARD_SHARE_DIRECT,
WinScard.SCARD_PROTOCOL_T0 | WinScard.SCARD_PROTOCOL_T1, out IntPtr handle, out _);
if (rc != WinScard.SCARD_S_SUCCESS) throw new PcscException("SCardConnect (direct)", rc);
try
{
var reply = new byte[262];
rc = NativeControl.SCardControl(handle, AcsEscape, bytes, (uint)bytes.Length, reply, (uint)reply.Length, out uint n);
if (rc != WinScard.SCARD_S_SUCCESS) throw new PcscException("SCardControl", rc);
return reply[..(int)n];
}
finally { WinScard.SCardDisconnect(handle, WinScard.SCARD_LEAVE_CARD); }
}
finally { WinScard.SCardReleaseContext(context); }
}
/// <summary>The version text from a firmware reply, or null when the reply is not in the documented form.</summary>
public static string? FirmwareText(SafeCommand id, byte[] reply)
{
if (id == SafeCommand.FirmwareEscape)
{
// Documented reply: E1 00 00 00, one length byte, then ASCII text.
if (reply.Length < 5 || reply[0] != 0xE1 || reply[1] != 0 || reply[2] != 0 || reply[3] != 0) return null;
return Encoding.ASCII.GetString(reply, 5, Math.Min(reply[4], reply.Length - 5));
}
if (id == SafeCommand.FirmwarePseudoApdu)
{
// Documented reply: version text only. Drop a 90 00 if a driver adds one.
byte[] text = Apdu.IsSuccess(reply) ? Apdu.Data(reply) : reply;
return text.Length > 0 && Array.TrueForAll(text, b => b is >= 0x20 and < 0x7F) ? Encoding.ASCII.GetString(text) : null;
}
return null;
}
}
internal static class NativeControl
{
[DllImport("winscard.dll")]
public static extern int SCardControl(IntPtr card, uint controlCode, byte[] inBuffer, uint inLength,
byte[] outBuffer, uint outLength, out uint bytesReturned);
}
A console test run that uses it
Program.cs first proves the gate: it asks the whitelist about a write, a read-binary and a padded Get UID, and stops with exit code 4 if any is accepted. It then runs every allowed test on every reader (or on readers whose name contains the first argument) and prints one tab-separated result line per test. In a Windows Forms tool the same loop runs on the reader thread of the .NET reader application.
// Day 51: a read-only reader test run built on the command whitelist. C# 14, .NET 10, Windows only.
// Needs SafeCommands.cs, WinScard.cs and Pcsc.cs. Compiled by BSD; not yet tested on a reader.
// Sends only Get UID (FF CA 00 00 00) and the documented Get Firmware Version command of each model.
using System;
using Bsd.Pcsc;
using Bsd.ReaderTest;
// 1. Self-check: the gate must refuse anything that is not an exact whitelisted command.
byte[][] mustRefuse =
[
[0xFF, 0xD6, 0x00, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00], // Update Binary (a write)
[0xFF, 0xB0, 0x00, 0x04, 0x10], // Read Binary (needs authentication; not in this tool)
[0xFF, 0xCA, 0x00, 0x00, 0x00, 0x00], // Get UID with an extra byte
];
foreach (var bytes in mustRefuse)
{
if (CommandWhitelist.IsAllowed(Route.Transmit, bytes))
{
Console.WriteLine("Self-check FAILED: the whitelist accepted " + Apdu.HexSpaced(bytes));
return 4;
}
}
Console.WriteLine($"Self-check passed: {mustRefuse.Length} non-whitelisted commands refused.");
try
{
using var pcsc = new PcscContext();
string[] readers = pcsc.ListReaders();
if (args.Length > 0) readers = Array.FindAll(readers, r => r.Contains(args[0], StringComparison.OrdinalIgnoreCase));
if (readers.Length == 0)
{
Console.WriteLine("No PC/SC reader found" + (args.Length > 0 ? $" containing \"{args[0]}\"." : "."));
return 1;
}
// One result line per command: time, reader, command, bytes sent, result.
Console.WriteLine("Time\tReader\tCommand\tSent\tResult");
foreach (string reader in readers)
{
var state = new[] { PcscContext.NewState(reader) };
pcsc.WaitForChange(state, 0, CancellationToken.None); // current state, at once
bool cardPresent = (state[0].dwEventState & WinScard.SCARD_STATE_PRESENT) != 0
&& (state[0].dwEventState & WinScard.SCARD_STATE_MUTE) == 0;
CardConnection? card = null;
try
{
if (cardPresent) card = pcsc.Connect(reader);
foreach (SafeCommand id in CommandWhitelist.ForReader(reader))
Log(reader, id, Run(reader, id, card));
}
catch (PcscException ex)
{
Console.WriteLine($"{DateTime.Now:HH:mm:ss}\t{reader}\t(connect)\t-\t{ex.Message}");
}
finally { card?.Dispose(); }
}
return 0;
}
catch (PcscException ex)
{
Console.WriteLine(ex.Message);
return 2;
}
static string Run(string reader, SafeCommand id, CardConnection? card)
{
try
{
var info = CommandWhitelist.Get(id);
if (info.Route == Route.Escape)
{
byte[] reply = SafeRunner.Escape(reader, id);
return SafeRunner.FirmwareText(id, reply) is { } fw ? $"OK {fw}" : $"Unexpected reply {Apdu.HexSpaced(reply)}";
}
if (card is null) return "No card on the reader: not run";
if (id == SafeCommand.ReadAtr) return "OK " + Apdu.HexSpaced(card.Status().Atr);
byte[] r = SafeRunner.Transmit(card, id);
if (id == SafeCommand.FirmwarePseudoApdu)
return SafeRunner.FirmwareText(id, r) is { } text ? $"OK {text}" : $"Unexpected reply {Apdu.HexSpaced(r)}";
return Apdu.IsSuccess(r) ? "OK " + Apdu.HexSpaced(Apdu.Data(r)) : "SW " + Apdu.StatusWord(r);
}
catch (PcscException ex) { return ex.Message; }
}
static void Log(string reader, SafeCommand id, string result)
{
var info = CommandWhitelist.Get(id);
Console.WriteLine($"{DateTime.Now:HH:mm:ss}\t{reader}\t{info.Name}\t{info.Hex}\t{result}");
}
Run it: dotnet run tests every reader; dotnet run -- ACR1252 tests only readers whose name contains "ACR1252". Exit codes: 0 done, 1 no matching reader, 2 PC/SC error (for example the Smart Card service is not running), 4 the self-check failed.
Expected result (from the ACS manuals, not yet a BSD result): for an ACR1252U PICC entry with a MIFARE Classic 1K card, lines for Read ATR (an ATR containing card name 00 01), Get UID (4 or 7 bytes) and Get firmware version (text such as ACR1252U_V...). With no card, the card tests say "No card on the reader: not run" and the firmware test still runs. What BSD saw without a reader: Self-check passed and one Read ATR line for the Windows Hello virtual card.
If it fails: SCardConnect (direct) failed ... SCARD_E_UNKNOWN_READER or SCardControl failed usually means Windows' built-in driver is in use instead of the ACS driver, or the escape command is not enabled; see the firmware troubleshooting table. SCARD_E_SHARING_VIOLATION means another program holds the card. Other codes are in the C# error section.
Test Cases per Reader and Card
Write the test plan as data the runner walks through, one row per reader and card. Below is the plan for the ACS readers and test cards BSD uses. The "expected" column comes from the ACS manuals and the PC/SC specification; it is what your tool should check, not a result BSD has recorded yet.
| ID | Reader | Card | Tests | Expected (per ACS / PC/SC documents) |
|---|---|---|---|---|
| T0 | Any | None | Service and reader detection; unplug and replug | Context opens; reader listed with an ACS name; entry disappears and returns; state EMPTY |
| T1 | ACR1252U | None | Firmware (escape) | Reply E1 00 00 00 + length + version text |
| T2 | ACR1252U | MIFARE Classic 1K | ATR, UID | Storage-card ATR with standard 03 and card name 00 01; UID 4 or 7 bytes + 90 00 |
| T3 | ACR1252U | NTAG / Ultralight | ATR, UID | Storage-card ATR; UID 7 bytes + 90 00. Which card name the reader reports for NTAG is still to be recorded (see the ATR card-name table). |
| T4 | ACR1252U | DESFire | ATR, UID | An ISO 14443-4 ATR (not a storage-card ATR); UID + 90 00 |
| T5 | ACR1552U | None, then T2 to T4 cards | Firmware (escape), ATR, UID | As T1 to T4; firmware text in the ACR1552U format |
| T6 | ACR122U | MIFARE Classic 1K, NTAG, DESFire | ATR, UID, firmware (pseudo-APDU, card on the reader) | As T2 to T4; firmware reply is version text only (10 bytes in ACS's example) |
| T7 | ACR39U | SLE4442 / SLE4428, ISO 7816 processor card | ATR only | An ATR is reported for the processor card. What the ACR39U reports for memory cards before a card type is selected is still to be recorded. |
| T8 | Any contactless | Card removed during the test | UID | A logged SCARD_W_REMOVED_CARD or similar error, no crash, next card works |
| T9 | Any | Card held by another program (for example QuickView) | Connect | A logged SCARD_E_SHARING_VIOLATION; the tool keeps running |
The manual, step-by-step version of these checks (what a person does with QuickView and the Script Tool) is in how to test an NFC reader on Windows and the APDU test plan. Your tool automates the read-only part of them.
Result Log and Test Report
Store one record per step with these fields: time, test ID (T0 to T9), reader name, card type (from the ATR), command name, bytes sent, result (pass/fail), reply or status word, and PC/SC error name. Never log keys, because a read-only tool has none to log.
For export, reuse the CSV writer from the .NET app (quoted fields, UTF-8 with BOM, sortable time format) and add a short header block that support always needs:
- PC name and Windows version and build (for example from
Environment.OSVersion); - the test tool's own version;
- the full list of PC/SC readers seen, including non-ACS ones such as virtual smart cards;
- the reader firmware text from T1, T5 or T6.
Remind users in the UI that a UID with leading zeros can lose them if the CSV is opened in Excel by double-click. The .NET app page explains the import route that keeps them.
Packaging and an MSI Installer
A test tool is installed on PCs you do not control, so the install must be simple and must not change more than it needs to.
The application
Publish the app as described in packaging the .NET reader application: self-contained (no .NET runtime needed on the PC) or framework-dependent (needs the .NET 10 Desktop Runtime). For a handful of PCs, copying the published folder or single .exe is enough.
An MSI package
For roll-out across a company, wrap the published files in a Windows Installer package (.msi). An MSI gives IT a standard silent install (msiexec /i tool.msi /qn), a clean uninstall from Settings, version upgrades, and deployment through tools such as Group Policy or Intune. Common ways to build one are the open-source WiX Toolset and Microsoft's Visual Studio Installer Projects extension. Keep the package small: program files, a Start-menu shortcut and nothing else. A test tool needs no service, no start-up entry and no administrator rights at run time.
The driver is a prerequisite, not part of your package
- Ask for the ACS driver to be installed first, from the official ACS page for each model: ACR1252U, ACR1552U, ACR122U, ACR39U. The steps are in installing ACS reader drivers on Windows.
- Do not bundle the ACS driver inside your installer unless ACS has given you permission to redistribute it. Link to the official download instead.
- Make the tool check the prerequisite at start-up instead: if the context cannot be opened, show "Smart Card service not running" and link to starting the service; if no ACS reader name appears but the reader is plugged in, point to checking that Windows detects the reader.
- winscard.dll and the Smart Card service are part of Windows: nothing PC/SC-related needs installing.
Sign the .exe and the .msi with your organisation's code-signing certificate, so Windows SmartScreen and IT security tools can identify the publisher.
How This Relates to the BSD Utilities and Services
You may not need to build a tool at all. For a quick reader check, the free official ACS tools are often enough (QuickView for detection and card presence, the Script Tool for single commands), and BSD Infotech offers its own free Windows utilities for the ACR1252U, ACR1552U, ACR122U and ACR39U. They are BSD software, not ACS products, and they go further than a read-only test: they work with cards that are still on their factory keys, and in the ACR1252U, ACR1552U and ACR39U utilities reader and card detection is free while reading and writing card data needs a BSD licence key. The download is free after a one-time email check. See the BSD reader utilities and the tool chooser, or go straight to the ACR1252U utility download.
Build your own test application when you need things those tools do not offer: your company's branding, a fixed test plan for your production line or support desk, reports in your own format, or a test step built into your own installer. BSD Infotech builds such tools and the applications around them.
Need a reader test tool or a full card application?
BSD Infotech supplies ACS readers and cards and develops Windows software around them, from read-only diagnostic tools to attendance, access and cashless applications. See NFC and smart card application development, or tell us what you need to test.
Troubleshooting a Reader Test Tool
| What you see | Likely cause | What to do |
|---|---|---|
| The tool says "no reader" but Device Manager shows one | Smart Card service stopped, or the tool's context died when the service restarted | Start the service; make the tool re-create its context on SCARD_E_NO_SERVICE or SCARD_E_SERVICE_STOPPED, as in the detection guide. |
| Only "Windows Hello" or another virtual reader is listed | The ACS reader is not installed or not plugged in; the virtual reader is a TPM smart card | Filter by the "ACS" prefix in the UI, and see checking reader detection. |
| Firmware test fails, the UID test works | Escape commands need the ACS driver; Windows' built-in CCID driver may be in use | Install the ACS driver from the official page and retest; see the firmware guide. |
| Card tests fail with a sharing violation | QuickView, a BSD utility or the customer's software has the card open | Close the other program. The tool should log this, not stop. |
UID test returns an error status word instead of 90 00 | Contact card or a SAM entry: no contactless UID | Offer Get UID on PICC entries only, as the whitelist does. |
| The tool freezes when a reader is unplugged | Waiting on the UI thread, or no handling of UNKNOWN / UNAVAILABLE states | Move all waiting to the reader thread; see the .NET app architecture. |
| Nothing works in a Remote Desktop session | The session sees the client PC's readers, only if smart card redirection is on | See readers over Remote Desktop. |
Reader problems that are not caused by the tool are covered in the ACS reader troubleshooting centre.
Sources
Checked on 1 Dec 2026. Explanations are in BSD's own words.
- ACS manuals (via BSD's firmware and ATR guides): ACR1252U API manual v1.17 s5.4.1 (Get Firmware Version escape command); ACR1552U reference manual v1.09 s6.2.1; ACR122U API manual v2.04 s6.3 (
FF 00 48 00 00); ACR122U API v1.4 and ACR1552U reference v1.05 (contactless ATR examples) - PC/SC Workgroup, Part 3 and its supplemental document (Get Data
FF CA, contactless ATR standard and card-name bytes) - Microsoft Win32 reference: SCardControl, SCardConnect, SCardGetStatusChange; Windows Installer
- ACS driver pages for the ACR1252U, ACR1552U, ACR122U and ACR39U, and the ACS utility tools page
BSD Infotech is an independent ACS supplier and integrator, not the manufacturer. ACS, the ACS logo and ACS product names belong to Advanced Card Systems Ltd. MIFARE, MIFARE DESFire, MIFARE Classic and MIFARE Ultralight are trademarks of NXP B.V.
