USB Smart Card Reader Communication: CCID Technical Guide

How does a USB smart card reader communicate with the PC? Most current USB smart card readers, including ACS's ACR1252U, ACR1552U, ACR122U and ACR39U, follow the USB CCID class (Chip/Smart Card Interface Devices, USB class code 0Bh). CCID defines a small set of messages that the reader driver and the reader exchange over USB: commands go to the reader on a bulk-OUT endpoint, replies come back on a bulk-IN endpoint, and card insertion and removal are reported on an interrupt endpoint. When your program calls SCardTransmit, the driver wraps the APDU in a PC_to_RDR_XfrBlock message; when it calls SCardControl with an escape code, the bytes travel in a PC_to_RDR_Escape message. Your program never sees these messages: it talks to PC/SC, and the driver handles CCID.

This page covers that transport layer: the USB-IF CCID specification, the messages it defines, how PC/SC calls turn into CCID traffic, the difference between Microsoft's built-in CCID class driver and the ACS driver, the free CCID driver on Linux, and what a developer can actually observe when something fails. The application side (the WinSCard calls, share modes, protocols and pseudo-APDUs) is explained in PC/SC architecture explained for developers, and this page does not repeat it. BSD Infotech is an independent ACS supplier and integrator, not the manufacturer.

In the PC/SC layer model, your program calls the PC/SC API, the resource manager (the Smart Card service on Windows, pcscd on Linux) shares the reader, and the reader driver (the "IFD handler") talks to the hardware. CCID lives entirely below that driver. It is the agreement between the driver and the reader's USB firmware about how commands, replies and events are packaged on the USB cable.

That split is what lets one reader work with several drivers. Because the reader speaks a standard USB class, Windows can run it with Microsoft's own class driver, ACS can supply its own driver, and Linux can use the free CCID driver, while programs above them keep using the same PC/SC calls. Our SDK vs driver guide explains which of these pieces you install and which you write.

USB CCID pipes between the reader driver and the reader The reader driver on the PC and the CCID reader are joined by four USB pipes: the control pipe in both directions for standard and class requests; the bulk-OUT pipe carrying PC_to_RDR commands to the reader; the bulk-IN pipe carrying RDR_to_PC responses back; and the optional interrupt-IN pipe carrying NotifySlotChange and HardwareError events to the PC. PC: reader driver (IFD handler) Windows CCID class driver, ACS driver, or libccid on Linux USB CCID reader (interface class 0Bh) one or more slots; each slot holds one card Control descriptors, ABORT, clock and data rates Bulk-OUT commands PC_to_RDR_… (mandatory) Bulk-IN responses RDR_to_PC_… (mandatory) Interrupt-IN events NotifySlotChange (optional*) Diagram by BSD Infotech, based on USB CCID Rev 1.1, sections 3.1 and 5.2.
*The interrupt pipe is required for any reader that reports card insertion or removal; it is optional only when the card can never be removed.

The CCID class is defined by the USB Implementers Forum (USB-IF) in Device Class: Smart Card, CCID, Specification for Integrated Circuit(s) Cards Interface Devices. The current revision is 1.1, released on 22 April 2005, and it can be downloaded free from usb.org (see Sources). Its revision history records that device class code 0Bh was assigned with release 1.00 in March 2001. The specification is deliberately narrow: it says that neither the mechanics of the card interface nor the content of the data matter to it. It only defines the USB side, which is why the same messages can carry commands for any card.

What a CCID reader declares

  • Interface class 0Bh, subclass 00h, protocol 00h in its USB interface descriptor (section 4.3). Windows matches its class driver on exactly this: Microsoft lists the ID USB\Class_0B&SubClass_00.
  • A smart card class descriptor (section 5.1), which tells the driver the reader's capabilities: the highest slot number (bMaxSlotIndex), the card voltages it can supply, the protocols, the largest message it accepts (dwMaxCCIDMessageLength) and a feature bit field, dwFeatures.
  • One level of exchange, announced in dwFeatures (section 3.2): character level, TPDU level (00010000h), short APDU level (00020000h) or short and extended APDU level (00040000h). At TPDU level the driver does the protocol work (T=0 procedure bytes, T=1 blocks); at APDU level the reader takes a whole ISO 7816-4 APDU and does that work itself.

Endpoints (section 5.2)

