Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Figure out how best to support multiple readers #10

Closed
JohnMcLear opened this issue Mar 5, 2016 · 14 comments
Closed

Figure out how best to support multiple readers #10

JohnMcLear opened this issue Mar 5, 2016 · 14 comments
Milestone

Comments

@JohnMcLear
Copy link
Contributor

and/or provide a UI to switch between readers

@JohnMcLear JohnMcLear added this to the v1 milestone Mar 5, 2016
@Deph0
Copy link
Collaborator

Deph0 commented Feb 1, 2018

Related to #22 ? Needs testing i guess?

@maz-net-au
Copy link
Collaborator

maz-net-au commented Feb 2, 2018

I just bought 4 more readers on aliexpress. As soon as they arrive I can test connecting them all and polling each one in a loop, or would you prefer a selector? I'll see if I can get a reader name from it somehow.

@JohnMcLear
Copy link
Contributor Author

JohnMcLear commented Feb 2, 2018 via email

@DNThomas
Copy link
Contributor

DNThomas commented Feb 2, 2018

@maz-net-au , sentimental already added reader detection and listing. This probably just needs expanding on for them to be individually selectable/identifiable.

@maz-net-au
Copy link
Collaborator

It already polls all of the readers. I'm using 2 different ones at the same time right now. Is there a reason to explicitly select one?

rv = SCardListReaders(hContext, NULL, (LPTSTR)&mszReaders, &dwReaders);
for (LPTSTR pszz = mszReaders; *pszz; pszz += lstrlen(pszz) + 1)

@maz-net-au
Copy link
Collaborator

I also have info as to whether or not there are any available readers

if (rv == SCARD_E_READER_UNAVAILABLE)
resultLen = -5;
else if (rv == SCARD_E_NO_READERS_AVAILABLE)
resultLen = -6;

@DNThomas
Copy link
Contributor

DNThomas commented Feb 2, 2018

When testing in the office, it was quite easy to inadvertently lock our laptops as the machines we use have the NFC reader in the touchpad and we all wear NFC rings.

This would be alleviated by being able to explicitly select a reader or readers.

@maz-net-au
Copy link
Collaborator

I'd de-register the TagDown Lock event. It's only really useful when you want to look like a wizard. Windows Key + L is easy enough for locking.
I'll find out what strings I have access to in the PCSC interface for filtering out readers.

@DNThomas
Copy link
Contributor

DNThomas commented Feb 2, 2018

Good point Maz .. making TagDown selectable would be the best option for the user, then can choose what suits them best.

@maz-net-au
Copy link
Collaborator

It's a plugin based system that can be registered against events. We just need to add UI to support it. I was asked to add a "RegisterAll" event to the service, but the original version that lets you select plugins and events should still work.

@sentimental37
Copy link
Collaborator

sentimental37 commented Feb 8, 2018

My two readers from aliexpress arrived today, i had one ACR122U, so having 3 readers now, i will look into this, however, can we settle on adding option in application to select one of the multiple readers(I have already added this in #22) , and set the selected reader as the one we want to use, and then we can restrict the application code from using other readers while we have set the one as default?

I am not properly aware what is the default behaviour when we have multiple readers connected, how the code picks up one to read tags? On first one detected basis, or some other logic? any insights on this would help me.

Thanks
Vishal

@maz-net-au
Copy link
Collaborator

It round robins them until it finds a tag on one of the readers. It's in the WinAPIWrapper that encapsulates the PC/SC interface. If the readers are to be selectable, the names will have to be returned to the UI via the service somehow so the readers are selectable. A decision will have to be made what reader to change to if the previously selected one is unpligged.

@maz-net-au
Copy link
Collaborator

Today i converted the scard api code to p/invoke in c#. This gives us better access to the underlying data and to better control the flow. I've already made a new function that returns a list of all readers attached to the system by name. It won't be hard to explicitly ignore a subset of them.
I'll be working on it more tomorrow to expose this to the UI project.

@maz-net-au
Copy link
Collaborator

Multiple readers are now supported. All tags on all reads are now checked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants