mclear / Sesame

Microsoft Windows NFC Login and Logout
Apache License 2.0
53 stars 18 forks source link

Figure out how best to support multiple readers #10

Closed JohnMcLear closed 6 years ago

JohnMcLear commented 8 years ago

and/or provide a UI to switch between readers

Deph0 commented 6 years ago

Related to #22 ? Needs testing i guess?

maz-net-au commented 6 years ago

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 commented 6 years ago

Let me know if you need reimbursement


From: Maz notifications@github.com Sent: Friday, 2 February 2018 1:24 am To: mclear/Sesame Cc: John McLear; Author Subject: Re: [mclear/Sesame] Figure out how best to support multiple readers (#10)

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?

- You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/mclear/Sesame/issues/10#issuecomment-362456576, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AANewJkUd9g5n_ZlAgVBr28ERY84ncXzks5tQmO6gaJpZM4HqD6H.

DNThomas commented 6 years ago

@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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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

maz-net-au commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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