€•åNŒsphinx.addnodes”Œdocument”“”)”}”(Œ rawsource”Œ”Œchildren”]”(Œ translations”Œ LanguagesNode”“”)”}”(hhh]”(hŒ pending_xref”“”)”}”(hhh]”Œdocutils.nodes”ŒText”“”ŒChinese (Simplified)”…””}”Œparent”hsbaŒ attributes”}”(Œids”]”Œclasses”]”Œnames”]”Œdupnames”]”Œbackrefs”]”Œ refdomain”Œstd”Œreftype”Œdoc”Œ reftarget”Œ"/translations/zh_CN/networking/nfc”Œmodname”NŒ classname”NŒ refexplicit”ˆuŒtagname”hhh ubh)”}”(hhh]”hŒChinese (Traditional)”…””}”hh2sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ"/translations/zh_TW/networking/nfc”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒItalian”…””}”hhFsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ"/translations/it_IT/networking/nfc”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒJapanese”…””}”hhZsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ"/translations/ja_JP/networking/nfc”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒKorean”…””}”hhnsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ"/translations/ko_KR/networking/nfc”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒPortuguese (Brazilian)”…””}”hh‚sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ"/translations/pt_BR/networking/nfc”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒSpanish”…””}”hh–sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ"/translations/sp_SP/networking/nfc”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubeh}”(h]”h ]”h"]”h$]”h&]”Œcurrent_language”ŒEnglish”uh1h hhŒ _document”hŒsource”NŒline”NubhŒsection”“”)”}”(hhh]”(hŒtitle”“”)”}”(hŒLinux NFC subsystem”h]”hŒLinux NFC subsystem”…””}”(hh¼h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhh·h²hh³Œ | core | +---------+ +-----------+ ^ | v +-----------+ | driver | +-----------+”h]”hX$+--------------------------------------+ | USER SPACE | +--------------------------------------+ ^ ^ | low-level | control | data exchange | operations | | | v | +-----------+ | AF_NFC | netlink | | socket +-----------+ | raw ^ | | v v +---------+ +-----------+ | rawsock | <--------> | core | +---------+ +-----------+ ^ | v +-----------+ | driver | +-----------+”…””}”hj­sbah}”(h]”h ]”h"]”h$]”h&]”Œ xml:space”Œpreserve”Œforce”‰Œlanguage”Œnone”Œhighlight_args”}”uh1j«h³hÊh´Khhéh²hubeh}”(h]”Œarchitecture-overview”ah ]”h"]”Œarchitecture overview”ah$]”h&]”uh1hµhh·h²hh³hÊh´K ubh¶)”}”(hhh]”(h»)”}”(hŒDevice Driver Interface”h]”hŒDevice Driver Interface”…””}”(hjÍh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhjÊh²hh³hÊh´K8ubhÌ)”}”(hŒÏWhen registering on the NFC subsystem, the device driver must inform the core of the set of supported NFC protocols and the set of ops callbacks. The ops callbacks that must be implemented are the following:”h]”hŒÏWhen registering on the NFC subsystem, the device driver must inform the core of the set of supported NFC protocols and the set of ops callbacks. The ops callbacks that must be implemented are the following:”…””}”(hjÛh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K:hjÊh²hubj)”}”(hhh]”(j )”}”(hŒ1start_poll - setup the device to poll for targets”h]”hÌ)”}”(hjîh]”hŒ1start_poll - setup the device to poll for targets”…””}”(hjðh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K>hjìubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjéh²hh³hÊh´Nubj )”}”(hŒ.stop_poll - stop on progress polling operation”h]”hÌ)”}”(hjh]”hŒ.stop_poll - stop on progress polling operation”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K?hjubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjéh²hh³hÊh´Nubj )”}”(hŒ@activate_target - select and initialize one of the targets found”h]”hÌ)”}”(hjh]”hŒ@activate_target - select and initialize one of the targets found”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K@hjubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjéh²hh³hÊh´Nubj )”}”(hŒAdeactivate_target - deselect and deinitialize the selected target”h]”hÌ)”}”(hj3h]”hŒAdeactivate_target - deselect and deinitialize the selected target”…””}”(hj5h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KAhj1ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjéh²hh³hÊh´Nubj )”}”(hŒJdata_exchange - send data and receive the response (transceive operation) ”h]”hÌ)”}”(hŒIdata_exchange - send data and receive the response (transceive operation)”h]”hŒIdata_exchange - send data and receive the response (transceive operation)”…””}”(hjLh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KBhjHubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjéh²hh³hÊh´Nubeh}”(h]”h ]”h"]”h$]”h&]”jmŒ*”uh1jh³hÊh´K>hjÊh²hubeh}”(h]”Œdevice-driver-interface”ah ]”h"]”Œdevice driver interface”ah$]”h&]”uh1hµhh·h²hh³hÊh´K8ubh¶)”}”(hhh]”(h»)”}”(hŒUserspace interface”h]”hŒUserspace interface”…””}”(hjrh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhjoh²hh³hÊh´KEubhÌ)”}”(hŒ_The userspace interface is divided in control operations and low-level data exchange operation.”h]”hŒ_The userspace interface is divided in control operations and low-level data exchange operation.”…””}”(hj€h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KGhjoh²hubh¶)”}”(hhh]”(h»)”}”(hŒControl operations”h]”hŒControl operations”…””}”(hj‘h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhjŽh²hh³hÊh´KKubhÌ)”}”(hŒ“Generic netlink is used to implement the interface to the control operations. The operations are composed by commands and events, all listed below:”h]”hŒ“Generic netlink is used to implement the interface to the control operations. The operations are composed by commands and events, all listed below:”…””}”(hjŸh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KMhjŽh²hubj)”}”(hhh]”(j )”}”(hŒENFC_CMD_GET_DEVICE - get specific device info or dump the device list”h]”hÌ)”}”(hj²h]”hŒENFC_CMD_GET_DEVICE - get specific device info or dump the device list”…””}”(hj´h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KPhj°ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj­h²hh³hÊh´Nubj )”}”(hŒCNFC_CMD_START_POLL - setup a specific device to polling for targets”h]”hÌ)”}”(hjÉh]”hŒCNFC_CMD_START_POLL - setup a specific device to polling for targets”…””}”(hjËh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KQhjÇubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj­h²hh³hÊh´Nubj )”}”(hŒCNFC_CMD_STOP_POLL - stop the polling operation in a specific device”h]”hÌ)”}”(hjàh]”hŒCNFC_CMD_STOP_POLL - stop the polling operation in a specific device”…””}”(hjâh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KRhjÞubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj­h²hh³hÊh´Nubj )”}”(hŒINFC_CMD_GET_TARGET - dump the list of targets found by a specific device ”h]”hÌ)”}”(hŒHNFC_CMD_GET_TARGET - dump the list of targets found by a specific device”h]”hŒHNFC_CMD_GET_TARGET - dump the list of targets found by a specific device”…””}”(hjùh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KShjõubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj­h²hh³hÊh´Nubj )”}”(hŒ7NFC_EVENT_DEVICE_ADDED - reports an NFC device addition”h]”hÌ)”}”(hjh]”hŒ7NFC_EVENT_DEVICE_ADDED - reports an NFC device addition”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KUhj ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj­h²hh³hÊh´Nubj )”}”(hŒ8NFC_EVENT_DEVICE_REMOVED - reports an NFC device removal”h]”hÌ)”}”(hj&h]”hŒ8NFC_EVENT_DEVICE_REMOVED - reports an NFC device removal”…””}”(hj(h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KVhj$ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj­h²hh³hÊh´Nubj )”}”(hŒVNFC_EVENT_TARGETS_FOUND - reports START_POLL results when 1 or more targets are found ”h]”hÌ)”}”(hŒUNFC_EVENT_TARGETS_FOUND - reports START_POLL results when 1 or more targets are found”h]”hŒUNFC_EVENT_TARGETS_FOUND - reports START_POLL results when 1 or more targets are found”…””}”(hj?h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KWhj;ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj­h²hh³hÊh´Nubeh}”(h]”h ]”h"]”h$]”h&]”jmjfuh1jh³hÊh´KPhjŽh²hubhÌ)”}”(hXfThe user must call START_POLL to poll for NFC targets, passing the desired NFC protocols through NFC_ATTR_PROTOCOLS attribute. The device remains in polling state until it finds any target. However, the user can stop the polling operation by calling STOP_POLL command. In this case, it will be checked if the requester of STOP_POLL is the same of START_POLL.”h]”hXfThe user must call START_POLL to poll for NFC targets, passing the desired NFC protocols through NFC_ATTR_PROTOCOLS attribute. The device remains in polling state until it finds any target. However, the user can stop the polling operation by calling STOP_POLL command. In this case, it will be checked if the requester of STOP_POLL is the same of START_POLL.”…””}”(hjYh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KZhjŽh²hubhÌ)”}”(hX)If the polling operation finds one or more targets, the event TARGETS_FOUND is sent (including the device id). The user must call GET_TARGET to get the list of all targets found by such device. Each reply message has target attributes with relevant information such as the supported NFC protocols.”h]”hX)If the polling operation finds one or more targets, the event TARGETS_FOUND is sent (including the device id). The user must call GET_TARGET to get the list of all targets found by such device. Each reply message has target attributes with relevant information such as the supported NFC protocols.”…””}”(hjgh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K`hjŽh²hubhÌ)”}”(hŒYAll polling operations requested through one netlink socket are stopped when it's closed.”h]”hŒ[All polling operations requested through one netlink socket are stopped when it’s closed.”…””}”(hjuh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KehjŽh²hubeh}”(h]”Œcontrol-operations”ah ]”h"]”Œcontrol operations”ah$]”h&]”uh1hµhjoh²hh³hÊh´KKubh¶)”}”(hhh]”(h»)”}”(hŒLow-level data exchange”h]”hŒLow-level data exchange”…””}”(hjŽh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhj‹h²hh³hÊh´KiubhÌ)”}”(hŒrThe userspace must use PF_NFC sockets to perform any data communication with targets. All NFC sockets use AF_NFC::”h]”hŒqThe userspace must use PF_NFC sockets to perform any data communication with targets. All NFC sockets use AF_NFC:”…””}”(hjœh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Kkhj‹h²hubj¬)”}”(hŒ€struct sockaddr_nfc { sa_family_t sa_family; __u32 dev_idx; __u32 target_idx; __u32 nfc_protocol; };”h]”hŒ€struct sockaddr_nfc { sa_family_t sa_family; __u32 dev_idx; __u32 target_idx; __u32 nfc_protocol; };”…””}”hjªsbah}”(h]”h ]”h"]”h$]”h&]”j»j¼uh1j«h³hÊh´Knhj‹h²hubhÌ)”}”(hXTTo establish a connection with one target, the user must create an NFC_SOCKPROTO_RAW socket and call the 'connect' syscall with the sockaddr_nfc struct correctly filled. All information comes from NFC_EVENT_TARGETS_FOUND netlink event. As a target can support more than one NFC protocol, the user must inform which protocol it wants to use.”h]”hXXTo establish a connection with one target, the user must create an NFC_SOCKPROTO_RAW socket and call the ‘connect’ syscall with the sockaddr_nfc struct correctly filled. All information comes from NFC_EVENT_TARGETS_FOUND netlink event. As a target can support more than one NFC protocol, the user must inform which protocol it wants to use.”…””}”(hj¸h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Kuhj‹h²hubhÌ)”}”(hŒInternally, 'connect' will result in an activate_target call to the driver. When the socket is closed, the target is deactivated.”h]”hŒ…Internally, ‘connect’ will result in an activate_target call to the driver. When the socket is closed, the target is deactivated.”…””}”(hjÆh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K{hj‹h²hubhÌ)”}”(hŒ·The data format exchanged through the sockets is NFC protocol dependent. For instance, when communicating with MIFARE tags, the data exchanged are MIFARE commands and their responses.”h]”hŒ·The data format exchanged through the sockets is NFC protocol dependent. For instance, when communicating with MIFARE tags, the data exchanged are MIFARE commands and their responses.”…””}”(hjÔh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K~hj‹h²hubhÌ)”}”(hŒ«The first received package is the response to the first sent package and so on. In order to allow valid "empty" responses, every data received has a NULL header of 1 byte.”h]”hŒ¯The first received package is the response to the first sent package and so on. In order to allow valid “empty†responses, every data received has a NULL header of 1 byte.”…””}”(hjâh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K‚hj‹h²hubeh}”(h]”Œlow-level-data-exchange”ah ]”h"]”Œlow-level data exchange”ah$]”h&]”uh1hµhjoh²hh³hÊh´Kiubeh}”(h]”Œuserspace-interface”ah ]”h"]”Œuserspace interface”ah$]”h&]”uh1hµhh·h²hh³hÊh´KEubeh}”(h]”Œlinux-nfc-subsystem”ah ]”h"]”Œlinux nfc subsystem”ah$]”h&]”uh1hµhhh²hh³hÊh´Kubeh}”(h]”h ]”h"]”h$]”h&]”Œsource”hÊuh1hŒcurrent_source”NŒ current_line”NŒsettings”Œdocutils.frontend”ŒValues”“”)”}”(hºNŒ generator”NŒ datestamp”NŒ source_link”NŒ source_url”NŒ toc_backlinks”Œentry”Œfootnote_backlinks”KŒ sectnum_xform”KŒstrip_comments”NŒstrip_elements_with_classes”NŒ strip_classes”NŒ report_level”KŒ halt_level”KŒexit_status_level”KŒdebug”NŒwarning_stream”NŒ traceback”ˆŒinput_encoding”Œ utf-8-sig”Œinput_encoding_error_handler”Œstrict”Œoutput_encoding”Œutf-8”Œoutput_encoding_error_handler”j+Œerror_encoding”Œutf-8”Œerror_encoding_error_handler”Œbackslashreplace”Œ language_code”Œen”Œrecord_dependencies”NŒconfig”NŒ id_prefix”hŒauto_id_prefix”Œid”Œ dump_settings”NŒdump_internals”NŒdump_transforms”NŒdump_pseudo_xml”NŒexpose_internals”NŒstrict_visitor”NŒ_disable_config”NŒ_source”hÊŒ _destination”NŒ _config_files”]”Œ7/var/lib/git/docbuild/linux/Documentation/docutils.conf”aŒfile_insertion_enabled”ˆŒ raw_enabled”KŒline_length_limit”M'Œpep_references”NŒ pep_base_url”Œhttps://peps.python.org/”Œpep_file_url_template”Œpep-%04d”Œrfc_references”NŒ rfc_base_url”Œ&https://datatracker.ietf.org/doc/html/”Œ tab_width”KŒtrim_footnote_reference_space”‰Œsyntax_highlight”Œlong”Œ smart_quotes”ˆŒsmartquotes_locales”]”Œcharacter_level_inline_markup”‰Œdoctitle_xform”‰Œ docinfo_xform”KŒsectsubtitle_xform”‰Œ image_loading”Œlink”Œembed_stylesheet”‰Œcloak_email_addresses”ˆŒsection_self_link”‰Œenv”NubŒreporter”NŒindirect_targets”]”Œsubstitution_defs”}”Œsubstitution_names”}”Œrefnames”}”Œrefids”}”Œnameids”}”(jjjÇjÄjljijýjújˆj…jõjòuŒ nametypes”}”(j‰jljjl‰jý‰jˆ‰jõ‰uh}”(jh·jÄhéjijÊjújoj…jŽjòj‹uŒ footnote_refs”}”Œ citation_refs”}”Œ autofootnotes”]”Œautofootnote_refs”]”Œsymbol_footnotes”]”Œsymbol_footnote_refs”]”Œ footnotes”]”Œ citations”]”Œautofootnote_start”KŒsymbol_footnote_start”KŒ id_counter”Œ collections”ŒCounter”“”}”…”R”Œparse_messages”]”Œtransform_messages”]”Œ transformer”NŒ include_log”]”Œ decoration”Nh²hub.