the linux nfc subsystem - 01.org · the linux nfc subsystem samuel ortiz intel open source...

23
The Linux NFC subsystem Samuel Ortiz Intel Open Source Technology Center February 20th, 2013

Upload: others

Post on 13-Oct-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: The Linux NFC subsystem - 01.org · The Linux NFC subsystem Samuel Ortiz Intel Open Source Technology Center February 20th, 2013. 2 Agenda ... Focus on data, not on technology

The Linux NFC subsystem

Samuel OrtizIntel Open Source Technology Center

February 20th, 2013

Page 2: The Linux NFC subsystem - 01.org · The Linux NFC subsystem Samuel Ortiz Intel Open Source Technology Center February 20th, 2013. 2 Agenda ... Focus on data, not on technology

2

Agenda

● The Linux NFC architecture● The Linux NFC APIs● IVI specific uses cases and implementation

Page 3: The Linux NFC subsystem - 01.org · The Linux NFC subsystem Samuel Ortiz Intel Open Source Technology Center February 20th, 2013. 2 Agenda ... Focus on data, not on technology

3

The Linux NFC Architecture

Page 4: The Linux NFC subsystem - 01.org · The Linux NFC subsystem Samuel Ortiz Intel Open Source Technology Center February 20th, 2013. 2 Agenda ... Focus on data, not on technology

4

NFC 101

● Very short range, very low latency, very cheap● Tags and devices● 3 modes: Reader, p2p or card emulation● 4 tags family, all linked to a specific

manufacturer.● NFC Forum specified● NDEFs carry NFC payloads

Page 5: The Linux NFC subsystem - 01.org · The Linux NFC subsystem Samuel Ortiz Intel Open Source Technology Center February 20th, 2013. 2 Agenda ... Focus on data, not on technology

5

Design Objectives

● HW independence.● POSIX NFC APIs.● Consistent behavior and simple APIs.● Open development process.● NFC for non Android platforms.● Kernel/User space split.

Page 6: The Linux NFC subsystem - 01.org · The Linux NFC subsystem Samuel Ortiz Intel Open Source Technology Center February 20th, 2013. 2 Agenda ... Focus on data, not on technology

6

The overall picture

Kernel space

User space

AF_NFC Sockets

applicationneard

NFC Netlink

D-Bus API

application

NFC Core

NFC Drivers

NFC Hardware

Page 7: The Linux NFC subsystem - 01.org · The Linux NFC subsystem Samuel Ortiz Intel Open Source Technology Center February 20th, 2013. 2 Agenda ... Focus on data, not on technology

7

Neard - The NFC daemon● Tag specific handling (R/W).

● Transport protocols on top of LLCP.

● Adapter and targets management.

● NDEF parsing.

● Handover.

● D-Bus APIs.

● Plugin based.

neard core

NPP Tag R/W

D-Bus API

Handover

SNEP

LLCP RAW

BlueZ

Netlink

AF_NFC

plugins

KU

ConnMan

Page 8: The Linux NFC subsystem - 01.org · The Linux NFC subsystem Samuel Ortiz Intel Open Source Technology Center February 20th, 2013. 2 Agenda ... Focus on data, not on technology

8

The Linux NFC APIs

Page 9: The Linux NFC subsystem - 01.org · The Linux NFC subsystem Samuel Ortiz Intel Open Source Technology Center February 20th, 2013. 2 Agenda ... Focus on data, not on technology

9

Design Objectives

● System API● Provide a standard Linux networking API● Provide a netlink based out of band API

● D-Bus API● Only expose what the apps need● Simple API for a simple and intuitive technology● Offload the non NFC bits to the experts (BlueZ,

ConnMan)

Page 10: The Linux NFC subsystem - 01.org · The Linux NFC subsystem Samuel Ortiz Intel Open Source Technology Center February 20th, 2013. 2 Agenda ... Focus on data, not on technology

10

System API

● A dedicated socket domain – AF_NFC● Fully standard UNIX networking API● 2 socket protocols: LLCP and RAW● Connection less and connection oriented support

● A generic netlink name for NFC● Out of band operations● Polling, Service Name Lookups, Secure Element

handling, NFC events, etc..

Page 11: The Linux NFC subsystem - 01.org · The Linux NFC subsystem Samuel Ortiz Intel Open Source Technology Center February 20th, 2013. 2 Agenda ... Focus on data, not on technology

11

D-Bus API

● Simple, consistent and intuitive API● Focus on data, not on technology● Minimal exposure to technology details● Tight interaction with other daemons● Similarities with BlueZ or ConnMan APIs

Page 12: The Linux NFC subsystem - 01.org · The Linux NFC subsystem Samuel Ortiz Intel Open Source Technology Center February 20th, 2013. 2 Agenda ... Focus on data, not on technology

12

manager/

adapter/nfc0

adapter/nfc1

tag/nfc0/tag0

device/nfc0/device0 device

/nfc1/device0

record/nfc0/device0/record0

BlueZ(handover agent)

