Skip to content

"Type of target not supported" on Windows 10, using libnfc pcsc driver #757

@dimgit

Description

@dimgit

Hello,

I built libnfc on Windows and tried to read Mifare Classic tag.
The library prints this message:
"Type of target not supported"

I looked at the code, and I think the problem is with the pcsc_get_icc_type function. It calls SCardGetAttrib() with SCARD_ATTR_ICC_TYPE_PER_ATR. According to the current documentation for SCardGetAttrib() and SCARD_ATTR_ICC_TYPE_PER_ATR can be one:

Single byte indicating smart card type:
0 = unknown type
1 = 7816 Asynchronous
2 = 7816 Synchronous

[https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardgetattrib](SCardGetAttrib() documentation)

The pcsc driver expects one of the following types:

#define ICC_TYPE_UNKNOWN 0
#define ICC_TYPE_14443A 5
#define ICC_TYPE_14443B 6

In my case, SCardGetAttrib() returns 1 for SCARD_ATTR_ICC_TYPE_PER_ATR, for the sample tag I use.

It looks like there is some disconnect between the pcsc driver and the MS SCard API. Or am I doing something incorrectly?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions