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

28
1 NFC on Linux Current status and future developments Thierry Escande Collabora November 2 nd , 2016

Upload: others

Post on 23-Jul-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: NFC on Linux · 1 NFC on Linux Current status and future developments Thierry Escande Collabora November 2nd, 2016

1

NFC on LinuxCurrent status and future developments

Thierry EscandeCollabora

November 2nd, 2016

Page 2: NFC on Linux · 1 NFC on Linux Current status and future developments Thierry Escande Collabora November 2nd, 2016

2

Agenda

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

Page 3: NFC on Linux · 1 NFC on Linux Current status and future developments Thierry Escande Collabora November 2nd, 2016

3

What is NFC?

Page 4: NFC on Linux · 1 NFC on Linux Current status and future developments Thierry Escande Collabora November 2nd, 2016

4

NF What ?

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

Page 5: NFC on Linux · 1 NFC on Linux Current status and future developments Thierry Escande Collabora November 2nd, 2016

5

Devices

Page 6: NFC on Linux · 1 NFC on Linux Current status and future developments Thierry Escande Collabora November 2nd, 2016

6

Tags

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

Page 7: NFC on Linux · 1 NFC on Linux Current status and future developments Thierry Escande Collabora November 2nd, 2016

7

Use cases

Page 8: NFC on Linux · 1 NFC on Linux Current status and future developments Thierry Escande Collabora November 2nd, 2016

8

Reading tags

Page 9: NFC on Linux · 1 NFC on Linux Current status and future developments Thierry Escande Collabora November 2nd, 2016

9

Peer to Peer

● Communication between 2 devices● Data exchange● Handover

Page 10: NFC on Linux · 1 NFC on Linux Current status and future developments Thierry Escande Collabora November 2nd, 2016

10

Host Card Emulation

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

Page 11: NFC on Linux · 1 NFC on Linux Current status and future developments Thierry Escande Collabora November 2nd, 2016

11

Existing solutions

Page 12: NFC on Linux · 1 NFC on Linux Current status and future developments Thierry Escande Collabora November 2nd, 2016

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

Page 13: NFC on Linux · 1 NFC on Linux Current status and future developments Thierry Escande Collabora November 2nd, 2016

13

libnfc

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

Page 14: NFC on Linux · 1 NFC on Linux Current status and future developments Thierry Escande Collabora November 2nd, 2016

14

nfcpy

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

Page 15: NFC on Linux · 1 NFC on Linux Current status and future developments Thierry Escande Collabora November 2nd, 2016

15

Linux NFC Project

Page 16: NFC on Linux · 1 NFC on Linux Current status and future developments Thierry Escande Collabora November 2nd, 2016

16

Linux NFC

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

Page 17: NFC on Linux · 1 NFC on Linux Current status and future developments Thierry Escande Collabora November 2nd, 2016

17

Architecture diagram

neard

NFC Netlink

User space

Kernel space

D-Bus API

AF_NFC sockets

NFC Core

Applications

NFC Drivers

NFC Hardware

seeld

Page 18: NFC on Linux · 1 NFC on Linux Current status and future developments Thierry Escande Collabora November 2nd, 2016

18

Kernel architecture

Netlink socketAF_NFC sockets

NFC Core

NFC Drivers

NFC Hardware

DigitalNCI HCI

USB I²C SPI

PROTO_LLCP PROTO_RAW

Page 19: NFC on Linux · 1 NFC on Linux Current status and future developments Thierry Escande Collabora November 2nd, 2016

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

Page 20: NFC on Linux · 1 NFC on Linux Current status and future developments Thierry Escande Collabora November 2nd, 2016

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

Page 21: NFC on Linux · 1 NFC on Linux Current status and future developments Thierry Escande Collabora November 2nd, 2016

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

Page 22: NFC on Linux · 1 NFC on Linux Current status and future developments Thierry Escande Collabora November 2nd, 2016

22

Development Tools

Page 23: NFC on Linux · 1 NFC on Linux Current status and future developments Thierry Escande Collabora November 2nd, 2016

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

Page 24: NFC on Linux · 1 NFC on Linux Current status and future developments Thierry Escande Collabora November 2nd, 2016

24

nfctool

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

– Link timeout

– Receive window

– Max information unit extension

Page 25: NFC on Linux · 1 NFC on Linux Current status and future developments Thierry Escande Collabora November 2nd, 2016

25

The sniffer

● Monitor LLCP traffic● Support decoding for

– LLCP

– SNEP

– NDEF

● Digital Layer frames decoding coming soon

Page 26: NFC on Linux · 1 NFC on Linux Current status and future developments Thierry Escande Collabora November 2nd, 2016

26

The sniffer in action

Page 27: NFC on Linux · 1 NFC on Linux Current status and future developments Thierry Escande Collabora November 2nd, 2016

27

Future Developments

● NCI User channel● Host Card Emulation

Page 28: NFC on Linux · 1 NFC on Linux Current status and future developments Thierry Escande Collabora November 2nd, 2016

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