€•6Œ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/driver-api/tty/index”Œ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/driver-api/tty/index”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒItalian”…”�”}”hhFsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ(/translations/it_IT/driver-api/tty/index”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒJapanese”…”�”}”hhZsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ(/translations/ja_JP/driver-api/tty/index”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒKorean”…”�”}”hhnsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ(/translations/ko_KR/driver-api/tty/index”Œ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/driver-api/tty/index”Œ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/driver-api/tty/index”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubeh}”(h]”h ]”h"]”h$]”h&]”Œcurrent_language”ŒEnglish”uh1h hhŒ _document”hŒsource”NŒline”NubhŒcomment”“”)�”}”(hŒ SPDX-License-Identifier: GPL-2.0”h]”hŒ SPDX-License-Identifier: GPL-2.0”…”�”}”hh·sbah}”(h]”h ]”h"]”h$]”h&]”Œ xml:space”Œpreserve”uh1hµhhh²hh³ŒB/var/lib/git/docbuild/linux/Documentation/driver-api/tty/index.rst”h´KubhŒsection”“”)�”}”(hhh]”(hŒtitle”“”)�”}”(hŒTTY”h]”hŒTTY”…”�”}”(hhÏh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhhÊh²hh³hÇh´KubhŒ paragraph”“”)�”}”(hŒxTeletypewriter (TTY) layer takes care of all those serial devices. Including the virtual ones like pseudoterminal (PTY).”h]”hŒxTeletypewriter (TTY) layer takes care of all those serial devices. Including the virtual ones like pseudoterminal (PTY).”…”�”}”(hhßh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´KhhÊh²hubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒTTY structures”h]”hŒTTY structures”…”�”}”(hhðh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhhíh²hh³hÇh´K ubhÞ)�”}”(hXõThere are several major TTY structures. Every TTY device in a system has a corresponding struct tty_port. These devices are maintained by a TTY driver which is struct tty_driver. This structure describes the driver but also contains a reference to operations which could be performed on the TTYs. It is struct tty_operations. Then, upon open, a struct tty_struct is allocated and lives until the final close. During this time, several callbacks from struct tty_operations are invoked by the TTY layer.”h]”hXõThere are several major TTY structures. Every TTY device in a system has a corresponding struct tty_port. These devices are maintained by a TTY driver which is struct tty_driver. This structure describes the driver but also contains a reference to operations which could be performed on the TTYs. It is struct tty_operations. Then, upon open, a struct tty_struct is allocated and lives until the final close. During this time, several callbacks from struct tty_operations are invoked by the TTY layer.”…”�”}”(hhþh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K hhíh²hubhÞ)�”}”(hXÆEvery character received by the kernel (both from devices and users) is passed through a preselected :doc:`tty_ldisc` (in short ldisc; in C, struct tty_ldisc_ops). Its task is to transform characters as defined by a particular ldisc or by user too. The default one is n_tty, implementing echoes, signal handling, jobs control, special characters processing, and more. The transformed characters are passed further to user/device, depending on the source.”h]”(hŒeEvery character received by the kernel (both from devices and users) is passed through a preselected ”…”�”}”(hj h²hh³Nh´Nubh)�”}”(hŒ:doc:`tty_ldisc`”h]”hŒinline”“”)�”}”(hjh]”hŒ tty_ldisc”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”(Œxref”Œstd”Œstd-doc”eh"]”h$]”h&]”uh1jhjubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”Œdriver-api/tty/index”Œ refdomain”j%Œreftype”Œdoc”Œ refexplicit”‰Œrefwarn”ˆŒ reftarget”Œ tty_ldisc”uh1hh³hÇh´Khj ubhXQ (in short ldisc; in C, struct tty_ldisc_ops). Its task is to transform characters as defined by a particular ldisc or by user too. The default one is n_tty, implementing echoes, signal handling, jobs control, special characters processing, and more. The transformed characters are passed further to user/device, depending on the source.”…”�”}”(hj h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´Khhíh²hubhÞ)�”}”(hŒKIn-detail description of the named TTY structures is in separate documents:”h]”hŒKIn-detail description of the named TTY structures is in separate documents:”…”�”}”(hjCh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´Khhíh²hubhŒcompound”“”)�”}”(hhh]”hŒtoctree”“”)�”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”hj1Œentries”]”(NŒdriver-api/tty/tty_driver”†”NŒdriver-api/tty/tty_port”†”NŒdriver-api/tty/tty_struct”†”NŒdriver-api/tty/tty_ldisc”†”NŒdriver-api/tty/tty_buffer”†”NŒdriver-api/tty/tty_ioctl”†”NŒdriver-api/tty/tty_internals”†”NŒdriver-api/tty/console”†”eŒ includefiles”]”(jcjejgjijkjmjojqeŒmaxdepth”KŒcaption”NŒglob”‰Œhidden”‰Œ includehidden”‰Œnumbered”KŒ titlesonly”‰Œ rawentries”]”uh1jVh³hÇh´KhjSubah}”(h]”h ]”Œtoctree-wrapper”ah"]”h$]”h&]”uh1jQhhíh²hh³hÇh´Nubeh}”(h]”Œtty-structures”ah ]”h"]”Œtty structures”ah$]”h&]”uh1hÈhhÊh²hh³hÇh´K ubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒWriting TTY Driver”h]”hŒWriting TTY Driver”…”�”}”(hj�h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhj�h²hh³hÇh´K,ubhÞ)�”}”(hXnBefore one starts writing a TTY driver, they must consider :doc:`Serial <../serial/driver>` and :doc:`USB Serial <../../usb/usb-serial>` layers first. Drivers for serial devices can often use one of these specific layers to implement a serial driver. Only special devices should be handled directly by the TTY Layer. If you are about to write such a driver, read on.”h]”(hŒ;Before one starts writing a TTY driver, they must consider ”…”�”}”(hjžh²hh³Nh´Nubh)�”}”(hŒ :doc:`Serial <../serial/driver>`”h]”j)�”}”(hj¨h]”hŒSerial”…”�”}”(hjªh²hh³Nh´Nubah}”(h]”h ]”(j$Œstd”Œstd-doc”eh"]”h$]”h&]”uh1jhj¦ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j1Œ refdomain”j´Œreftype”Œdoc”Œ refexplicit”ˆŒrefwarn”ˆj7Œ../serial/driver”uh1hh³hÇh´K.hjžubhŒ and ”…”�”}”(hjžh²hh³Nh´Nubh)�”}”(hŒ(:doc:`USB Serial <../../usb/usb-serial>`”h]”j)�”}”(hjÌh]”hŒ USB Serial”…”�”}”(hjÎh²hh³Nh´Nubah}”(h]”h ]”(j$Œstd”Œstd-doc”eh"]”h$]”h&]”uh1jhjÊubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j1Œ refdomain”jØŒreftype”Œdoc”Œ refexplicit”ˆŒrefwarn”ˆj7Œ../../usb/usb-serial”uh1hh³hÇh´K.hjžubhŒæ layers first. Drivers for serial devices can often use one of these specific layers to implement a serial driver. Only special devices should be handled directly by the TTY Layer. If you are about to write such a driver, read on.”…”�”}”(hjžh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K.hj�h²hubhÞ)�”}”(hŒ9A *typical* sequence a TTY driver performs is as follows:”h]”(hŒA ”…”�”}”(hjôh²hh³Nh´NubhŒemphasis”“”)�”}”(hŒ *typical*”h]”hŒtypical”…”�”}”(hjþh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jühjôubhŒ. sequence a TTY driver performs is as follows:”…”�”}”(hjôh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K4hj�h²hubhŒenumerated_list”“”)�”}”(hhh]”(hŒ list_item”“”)�”}”(hŒ0Allocate and register a TTY driver (module init)”h]”hÞ)�”}”(hjh]”hŒ0Allocate and register a TTY driver (module init)”…”�”}”(hj!h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K6hjubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjh²hh³hÇh´Nubj)�”}”(hŒCCreate and register TTY devices as they are probed (probe function)”h]”hÞ)�”}”(hj6h]”hŒCCreate and register TTY devices as they are probed (probe function)”…”�”}”(hj8h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K7hj4ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjh²hh³hÇh´Nubj)�”}”(hŒeHandle TTY operations and events like interrupts (TTY core invokes the former, the device the latter)”h]”hÞ)�”}”(hŒeHandle TTY operations and events like interrupts (TTY core invokes the former, the device the latter)”h]”hŒeHandle TTY operations and events like interrupts (TTY core invokes the former, the device the latter)”…”�”}”(hjOh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K8hjKubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjh²hh³hÇh´Nubj)�”}”(hŒ7Remove devices as they are going away (remove function)”h]”hÞ)�”}”(hjeh]”hŒ7Remove devices as they are going away (remove function)”…”�”}”(hjgh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K:hjcubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjh²hh³hÇh´Nubj)�”}”(hŒ1Unregister and free the TTY driver (module exit) ”h]”hÞ)�”}”(hŒ0Unregister and free the TTY driver (module exit)”h]”hŒ0Unregister and free the TTY driver (module exit)”…”�”}”(hj~h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K;hjzubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjh²hh³hÇh´Nubeh}”(h]”h ]”h"]”h$]”h&]”Œenumtype”Œarabic”Œprefix”hŒsuffix”Œ.”uh1jhj�h²hh³hÇh´K6ubhÞ)�”}”(hŒšSteps regarding driver, i.e. 1., 3., and 5. are described in detail in :doc:`tty_driver`. For the other two (devices handling), look into :doc:`tty_port`.”h]”(hŒGSteps regarding driver, i.e. 1., 3., and 5. are described in detail in ”…”�”}”(hj�h²hh³Nh´Nubh)�”}”(hŒ:doc:`tty_driver`”h]”j)�”}”(hj§h]”hŒ tty_driver”…”�”}”(hj©h²hh³Nh´Nubah}”(h]”h ]”(j$Œstd”Œstd-doc”eh"]”h$]”h&]”uh1jhj¥ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j1Œ refdomain”j³Œreftype”Œdoc”Œ refexplicit”‰Œrefwarn”ˆj7Œ tty_driver”uh1hh³hÇh´K=hj�ubhŒ2. For the other two (devices handling), look into ”…”�”}”(hj�h²hh³Nh´Nubh)�”}”(hŒ:doc:`tty_port`”h]”j)�”}”(hjËh]”hŒtty_port”…”�”}”(hjÍh²hh³Nh´Nubah}”(h]”h ]”(j$Œstd”Œstd-doc”eh"]”h$]”h&]”uh1jhjÉubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”j1Œ refdomain”j׌reftype”Œdoc”Œ refexplicit”‰Œrefwarn”ˆj7Œtty_port”uh1hh³hÇh´K=hj�ubhŒ.”…”�”}”(hj�h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K=hj�h²hubeh}”(h]”Œwriting-tty-driver”ah ]”h"]”Œwriting tty driver”ah$]”h&]”uh1hÈhhÊh²hh³hÇh´K,ubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒOther Documentation”h]”hŒOther Documentation”…”�”}”(hjþh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjûh²hh³hÇh´KBubhÞ)�”}”(hŒDMiscellaneous documentation can be further found in these documents:”h]”hŒDMiscellaneous documentation can be further found in these documents:”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´KDhjûh²hubjR)�”}”(hhh]”jW)�”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”hj1ja]”(NŒdriver-api/tty/moxa-smartio”†”NŒdriver-api/tty/n_gsm”†”NŒdriver-api/tty/n_tty”†”ejs]”(j'j)j+ejuKjvNjw‰jx‰jy‰jzKj{‰j|]”uh1jVh³hÇh´KFhjubah}”(h]”h ]”j�ah"]”h$]”h&]”uh1jQhjûh²hh³hÇh´Nubeh}”(h]”Œother-documentation”ah ]”h"]”Œother documentation”ah$]”h&]”uh1hÈhhÊh²hh³hÇh´KBubeh}”(h]”Œtty”ah ]”h"]”Œtty”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”jhŒ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”}”(jBj?jŠj‡jøjõj:j7uŒ nametypes”}”(jB‰jЉjø‰j:‰uh}”(j?hÊj‡híjõj�j7jû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.