Paul
Paul

Reputation: 1019

ACR122 Device Programming sample does not find reader

I'm trying to experiment with the ACR122 card reader on Windows 8 using the Device Programming sample for C# that ships with the SDK. When I start the sample I don't see the card reader in the list of available devices.

I don't think this is a general driver problem because the tools for configuring the reader (precompiled binaries) list the reader and allow to connecting to it.

I'm new to C# and .NET. I would be glad if anyone could give me some advice on determining what's wrong. If you need more information I will happily provide you with it.

Upvotes: 0

Views: 6746

Answers (2)

kdno_be
kdno_be

Reputation: 31

I'm no expert either, I'm currently working with the ACR122U reader and the samples didn't work perfectly for me either. But, I was able to write a little C# program so i can read/write small amounts of text (converted to hexadecimal) onto a Smart Card. So I suggest you try to write it yourself, like I did, I'll give you some code which got me started (I used the pcsc-sharp dll):

using PCSC;

namespace SmartcardCheck
{
    class Program
    {
        static void Main(string[] args)
        {
            using (var context = new SCardContext())
            {
                context.Establish(SCardScope.System);

                string[] readerNames = null;
                try
                {
                    // retrieve all reader names
                    readerNames = context.GetReaders();

                    // get the card status of each reader that is currently connected
                    foreach (var readerName in readerNames)
                    {
                        using (var reader = new SCardReader(context))
                        {
                            Console.WriteLine("Trying to connect to reader {0}.", readerName);

                            var sc = reader.Connect(readerName, SCardShareMode.Shared, SCardProtocol.Any);
                            if (sc == SCardError.Success)
                            {
                                DisplayReaderStatus(reader);
                            }
                            else
                            {
                                Console.WriteLine("No card inserted or reader is reserved exclusively by another application.");
                                Console.WriteLine("Error message: {0}\n", SCardHelper.StringifyError(sc));
                            }
                        }
                    }
                }
                catch (Exception)
                {
                    if (readerNames == null)
                    {
                        Console.WriteLine("No readers found.");
                        return;
                    }
                }

                Console.ReadKey();
            }
        }
    }
}

Hope it helps you :)

Upvotes: 3

LewisBenge
LewisBenge

Reputation: 2696

The ACR122 is not seen by Windows as an NFC (proximity) device, it is a smart card device which has the capability to read NFC cards. To use it within Modern Apps or via the WinRT API's you'll actually need to use Windows 8.1 which has introduced support for smart cards.

Upvotes: 1

Related Questions