ConnMan(handover agent)NFC app

(NDEF agent)

Page 13: The Linux NFC subsystem - 01.org · The Linux NFC subsystem Samuel Ortiz Intel Open Source Technology Center February 20th, 2013. 2 Agenda ... Focus on data, not on technology

13

D-Bus API – Manager and Adapters

● Manager is the top level API● Handle adapters● Handle agents registration

● An adapter represents an NFC controller● Polling methods● Powered and Polling properties● Devices and Tags arrays

– Detected peers and tags (typically only one single entry)

Page 14: The Linux NFC subsystem - 01.org · The Linux NFC subsystem Samuel Ortiz Intel Open Source Technology Center February 20th, 2013. 2 Agenda ... Focus on data, not on technology

14

D-Bus API – Devices and Tags

● Adapters properties● NDEF records array property● No read method

● Read is automatically done at Tag detection time● Devices records gets update as data is received

● Data is written to Tags, pushed to Devices

Page 15: The Linux NFC subsystem - 01.org · The Linux NFC subsystem Samuel Ortiz Intel Open Source Technology Center February 20th, 2013. 2 Agenda ... Focus on data, not on technology

15

D-Bus API - Records

● One NDEF might contain several records● Tags and Devices hold an array of Records● Avoid NFC specific details● Mostly a list of properties exposing data and

meta-data

Page 16: The Linux NFC subsystem - 01.org · The Linux NFC subsystem Samuel Ortiz Intel Open Source Technology Center February 20th, 2013. 2 Agenda ... Focus on data, not on technology

16

D-Bus API – Handover Agent● Split between NFC and WiFi or Bluetooth● Neard only handles the NFC bits● Agent role:

● Implement PushOOB and RequestOOB● Register as a handover agent for a specific carrier● Initiate pairing/association when needed

Page 17: The Linux NFC subsystem - 01.org · The Linux NFC subsystem Samuel Ortiz Intel Open Source Technology Center February 20th, 2013. 2 Agenda ... Focus on data, not on technology

17

D-Bus API – Handover Agent● Handover reception

● The peer is the handover initiator● Neard asks the agent for OOB data: RequestOOB● Neard builds and sends the reply to the peer

● Handover transmission● Neard is the handover initiator● Neard asks the agent for OOB data: RequestOOB● Neard builds and send the handover request frame● Neard receives the handover reply from the peer● Neard forwards the OOB data reply: PushOOB

Page 18: The Linux NFC subsystem - 01.org · The Linux NFC subsystem Samuel Ortiz Intel Open Source Technology Center February 20th, 2013. 2 Agenda ... Focus on data, not on technology

18

D-Bus API – NDEF Agent

● Allows for proprietary NDEF handling● Agent registers for a certain NDEF type● Agent implement GetNDEF to retrieve the raw

NDEF data

Page 19: The Linux NFC subsystem - 01.org · The Linux NFC subsystem Samuel Ortiz Intel Open Source Technology Center February 20th, 2013. 2 Agenda ... Focus on data, not on technology

19

IVI use cases and implementations

Page 20: The Linux NFC subsystem - 01.org · The Linux NFC subsystem Samuel Ortiz Intel Open Source Technology Center February 20th, 2013. 2 Agenda ... Focus on data, not on technology

20

Handover focus

● Seamless Bluetooth and WiFi pairing/association● Bluetooth main device selection● Binding car seats to headsets● Wireless charging

Page 21: The Linux NFC subsystem - 01.org · The Linux NFC subsystem Samuel Ortiz Intel Open Source Technology Center February 20th, 2013. 2 Agenda ... Focus on data, not on technology

21

Bluetooth pairing implementation

● Upstream BlueZ is a neard handover agent● D-Bus implementation:

● Listen on Adapter.PropertyChanged● When a new device shows up:

– Device.Push({Type=“Handover”, Carrier=”bluetooth”)● http://git.kernel.org/?p=network/nfc/neard.git;a=blob_plain;f=test/bt-handover;hb=HEAD

Page 22: The Linux NFC subsystem - 01.org · The Linux NFC subsystem Samuel Ortiz Intel Open Source Technology Center February 20th, 2013. 2 Agenda ... Focus on data, not on technology

22

Implementation status

● Bluetooth pairing implemented● WiFi handover ready in 3-4 weeks● Main device selection needs some BlueZ

plumbing● Wireless charging is not an official spec yet

Page 23: The Linux NFC subsystem - 01.org · The Linux NFC subsystem Samuel Ortiz Intel Open Source Technology Center February 20th, 2013. 2 Agenda ... Focus on data, not on technology

23

Questions ?● NFC daemon

http://git.kernel.org/?p=network/nfc/neard.git;a=summary

● NFC kernelhttp://git.kernel.org/pub/scm/linux/kernel/git/sameo/nfc-3.0.git

● Web site● https://www.01.org/linux-nfc

● Mailing list

https://lists.01.org/mailman/listinfo/linux-nfc

[email protected]