EndpointDirectionRequired?What travels on it
Control (endpoint 0)BothAlways (every USB device)Standard USB requests such as GET_DESCRIPTOR, plus three CCID class requests: ABORT, GET_CLOCK_FREQUENCIES and GET_DATA_RATES.
Bulk-OUTPC to readerMandatoryThe command pipe: every PC_to_RDR_… message.
Bulk-INReader to PCMandatoryThe response pipe: every RDR_to_PC_… reply. One command can get more than one reply, for example a time-extension notice before the card's answer.
Interrupt-INReader to PCRequired if the reader reports card insertion or removalEvents outside any command: RDR_to_PC_NotifySlotChange and RDR_to_PC_HardwareError.

The 10-byte message header (section 6)

Every bulk message starts with the same 10 bytes, so the data always begins at the same offset: the message type (bMessageType, 1 byte), the length of the data after the header (dwLength, 4 bytes, little-endian), the slot number (bSlot), a sequence number (bSeq), and three bytes whose meaning depends on the message. In replies, two of those bytes become the slot status (bStatus) and slot error (bError) registers.

The sequence number is how the driver matches replies to commands: the reader copies bSeq and bSlot from the command into every reply. The specification says a slot accepts only one command at a time and that the driver must not send a new command to a slot until the last one has its final reply. A reader that receives a command for a busy slot fails it with the CMD_SLOT_BUSY error.

The names say the direction: PC_to_RDR_ messages are commands from the host to the reader, and RDR_to_PC_ messages are replies or events from the reader. The table lists the messages most relevant to reading and writing cards, with the type byte and reply given in the specification's tables 6.1-1, 6.2-1 and 6.3-1.

Command (bulk-OUT)TypeReply (bulk-IN)What it is for
PC_to_RDR_IccPowerOn62hRDR_to_PC_DataBlock (80h)Powers and resets the card in a slot. The reply's data is the card's ATR (answer to reset). Sent again to an active card, it gives a warm reset.
PC_to_RDR_IccPowerOff63hRDR_to_PC_SlotStatus (81h)Powers the card down.
PC_to_RDR_GetSlotStatus65hRDR_to_PC_SlotStatus (81h)Asks whether a card is present and powered.
PC_to_RDR_XfrBlock6FhRDR_to_PC_DataBlock (80h)Carries a block of data to the card: an APDU, a TPDU or characters, depending on the reader's exchange level. The reply carries the card's response data and SW1 SW2.
PC_to_RDR_GetParameters / SetParameters / ResetParameters6Ch / 61h / 6DhRDR_to_PC_Parameters (82h)Read or set the protocol (T=0 or T=1) and its timing parameters for a slot.
PC_to_RDR_Escape6BhRDR_to_PC_Escape (83h)In the specification's words, it lets the reader's manufacturer "define and access extended features". The bytes go to the reader's own control logic, not to the card.
PC_to_RDR_Abort72hRDR_to_PC_SlotStatus (81h)Used with the ABORT control request to cancel a command that has hung or timed out.

The specification defines a few more commands: IccClock (6Eh, stop or restart the card clock), T0APDU (6Ah), Secure (69h, PIN entry on readers with a keypad), Mechanical (71h) and SetDataRateAndClockFrequency (73h). On the interrupt pipe there are two events: RDR_to_PC_NotifySlotChange (50h), two bits per slot saying whether a card is present and whether that changed, and RDR_to_PC_HardwareError (51h), for example an over-current on a slot.

Status and error bytes in every reply

Each bulk-IN reply carries two registers (section 6.2.6). The slot status says whether a card is present and active, present but inactive, or absent, and whether the command succeeded, failed or needs more time. When a command fails, the slot error byte gives the reason, for example ICC_MUTE (the reader timed out talking to the card), XFR_PARITY_ERROR, HW_ERROR, CMD_ABORTED or CMD_SLOT_BUSY. Applications never receive these bytes: the driver turns them into a PC/SC return code, and the exact translation is the driver's own.

The table follows a typical card session from the application's point of view and names the CCID message that does the matching job underneath. It shows the role of each message, not a captured trace: when the driver sends a message, and whether it sends extra ones (for example to read or set protocol parameters), depends on the driver and on the reader's features. A reader that declares "automatic activation of ICC on inserting" (dwFeatures bit 00000004h) may already have powered the card before the driver asks.

