€•ïLŒ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Œ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&]”uh1j hjÕhžhhŸh¶h Nubj )”}”(hŒ.stop_poll - stop on progress polling operation”h]”h¸)”}”(hjñh]”hŒ.stop_poll - stop on progress polling operation”…””}”(hjóhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h K?hjïubah}”(h]”h ]”h"]”h$]”h&]”uh1j hjÕ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”…””}”(hj hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h K@hjubah}”(h]”h ]”h"]”h$]”h&]”uh1j hjÕhžhhŸh¶h Nubj )”}”(hŒAdeactivate_target - deselect and deinitialize the selected target”h]”h¸)”}”(hjh]”hŒAdeactivate_target - deselect and deinitialize the selected target”…””}”(hj!hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h KAhjubah}”(h]”h ]”h"]”h$]”h&]”uh1j hjÕ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)”…””}”(hj8hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h KBhj4ubah}”(h]”h ]”h"]”h$]”h&]”uh1j hjÕhžhhŸh¶h Nubeh}”(h]”h ]”h"]”h$]”h&]”jYŒ*”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”…””}”(hj^hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h¦hj[hž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.”…””}”(hjlhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h KGhj[hžhubh¸)”}”(hŒCONTROL OPERATIONS:”h]”hŒCONTROL OPERATIONS:”…””}”(hjzhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h KJhj[hžhubh¸)”}”(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 KLhj[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”…””}”(hjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h KOhj™ubah}”(h]”h ]”h"]”h$]”h&]”uh1j hj–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 KPhj°ubah}”(h]”h ]”h"]”h$]”h&]”uh1j hj–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 KQhjÇubah}”(h]”h ]”h"]”h$]”h&]”uh1j hj–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 KRhjÞubah}”(h]”h ]”h"]”h$]”h&]”uh1j hj–hžhhŸh¶h Nubj )”}”(hŒ7NFC_EVENT_DEVICE_ADDED - reports an NFC device addition”h]”h¸)”}”(hjøh]”hŒ7NFC_EVENT_DEVICE_ADDED - reports an NFC device addition”…””}”(hjúhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h KThjöubah}”(h]”h ]”h"]”h$]”h&]”uh1j hj–hžhhŸh¶h Nubj )”}”(hŒ8NFC_EVENT_DEVICE_REMOVED - reports an NFC device removal”h]”h¸)”}”(hjh]”hŒ8NFC_EVENT_DEVICE_REMOVED - reports an NFC device removal”…””}”(hjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h KUhj ubah}”(h]”h ]”h"]”h$]”h&]”uh1j hj–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 KVhj$ubah}”(h]”h ]”h"]”h$]”h&]”uh1j hj–hžhhŸh¶h Nubeh}”(h]”h ]”h"]”h$]”h&]”jYjRuh1jhŸh¶h KOhj[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.”…””}”(hjBhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h KYhj[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.”…””}”(hjPhž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.”…””}”(hj^hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h Kdhj[hžhubh¸)”}”(hŒLOW-LEVEL DATA EXCHANGE:”h]”hŒLOW-LEVEL DATA EXCHANGE:”…””}”(hjlhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h Kghj[hžhubh¸)”}”(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:”…””}”(hjzhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h Kihj[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 Klhj[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 Kshj[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 Kyhj[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]”Œ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”}”(jÛjØj³j°jXjUjÓjÐuŒ nametypes”}”(jÛ‰j³‰jX‰jÓ‰uh}”(jØh£j°hÕjUj¶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.