nfc on linux · 1 nfc on linux current status and future developments thierry escande collabora...

Post on 23-Jul-2020

3 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

1

NFC on LinuxCurrent status and future developments

Thierry EscandeCollabora

November 2nd, 2016

2

Agenda

● What is NFC● Existing stacks● Linux NFC project● Development tools● Future developments

3

What is NFC?

4

NF What ?

● Stands for Near Field Communication● Short distance communication● Limited bandwidth

5

Devices

6

Tags

● 5 different tag types● Devices can read and write● Dedicated usage for a tag

7

Use cases

8

Reading tags

9

Peer to Peer

● Communication between 2 devices● Data exchange● Handover

10

Host Card Emulation

● Device simulates a tag● Payment, ticketing, authentication● Emulation through Secure Elements

11

Existing solutions

12

Android

● User space stack● NXP and Broadcom chipsets● HCI and NCI support● Maintained by Broadcom and Google● Support all tag types● Supports LLCP and HCE modes

13

libnfc

● Academic LGPL licensed project● USB and UART devices support● Community supported● Hosted on Github

14

nfcpy

● Written in python● Nice implementation● Supported by Sony● No HCI or NCI support● USB dongles only

15

Linux NFC Project

16

Linux NFC

● Hardware independence● POSIX NFC APIs● Licensed under GPL v2● Kernel and user space separation● D-Bus APIs● Maintained by Samuel Ortiz

17

Architecture diagram

neard

NFC Netlink

User space

Kernel space

D-Bus API

AF_NFC sockets

NFC Core

Applications

NFC Drivers

NFC Hardware

seeld

18

Kernel architecture

Netlink socketAF_NFC sockets

NFC Core

NFC Drivers

NFC Hardware

DigitalNCI HCI

USB I²C SPI

PROTO_LLCP PROTO_RAW

19

Kernel architecture

● Drivers can register against:– The core stack directly

– The HCI backend

– The NCI backend

– The Digital protocol layer

● User space commands go through netlink● Dedicated socket domain for data transfer

20

User space architecture

Netlink socketAF_NFC sockets PROTO_LLCP PROTO_RAW

neard

Plugins

HandoverNPP

SNEP

TAGRead Write

User space

Kernel space

seeld

Plugins

NFCStack

TelephonyStack

SIM

21

User space architecture

● User space daemon “neard”● Secure elements daemon “seeld”● Plugin based● API Abstraction using D-Bus● Tag reading & writing● NDEF parsing● LLCP protocols● WiFi and BT handover

22

Development Tools

23

Hardware Simulation nfcsim

● Special driver declaring 2 virtual devices● Supports NFC-DEP protocol only● Act as a loopback device

– Everything sent from one device is sent back to the other one.

● Useful to debug the whole stack

24

nfctool

● List attached devices● Enable / disable devices● Start / stop poll● Set connection parameters

– Link timeout

– Receive window

– Max information unit extension

25

The sniffer

● Monitor LLCP traffic● Support decoding for

– LLCP

– SNEP

– NDEF

● Digital Layer frames decoding coming soon

26

The sniffer in action

27

Future Developments

● NCI User channel● Host Card Emulation

28

Q & A

● nfc-next kernelhttps://git.kernel.org/cgit/linux/kernel/git/sameo/nfc-next.git

● nfc-next-stable kernelhttps://github.com/tescande/linux-nfc-next-stable

● Daemonshttps://git.kernel.org/cgit/network/nfc/neard.git

● Mailing listhttps://lists.01.org/mailman/listinfo/linux-nfc

● IRC#linux-nfc on freenode

top related