Your program (PC/SC)What the driver must doCCID messageReader's reply
Waits in SCardGetStatusChange; a card is placed on the readerLearn that the slot changed and tell the resource managerNone from the PC: the reader sends RDR_to_PC_NotifySlotChange on the interrupt pipe. A driver can also ask with PC_to_RDR_GetSlotStatus.RDR_to_PC_SlotStatus (when asked)
SCardConnect to the cardPower the card, get its ATR, settle the protocolPC_to_RDR_IccPowerOn, and as needed GetParameters / SetParametersRDR_to_PC_DataBlock with the ATR; RDR_to_PC_Parameters
SCardTransmit with an APDUDeliver the APDU to the card and return the answerPC_to_RDR_XfrBlockRDR_to_PC_DataBlock: response data plus SW1 SW2
SCardControl with the escape control codePass vendor bytes to the reader itselfPC_to_RDR_EscapeRDR_to_PC_Escape
SCardDisconnect with SCARD_UNPOWER_CARDPower the card downPC_to_RDR_IccPowerOffRDR_to_PC_SlotStatus
Card removed; SCardGetStatusChange reports itMark the slot emptyNone from the PC: RDR_to_PC_NotifySlotChange on the interrupt pipe(event)

The PC/SC calls themselves, in order, with the share modes, protocols and dispositions, are explained in the WinSCard call sequence.

How the APDU from SCardTransmit travels inside XfrBlock

Take the PC/SC Get Data command that returns a contactless card's UID, FF CA 00 00 00. Your program passes these five bytes to SCardTransmit; the resource manager hands them to the driver; the driver puts them in the data part of a PC_to_RDR_XfrBlock. For a reader working at short APDU level, the message laid out per section 6.1.4 would look like this (an illustration built from the specification, not a USB capture):

OffsetFieldBytesMeaning
0bMessageType6FPC_to_RDR_XfrBlock
1-4dwLength05 00 00 005 bytes of data follow (little-endian)
5bSlot00Slot 0
6bSeqe.g. 07Chosen by the driver; the reply repeats it
7bBWI00Block waiting time extension; used only at character and TPDU level with T=1
8-9wLevelParameter00 00At short APDU level: reserved, zero. At extended APDU level it marks the start, middle or end of a long APDU split over several messages.
10-14abDataFF CA 00 00 00Your APDU, unchanged

The answer comes back as RDR_to_PC_DataBlock: type 80, the data length, the same slot and sequence number, the status and error bytes (both 00 when a card is present, active and the command succeeded), a chain parameter byte, and then the data: the UID followed by 90 00. The driver strips the 10-byte header and gives your program only the data and status word, which is exactly what SCardTransmit returns.

Two details change this picture. At TPDU level, the driver, not the reader, adapts the APDU to the card's protocol: for T=0 it may need more than one exchange, and for T=1 it builds the protocol blocks itself, so abData no longer equals your APDU. And for a pseudo-APDU such as FF CA, the bytes travel in XfrBlock like any other APDU, but the reader answers them itself instead of passing them to the card, as PC/SC Part 3 requires for storage cards (see pseudo-APDUs).

How SCardControl escape commands map to PC_to_RDR_Escape

An escape command is meant for the reader, not the card, so it does not go through XfrBlock. Your program calls SCardControl with a control code; the resource manager passes the request to the driver unchanged; and a CCID driver that supports escape commands puts your input bytes into the abData part of a PC_to_RDR_Escape message (6Bh). The reader's reply arrives as RDR_to_PC_Escape (83h), and its data becomes the output buffer of SCardControl. For example, the ACS escape command E0 00 00 18 00, which asks an ACR1252U or ACR1552U for its firmware version, would be the five data bytes of a PC_to_RDR_Escape message.

The control code is where drivers differ:

  • Microsoft's CCID class driver defines its escape request as IOCTL_CCID_ESCAPE = SCARD_CTL_CODE(3500), and only accepts it when escape commands have been enabled for that reader (see the next section).
  • ACS documents its escape commands with the same code, 3500, written for Windows as 0x310000 + 3500 * 4, and BSD's guides send them with the ACS driver installed: see checking the firmware version and LED and buzzer control.
  • The free CCID driver on Linux uses a different control code and only allows escape commands under a driver option. The details are in the PC/SC architecture page's Linux section.

