[lkml]   [2011]   [Apr]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Subject[RFC] NFC subsystem prototype
As previously mentioned in this list, a NFC (Near Field Communication)
subsystem is required to standardize the NFC device drivers
development and create an unified userspace interface. This email
describes our NFC subsystem proposal.

The NFC protocols implementation is divided in some parts:

* The NFC subsystem in the kernel side is responsible for:
- NFC adapters management;
- Polling for targets;
- Low level data exchange;

* All the commands to access the tags data (e.g. MIFARE commands:
READ, WRITE, SECTOR_SELECT) are implemented in the userspace using the
low level data exchange provided by kernel.

* The peer-to-peer NFC protocol (LLCP) will be implemented on kernel
side in order to provide a socket interface (DGRAM and STREAM) with
userspace. The LLCP will be implemented on top of the low level data
exchange provided by NFC subsystem.

^ ^
| netlink |
v |
+---------------+ |
| nlnfc | | AF_NFC socket
+---------------+ |
^ |
| |
v v
+---------------+ +-----------------------------+
| nfccore | <--> | high-level-protocols (LLCP) |
+---------------+ +-----------------------------+
| Device driver |

In order to validate this idea, we developed a NFC subsystem prototype.
For testing purpose, we also implemented a device driver (PN533) and
an userspace test application.

The prototype implementation can be found at:

The userspace test application (list targets and read/write MIFARE
tags) can be found at:

Prototype Scope:
- Tag Reader/Writer
- Protocols: MIFARE, ISO14443, FELICA, JEWEL

Subsystem Operations:
- start poll - start polling for targets using the protocols given as parameter
- stop poll - stop polling
- activate target - activate a target for communication using a
specific protocol
- deactivate target - deactivate a target
- reset device - put the adapter in idle mode
- data exchange - low level data exchange (send and receive data)

Subsystem Event:
- targets found - report all targets found by the polling

Device Driver Interface:
The device driver interface is a direct correspondence from the NFC
subsystem interface.

User space interface:
When we were designing this subsystem, we were in doubt between
netlink (as in nl80211) and sockets (as in bluez) for userspace
communication. For this prototype, we decided to use generic netlink.

However, the netlink choice has not proven to be the best solution for
the data exchange operation. So we plan to have a new prototype
version using another solution. The options are:
- sockets for all operations as in bluez implementation;
- sockets for data exchange and keep netlink for the other operations.

Further work:
- Define subsystem operations for adapters in "target mode"
- Implement LLCP
- Add support to the "secure elements"


Lauro Ramos Venancio
INdT - Instituto Nokia de Tecnologia

 \ /
  Last update: 2011-04-07 22:55    [W:0.047 / U:2.272 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site