![Page 1: NFC on Linux · 1 NFC on Linux Current status and future developments Thierry Escande Collabora November 2nd, 2016](https://reader034.vdocument.in/reader034/viewer/2022050300/5f69f9ab26a11360605554c7/html5/thumbnails/1.jpg)
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](https://reader034.vdocument.in/reader034/viewer/2022050300/5f69f9ab26a11360605554c7/html5/thumbnails/2.jpg)
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](https://reader034.vdocument.in/reader034/viewer/2022050300/5f69f9ab26a11360605554c7/html5/thumbnails/3.jpg)
3
What is NFC?
![Page 4: NFC on Linux · 1 NFC on Linux Current status and future developments Thierry Escande Collabora November 2nd, 2016](https://reader034.vdocument.in/reader034/viewer/2022050300/5f69f9ab26a11360605554c7/html5/thumbnails/4.jpg)
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](https://reader034.vdocument.in/reader034/viewer/2022050300/5f69f9ab26a11360605554c7/html5/thumbnails/5.jpg)
5
Devices
![Page 6: NFC on Linux · 1 NFC on Linux Current status and future developments Thierry Escande Collabora November 2nd, 2016](https://reader034.vdocument.in/reader034/viewer/2022050300/5f69f9ab26a11360605554c7/html5/thumbnails/6.jpg)
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](https://reader034.vdocument.in/reader034/viewer/2022050300/5f69f9ab26a11360605554c7/html5/thumbnails/7.jpg)
7
Use cases
![Page 8: NFC on Linux · 1 NFC on Linux Current status and future developments Thierry Escande Collabora November 2nd, 2016](https://reader034.vdocument.in/reader034/viewer/2022050300/5f69f9ab26a11360605554c7/html5/thumbnails/8.jpg)
8
Reading tags
![Page 9: NFC on Linux · 1 NFC on Linux Current status and future developments Thierry Escande Collabora November 2nd, 2016](https://reader034.vdocument.in/reader034/viewer/2022050300/5f69f9ab26a11360605554c7/html5/thumbnails/9.jpg)
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](https://reader034.vdocument.in/reader034/viewer/2022050300/5f69f9ab26a11360605554c7/html5/thumbnails/10.jpg)
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](https://reader034.vdocument.in/reader034/viewer/2022050300/5f69f9ab26a11360605554c7/html5/thumbnails/11.jpg)
11
Existing solutions
![Page 12: NFC on Linux · 1 NFC on Linux Current status and future developments Thierry Escande Collabora November 2nd, 2016](https://reader034.vdocument.in/reader034/viewer/2022050300/5f69f9ab26a11360605554c7/html5/thumbnails/12.jpg)
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](https://reader034.vdocument.in/reader034/viewer/2022050300/5f69f9ab26a11360605554c7/html5/thumbnails/13.jpg)
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](https://reader034.vdocument.in/reader034/viewer/2022050300/5f69f9ab26a11360605554c7/html5/thumbnails/14.jpg)
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](https://reader034.vdocument.in/reader034/viewer/2022050300/5f69f9ab26a11360605554c7/html5/thumbnails/15.jpg)
15
Linux NFC Project
![Page 16: NFC on Linux · 1 NFC on Linux Current status and future developments Thierry Escande Collabora November 2nd, 2016](https://reader034.vdocument.in/reader034/viewer/2022050300/5f69f9ab26a11360605554c7/html5/thumbnails/16.jpg)
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](https://reader034.vdocument.in/reader034/viewer/2022050300/5f69f9ab26a11360605554c7/html5/thumbnails/17.jpg)
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](https://reader034.vdocument.in/reader034/viewer/2022050300/5f69f9ab26a11360605554c7/html5/thumbnails/18.jpg)
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](https://reader034.vdocument.in/reader034/viewer/2022050300/5f69f9ab26a11360605554c7/html5/thumbnails/19.jpg)
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](https://reader034.vdocument.in/reader034/viewer/2022050300/5f69f9ab26a11360605554c7/html5/thumbnails/20.jpg)
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](https://reader034.vdocument.in/reader034/viewer/2022050300/5f69f9ab26a11360605554c7/html5/thumbnails/21.jpg)
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](https://reader034.vdocument.in/reader034/viewer/2022050300/5f69f9ab26a11360605554c7/html5/thumbnails/22.jpg)
22
Development Tools
![Page 23: NFC on Linux · 1 NFC on Linux Current status and future developments Thierry Escande Collabora November 2nd, 2016](https://reader034.vdocument.in/reader034/viewer/2022050300/5f69f9ab26a11360605554c7/html5/thumbnails/23.jpg)
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](https://reader034.vdocument.in/reader034/viewer/2022050300/5f69f9ab26a11360605554c7/html5/thumbnails/24.jpg)
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](https://reader034.vdocument.in/reader034/viewer/2022050300/5f69f9ab26a11360605554c7/html5/thumbnails/25.jpg)
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](https://reader034.vdocument.in/reader034/viewer/2022050300/5f69f9ab26a11360605554c7/html5/thumbnails/26.jpg)
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](https://reader034.vdocument.in/reader034/viewer/2022050300/5f69f9ab26a11360605554c7/html5/thumbnails/27.jpg)
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](https://reader034.vdocument.in/reader034/viewer/2022050300/5f69f9ab26a11360605554c7/html5/thumbnails/28.jpg)
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