In short, SCardTransmit becomes XfrBlock and goes to the card (or is answered by the reader for a pseudo-APDU); SCardControl with the escape code becomes Escape and goes to the reader. The application-level comparison of the two calls is in SCardTransmit vs SCardControl.

Microsoft's list of USB class drivers included in Windows gives the smart card class (0Bh) the device setup class SmartCardReader and names Usbccid.sys as its mini-class driver, now marked obsolete: the user-mode (UMDF) driver WUDFUsbccidDriver.dll replaces it. Microsoft's general rule for class drivers applies here too: they "might not support all of the features" in a class specification, and hardware makers should supply drivers for the rest. The practical choice between the two drivers for an ACS reader, and the steps to install the ACS one, are on the driver installation guide; this table only compares what each does at the CCID level.

Microsoft USB CCID class driverACS PC/SC driver
Comes fromWindows itself and Windows Update. Loaded automatically for any interface that reports class 0Bh, subclass 00h.ACS, one package per model family, downloaded from acs.com.hk.
Shown in Device ManagerDriver Provider: Microsoft. Often a generic reader name rather than the model.Driver Provider: ACS, with the version from the ACS download page.
Exchange levelsMicrosoft's design note says it supports all dwFeatures levels (character, TPDU, APDU, extended APDU), with TPDU the preferred one.Written for ACS hardware; ACS's manuals assume it.
Escape commandsOff by default. Microsoft documents a DWORD registry value, EscapeCommandEnable, that must be non-zero for the reader's USB device, and notes that once enabled, protection against malicious escape commands becomes the reader's responsibility.Code 3500 as documented by ACS. This is the route BSD's escape-command guides use.
Several slots in one CCID interfaceMicrosoft's design note says only slot 0 is used; a device that wants to show several readers can be a composite device with a CCID interface for each.Handled by the ACS driver for the model.
Other limits in Microsoft's noteNo keypad or display support, no queuing of several commands, no mechanical features, no wake on card insertion.Model-specific; see the ACS reference manual.

Microsoft's design note on the class driver is an archived document written for the driver's first releases, so some limits may have changed in later Windows versions. It still explains the behaviour most developers meet: card commands work on either driver, while reader-specific escape commands normally need the ACS driver. BSD's firmware guide mentions this registry value only as ACS's ACR122U manual describes it. Changing the registry is a system change, so if you need escape commands, installing the ACS driver is the simpler route.

Not yet tested by BSD. BSD's test machines run Windows 10 and 11. This section reports what the CCID driver and pcsc-lite documentation says; it makes no claim that a given ACS reader works on Linux or macOS.

On Linux and other Unix systems, the CCID level is handled by the free "CCID driver" (libccid), a generic driver for USB CCID and ICCD readers published under the LGPL 2.1 or later. It runs as an IFD handler inside pcscd, the pcsc-lite resource manager, so applications above it use the same SCard functions as on Windows. Its documentation says it is built on the USB-IF CCID and ICCD specifications, is bundled with macOS, and is packaged for FreeBSD and NetBSD.

The project keeps a public reader list in levels: "supported", "should work", "unsupported" and "disabled", and it recommends readers from the supported list. ACS readers appear on it, and ACS also lists its own Linux and macOS drivers on its download pages (the ACR1552U page, for example). Which escape-command route each driver uses on Linux is covered on the PC/SC architecture page.

For diagnosis, the pcsc-lite support page asks users to restart pcscd in the foreground with debug and APDU logging and with the CCID driver's log level raised, and to send the full log. It also warns that a PIN typed during the test will appear in the log. Follow that page's exact command rather than a copy.

These points come from ACS's product information as already summarised on BSD's model pages, where each is cited:

  • CCID and PC/SC compliant. ACS describes its current USB readers, including the ACR1252U, ACR1552U, ACR122U and ACR39U, as compliant with both CCID and PC/SC, and lists Microsoft WHQL certification for the ACR1252U, ACR1552U and ACR39U. That is why Windows can set these readers up before any ACS driver is installed (ACR1252U, ACR1552U, ACR122U, ACR39U).
  • Contactless readers use the same messages. The CCID specification was written for ISO 7816 contact cards, but a CCID contactless reader handles the radio side itself and presents the card to the driver through the same CCID messages. PC/SC Part 3 asks such readers to report card arrival and removal and to build an ATR for the contactless card, so to the driver and your program a MIFARE or DESFire card looks like any other card (see protocols and contactless cards).
  • More than one reader entry per device. A reader with a SAM slot, such as the ACR1252U, shows a PICC entry and a SAM entry in the PC/SC reader list. In Device Manager, two interfaces of one reader carry the same vendor and product ID with different MI_ numbers, as our detection guide explains.
  • Keyboard mode is not CCID. Readers that can type a card's UID like a keyboard, such as the ACR1552U, are not CCID readers while in keyboard-only mode, so PC/SC software cannot see them. See ACS keyboard emulation.
  • Escape code 3500. ACS documents its escape commands with control code 3500, the same number Microsoft defines for its class driver's escape request.

