Development:Porting: Difference between revisions

From TapTo
(Created page with "Requirements and notes for porting TapTo to other platforms. * Each platform supported by TapTo has a new submodule in the <code>platforms</code> and <code>cmd</code> modules. * The <code>platforms</code> submodule contains all platform-specific code and defines a generic "platform" interface. * The <code>cmd</code> submodule is the final binary distributed to the platform, which imports the specific platform submodule and sets it up for use with th...")
 
No edit summary
 
Line 15: Line 15:
** The poll loops need to be abstracted from libnfc so other drivers can be swapped in (this really needs to be done in any case).
** The poll loops need to be abstracted from libnfc so other drivers can be swapped in (this really needs to be done in any case).
** Support for the [[wikipedia:PC/SC|PC/SC standard]] needs to be added (another good one to do anyway, this is the preferred way to interact with NFC readers on everything besides MiSTer).
** Support for the [[wikipedia:PC/SC|PC/SC standard]] needs to be added (another good one to do anyway, this is the preferred way to interact with NFC readers on everything besides MiSTer).
== PC/SC ==
[[wikipedia:PC/SC|PC/SC]] is a smart card standard that is supported by many NFC readers and all major operating systems. It's a common protocol for the NFC reader to connect and communicate with a host device. In order for TapTo to have the best support for different readers and operating systems, it should support PS/SC eventually.
A PC/SC service in enabled by default on [https://learn.microsoft.com/en-us/windows/win32/api/winscard/ Windows], Mac<ref>Not sure yet, but seems OS X is transitioning to a new smart card API, so Mac may have questionable support right now. But it's OK, this is the least necessary platform and should support PN532 alright.</ref>, and most major [https://pcsclite.apdu.fr/ Linux distributions].
There are several PC/SC libraries for Go, but they are not popular. Investigation will need to be done for the best fit:
* https://github.com/dumacp/smartcard
* https://github.com/deeper-x/gopcsc
* https://github.com/ElMostafaIdrassi/goscard
* https://github.com/gballet/go-libpcsclite
* https://github.com/LudovicRousseau/CCID
None of these are exactly the same.
The [[PN532]] is '''not''' supported by PC/SC
libnfc claims to have some amount of support for PC/SC, but upon testing it doesn't really work. The acr122u_pcsc driver is deprecated and not working, the pcsc driver is undocumented and would not work. I don't think it's wise to rely on support via libnfc.

Latest revision as of 09:32, 5 May 2024

Requirements and notes for porting TapTo to other platforms.

  • Each platform supported by TapTo has a new submodule in the platforms and cmd modules.
  • The platforms submodule contains all platform-specific code and defines a generic "platform" interface.
  • The cmd submodule is the final binary distributed to the platform, which imports the specific platform submodule and sets it up for use with the shared library.

Work to do be done:

  • The "platform" interface is not defined yet. We need to come up with a list of generic methods for this interface of stuff that will differ between platform. E.g. launching a game from a path, sending a keyboard input, starting/stopping/restarting the TapTo service, etc.
  • Although it's marked now, the shared code is still littered with references to MiSTer-specific (mrext) library calls.
  • The path definitions (config modules) are hardcoded to MiSTer paths.
  • The mrext systems module is probably no longer possible to use, there needs to be a new list of system definitions in TapTo itself that can be shared between platforms.
  • I don't know if libnfc even works on Windows. It looks like it will, but it's also not officially supported. If it doesn't, two major bits of work need to be done:
    • A custom driver needs to be created for the PN532 UART support.
    • The poll loops need to be abstracted from libnfc so other drivers can be swapped in (this really needs to be done in any case).
    • Support for the PC/SC standard needs to be added (another good one to do anyway, this is the preferred way to interact with NFC readers on everything besides MiSTer).

PC/SC

PC/SC is a smart card standard that is supported by many NFC readers and all major operating systems. It's a common protocol for the NFC reader to connect and communicate with a host device. In order for TapTo to have the best support for different readers and operating systems, it should support PS/SC eventually.

A PC/SC service in enabled by default on Windows, Mac[1], and most major Linux distributions.

There are several PC/SC libraries for Go, but they are not popular. Investigation will need to be done for the best fit:

None of these are exactly the same.

The PN532 is not supported by PC/SC

libnfc claims to have some amount of support for PC/SC, but upon testing it doesn't really work. The acr122u_pcsc driver is deprecated and not working, the pcsc driver is undocumented and would not work. I don't think it's wise to rely on support via libnfc.

  1. Not sure yet, but seems OS X is transitioning to a new smart card API, so Mac may have questionable support right now. But it's OK, this is the least necessary platform and should support PN532 alright.