BSD has not published which exchange level (dwFeatures) each ACS reader declares; that is a detail in the reader's USB descriptors and, where given, in ACS's reference manual.

In Device Manager (no tools needed)

  • Hardware Ids come from the reader's own USB descriptors, so they are readable even when no driver is loaded. They give the vendor and product codes and, for multi-interface readers, the interface number. The steps, and a read-only PowerShell equivalent, are in identifying your ACS reader model.
  • Compatible Ids on the same Details tab show the USB class. Class 0B means the interface declares itself a CCID smart card reader, which is what Windows' class driver binds to.
  • Driver tab: Driver Provider Microsoft means the class driver is running; ACS means the ACS driver. Driver Details lists the driver files, so WUDFUsbccidDriver.dll there tells you the Microsoft class driver is in use.

At the PC/SC level

Tools that send APDUs (ACS's QuickView and Script Tool, or the PC/SC Learning Tool) show exactly what goes into SCardTransmit and what comes back. At APDU level, those bytes are the abData of the XfrBlock and DataBlock messages, so for most work this is all the visibility you need. Start from the tool chooser.

At the USB level

Seeing the raw CCID messages on Windows needs a USB protocol analyser or USB capture software; BSD has not tested a particular tool for this and does not recommend one here. On Linux, the CCID driver's own log (see above) is the documented route. Raw CCID traces are mainly useful to reader and driver developers; application developers rarely need them.

Why applications never talk to the CCID layer directly

  • The driver owns the USB interface. Once a reader driver is loaded, it holds the bulk and interrupt pipes. To send CCID messages yourself you would have to replace that driver with a generic USB one, and the reader would then leave the "Smart card readers" list, so every PC/SC program, including your own, would lose it.
  • Sharing needs the resource manager. CCID allows one command per slot at a time and has no idea of programs or transactions. The resource manager adds sharing, exclusive access and transactions on top (see what SCardSvr does).
  • Portability. Code written against PC/SC works whether Windows loaded Microsoft's driver or ACS's, and on Linux with libccid. Code written against CCID messages would be tied to one driver stack and to the reader's exchange level.
  • Everything you need is already reachable. Card commands go through SCardTransmit, reader commands through SCardControl, and card events through SCardGetStatusChange. Between them they cover XfrBlock, Escape and NotifySlotChange.

Use the transport layer to decide where a problem lives, then go to the matching guide. The detailed fixes are in the ACS reader troubleshooting centre; for faults above the driver, use the PC/SC layer table.

What you seeLayerWhere to go
Nothing appears in Device Manager when the reader is plugged inUSB: cable, port, powerReader not detected
A device appears, but as unknown or under Other devicesUSB works; no CCID driver is bound to the interfaceInstall the ACS driver and check the Hardware Ids
Tapping a card types characters; no reader in PC/SCReader in keyboard mode, not CCIDKeyboard mode problems
Reader under "Smart card readers", but programs find no readerAbove CCID: Smart Card service and PC/SC"No reader found" checks
Card commands work, escape commands failEscape path in the driver (often the Microsoft class driver with escape off)CCID vs ACS driver and the firmware guide's troubleshooting
Reader listed, but the card is not read or connect failsCard or slot: the reader reports a slot error such as a mute card, which the driver turns into a PC/SC errorCard not read

Checked on 30 Nov 2026. ACS facts (CCID and PC/SC compliance, WHQL, escape code 3500, the firmware-version escape command, keyboard mode) are taken from ACS's product pages and manuals as cited on BSD's model and how-to guides linked above.

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. USB is a trademark of USB Implementers Forum; Windows is a trademark of Microsoft Corporation.

Building software on ACS USB readers?

Tell us the reader model, the driver you use and what the application must do. We help with PC/SC integration, escape commands and reliable reader handling.