€•Œ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/j1939”Œ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/j1939”Œ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/j1939”Œ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/j1939”Œ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/j1939”Œ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/j1939”Œ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/j1939”Œ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 OR MIT)”h]”hŒ)SPDX-License-Identifier: (GPL-2.0 OR MIT)”…”�”}”hh·sbah}”(h]”h ]”h"]”h$]”h&]”Œ xml:space”Œpreserve”uh1hµhhh²hh³Œ>/var/lib/git/docbuild/linux/Documentation/networking/j1939.rst”h´KubhŒsection”“”)�”}”(hhh]”(hŒtitle”“”)�”}”(hŒJ1939 Documentation”h]”hŒJ1939 Documentation”…”�”}”(hhÏh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhhÊh²hh³hÇh´KubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒOverview / What Is J1939”h]”hŒOverview / What Is J1939”…”�”}”(hhàh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhhÝh²hh³hÇh´KubhŒ paragraph”“”)�”}”(hXSAE J1939 defines a higher layer protocol on CAN. It implements a more sophisticated addressing scheme and extends the maximum packet size above 8 bytes. Several derived specifications exist, which differ from the original J1939 on the application level, like MilCAN A, NMEA2000, and especially ISO-11783 (ISOBUS). This last one specifies the so-called ETP (Extended Transport Protocol), which has been included in this implementation. This results in a maximum packet size of ((2 ^ 24) - 1) * 7 bytes == 111 MiB.”h]”hXSAE J1939 defines a higher layer protocol on CAN. It implements a more sophisticated addressing scheme and extends the maximum packet size above 8 bytes. Several derived specifications exist, which differ from the original J1939 on the application level, like MilCAN A, NMEA2000, and especially ISO-11783 (ISOBUS). This last one specifies the so-called ETP (Extended Transport Protocol), which has been included in this implementation. This results in a maximum packet size of ((2 ^ 24) - 1) * 7 bytes == 111 MiB.”…”�”}”(hhðh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K hhÝh²hubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒSpecifications used”h]”hŒSpecifications used”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhhþh²hh³hÇh´KubhŒ bullet_list”“”)�”}”(hhh]”(hŒ list_item”“”)�”}”(hŒSAE J1939-21 : data link layer”h]”hï)�”}”(hjh]”hŒSAE J1939-21 : data link layer”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Khjubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjh²hh³hÇh´Nubj)�”}”(hŒ!SAE J1939-81 : network management”h]”hï)�”}”(hj/h]”hŒ!SAE J1939-81 : network management”…”�”}”(hj1h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Khj-ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjh²hh³hÇh´Nubj)�”}”(hŒ>ISO 11783-6 : Virtual Terminal (Extended Transport Protocol) ”h]”hï)�”}”(hŒ=ISO 11783-6 : Virtual Terminal (Extended Transport Protocol)”h]”hŒ=ISO 11783-6 : Virtual Terminal (Extended Transport Protocol)”…”�”}”(hjHh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´KhjDubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjh²hh³hÇh´Nubeh}”(h]”h ]”h"]”h$]”h&]”Œbullet”Œ*”uh1jh³hÇh´Khhþh²hubhŒtarget”“”)�”}”(hŒ.. _j1939-motivation:”h]”h}”(h]”h ]”h"]”h$]”h&]”Œrefid”Œj1939-motivation”uh1jdh´Khhþh²hh³hÇubeh}”(h]”Œspecifications-used”ah ]”h"]”Œspecifications used”ah$]”h&]”uh1hÈhhÝh²hh³hÇh´Kubeh}”(h]”Œoverview-what-is-j1939”ah ]”h"]”Œoverview / what is j1939”ah$]”h&]”uh1hÈhhÊh²hh³hÇh´KubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒ Motivation”h]”hŒ Motivation”…”�”}”(hj…h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhj‚h²hh³hÇh´Kubhï)�”}”(hŒÄGiven the fact there's something like SocketCAN with an API similar to BSD sockets, we found some reasons to justify a kernel implementation for the addressing and transport methods used by J1939.”h]”hŒÆGiven the fact there’s something like SocketCAN with an API similar to BSD sockets, we found some reasons to justify a kernel implementation for the addressing and transport methods used by J1939.”…”�”}”(hj“h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Khj‚h²hubj)�”}”(hhh]”(j)�”}”(hXÅ**Addressing:** when a process on an ECU communicates via J1939, it should not necessarily know its source address. Although, at least one process per ECU should know the source address. Other processes should be able to reuse that address. This way, address parameters for different processes cooperating for the same ECU, are not duplicated. This way of working is closely related to the UNIX concept, where programs do just one thing and do it well. ”h]”hï)�”}”(hXÄ**Addressing:** when a process on an ECU communicates via J1939, it should not necessarily know its source address. Although, at least one process per ECU should know the source address. Other processes should be able to reuse that address. This way, address parameters for different processes cooperating for the same ECU, are not duplicated. This way of working is closely related to the UNIX concept, where programs do just one thing and do it well.”h]”(hŒstrong”“”)�”}”(hŒ**Addressing:**”h]”hŒ Addressing:”…”�”}”(hj®h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j¬hj¨ubhXµ when a process on an ECU communicates via J1939, it should not necessarily know its source address. Although, at least one process per ECU should know the source address. Other processes should be able to reuse that address. This way, address parameters for different processes cooperating for the same ECU, are not duplicated. This way of working is closely related to the UNIX concept, where programs do just one thing and do it well.”…”�”}”(hj¨h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K"hj¤ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj¡h²hh³hÇh´Nubj)�”}”(hX^**Dynamic addressing:** Address Claiming in J1939 is time critical. Furthermore, data transport should be handled properly during the address negotiation. Putting this functionality in the kernel eliminates it as a requirement for _every_ user space process that communicates via J1939. This results in a consistent J1939 bus with proper addressing. ”h]”hï)�”}”(hX]**Dynamic addressing:** Address Claiming in J1939 is time critical. Furthermore, data transport should be handled properly during the address negotiation. Putting this functionality in the kernel eliminates it as a requirement for _every_ user space process that communicates via J1939. This results in a consistent J1939 bus with proper addressing.”h]”(j­)�”}”(hŒ**Dynamic addressing:**”h]”hŒDynamic addressing:”…”�”}”(hjÔh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j¬hjÐubhXF Address Claiming in J1939 is time critical. Furthermore, data transport should be handled properly during the address negotiation. Putting this functionality in the kernel eliminates it as a requirement for _every_ user space process that communicates via J1939. This results in a consistent J1939 bus with proper addressing.”…”�”}”(hjÐh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K*hjÌubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj¡h²hh³hÇh´Nubj)�”}”(hX¬**Transport:** both TP & ETP reuse some PGNs to relay big packets over them. Different processes may thus use the same TP & ETP PGNs without actually knowing it. The individual TP & ETP sessions _must_ be serialized (synchronized) between different processes. The kernel solves this problem properly and eliminates the serialization (synchronization) as a requirement for _every_ user space process that communicates via J1939. ”h]”hï)�”}”(hX«**Transport:** both TP & ETP reuse some PGNs to relay big packets over them. Different processes may thus use the same TP & ETP PGNs without actually knowing it. The individual TP & ETP sessions _must_ be serialized (synchronized) between different processes. The kernel solves this problem properly and eliminates the serialization (synchronization) as a requirement for _every_ user space process that communicates via J1939.”h]”(j­)�”}”(hŒ**Transport:**”h]”hŒ Transport:”…”�”}”(hjúh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j¬hjöubhX� both TP & ETP reuse some PGNs to relay big packets over them. Different processes may thus use the same TP & ETP PGNs without actually knowing it. The individual TP & ETP sessions _must_ be serialized (synchronized) between different processes. The kernel solves this problem properly and eliminates the serialization (synchronization) as a requirement for _every_ user space process that communicates via J1939.”…”�”}”(hjöh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K0hjòubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj¡h²hh³hÇh´Nubeh}”(h]”h ]”h"]”h$]”h&]”jbjcuh1jh³hÇh´K"hj‚h²hubhï)�”}”(hŒÆJ1939 defines some other features (relaying, gateway, fast packet transport, ...). In-kernel code for these would not contribute to protocol stability. Therefore, these parts are left to user space.”h]”hŒÆJ1939 defines some other features (relaying, gateway, fast packet transport, ...). In-kernel code for these would not contribute to protocol stability. Therefore, these parts are left to user space.”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K7hj‚h²hubhï)�”}”(hXÄThe J1939 sockets operate on CAN network devices (see SocketCAN). Any J1939 user space library operating on CAN raw sockets will still operate properly. Since such a library does not communicate with the in-kernel implementation, care must be taken that these two do not interfere. In practice, this means they cannot share ECU addresses. A single ECU (or virtual ECU) address is used by the library exclusively, or by the in-kernel system exclusively.”h]”hXÄThe J1939 sockets operate on CAN network devices (see SocketCAN). Any J1939 user space library operating on CAN raw sockets will still operate properly. Since such a library does not communicate with the in-kernel implementation, care must be taken that these two do not interfere. In practice, this means they cannot share ECU addresses. A single ECU (or virtual ECU) address is used by the library exclusively, or by the in-kernel system exclusively.”…”�”}”(hj,h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K;hj‚h²hubeh}”(h]”(Œ motivation”jqeh ]”h"]”(Œ motivation”Œj1939-motivation”eh$]”h&]”uh1hÈhhÊh²hh³hÇh´KŒexpect_referenced_by_name”}”j@jfsŒexpect_referenced_by_id”}”jqjfsubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒJ1939 concepts”h]”hŒJ1939 concepts”…”�”}”(hjJh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjGh²hh³hÇh´KCubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒData Sent to the J1939 Stack”h]”hŒData Sent to the J1939 Stack”…”�”}”(hj[h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjXh²hh³hÇh´KFubhï)�”}”(hXaThe data buffers sent to the J1939 stack from user space are not CAN frames themselves. Instead, they are payloads that the J1939 stack converts into proper CAN frames based on the size of the buffer and the type of transfer. The size of the buffer influences how the stack processes the data and determines the internal code path used for the transfer.”h]”hXaThe data buffers sent to the J1939 stack from user space are not CAN frames themselves. Instead, they are payloads that the J1939 stack converts into proper CAN frames based on the size of the buffer and the type of transfer. The size of the buffer influences how the stack processes the data and determines the internal code path used for the transfer.”…”�”}”(hjih²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´KHhjXh²hubhï)�”}”(hŒ'**Handling of Different Buffer Sizes:**”h]”j­)�”}”(hjyh]”hŒ#Handling of Different Buffer Sizes:”…”�”}”(hj{h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j¬hjwubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´KNhjXh²hubj)�”}”(hhh]”(j)�”}”(hX+**Buffers with a size of 8 bytes or less:** - These are handled as simple sessions internally within the stack. - The stack converts the buffer directly into a single CAN frame without fragmentation. - This type of transfer does not require an actual client (receiver) on the receiving side. ”h]”(hï)�”}”(hŒ+**Buffers with a size of 8 bytes or less:**”h]”j­)�”}”(hj—h]”hŒ'Buffers with a size of 8 bytes or less:”…”�”}”(hj™h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j¬hj•ubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´KPhj‘ubj)�”}”(hhh]”(j)�”}”(hŒBThese are handled as simple sessions internally within the stack. ”h]”hï)�”}”(hŒAThese are handled as simple sessions internally within the stack.”h]”hŒAThese are handled as simple sessions internally within the stack.”…”�”}”(hj³h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´KRhj¯ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj¬ubj)�”}”(hŒVThe stack converts the buffer directly into a single CAN frame without fragmentation. ”h]”hï)�”}”(hŒUThe stack converts the buffer directly into a single CAN frame without fragmentation.”h]”hŒUThe stack converts the buffer directly into a single CAN frame without fragmentation.”…”�”}”(hjËh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´KThjÇubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj¬ubj)�”}”(hŒZThis type of transfer does not require an actual client (receiver) on the receiving side. ”h]”hï)�”}”(hŒYThis type of transfer does not require an actual client (receiver) on the receiving side.”h]”hŒYThis type of transfer does not require an actual client (receiver) on the receiving side.”…”�”}”(hjãh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´KWhjßubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj¬ubeh}”(h]”h ]”h"]”h$]”h&]”jbŒ-”uh1jh³hÇh´KRhj‘ubeh}”(h]”h ]”h"]”h$]”h&]”uh1jhjŽh²hh³Nh´Nubj)�”}”(hX¼**Buffers up to 1785 bytes:** - These are automatically handled as J1939 Transport Protocol (TP) transfers. - Internally, the stack splits the buffer into multiple 8-byte CAN frames. - TP transfers can be unicast or broadcast. - **Broadcast TP:** Does not require a receiver on the other side and can be used in broadcast scenarios. - **Unicast TP:** Requires an active receiver (client) on the other side to acknowledge the transfer. ”h]”(hï)�”}”(hŒ**Buffers up to 1785 bytes:**”h]”j­)�”}”(hj h]”hŒBuffers up to 1785 bytes:”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j¬hjubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´KZhjubj)�”}”(hhh]”(j)�”}”(hŒLThese are automatically handled as J1939 Transport Protocol (TP) transfers. ”h]”hï)�”}”(hŒKThese are automatically handled as J1939 Transport Protocol (TP) transfers.”h]”hŒKThese are automatically handled as J1939 Transport Protocol (TP) transfers.”…”�”}”(hj&h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K\hj"ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjubj)�”}”(hŒIInternally, the stack splits the buffer into multiple 8-byte CAN frames. ”h]”hï)�”}”(hŒHInternally, the stack splits the buffer into multiple 8-byte CAN frames.”h]”hŒHInternally, the stack splits the buffer into multiple 8-byte CAN frames.”…”�”}”(hj>h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K^hj:ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjubj)�”}”(hŒ*TP transfers can be unicast or broadcast. ”h]”hï)�”}”(hŒ)TP transfers can be unicast or broadcast.”h]”hŒ)TP transfers can be unicast or broadcast.”…”�”}”(hjVh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K`hjRubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjubj)�”}”(hŒh**Broadcast TP:** Does not require a receiver on the other side and can be used in broadcast scenarios. ”h]”hï)�”}”(hŒg**Broadcast TP:** Does not require a receiver on the other side and can be used in broadcast scenarios.”h]”(j­)�”}”(hŒ**Broadcast TP:**”h]”hŒ Broadcast TP:”…”�”}”(hjrh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j¬hjnubhŒV Does not require a receiver on the other side and can be used in broadcast scenarios.”…”�”}”(hjnh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Kbhjjubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjubj)�”}”(hŒd**Unicast TP:** Requires an active receiver (client) on the other side to acknowledge the transfer. ”h]”hï)�”}”(hŒc**Unicast TP:** Requires an active receiver (client) on the other side to acknowledge the transfer.”h]”(j­)�”}”(hŒ**Unicast TP:**”h]”hŒ Unicast TP:”…”�”}”(hj˜h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j¬hj”ubhŒT Requires an active receiver (client) on the other side to acknowledge the transfer.”…”�”}”(hj”h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Kehj�ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjubeh}”(h]”h ]”h"]”h$]”h&]”jbjýuh1jh³hÇh´K\hjubeh}”(h]”h ]”h"]”h$]”h&]”uh1jhjŽh²hh³Nh´Nubj)�”}”(hXÓ**Buffers from 1786 bytes up to 111 MiB:** - These are handled as ISO 11783 Extended Transport Protocol (ETP) transfers. - ETP transfers are used for larger payloads and are split into multiple CAN frames internally. - **ETP transfers (unicast):** Require a receiver on the other side to process the incoming data and acknowledge each step of the transfer. - ETP transfers cannot be broadcast like TP transfers, and always require a receiver for operation. ”h]”(hï)�”}”(hŒ***Buffers from 1786 bytes up to 111 MiB:**”h]”j­)�”}”(hjÈh]”hŒ&Buffers from 1786 bytes up to 111 MiB:”…”�”}”(hjÊh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j¬hjÆubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´KhhjÂubj)�”}”(hhh]”(j)�”}”(hŒLThese are handled as ISO 11783 Extended Transport Protocol (ETP) transfers. ”h]”hï)�”}”(hŒKThese are handled as ISO 11783 Extended Transport Protocol (ETP) transfers.”h]”hŒKThese are handled as ISO 11783 Extended Transport Protocol (ETP) transfers.”…”�”}”(hjäh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Kjhjàubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjÝubj)�”}”(hŒ^ETP transfers are used for larger payloads and are split into multiple CAN frames internally. ”h]”hï)�”}”(hŒ]ETP transfers are used for larger payloads and are split into multiple CAN frames internally.”h]”hŒ]ETP transfers are used for larger payloads and are split into multiple CAN frames internally.”…”�”}”(hjüh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Klhjøubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjÝubj)�”}”(hŒŠ**ETP transfers (unicast):** Require a receiver on the other side to process the incoming data and acknowledge each step of the transfer. ”h]”hï)�”}”(hŒ‰**ETP transfers (unicast):** Require a receiver on the other side to process the incoming data and acknowledge each step of the transfer.”h]”(j­)�”}”(hŒ**ETP transfers (unicast):**”h]”hŒETP transfers (unicast):”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j¬hjubhŒm Require a receiver on the other side to process the incoming data and acknowledge each step of the transfer.”…”�”}”(hjh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Kohjubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjÝubj)�”}”(hŒbETP transfers cannot be broadcast like TP transfers, and always require a receiver for operation. ”h]”hï)�”}”(hŒaETP transfers cannot be broadcast like TP transfers, and always require a receiver for operation.”h]”hŒaETP transfers cannot be broadcast like TP transfers, and always require a receiver for operation.”…”�”}”(hj:h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Krhj6ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjÝubeh}”(h]”h ]”h"]”h$]”h&]”jbjýuh1jh³hÇh´KjhjÂubeh}”(h]”h ]”h"]”h$]”h&]”uh1jhjŽh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”jbjýuh1jh³hÇh´KPhjXh²hubhï)�”}”(hŒ/**Non-Blocking Operation with `MSG_DONTWAIT`:**”h]”j­)�”}”(hjbh]”hŒ+Non-Blocking Operation with `MSG_DONTWAIT`:”…”�”}”(hjdh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j¬hj`ubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´KuhjXh²hubhï)�”}”(hXeThe J1939 stack supports non-blocking operation when used in combination with the `MSG_DONTWAIT` flag. In this mode, the stack attempts to take as much data as the available memory for the socket allows. It returns the amount of data that was successfully taken, and it is the responsibility of user space to monitor this value and handle partial transfers.”h]”(hŒRThe J1939 stack supports non-blocking operation when used in combination with the ”…”�”}”(hjwh²hh³Nh´NubhŒtitle_reference”“”)�”}”(hŒ`MSG_DONTWAIT`”h]”hŒ MSG_DONTWAIT”…”�”}”(hj�h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjwubhX flag. In this mode, the stack attempts to take as much data as the available memory for the socket allows. It returns the amount of data that was successfully taken, and it is the responsibility of user space to monitor this value and handle partial transfers.”…”�”}”(hjwh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´KwhjXh²hubj)�”}”(hhh]”(j)�”}”(hŒ‹If the stack cannot take the entire buffer, it returns the number of bytes successfully taken, and user space should handle the remainder. ”h]”hï)�”}”(hŒŠIf the stack cannot take the entire buffer, it returns the number of bytes successfully taken, and user space should handle the remainder.”h]”hŒŠIf the stack cannot take the entire buffer, it returns the number of bytes successfully taken, and user space should handle the remainder.”…”�”}”(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)�”}”(hXN**Error handling:** When using `MSG_DONTWAIT`, the user must rely on the error queue to detect transfer errors. See the **SO_J1939_ERRQUEUE** section for details on how to subscribe to error notifications. Without the error queue, there is no other way for user space to be notified of transfer errors during non-blocking operations. ”h]”hï)�”}”(hXM**Error handling:** When using `MSG_DONTWAIT`, the user must rely on the error queue to detect transfer errors. See the **SO_J1939_ERRQUEUE** section for details on how to subscribe to error notifications. Without the error queue, there is no other way for user space to be notified of transfer errors during non-blocking operations.”h]”(j­)�”}”(hŒ**Error handling:**”h]”hŒError handling:”…”�”}”(hj¼h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j¬hj¸ubhŒ When using ”…”�”}”(hj¸h²hh³Nh´Nubj€)�”}”(hŒ`MSG_DONTWAIT`”h]”hŒ MSG_DONTWAIT”…”�”}”(hjÎh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj¸ubhŒK, the user must rely on the error queue to detect transfer errors. See the ”…”�”}”(hj¸h²hh³Nh´Nubj­)�”}”(hŒ**SO_J1939_ERRQUEUE**”h]”hŒSO_J1939_ERRQUEUE”…”�”}”(hjàh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j¬hj¸ubhŒÀ section for details on how to subscribe to error notifications. Without the error queue, there is no other way for user space to be notified of transfer errors during non-blocking operations.”…”�”}”(hj¸h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K€hj´ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj™h²hh³hÇh´Nubeh}”(h]”h ]”h"]”h$]”h&]”jbjýuh1jh³hÇh´K}hjXh²hubhï)�”}”(hŒ**Behavior and Requirements:**”h]”j­)�”}”(hjh]”hŒBehavior and Requirements:”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j¬hjubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K†hjXh²hubj)�”}”(hhh]”(j)�”}”(hŒ®**Simple transfers (<= 8 bytes):** Do not require a receiver on the other side, making them easy to send without needing address claiming or coordination with a destination. ”h]”hï)�”}”(hŒ­**Simple transfers (<= 8 bytes):** Do not require a receiver on the other side, making them easy to send without needing address claiming or coordination with a destination.”h]”(j­)�”}”(hŒ"**Simple transfers (<= 8 bytes):**”h]”hŒSimple transfers (<= 8 bytes):”…”�”}”(hj&h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j¬hj"ubhŒ‹ Do not require a receiver on the other side, making them easy to send without needing address claiming or coordination with a destination.”…”�”}”(hj"h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Kˆhjubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjh²hh³hÇh´Nubj)�”}”(hŒ¨**Unicast TP/ETP:** Requires a receiver on the other side to complete the transfer. The receiver must acknowledge the transfer for the session to proceed successfully. ”h]”hï)�”}”(hŒ§**Unicast TP/ETP:** Requires a receiver on the other side to complete the transfer. The receiver must acknowledge the transfer for the session to proceed successfully.”h]”(j­)�”}”(hŒ**Unicast TP/ETP:**”h]”hŒUnicast TP/ETP:”…”�”}”(hjLh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j¬hjHubhŒ” Requires a receiver on the other side to complete the transfer. The receiver must acknowledge the transfer for the session to proceed successfully.”…”�”}”(hjHh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´KŒhjDubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjh²hh³hÇh´Nubj)�”}”(hŒ˜**Broadcast TP:** Allows sending data without a receiver, but only works for TP transfers. ETP cannot be broadcast and always needs a receiving client. ”h]”hï)�”}”(hŒ—**Broadcast TP:** Allows sending data without a receiver, but only works for TP transfers. ETP cannot be broadcast and always needs a receiving client.”h]”(j­)�”}”(hŒ**Broadcast TP:**”h]”hŒ Broadcast TP:”…”�”}”(hjrh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j¬hjnubhŒ† Allows sending data without a receiver, but only works for TP transfers. ETP cannot be broadcast and always needs a receiving client.”…”�”}”(hjnh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K�hjjubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjh²hh³hÇh´Nubeh}”(h]”h ]”h"]”h$]”h&]”jbjýuh1jh³hÇh´KˆhjXh²hubhï)�”}”(hX_These different behaviors depend heavily on the size of the buffer provided to the stack, and the appropriate transport mechanism (TP or ETP) is selected based on the payload size. The stack automatically manages the fragmentation and reassembly of large payloads and ensures that the correct CAN frames are generated and transmitted for each session.”h]”hX_These different behaviors depend heavily on the size of the buffer provided to the stack, and the appropriate transport mechanism (TP or ETP) is selected based on the payload size. The stack automatically manages the fragmentation and reassembly of large payloads and ensures that the correct CAN frames are generated and transmitted for each session.”…”�”}”(hj–h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K“hjXh²hubeh}”(h]”Œdata-sent-to-the-j1939-stack”ah ]”h"]”Œdata sent to the j1939 stack”ah$]”h&]”uh1hÈhjGh²hh³hÇh´KFubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒPGN”h]”hŒPGN”…”�”}”(hj¯h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhj¬h²hh³hÇh´Kšubhï)�”}”(hŒOThe J1939 protocol uses the 29-bit CAN identifier with the following structure:”h]”hŒOThe J1939 protocol uses the 29-bit CAN identifier with the following structure:”…”�”}”(hj½h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Kœhj¬h²hubhŒ block_quote”“”)�”}”(hX…============ ============== ==================== 29 bit CAN-ID -------------------------------------------------- Bit positions within the CAN-ID -------------------------------------------------- 28 ... 26 25 ... 8 7 ... 0 ============ ============== ==================== Priority PGN SA (Source Address) ============ ============== ==================== ”h]”hŒtable”“”)�”}”(hhh]”hŒtgroup”“”)�”}”(hhh]”(hŒcolspec”“”)�”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”Œcolwidth”K uh1jÛhjØubjÜ)�”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”Œcolwidth”Kuh1jÛhjØubjÜ)�”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”Œcolwidth”Kuh1jÛhjØubhŒthead”“”)�”}”(hhh]”(hŒrow”“”)�”}”(hhh]”hŒentry”“”)�”}”(hhh]”hï)�”}”(hŒ 29 bit CAN-ID”h]”hŒ 29 bit CAN-ID”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´KŸhjubah}”(h]”h ]”h"]”h$]”h&]”Œmorecols”Kuh1jhjubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjýubj)�”}”(hhh]”j)�”}”(hhh]”hï)�”}”(hŒBit positions within the CAN-ID”h]”hŒBit positions within the CAN-ID”…”�”}”(hj+h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K¡hj(ubah}”(h]”h ]”h"]”h$]”h&]”Œmorecols”Kuh1jhj%ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjýubj)�”}”(hhh]”(j)�”}”(hhh]”hï)�”}”(hŒ 28 ... 26”h]”hŒ 28 ... 26”…”�”}”(hjLh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K£hjIubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjFubj)�”}”(hhh]”hï)�”}”(hŒ25 ... 8”h]”hŒ25 ... 8”…”�”}”(hjch²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K£hj`ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjFubj)�”}”(hhh]”hï)�”}”(hŒ7 ... 0”h]”hŒ7 ... 0”…”�”}”(hjzh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K£hjwubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjFubeh}”(h]”h ]”h"]”h$]”h&]”uh1jhjýubeh}”(h]”h ]”h"]”h$]”h&]”uh1jûhjØubhŒtbody”“”)�”}”(hhh]”j)�”}”(hhh]”(j)�”}”(hhh]”hï)�”}”(hŒPriority”h]”hŒPriority”…”�”}”(hj¥h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K¥hj¢ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjŸubj)�”}”(hhh]”hï)�”}”(hŒPGN”h]”hŒPGN”…”�”}”(hj¼h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K¥hj¹ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjŸubj)�”}”(hhh]”hï)�”}”(hŒSA (Source Address)”h]”hŒSA (Source Address)”…”�”}”(hjÓh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K¥hjÐubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjŸubeh}”(h]”h ]”h"]”h$]”h&]”uh1jhjœubah}”(h]”h ]”h"]”h$]”h&]”uh1jšhjØubeh}”(h]”h ]”h"]”h$]”h&]”Œcols”Kuh1jÖhjÓubah}”(h]”h ]”h"]”h$]”h&]”uh1jÑhjÍubah}”(h]”h ]”h"]”h$]”h&]”uh1jËh³hÇh´Kžhj¬h²hubhï)�”}”(hŒbThe PGN (Parameter Group Number) is a number to identify a packet. The PGN is composed as follows:”h]”hŒbThe PGN (Parameter Group Number) is a number to identify a packet. The PGN is composed as follows:”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K¨hj¬h²hubjÌ)�”}”(hXð============ ============== ================= ================= PGN ------------------------------------------------------------------ Bit positions within the CAN-ID ------------------------------------------------------------------ 25 24 23 ... 16 15 ... 8 ============ ============== ================= ================= R (Reserved) DP (Data Page) PF (PDU Format) PS (PDU Specific) ============ ============== ================= ================= ”h]”jÒ)�”}”(hhh]”j×)�”}”(hhh]”(jÜ)�”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”Œcolwidth”K uh1jÛhjubjÜ)�”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”Œcolwidth”Kuh1jÛhjubjÜ)�”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”Œcolwidth”Kuh1jÛhjubjÜ)�”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”Œcolwidth”Kuh1jÛhjubjü)�”}”(hhh]”(j)�”}”(hhh]”j)�”}”(hhh]”hï)�”}”(hŒPGN”h]”hŒPGN”…”�”}”(hjOh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K¬hjLubah}”(h]”h ]”h"]”h$]”h&]”Œmorecols”Kuh1jhjIubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjFubj)�”}”(hhh]”j)�”}”(hhh]”hï)�”}”(hŒBit positions within the CAN-ID”h]”hŒBit positions within the CAN-ID”…”�”}”(hjph²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K®hjmubah}”(h]”h ]”h"]”h$]”h&]”Œmorecols”Kuh1jhjjubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjFubj)�”}”(hhh]”(j)�”}”(hhh]”hï)�”}”(hŒ25”h]”hŒ25”…”�”}”(hj‘h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K°hjŽubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj‹ubj)�”}”(hhh]”hï)�”}”(hŒ24”h]”hŒ24”…”�”}”(hj¨h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K°hj¥ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj‹ubj)�”}”(hhh]”hï)�”}”(hŒ 23 ... 16”h]”hŒ 23 ... 16”…”�”}”(hj¿h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K°hj¼ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj‹ubj)�”}”(hhh]”hï)�”}”(hŒ15 ... 8”h]”hŒ15 ... 8”…”�”}”(hjÖh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K°hjÓubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj‹ubeh}”(h]”h ]”h"]”h$]”h&]”uh1jhjFubeh}”(h]”h ]”h"]”h$]”h&]”uh1jûhjubj›)�”}”(hhh]”j)�”}”(hhh]”(j)�”}”(hhh]”hï)�”}”(hŒ R (Reserved)”h]”hŒ R (Reserved)”…”�”}”(hjÿh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K²hjüubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjùubj)�”}”(hhh]”hï)�”}”(hŒDP (Data Page)”h]”hŒDP (Data Page)”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K²hjubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjùubj)�”}”(hhh]”hï)�”}”(hŒPF (PDU Format)”h]”hŒPF (PDU Format)”…”�”}”(hj-h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K²hj*ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjùubj)�”}”(hhh]”hï)�”}”(hŒPS (PDU Specific)”h]”hŒPS (PDU Specific)”…”�”}”(hjDh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K²hjAubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjùubeh}”(h]”h ]”h"]”h$]”h&]”uh1jhjöubah}”(h]”h ]”h"]”h$]”h&]”uh1jšhjubeh}”(h]”h ]”h"]”h$]”h&]”Œcols”Kuh1jÖhjubah}”(h]”h ]”h"]”h$]”h&]”uh1jÑhjubah}”(h]”h ]”h"]”h$]”h&]”uh1jËh³hÇh´K«hj¬h²hubhï)�”}”(hX!In J1939-21 distinction is made between PDU1 format (where PF < 240) and PDU2 format (where PF >= 240). Furthermore, when using the PDU2 format, the PS-field contains a so-called Group Extension, which is part of the PGN. When using PDU2 format, the Group Extension is set in the PS-field.”h]”hX!In J1939-21 distinction is made between PDU1 format (where PF < 240) and PDU2 format (where PF >= 240). Furthermore, when using the PDU2 format, the PS-field contains a so-called Group Extension, which is part of the PGN. When using PDU2 format, the Group Extension is set in the PS-field.”…”�”}”(hjwh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Kµhj¬h²hubjÌ)�”}”(hX¢============== ======================== PDU1 Format (specific) (peer to peer) ---------------------------------------- Bit positions within the CAN-ID ---------------------------------------- 23 ... 16 15 ... 8 ============== ======================== 00h ... EFh DA (Destination address) ============== ======================== ============== ======================== PDU2 Format (global) (broadcast) ---------------------------------------- Bit positions within the CAN-ID ---------------------------------------- 23 ... 16 15 ... 8 ============== ======================== F0h ... FFh GE (Group Extension) ============== ======================== ”h]”(jÒ)�”}”(hhh]”j×)�”}”(hhh]”(jÜ)�”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”Œcolwidth”Kuh1jÛhjŒubjÜ)�”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”Œcolwidth”Kuh1jÛhjŒubjü)�”}”(hhh]”(j)�”}”(hhh]”j)�”}”(hhh]”hï)�”}”(hŒ%PDU1 Format (specific) (peer to peer)”h]”hŒ%PDU1 Format (specific) (peer to peer)”…”�”}”(hj¬h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K»hj©ubah}”(h]”h ]”h"]”h$]”h&]”Œmorecols”Kuh1jhj¦ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj£ubj)�”}”(hhh]”j)�”}”(hhh]”hï)�”}”(hŒBit positions within the CAN-ID”h]”hŒBit positions within the CAN-ID”…”�”}”(hjÍh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K½hjÊubah}”(h]”h ]”h"]”h$]”h&]”Œmorecols”Kuh1jhjÇubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj£ubj)�”}”(hhh]”(j)�”}”(hhh]”hï)�”}”(hŒ 23 ... 16”h]”hŒ 23 ... 16”…”�”}”(hjîh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K¿hjëubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjèubj)�”}”(hhh]”hï)�”}”(hŒ15 ... 8”h]”hŒ15 ... 8”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´K¿hj ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjèubeh}”(h]”h ]”h"]”h$]”h&]”uh1jhj£ubeh}”(h]”h ]”h"]”h$]”h&]”uh1jûhjŒubj›)�”}”(hhh]”j)�”}”(hhh]”(j)�”}”(hhh]”hï)�”}”(hŒ 00h ... EFh”h]”hŒ 00h ... EFh”…”�”}”(hj. h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´KÁhj+ ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj( ubj)�”}”(hhh]”hï)�”}”(hŒDA (Destination address)”h]”hŒDA (Destination address)”…”�”}”(hjE h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´KÁhjB ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj( ubeh}”(h]”h ]”h"]”h$]”h&]”uh1jhj% ubah}”(h]”h ]”h"]”h$]”h&]”uh1jšhjŒubeh}”(h]”h ]”h"]”h$]”h&]”Œcols”Kuh1jÖhj‰ubah}”(h]”h ]”h"]”h$]”h&]”uh1jÑhj…ubjÒ)�”}”(hhh]”j×)�”}”(hhh]”(jÜ)�”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”Œcolwidth”Kuh1jÛhju ubjÜ)�”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”Œcolwidth”Kuh1jÛhju ubjü)�”}”(hhh]”(j)�”}”(hhh]”j)�”}”(hhh]”hï)�”}”(hŒ PDU2 Format (global) (broadcast)”h]”hŒ PDU2 Format (global) (broadcast)”…”�”}”(hj• h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´KÅhj’ ubah}”(h]”h ]”h"]”h$]”h&]”Œmorecols”Kuh1jhj� ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjŒ ubj)�”}”(hhh]”j)�”}”(hhh]”hï)�”}”(hŒBit positions within the CAN-ID”h]”hŒBit positions within the CAN-ID”…”�”}”(hj¶ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´KÇhj³ ubah}”(h]”h ]”h"]”h$]”h&]”Œmorecols”Kuh1jhj° ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjŒ ubj)�”}”(hhh]”(j)�”}”(hhh]”hï)�”}”(hŒ 23 ... 16”h]”hŒ 23 ... 16”…”�”}”(hj× h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´KÉhjÔ ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjÑ ubj)�”}”(hhh]”hï)�”}”(hŒ15 ... 8”h]”hŒ15 ... 8”…”�”}”(hjî h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´KÉhjë ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjÑ ubeh}”(h]”h ]”h"]”h$]”h&]”uh1jhjŒ ubeh}”(h]”h ]”h"]”h$]”h&]”uh1jûhju ubj›)�”}”(hhh]”j)�”}”(hhh]”(j)�”}”(hhh]”hï)�”}”(hŒ F0h ... FFh”h]”hŒ F0h ... FFh”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´KËhj ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj ubj)�”}”(hhh]”hï)�”}”(hŒGE (Group Extension)”h]”hŒGE (Group Extension)”…”�”}”(hj. h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´KËhj+ ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj ubeh}”(h]”h ]”h"]”h$]”h&]”uh1jhj ubah}”(h]”h ]”h"]”h$]”h&]”uh1jšhju ubeh}”(h]”h ]”h"]”h$]”h&]”Œcols”Kuh1jÖhjr ubah}”(h]”h ]”h"]”h$]”h&]”uh1jÑhj…ubeh}”(h]”h ]”h"]”h$]”h&]”uh1jËh³hÇh´Kºhj¬h²hubhï)�”}”(hX;On the other hand, when using PDU1 format, the PS-field contains a so-called Destination Address, which is _not_ part of the PGN. When communicating a PGN from user space to kernel (or vice versa) and PDU1 format is used, the PS-field of the PGN shall be set to zero. The Destination Address shall be set elsewhere.”h]”hX;On the other hand, when using PDU1 format, the PS-field contains a so-called Destination Address, which is _not_ part of the PGN. When communicating a PGN from user space to kernel (or vice versa) and PDU1 format is used, the PS-field of the PGN shall be set to zero. The Destination Address shall be set elsewhere.”…”�”}”(hja h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´KÎhj¬h²hubhï)�”}”(hŒ–Regarding PGN mapping to 29-bit CAN identifier, the Destination Address shall be get/set from/to the appropriate bits of the identifier by the kernel.”h]”hŒ–Regarding PGN mapping to 29-bit CAN identifier, the Destination Address shall be get/set from/to the appropriate bits of the identifier by the kernel.”…”�”}”(hjo h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´KÔhj¬h²hubeh}”(h]”Œpgn”ah ]”h"]”Œpgn”ah$]”h&]”uh1hÈhjGh²hh³hÇh´KšubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒ Addressing”h]”hŒ Addressing”…”�”}”(hjˆ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhj… h²hh³hÇh´KÙubhï)�”}”(hŒ7Both static and dynamic addressing methods can be used.”h]”hŒ7Both static and dynamic addressing methods can be used.”…”�”}”(hj– h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´KÛhj… h²hubhï)�”}”(hŒ¢For static addresses, no extra checks are made by the kernel and provided addresses are considered right. This responsibility is for the OEM or system integrator.”h]”hŒ¢For static addresses, no extra checks are made by the kernel and provided addresses are considered right. This responsibility is for the OEM or system integrator.”…”�”}”(hj¤ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´KÝhj… h²hubhï)�”}”(hXtFor dynamic addressing, so-called Address Claiming, extra support is foreseen in the kernel. In J1939 any ECU is known by its 64-bit NAME. At the moment of a successful address claim, the kernel keeps track of both NAME and source address being claimed. This serves as a base for filter schemes. By default, packets with a destination that is not locally will be rejected.”h]”hXtFor dynamic addressing, so-called Address Claiming, extra support is foreseen in the kernel. In J1939 any ECU is known by its 64-bit NAME. At the moment of a successful address claim, the kernel keeps track of both NAME and source address being claimed. This serves as a base for filter schemes. By default, packets with a destination that is not locally will be rejected.”…”�”}”(hj² h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Káhj… h²hubhï)�”}”(hŒÑMixed mode packets (from a static to a dynamic address or vice versa) are allowed. The BSD sockets define separate API calls for getting/setting the local & remote address and are applicable for J1939 sockets.”h]”hŒÑMixed mode packets (from a static to a dynamic address or vice versa) are allowed. The BSD sockets define separate API calls for getting/setting the local & remote address and are applicable for J1939 sockets.”…”�”}”(hjÀ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Kçhj… h²hubeh}”(h]”Œ addressing”ah ]”h"]”Œ addressing”ah$]”h&]”uh1hÈhjGh²hh³hÇh´KÙubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒ Filtering”h]”hŒ Filtering”…”�”}”(hjÙ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjÖ h²hh³hÇh´Kìubhï)�”}”(hŒ�J1939 defines white list filters per socket that a user can set in order to receive a subset of the J1939 traffic. Filtering can be based on:”h]”hŒ�J1939 defines white list filters per socket that a user can set in order to receive a subset of the J1939 traffic. Filtering can be based on:”…”�”}”(hjç h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´KîhjÖ h²hubj)�”}”(hhh]”(j)�”}”(hŒSA”h]”hï)�”}”(hjú h]”hŒSA”…”�”}”(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Œ SOURCE_NAME”h]”hï)�”}”(hj h]”hŒ SOURCE_NAME”…”�”}”(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ŒPGN ”h]”hï)�”}”(hŒPGN”h]”hŒPGN”…”�”}”(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´Nubeh}”(h]”h ]”h"]”h$]”h&]”jbjcuh1jh³hÇh´KñhjÖ h²hubhï)�”}”(hŒ¦When multiple filters are in place for a single socket, and a packet comes in that matches several of those filters, the packet is only received once for that socket.”h]”hŒ¦When multiple filters are in place for a single socket, and a packet comes in that matches several of those filters, the packet is only received once for that socket.”…”�”}”(hjD h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´KõhjÖ h²hubeh}”(h]”Œ filtering”ah ]”h"]”Œ filtering”ah$]”h&]”uh1hÈhjGh²hh³hÇh´Kìubeh}”(h]”Œj1939-concepts”ah ]”h"]”Œj1939 concepts”ah$]”h&]”uh1hÈhhÊh²hh³hÇh´KCubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒHow to Use J1939”h]”hŒHow to Use J1939”…”�”}”(hje h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjb h²hh³hÇh´KúubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒ API Calls”h]”hŒ API Calls”…”�”}”(hjv h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjs h²hh³hÇh´Kýubhï)�”}”(hŒÈOn CAN, you first need to open a socket for communicating over a CAN network. To use J1939, ``#include ``. From there, ```` will be included too. To open a socket, use:”h]”(hŒ\On CAN, you first need to open a socket for communicating over a CAN network. To use J1939, ”…”�”}”(hj„ h²hh³Nh´NubhŒliteral”“”)�”}”(hŒ ``#include ``”h]”hŒ#include ”…”�”}”(hjŽ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj„ ubhŒ. From there, ”…”�”}”(hj„ h²hh³Nh´Nubj� )�”}”(hŒ````”h]”hŒ ”…”�”}”(hj  h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj„ ubhŒ- will be included too. To open a socket, use:”…”�”}”(hj„ h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Kÿhjs h²hubhŒ literal_block”“”)�”}”(hŒ*s = socket(PF_CAN, SOCK_DGRAM, CAN_J1939);”h]”hŒ*s = socket(PF_CAN, SOCK_DGRAM, CAN_J1939);”…”�”}”hjº sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆŒforce”‰Œlanguage”ŒC”Œhighlight_args”}”uh1j¸ h³hÇh´Mhjs h²hubhï)�”}”(hŒ÷J1939 does use ``SOCK_DGRAM`` sockets. In the J1939 specification, connections are mentioned in the context of transport protocol sessions. These still deliver packets to the other end (using several CAN packets). ``SOCK_STREAM`` is not supported.”h]”(hŒJ1939 does use ”…”�”}”(hjÍ h²hh³Nh´Nubj� )�”}”(hŒ``SOCK_DGRAM``”h]”hŒ SOCK_DGRAM”…”�”}”(hjÕ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjÍ ubhŒ¹ sockets. In the J1939 specification, connections are mentioned in the context of transport protocol sessions. These still deliver packets to the other end (using several CAN packets). ”…”�”}”(hjÍ h²hh³Nh´Nubj� )�”}”(hŒ``SOCK_STREAM``”h]”hŒ SOCK_STREAM”…”�”}”(hjç h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjÍ ubhŒ is not supported.”…”�”}”(hjÍ h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Mhjs h²hubhï)�”}”(hX³After the successful creation of the socket, you would normally use the ``bind(2)`` and/or ``connect(2)`` system call to bind the socket to a CAN interface. After binding and/or connecting the socket, you can ``read(2)`` and ``write(2)`` from/to the socket or use ``send(2)``, ``sendto(2)``, ``sendmsg(2)`` and the ``recv*()`` counterpart operations on the socket as usual. There are also J1939 specific socket options described below.”h]”(hŒHAfter the successful creation of the socket, you would normally use the ”…”�”}”(hjÿ h²hh³Nh´Nubj� )�”}”(hŒ ``bind(2)``”h]”hŒbind(2)”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjÿ ubhŒ and/or ”…”�”}”(hjÿ h²hh³Nh´Nubj� )�”}”(hŒ``connect(2)``”h]”hŒ connect(2)”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjÿ ubhŒh system call to bind the socket to a CAN interface. After binding and/or connecting the socket, you can ”…”�”}”(hjÿ h²hh³Nh´Nubj� )�”}”(hŒ ``read(2)``”h]”hŒread(2)”…”�”}”(hj+ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjÿ ubhŒ and ”…”�”}”(hjÿ h²hh³Nh´Nubj� )�”}”(hŒ ``write(2)``”h]”hŒwrite(2)”…”�”}”(hj= h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjÿ ubhŒ from/to the socket or use ”…”�”}”(hjÿ h²hh³Nh´Nubj� )�”}”(hŒ ``send(2)``”h]”hŒsend(2)”…”�”}”(hjO h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjÿ ubhŒ, ”…”�”}”(hjÿ h²hh³Nh´Nubj� )�”}”(hŒ ``sendto(2)``”h]”hŒ sendto(2)”…”�”}”(hja h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjÿ ubhŒ, ”…”�”}”hjÿ sbj� )�”}”(hŒ``sendmsg(2)``”h]”hŒ sendmsg(2)”…”�”}”(hjs h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjÿ ubhŒ and the ”…”�”}”(hjÿ h²hh³Nh´Nubj� )�”}”(hŒ ``recv*()``”h]”hŒrecv*()”…”�”}”(hj… h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjÿ ubhŒm counterpart operations on the socket as usual. There are also J1939 specific socket options described below.”…”�”}”(hjÿ h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M hjs h²hubhï)�”}”(hŒpIn order to send data, a ``bind(2)`` must have been successful. ``bind(2)`` assigns a local address to a socket.”h]”(hŒIn order to send data, a ”…”�”}”(hj� h²hh³Nh´Nubj� )�”}”(hŒ ``bind(2)``”h]”hŒbind(2)”…”�”}”(hj¥ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj� ubhŒ must have been successful. ”…”�”}”(hj� h²hh³Nh´Nubj� )�”}”(hŒ ``bind(2)``”h]”hŒbind(2)”…”�”}”(hj· h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj� ubhŒ% assigns a local address to a socket.”…”�”}”(hj� h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Mhjs h²hubhï)�”}”(hXDifferent from CAN is that the payload data is just the data that get sends, without its header info. The header info is derived from the sockaddr supplied to ``bind(2)``, ``connect(2)``, ``sendto(2)`` and ``recvfrom(2)``. A ``write(2)`` with size 4 will result in a packet with 4 bytes.”h]”(hŒŸDifferent from CAN is that the payload data is just the data that get sends, without its header info. The header info is derived from the sockaddr supplied to ”…”�”}”(hjÏ h²hh³Nh´Nubj� )�”}”(hŒ ``bind(2)``”h]”hŒbind(2)”…”�”}”(hj× h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjÏ ubhŒ, ”…”�”}”(hjÏ h²hh³Nh´Nubj� )�”}”(hŒ``connect(2)``”h]”hŒ connect(2)”…”�”}”(hjé h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjÏ ubhŒ, ”…”�”}”hjÏ sbj� )�”}”(hŒ ``sendto(2)``”h]”hŒ sendto(2)”…”�”}”(hjû h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjÏ ubhŒ and ”…”�”}”(hjÏ h²hh³Nh´Nubj� )�”}”(hŒ``recvfrom(2)``”h]”hŒ recvfrom(2)”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjÏ ubhŒ. A ”…”�”}”(hjÏ h²hh³Nh´Nubj� )�”}”(hŒ ``write(2)``”h]”hŒwrite(2)”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjÏ ubhŒ2 with size 4 will result in a packet with 4 bytes.”…”�”}”(hjÏ h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Mhjs h²hubhï)�”}”(hŒLThe sockaddr structure has extensions for use with J1939 as specified below:”h]”hŒLThe sockaddr structure has extensions for use with J1939 as specified below:”…”�”}”(hj7 h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Mhjs h²hubj¹ )�”}”(hX‹struct sockaddr_can { sa_family_t can_family; int can_ifindex; union { struct { __u64 name; /* pgn: * 8 bit: PS in PDU2 case, else 0 * 8 bit: PF * 1 bit: DP * 1 bit: reserved */ __u32 pgn; __u8 addr; } j1939; } can_addr; }”h]”hX‹struct sockaddr_can { sa_family_t can_family; int can_ifindex; union { struct { __u64 name; /* pgn: * 8 bit: PS in PDU2 case, else 0 * 8 bit: PF * 1 bit: DP * 1 bit: reserved */ __u32 pgn; __u8 addr; } j1939; } can_addr; }”…”�”}”hjE sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆjÈ ‰jÉ jÊ jË }”uh1j¸ h³hÇh´Mhjs h²hubhï)�”}”(hŒW``can_family`` & ``can_ifindex`` serve the same purpose as for other SocketCAN sockets.”h]”(j� )�”}”(hŒ``can_family``”h]”hŒ can_family”…”�”}”(hjX h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjT ubhŒ & ”…”�”}”(hjT h²hh³Nh´Nubj� )�”}”(hŒ``can_ifindex``”h]”hŒ can_ifindex”…”�”}”(hjj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjT ubhŒ7 serve the same purpose as for other SocketCAN sockets.”…”�”}”(hjT h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M1hjs h²hubhï)�”}”(hŒ\``can_addr.j1939.pgn`` specifies the PGN (max 0x3ffff). Individual bits are specified above.”h]”(j� )�”}”(hŒ``can_addr.j1939.pgn``”h]”hŒcan_addr.j1939.pgn”…”�”}”(hj† h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj‚ ubhŒF specifies the PGN (max 0x3ffff). Individual bits are specified above.”…”�”}”(hj‚ h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M3hjs h²hubhï)�”}”(hŒ7``can_addr.j1939.name`` contains the 64-bit J1939 NAME.”h]”(j� )�”}”(hŒ``can_addr.j1939.name``”h]”hŒcan_addr.j1939.name”…”�”}”(hj¢ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjž ubhŒ contains the 64-bit J1939 NAME.”…”�”}”(hjž h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M6hjs h²hubhï)�”}”(hŒ-``can_addr.j1939.addr`` contains the address.”h]”(j� )�”}”(hŒ``can_addr.j1939.addr``”h]”hŒcan_addr.j1939.addr”…”�”}”(hj¾ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjº ubhŒ contains the address.”…”�”}”(hjº h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M8hjs h²hubhï)�”}”(hXãThe ``bind(2)`` system call assigns the local address, i.e. the source address when sending packages. If a PGN during ``bind(2)`` is set, it's used as a RX filter. I.e. only packets with a matching PGN are received. If an ADDR or NAME is set it is used as a receive filter, too. It will match the destination NAME or ADDR of the incoming packet. The NAME filter will work only if appropriate Address Claiming for this name was done on the CAN bus and registered/cached by the kernel.”h]”(hŒThe ”…”�”}”(hjÖ h²hh³Nh´Nubj� )�”}”(hŒ ``bind(2)``”h]”hŒbind(2)”…”�”}”(hjÞ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjÖ ubhŒg system call assigns the local address, i.e. the source address when sending packages. If a PGN during ”…”�”}”(hjÖ h²hh³Nh´Nubj� )�”}”(hŒ ``bind(2)``”h]”hŒbind(2)”…”�”}”(hjð h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjÖ ubhXd is set, it’s used as a RX filter. I.e. only packets with a matching PGN are received. If an ADDR or NAME is set it is used as a receive filter, too. It will match the destination NAME or ADDR of the incoming packet. The NAME filter will work only if appropriate Address Claiming for this name was done on the CAN bus and registered/cached by the kernel.”…”�”}”(hjÖ h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M:hjs h²hubhï)�”}”(hXƒOn the other hand ``connect(2)`` assigns the remote address, i.e. the destination address. The PGN from ``connect(2)`` is used as the default PGN when sending packets. If ADDR or NAME is set it will be used as the default destination ADDR or NAME. Further a set ADDR or NAME during ``connect(2)`` is used as a receive filter. It will match the source NAME or ADDR of the incoming packet.”h]”(hŒOn the other hand ”…”�”}”(hjh²hh³Nh´Nubj� )�”}”(hŒ``connect(2)``”h]”hŒ connect(2)”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjubhŒH assigns the remote address, i.e. the destination address. The PGN from ”…”�”}”(hjh²hh³Nh´Nubj� )�”}”(hŒ``connect(2)``”h]”hŒ connect(2)”…”�”}”(hj"h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjubhŒ¤ is used as the default PGN when sending packets. If ADDR or NAME is set it will be used as the default destination ADDR or NAME. Further a set ADDR or NAME during ”…”�”}”(hjh²hh³Nh´Nubj� )�”}”(hŒ``connect(2)``”h]”hŒ connect(2)”…”�”}”(hj4h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjubhŒ[ is used as a receive filter. It will match the source NAME or ADDR of the incoming packet.”…”�”}”(hjh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MBhjs h²hubhï)�”}”(hŒ¼Both ``write(2)`` and ``send(2)`` will send a packet with local address from ``bind(2)`` and the remote address from ``connect(2)``. Use ``sendto(2)`` to overwrite the destination address.”h]”(hŒBoth ”…”�”}”(hjLh²hh³Nh´Nubj� )�”}”(hŒ ``write(2)``”h]”hŒwrite(2)”…”�”}”(hjTh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjLubhŒ and ”…”�”}”(hjLh²hh³Nh´Nubj� )�”}”(hŒ ``send(2)``”h]”hŒsend(2)”…”�”}”(hjfh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjLubhŒ, will send a packet with local address from ”…”�”}”(hjLh²hh³Nh´Nubj� )�”}”(hŒ ``bind(2)``”h]”hŒbind(2)”…”�”}”(hjxh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjLubhŒ and the remote address from ”…”�”}”(hjLh²hh³Nh´Nubj� )�”}”(hŒ``connect(2)``”h]”hŒ connect(2)”…”�”}”(hjŠh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjLubhŒ. Use ”…”�”}”(hjLh²hh³Nh´Nubj� )�”}”(hŒ ``sendto(2)``”h]”hŒ sendto(2)”…”�”}”(hjœh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjLubhŒ& to overwrite the destination address.”…”�”}”(hjLh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MHhjs h²hubhï)�”}”(hŒ¿If ``can_addr.j1939.name`` is set (!= 0) the NAME is looked up by the kernel and the corresponding ADDR is used. If ``can_addr.j1939.name`` is not set (== 0), ``can_addr.j1939.addr`` is used.”h]”(hŒIf ”…”�”}”(hj´h²hh³Nh´Nubj� )�”}”(hŒ``can_addr.j1939.name``”h]”hŒcan_addr.j1939.name”…”�”}”(hj¼h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj´ubhŒZ is set (!= 0) the NAME is looked up by the kernel and the corresponding ADDR is used. If ”…”�”}”(hj´h²hh³Nh´Nubj� )�”}”(hŒ``can_addr.j1939.name``”h]”hŒcan_addr.j1939.name”…”�”}”(hjÎh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj´ubhŒ is not set (== 0), ”…”�”}”(hj´h²hh³Nh´Nubj� )�”}”(hŒ``can_addr.j1939.addr``”h]”hŒcan_addr.j1939.addr”…”�”}”(hjàh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj´ubhŒ is used.”…”�”}”(hj´h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MLhjs h²hubhï)�”}”(hŒ}When creating a socket, reasonable defaults are set. Some options can be modified with ``setsockopt(2)`` & ``getsockopt(2)``.”h]”(hŒWWhen creating a socket, reasonable defaults are set. Some options can be modified with ”…”�”}”(hjøh²hh³Nh´Nubj� )�”}”(hŒ``setsockopt(2)``”h]”hŒ setsockopt(2)”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjøubhŒ & ”…”�”}”(hjøh²hh³Nh´Nubj� )�”}”(hŒ``getsockopt(2)``”h]”hŒ getsockopt(2)”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjøubhŒ.”…”�”}”(hjøh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MPhjs h²hubhï)�”}”(hŒRX path related options:”h]”hŒRX path related options:”…”�”}”(hj*h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MShjs h²hubj)�”}”(hhh]”(j)�”}”(hŒ0``SO_J1939_FILTER`` - configure array of filters”h]”hï)�”}”(hj=h]”(j� )�”}”(hŒ``SO_J1939_FILTER``”h]”hŒSO_J1939_FILTER”…”�”}”(hjBh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj?ubhŒ - configure array of filters”…”�”}”(hj?h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MUhj;ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj8h²hh³hÇh´Nubj)�”}”(hŒM``SO_J1939_PROMISC`` - disable filters set by ``bind(2)`` and ``connect(2)`` ”h]”hï)�”}”(hŒL``SO_J1939_PROMISC`` - disable filters set by ``bind(2)`` and ``connect(2)``”h]”(j� )�”}”(hŒ``SO_J1939_PROMISC``”h]”hŒSO_J1939_PROMISC”…”�”}”(hjhh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjdubhŒ - disable filters set by ”…”�”}”(hjdh²hh³Nh´Nubj� )�”}”(hŒ ``bind(2)``”h]”hŒbind(2)”…”�”}”(hjzh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjdubhŒ and ”…”�”}”(hjdh²hh³Nh´Nubj� )�”}”(hŒ``connect(2)``”h]”hŒ connect(2)”…”�”}”(hjŒh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjdubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MVhj`ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj8h²hh³hÇh´Nubeh}”(h]”h ]”h"]”h$]”h&]”jbjýuh1jh³hÇh´MUhjs h²hubhï)�”}”(hŒ‘By default no broadcast packets can be send or received. To enable sending or receiving broadcast packets use the socket option ``SO_BROADCAST``:”h]”(hŒ€By default no broadcast packets can be send or received. To enable sending or receiving broadcast packets use the socket option ”…”�”}”(hj¬h²hh³Nh´Nubj� )�”}”(hŒ``SO_BROADCAST``”h]”hŒ SO_BROADCAST”…”�”}”(hj´h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj¬ubhŒ:”…”�”}”(hj¬h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MXhjs h²hubj¹ )�”}”(hŒQint value = 1; setsockopt(sock, SOL_SOCKET, SO_BROADCAST, &value, sizeof(value));”h]”hŒQint value = 1; setsockopt(sock, SOL_SOCKET, SO_BROADCAST, &value, sizeof(value));”…”�”}”hjÌsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆjÈ ‰jÉ jÊ jË }”uh1j¸ h³hÇh´M[hjs h²hubhï)�”}”(hŒ.The following diagram illustrates the RX path:”h]”hŒ.The following diagram illustrates the RX path:”…”�”}”(hjÛh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M`hjs h²hubj¹ )�”}”(hX� +--------------------+ | incoming packet | +--------------------+ | V +--------------------+ | SO_J1939_PROMISC? | +--------------------+ | | no | | yes | | .---------' `---------. | | +---------------------------+ | | bind() + connect() + | | | SOCK_BROADCAST filter | | +---------------------------+ | | | |<---------------------' V +---------------------------+ | SO_J1939_FILTER | +---------------------------+ | V +---------------------------+ | socket recv() | +---------------------------+”h]”hX� +--------------------+ | incoming packet | +--------------------+ | V +--------------------+ | SO_J1939_PROMISC? | +--------------------+ | | no | | yes | | .---------' `---------. | | +---------------------------+ | | bind() + connect() + | | | SOCK_BROADCAST filter | | +---------------------------+ | | | |<---------------------' V +---------------------------+ | SO_J1939_FILTER | +---------------------------+ | V +---------------------------+ | socket recv() | +---------------------------+”…”�”}”hjésbah}”(h]”h ]”h"]”h$]”h&]”Œforce”‰Œhighlight_args”}”hÅhÆjÉ Œnone”uh1j¸ h³hÇh´Mbhjs h²hubhï)�”}”(hŒ]TX path related options: ``SO_J1939_SEND_PRIO`` - change default send priority for the socket”h]”(hŒTX path related options: ”…”�”}”(hjûh²hh³Nh´Nubj� )�”}”(hŒ``SO_J1939_SEND_PRIO``”h]”hŒSO_J1939_SEND_PRIO”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjûubhŒ. - change default send priority for the socket”…”�”}”(hjûh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M�hjs h²hubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒ4Message Flags during send() and Related System Calls”h]”hŒ4Message Flags during send() and Related System Calls”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjh²hh³hÇh´M…ubhï)�”}”(hŒe``send(2)``, ``sendto(2)`` and ``sendmsg(2)`` take a 'flags' argument. Currently supported flags are:”h]”(j� )�”}”(hŒ ``send(2)``”h]”hŒsend(2)”…”�”}”(hj0h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj,ubhŒ, ”…”�”}”(hj,h²hh³Nh´Nubj� )�”}”(hŒ ``sendto(2)``”h]”hŒ sendto(2)”…”�”}”(hjBh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj,ubhŒ and ”…”�”}”(hj,h²hh³Nh´Nubj� )�”}”(hŒ``sendmsg(2)``”h]”hŒ sendmsg(2)”…”�”}”(hjTh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj,ubhŒ< take a ‘flags’ argument. Currently supported flags are:”…”�”}”(hj,h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M‡hjh²hubj)�”}”(hhh]”j)�”}”(hŒ/``MSG_DONTWAIT``, i.e. non-blocking operation. ”h]”hï)�”}”(hŒ.``MSG_DONTWAIT``, i.e. non-blocking operation.”h]”(j� )�”}”(hŒ``MSG_DONTWAIT``”h]”hŒ MSG_DONTWAIT”…”�”}”(hjwh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjsubhŒ, i.e. non-blocking operation.”…”�”}”(hjsh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MŠhjoubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjlh²hh³hÇh´Nubah}”(h]”h ]”h"]”h$]”h&]”jbjcuh1jh³hÇh´MŠhjh²hubeh}”(h]”Œ2message-flags-during-send-and-related-system-calls”ah ]”h"]”Œ4message flags during send() and related system calls”ah$]”h&]”uh1hÈhjs h²hh³hÇh´M…ubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒ recvmsg(2)”•h]”hŒ recvmsg(2)”…”�”}”(hj¦h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhj£h²hh³hÇh´M�ubhï)�”}”(hX#In most cases ``recvmsg(2)`` is needed if you want to extract more information than ``recvfrom(2)`` can provide. For example package priority and timestamp. The Destination Address, name and packet priority (if applicable) are attached to the msghdr in the ``recvmsg(2)`` call. They can be extracted using ``cmsg(3)`` macros, with ``cmsg_level == SOL_J1939 && cmsg_type == SCM_J1939_DEST_ADDR``, ``SCM_J1939_DEST_NAME`` or ``SCM_J1939_PRIO``. The returned data is a ``uint8_t`` for ``priority`` and ``dst_addr``, and ``uint64_t`` for ``dst_name``.”h]”(hŒIn most cases ”…”�”}”(hj´h²hh³Nh´Nubj� )�”}”(hŒ``recvmsg(2)``”h]”hŒ recvmsg(2)”…”�”}”(hj¼h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj´ubhŒ8 is needed if you want to extract more information than ”…”�”}”(hj´h²hh³Nh´Nubj� )�”}”(hŒ``recvfrom(2)``”h]”hŒ recvfrom(2)”…”�”}”(hjÎh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj´ubhŒž can provide. For example package priority and timestamp. The Destination Address, name and packet priority (if applicable) are attached to the msghdr in the ”…”�”}”(hj´h²hh³Nh´Nubj� )�”}”(hŒ``recvmsg(2)``”h]”hŒ recvmsg(2)”…”�”}”(hjàh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj´ubhŒ# call. They can be extracted using ”…”�”}”(hj´h²hh³Nh´Nubj� )�”}”(hŒ ``cmsg(3)``”h]”hŒcmsg(3)”…”�”}”(hjòh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj´ubhŒ macros, with ”…”�”}”(hj´h²hh³Nh´Nubj� )�”}”(hŒ?``cmsg_level == SOL_J1939 && cmsg_type == SCM_J1939_DEST_ADDR``”h]”hŒ;cmsg_level == SOL_J1939 && cmsg_type == SCM_J1939_DEST_ADDR”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj´ubhŒ, ”…”�”}”(hj´h²hh³Nh´Nubj� )�”}”(hŒ``SCM_J1939_DEST_NAME``”h]”hŒSCM_J1939_DEST_NAME”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj´ubhŒ or ”…”�”}”(hj´h²hh³Nh´Nubj� )�”}”(hŒ``SCM_J1939_PRIO``”h]”hŒSCM_J1939_PRIO”…”�”}”(hj(h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj´ubhŒ. The returned data is a ”…”�”}”(hj´h²hh³Nh´Nubj� )�”}”(hŒ ``uint8_t``”h]”hŒuint8_t”…”�”}”(hj:h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj´ubhŒ for ”…”�”}”(hj´h²hh³Nh´Nubj� )�”}”(hŒ ``priority``”h]”hŒpriority”…”�”}”(hjLh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj´ubhŒ and ”…”�”}”(hj´h²hh³Nh´Nubj� )�”}”(hŒ ``dst_addr``”h]”hŒdst_addr”…”�”}”(hj^h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj´ubhŒ, and ”…”�”}”(hj´h²hh³Nh´Nubj� )�”}”(hŒ ``uint64_t``”h]”hŒuint64_t”…”�”}”(hjph²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj´ubhŒ for ”…”�”}”(hj´h²hh³Nh´Nubj� )�”}”(hŒ ``dst_name``”h]”hŒdst_name”…”�”}”(hj‚h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj´ubhŒ.”…”�”}”(hj´h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M�hj£h²hubj¹ )�”}”(hXXuint8_t priority, dst_addr; uint64_t dst_name; for (cmsg = CMSG_FIRSTHDR(&msg); cmsg; cmsg = CMSG_NXTHDR(&msg, cmsg)) { switch (cmsg->cmsg_level) { case SOL_CAN_J1939: if (cmsg->cmsg_type == SCM_J1939_DEST_ADDR) dst_addr = *CMSG_DATA(cmsg); else if (cmsg->cmsg_type == SCM_J1939_DEST_NAME) memcpy(&dst_name, CMSG_DATA(cmsg), cmsg->cmsg_len - CMSG_LEN(0)); else if (cmsg->cmsg_type == SCM_J1939_PRIO) priority = *CMSG_DATA(cmsg); break; } }”h]”hXXuint8_t priority, dst_addr; uint64_t dst_name; for (cmsg = CMSG_FIRSTHDR(&msg); cmsg; cmsg = CMSG_NXTHDR(&msg, cmsg)) { switch (cmsg->cmsg_level) { case SOL_CAN_J1939: if (cmsg->cmsg_type == SCM_J1939_DEST_ADDR) dst_addr = *CMSG_DATA(cmsg); else if (cmsg->cmsg_type == SCM_J1939_DEST_NAME) memcpy(&dst_name, CMSG_DATA(cmsg), cmsg->cmsg_len - CMSG_LEN(0)); else if (cmsg->cmsg_type == SCM_J1939_PRIO) priority = *CMSG_DATA(cmsg); break; } }”…”�”}”hjšsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆjÈ ‰jÉ jÊ jË }”uh1j¸ h³hÇh´M—hj£h²hubeh}”(h]”Œ recvmsg-2”ah ]”h"]”Œ recvmsg(2)”ah$]”h&]”uh1hÈhjs h²hh³hÇh´M�ubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒ setsockopt(2)”h]”hŒ setsockopt(2)”…”�”}”(hj´h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhj±h²hh³hÇh´Mªubhï)�”}”(hŒŽThe ``setsockopt(2)`` function is used to configure various socket-level options for J1939 communication. The following options are supported:”h]”(hŒThe ”…”�”}”(hjÂh²hh³Nh´Nubj� )�”}”(hŒ``setsockopt(2)``”h]”hŒ setsockopt(2)”…”�”}”(hjÊh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjÂubhŒy function is used to configure various socket-level options for J1939 communication. The following options are supported:”…”�”}”(hjÂh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M¬hj±h²hubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒ``SO_J1939_FILTER``”h]”j� )�”}”(hjçh]”hŒSO_J1939_FILTER”…”�”}”(hjéh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjåubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjâh²hh³hÇh´M°ubhï)�”}”(hX«The ``SO_J1939_FILTER`` option is essential when the default behavior of ``bind(2)`` and ``connect(2)`` is insufficient for specific use cases. By default, ``bind(2)`` and ``connect(2)`` allow a socket to be associated with a single unicast or broadcast address. However, there are scenarios where finer control over the incoming messages is required, such as filtering by Parameter Group Number (PGN) rather than by addresses.”h]”(hŒThe ”…”�”}”(hjüh²hh³Nh´Nubj� )�”}”(hŒ``SO_J1939_FILTER``”h]”hŒSO_J1939_FILTER”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjüubhŒ2 option is essential when the default behavior of ”…”�”}”(hjüh²hh³Nh´Nubj� )�”}”(hŒ ``bind(2)``”h]”hŒbind(2)”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjüubhŒ and ”…”�”}”(hjüh²hh³Nh´Nubj� )�”}”(hŒ``connect(2)``”h]”hŒ connect(2)”…”�”}”(hj(h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjüubhŒ5 is insufficient for specific use cases. By default, ”…”�”}”(hjüh²hh³Nh´Nubj� )�”}”(hŒ ``bind(2)``”h]”hŒbind(2)”…”�”}”(hj:h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjüubhŒ and ”…”�”}”hjüsbj� )�”}”(hŒ``connect(2)``”h]”hŒ connect(2)”…”�”}”(hjLh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjüubhŒñ allow a socket to be associated with a single unicast or broadcast address. However, there are scenarios where finer control over the incoming messages is required, such as filtering by Parameter Group Number (PGN) rather than by addresses.”…”�”}”(hjüh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M²hjâh²hubhï)�”}”(hXFor example, in a system where multiple types of J1939 messages are being transmitted, a process might only be interested in a subset of those messages, such as specific PGNs, and not want to receive all messages destined for its address or broadcast to the bus.”h]”hXFor example, in a system where multiple types of J1939 messages are being transmitted, a process might only be interested in a subset of those messages, such as specific PGNs, and not want to receive all messages destined for its address or broadcast to the bus.”…”�”}”(hjdh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M¹hjâh²hubhï)�”}”(hŒMBy applying the ``SO_J1939_FILTER`` option, you can filter messages based on:”h]”(hŒBy applying the ”…”�”}”(hjrh²hh³Nh´Nubj� )�”}”(hŒ``SO_J1939_FILTER``”h]”hŒSO_J1939_FILTER”…”�”}”(hjzh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjrubhŒ* option, you can filter messages based on:”…”�”}”(hjrh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M¾hjâh²hubj)�”}”(hhh]”(j)�”}”(hŒP**Source Address (SA)**: Filter messages coming from specific source addresses. ”h]”hï)�”}”(hŒO**Source Address (SA)**: Filter messages coming from specific source addresses.”h]”(j­)�”}”(hŒ**Source Address (SA)**”h]”hŒSource Address (SA)”…”�”}”(hj�h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j¬hj™ubhŒ8: Filter messages coming from specific source addresses.”…”�”}”(hj™h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MÀhj•ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj’h²hh³hÇh´Nubj)�”}”(hŒR**Source Name**: Filter messages coming from ECUs with specific NAME identifiers. ”h]”hï)�”}”(hŒQ**Source Name**: Filter messages coming from ECUs with specific NAME identifiers.”h]”(j­)�”}”(hŒ**Source Name**”h]”hŒ Source Name”…”�”}”(hjÃh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j¬hj¿ubhŒB: Filter messages coming from ECUs with specific NAME identifiers.”…”�”}”(hj¿h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MÃhj»ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj’h²hh³hÇh´Nubj)�”}”(hŒq**Parameter Group Number (PGN)**: Focus on receiving messages with specific PGNs, filtering out irrelevant ones. ”h]”hï)�”}”(hŒp**Parameter Group Number (PGN)**: Focus on receiving messages with specific PGNs, filtering out irrelevant ones.”h]”(j­)�”}”(hŒ **Parameter Group Number (PGN)**”h]”hŒParameter Group Number (PGN)”…”�”}”(hjéh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j¬hjåubhŒP: Focus on receiving messages with specific PGNs, filtering out irrelevant ones.”…”�”}”(hjåh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MÆhjáubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj’h²hh³hÇh´Nubeh}”(h]”h ]”h"]”h$]”h&]”jbjýuh1jh³hÇh´MÀhjâh²hubhï)�”}”(hŒ5This filtering mechanism is particularly useful when:”h]”hŒ5This filtering mechanism is particularly useful when:”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MÉhjâh²hubj)�”}”(hhh]”(j)�”}”(hŒ_You want to receive a subset of messages based on their PGNs, even if the address is the same. ”h]”hï)�”}”(hŒ^You want to receive a subset of messages based on their PGNs, even if the address is the same.”h]”hŒ^You want to receive a subset of messages based on their PGNs, even if the address is the same.”…”�”}”(hj"h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MËhjubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjh²hh³hÇh´Nubj)�”}”(hŒpYou need to handle both broadcast and unicast messages but only care about certain message types or parameters. ”h]”hï)�”}”(hŒoYou need to handle both broadcast and unicast messages but only care about certain message types or parameters.”h]”hŒoYou need to handle both broadcast and unicast messages but only care about certain message types or parameters.”…”�”}”(hj:h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MÎhj6ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjh²hh³hÇh´Nubj)�”}”(hŒÌThe ``bind(2)`` and ``connect(2)`` functions only allow binding to a single address, which might not be sufficient if the process needs to handle multiple PGNs but does not want to open multiple sockets. ”h]”hï)�”}”(hŒËThe ``bind(2)`` and ``connect(2)`` functions only allow binding to a single address, which might not be sufficient if the process needs to handle multiple PGNs but does not want to open multiple sockets.”h]”(hŒThe ”…”�”}”(hjRh²hh³Nh´Nubj� )�”}”(hŒ ``bind(2)``”h]”hŒbind(2)”…”�”}”(hjZh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjRubhŒ and ”…”�”}”(hjRh²hh³Nh´Nubj� )�”}”(hŒ``connect(2)``”h]”hŒ connect(2)”…”�”}”(hjlh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjRubhŒ© functions only allow binding to a single address, which might not be sufficient if the process needs to handle multiple PGNs but does not want to open multiple sockets.”…”�”}”(hjRh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MÑhjNubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjh²hh³hÇh´Nubeh}”(h]”h ]”h"]”h$]”h&]”jbjýuh1jh³hÇh´MËhjâh²hubhï)�”}”(hX To remove existing filters, you can pass ``optval == NULL`` or ``optlen == 0`` to ``setsockopt(2)``. This will clear all currently set filters. If you want to **update** the set of filters, you must pass the updated filter set to ``setsockopt(2)``, as the new filter set will **replace** the old one entirely. This behavior ensures that any previous filter configuration is discarded and only the new set is applied.”h]”(hŒ)To remove existing filters, you can pass ”…”�”}”(hj�h²hh³Nh´Nubj� )�”}”(hŒ``optval == NULL``”h]”hŒoptval == NULL”…”�”}”(hj˜h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj�ubhŒ or ”…”�”}”(hj�h²hh³Nh´Nubj� )�”}”(hŒ``optlen == 0``”h]”hŒ optlen == 0”…”�”}”(hjªh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj�ubhŒ to ”…”�”}”(hj�h²hh³Nh´Nubj� )�”}”(hŒ``setsockopt(2)``”h]”hŒ setsockopt(2)”…”�”}”(hj¼h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj�ubhŒ<. This will clear all currently set filters. If you want to ”…”�”}”(hj�h²hh³Nh´Nubj­)�”}”(hŒ **update**”h]”hŒupdate”…”�”}”(hjÎh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j¬hj�ubhŒ= the set of filters, you must pass the updated filter set to ”…”�”}”(hj�h²hh³Nh´Nubj� )�”}”(hŒ``setsockopt(2)``”h]”hŒ setsockopt(2)”…”�”}”(hjàh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj�ubhŒ, as the new filter set will ”…”�”}”(hj�h²hh³Nh´Nubj­)�”}”(hŒ **replace**”h]”hŒreplace”…”�”}”(hjòh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j¬hj�ubhŒ� the old one entirely. This behavior ensures that any previous filter configuration is discarded and only the new set is applied.”…”�”}”(hj�h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MÕhjâh²hubhï)�”}”(hŒ Example of removing all filters:”h]”hŒ Example of removing all filters:”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MÜhjâh²hubj¹ )�”}”(hŒ:setsockopt(sock, SOL_CAN_J1939, SO_J1939_FILTER, NULL, 0);”h]”hŒ:setsockopt(sock, SOL_CAN_J1939, SO_J1939_FILTER, NULL, 0);”…”�”}”hjsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆjÈ ‰jÉ Œc”jË }”uh1j¸ h³hÇh´MÞhjâh²hubhï)�”}”(hX**Maximum number of filters:** The maximum amount of filters that can be applied using ``SO_J1939_FILTER`` is defined by ``J1939_FILTER_MAX``, which is set to 512. This means you can configure up to 512 individual filters to match your specific filtering needs.”h]”(j­)�”}”(hŒ**Maximum number of filters:**”h]”hŒMaximum number of filters:”…”�”}”(hj,h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j¬hj(ubhŒ9 The maximum amount of filters that can be applied using ”…”�”}”(hj(h²hh³Nh´Nubj� )�”}”(hŒ``SO_J1939_FILTER``”h]”hŒSO_J1939_FILTER”…”�”}”(hj>h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj(ubhŒ is defined by ”…”�”}”(hj(h²hh³Nh´Nubj� )�”}”(hŒ``J1939_FILTER_MAX``”h]”hŒJ1939_FILTER_MAX”…”�”}”(hjPh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj(ubhŒx, which is set to 512. This means you can configure up to 512 individual filters to match your specific filtering needs.”…”�”}”(hj(h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Mâhjâh²hubhï)�”}”(hŒ3Practical use case: **Monitoring Address Claiming**”h]”(hŒPractical use case: ”…”�”}”(hjhh²hh³Nh´Nubj­)�”}”(hŒ**Monitoring Address Claiming**”h]”hŒMonitoring Address Claiming”…”�”}”(hjph²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j¬hjhubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Mçhjâh²hubhï)�”}”(hŒåOne practical use case is monitoring the J1939 address claiming process by filtering for specific PGNs related to address claiming. This allows a process to monitor and handle address claims without processing unrelated messages.”h]”hŒåOne practical use case is monitoring the J1939 address claiming process by filtering for specific PGNs related to address claiming. This allows a process to monitor and handle address claims without processing unrelated messages.”…”�”}”(hj„h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Méhjâh²hubhï)�”}”(hŒExample:”h]”hŒExample:”…”�”}”(hj’h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Míhjâh²hubj¹ )�”}”(hXrstruct j1939_filter filt[] = { { .pgn = J1939_PGN_ADDRESS_CLAIMED, .pgn_mask = J1939_PGN_PDU1_MAX, }, { .pgn = J1939_PGN_REQUEST, .pgn_mask = J1939_PGN_PDU1_MAX, }, { .pgn = J1939_PGN_ADDRESS_COMMANDED, .pgn_mask = J1939_PGN_MAX, }, }; setsockopt(sock, SOL_CAN_J1939, SO_J1939_FILTER, &filt, sizeof(filt));”h]”hXrstruct j1939_filter filt[] = { { .pgn = J1939_PGN_ADDRESS_CLAIMED, .pgn_mask = J1939_PGN_PDU1_MAX, }, { .pgn = J1939_PGN_REQUEST, .pgn_mask = J1939_PGN_PDU1_MAX, }, { .pgn = J1939_PGN_ADDRESS_COMMANDED, .pgn_mask = J1939_PGN_MAX, }, }; setsockopt(sock, SOL_CAN_J1939, SO_J1939_FILTER, &filt, sizeof(filt));”…”�”}”hj sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆjÈ ‰jÉ j&jË }”uh1j¸ h³hÇh´Mïhjâh²hubhï)�”}”(hX[In this example, the socket will only receive messages with the PGNs related to address claiming: ``J1939_PGN_ADDRESS_CLAIMED``, ``J1939_PGN_REQUEST``, and ``J1939_PGN_ADDRESS_COMMANDED``. This is particularly useful in scenarios where you want to monitor and process address claims without being overwhelmed by other traffic on the J1939 network.”h]”(hŒbIn this example, the socket will only receive messages with the PGNs related to address claiming: ”…”�”}”(hj¯h²hh³Nh´Nubj� )�”}”(hŒ``J1939_PGN_ADDRESS_CLAIMED``”h]”hŒJ1939_PGN_ADDRESS_CLAIMED”…”�”}”(hj·h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj¯ubhŒ, ”…”�”}”(hj¯h²hh³Nh´Nubj� )�”}”(hŒ``J1939_PGN_REQUEST``”h]”hŒJ1939_PGN_REQUEST”…”�”}”(hjÉh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj¯ubhŒ, and ”…”�”}”(hj¯h²hh³Nh´Nubj� )�”}”(hŒ``J1939_PGN_ADDRESS_COMMANDED``”h]”hŒJ1939_PGN_ADDRESS_COMMANDED”…”�”}”(hjÛh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj¯ubhŒ . This is particularly useful in scenarios where you want to monitor and process address claims without being overwhelmed by other traffic on the J1939 network.”…”�”}”(hj¯h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Mÿhjâh²hubeh}”(h]”Œso-j1939-filter”ah ]”h"]”Œso_j1939_filter”ah$]”h&]”uh1hÈhj±h²hh³hÇh´M°ubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒ``SO_J1939_PROMISC``”h]”j� )�”}”(hjh]”hŒSO_J1939_PROMISC”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjþubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjûh²hh³hÇh´Mubhï)�”}”(hXLThe ``SO_J1939_PROMISC`` option enables socket-level promiscuous mode. When this option is enabled, the socket will receive all J1939 traffic, regardless of any filters set by ``bind()`` or ``connect()``. This is analogous to enabling promiscuous mode for an Ethernet interface, where all traffic on the network segment is captured.”h]”(hŒThe ”…”�”}”(hjh²hh³Nh´Nubj� )�”}”(hŒ``SO_J1939_PROMISC``”h]”hŒSO_J1939_PROMISC”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjubhŒ˜ option enables socket-level promiscuous mode. When this option is enabled, the socket will receive all J1939 traffic, regardless of any filters set by ”…”�”}”(hjh²hh³Nh´Nubj� )�”}”(hŒ ``bind()``”h]”hŒbind()”…”�”}”(hj/h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjubhŒ or ”…”�”}”(hjh²hh³Nh´Nubj� )�”}”(hŒ ``connect()``”h]”hŒ connect()”…”�”}”(hjAh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjubhŒ�. This is analogous to enabling promiscuous mode for an Ethernet interface, where all traffic on the network segment is captured.”…”�”}”(hjh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Mhjûh²hubhï)�”}”(hXpHowever, **`SO_J1939_FILTER` has a higher priority** compared to ``SO_J1939_PROMISC``. This means that even in promiscuous mode, you can reduce the number of packets received by applying specific filters with `SO_J1939_FILTER`. The filters will limit which packets are passed to the socket, allowing for more refined traffic selection while promiscuous mode is active.”h]”(hŒ However, ”…”�”}”(hjYh²hh³Nh´Nubj­)�”}”(hŒ+**`SO_J1939_FILTER` has a higher priority**”h]”hŒ'`SO_J1939_FILTER` has a higher priority”…”�”}”(hjah²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j¬hjYubhŒ compared to ”…”�”}”(hjYh²hh³Nh´Nubj� )�”}”(hŒ``SO_J1939_PROMISC``”h]”hŒSO_J1939_PROMISC”…”�”}”(hjsh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjYubhŒ|. This means that even in promiscuous mode, you can reduce the number of packets received by applying specific filters with ”…”�”}”(hjYh²hh³Nh´Nubj€)�”}”(hŒ`SO_J1939_FILTER`”h]”hŒSO_J1939_FILTER”…”�”}”(hj…h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjYubhŒŽ. The filters will limit which packets are passed to the socket, allowing for more refined traffic selection while promiscuous mode is active.”…”�”}”(hjYh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Mhjûh²hubhï)�”}”(hŒËThe acceptable value size for this option is ``sizeof(int)``, and the value is only differentiated between `0` and non-zero. A value of `0` disables promiscuous mode, while any non-zero value enables it.”h]”(hŒ-The acceptable value size for this option is ”…”�”}”(hj�h²hh³Nh´Nubj� )�”}”(hŒ``sizeof(int)``”h]”hŒ sizeof(int)”…”�”}”(hj¥h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj�ubhŒ/, and the value is only differentiated between ”…”�”}”(hj�h²hh³Nh´Nubj€)�”}”(hŒ`0`”h]”hŒ0”…”�”}”(hj·h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj�ubhŒ and non-zero. A value of ”…”�”}”(hj�h²hh³Nh´Nubj€)�”}”(hŒ`0`”h]”hŒ0”…”�”}”(hjÉh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj�ubhŒ@ disables promiscuous mode, while any non-zero value enables it.”…”�”}”(hj�h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Mhjûh²hubhï)�”}”(hŒƒThis combination can be useful for debugging or monitoring specific types of traffic while still capturing a broad set of messages.”h]”hŒƒThis combination can be useful for debugging or monitoring specific types of traffic while still capturing a broad set of messages.”…”�”}”(hjáh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Mhjûh²hubhï)�”}”(hŒExample:”h]”hŒExample:”…”�”}”(hjïh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Mhjûh²hubj¹ )�”}”(hŒXint value = 1; setsockopt(sock, SOL_CAN_J1939, SO_J1939_PROMISC, &value, sizeof(value));”h]”hŒXint value = 1; setsockopt(sock, SOL_CAN_J1939, SO_J1939_PROMISC, &value, sizeof(value));”…”�”}”hjýsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆjÈ ‰jÉ j&jË }”uh1j¸ h³hÇh´Mhjûh²hubhï)�”}”(hŒŸIn this example, setting ``value`` to any non-zero value (e.g., `1`) enables promiscuous mode, allowing the socket to receive all J1939 traffic on the network.”h]”(hŒIn this example, setting ”…”�”}”(hj h²hh³Nh´Nubj� )�”}”(hŒ ``value``”h]”hŒvalue”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj ubhŒ to any non-zero value (e.g., ”…”�”}”(hj h²hh³Nh´Nubj€)�”}”(hŒ`1`”h]”hŒ1”…”�”}”(hj&h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj ubhŒ\) enables promiscuous mode, allowing the socket to receive all J1939 traffic on the network.”…”�”}”(hj h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M#hjûh²hubeh}”(h]”Œso-j1939-promisc”ah ]”h"]”Œso_j1939_promisc”ah$]”h&]”uh1hÈhj±h²hh³hÇh´MubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒ``SO_BROADCAST``”h]”j� )�”}”(hjKh]”hŒ SO_BROADCAST”…”�”}”(hjMh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjIubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjFh²hh³hÇh´M(ubhï)�”}”(hXThe ``SO_BROADCAST`` option enables the sending and receiving of broadcast messages. By default, broadcast messages are disabled for J1939 sockets. When this option is enabled, the socket will be allowed to send and receive broadcast packets on the J1939 network.”h]”(hŒThe ”…”�”}”(hj`h²hh³Nh´Nubj� )�”}”(hŒ``SO_BROADCAST``”h]”hŒ SO_BROADCAST”…”�”}”(hjhh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj`ubhŒó option enables the sending and receiving of broadcast messages. By default, broadcast messages are disabled for J1939 sockets. When this option is enabled, the socket will be allowed to send and receive broadcast packets on the J1939 network.”…”�”}”(hj`h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M*hjFh²hubhï)�”}”(hXÇDue to the nature of the CAN bus as a shared medium, all messages transmitted on the bus are visible to all participants. In the context of J1939, broadcasting refers to using a specific destination address field, where the destination address is set to a value that indicates the message is intended for all participants (usually a global address such as 0xFF). Enabling the broadcast option allows the socket to send and receive such broadcast messages.”h]”hXÇDue to the nature of the CAN bus as a shared medium, all messages transmitted on the bus are visible to all participants. In the context of J1939, broadcasting refers to using a specific destination address field, where the destination address is set to a value that indicates the message is intended for all participants (usually a global address such as 0xFF). Enabling the broadcast option allows the socket to send and receive such broadcast messages.”…”�”}”(hj€h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M/hjFh²hubhï)�”}”(hŒíThe acceptable value size for this option is ``sizeof(int)``, and the value is only differentiated between `0` and non-zero. A value of `0` disables the ability to send and receive broadcast messages, while any non-zero value enables it.”h]”(hŒ-The acceptable value size for this option is ”…”�”}”(hjŽh²hh³Nh´Nubj� )�”}”(hŒ``sizeof(int)``”h]”hŒ sizeof(int)”…”�”}”(hj–h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjŽubhŒ/, and the value is only differentiated between ”…”�”}”(hjŽh²hh³Nh´Nubj€)�”}”(hŒ`0`”h]”hŒ0”…”�”}”(hj¨h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjŽubhŒ and non-zero. A value of ”…”�”}”(hjŽh²hh³Nh´Nubj€)�”}”(hŒ`0`”h]”hŒ0”…”�”}”(hjºh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjŽubhŒb disables the ability to send and receive broadcast messages, while any non-zero value enables it.”…”�”}”(hjŽh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M6hjFh²hubhï)�”}”(hŒExample:”h]”hŒExample:”…”�”}”(hjÒh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M;hjFh²hubj¹ )�”}”(hŒQint value = 1; setsockopt(sock, SOL_SOCKET, SO_BROADCAST, &value, sizeof(value));”h]”hŒQint value = 1; setsockopt(sock, SOL_SOCKET, SO_BROADCAST, &value, sizeof(value));”…”�”}”hjàsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆjÈ ‰jÉ j&jË }”uh1j¸ h³hÇh´M=hjFh²hubhï)�”}”(hŒIn this example, setting ``value`` to any non-zero value (e.g., `1`) enables the socket to send and receive broadcast messages.”h]”(hŒIn this example, setting ”…”�”}”(hjïh²hh³Nh´Nubj� )�”}”(hŒ ``value``”h]”hŒvalue”…”�”}”(hj÷h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjïubhŒ to any non-zero value (e.g., ”…”�”}”(hjïh²hh³Nh´Nubj€)�”}”(hŒ`1`”h]”hŒ1”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjïubhŒ<) enables the socket to send and receive broadcast messages.”…”�”}”(hjïh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MBhjFh²hubeh}”(h]”Œ so-broadcast”ah ]”h"]”Œ so_broadcast”ah$]”h&]”uh1hÈhj±h²hh³hÇh´M(ubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒ``SO_J1939_SEND_PRIO``”h]”j� )�”}”(hj.h]”hŒSO_J1939_SEND_PRIO”…”�”}”(hj0h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj,ubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhj)h²hh³hÇh´MFubhï)�”}”(hXPThe ``SO_J1939_SEND_PRIO`` option sets the priority of outgoing J1939 messages for the socket. In J1939, messages can have different priorities, and lower numerical values indicate higher priority. This option allows the user to control the priority of messages sent from the socket by adjusting the priority bits in the CAN identifier.”h]”(hŒThe ”…”�”}”(hjCh²hh³Nh´Nubj� )�”}”(hŒ``SO_J1939_SEND_PRIO``”h]”hŒSO_J1939_SEND_PRIO”…”�”}”(hjKh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjCubhX6 option sets the priority of outgoing J1939 messages for the socket. In J1939, messages can have different priorities, and lower numerical values indicate higher priority. This option allows the user to control the priority of messages sent from the socket by adjusting the priority bits in the CAN identifier.”…”�”}”(hjCh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MHhj)h²hubhï)�”}”(hXThe acceptable value **size** for this option is ``sizeof(int)``, and the value is expected to be in the range of 0 to 7, where `0` is the highest priority, and `7` is the lowest. By default, the priority is set to `6` if this option is not explicitly configured.”h]”(hŒThe acceptable value ”…”�”}”(hjch²hh³Nh´Nubj­)�”}”(hŒ**size**”h]”hŒsize”…”�”}”(hjkh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j¬hjcubhŒ for this option is ”…”�”}”(hjch²hh³Nh´Nubj� )�”}”(hŒ``sizeof(int)``”h]”hŒ sizeof(int)”…”�”}”(hj}h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjcubhŒ@, and the value is expected to be in the range of 0 to 7, where ”…”�”}”(hjch²hh³Nh´Nubj€)�”}”(hŒ`0`”h]”hŒ0”…”�”}”(hj�h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjcubhŒ is the highest priority, and ”…”�”}”(hjch²hh³Nh´Nubj€)�”}”(hŒ`7`”h]”hŒ7”…”�”}”(hj¡h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjcubhŒ3 is the lowest. By default, the priority is set to ”…”�”}”(hjch²hh³Nh´Nubj€)�”}”(hŒ`6`”h]”hŒ6”…”�”}”(hj³h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjcubhŒ- if this option is not explicitly configured.”…”�”}”(hjch²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MNhj)h²hubhï)�”}”(hŒÀNote that the priority values `0` and `1` can only be set if the process has the `CAP_NET_ADMIN` capability. These are reserved for high-priority traffic and require administrative privileges.”h]”(hŒNote that the priority values ”…”�”}”(hjËh²hh³Nh´Nubj€)�”}”(hŒ`0`”h]”hŒ0”…”�”}”(hjÓh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjËubhŒ and ”…”�”}”(hjËh²hh³Nh´Nubj€)�”}”(hŒ`1`”h]”hŒ1”…”�”}”(hjåh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjËubhŒ( can only be set if the process has the ”…”�”}”(hjËh²hh³Nh´Nubj€)�”}”(hŒ`CAP_NET_ADMIN`”h]”hŒ CAP_NET_ADMIN”…”�”}”(hj÷h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjËubhŒ` capability. These are reserved for high-priority traffic and require administrative privileges.”…”�”}”(hjËh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MShj)h²hubhï)�”}”(hŒExample:”h]”hŒExample:”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MWhj)h²hubj¹ )�”}”(hŒ�int prio = 3; // Priority value between 0 (highest) and 7 (lowest) setsockopt(sock, SOL_CAN_J1939, SO_J1939_SEND_PRIO, &prio, sizeof(prio));”h]”hŒ�int prio = 3; // Priority value between 0 (highest) and 7 (lowest) setsockopt(sock, SOL_CAN_J1939, SO_J1939_SEND_PRIO, &prio, sizeof(prio));”…”�”}”hjsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆjÈ ‰jÉ j&jË }”uh1j¸ h³hÇh´MYhj)h²hubhï)�”}”(hŒwIn this example, the priority is set to `3`, meaning the outgoing messages will be sent with a moderate priority level.”h]”(hŒ(In this example, the priority is set to ”…”�”}”(hj,h²hh³Nh´Nubj€)�”}”(hŒ`3`”h]”hŒ3”…”�”}”(hj4h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj,ubhŒL, meaning the outgoing messages will be sent with a moderate priority level.”…”�”}”(hj,h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M^hj)h²hubeh}”(h]”Œso-j1939-send-prio”ah ]”h"]”Œso_j1939_send_prio”ah$]”h&]”uh1hÈhj±h²hh³hÇh´MFubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒ``SO_J1939_ERRQUEUE``”h]”j� )�”}”(hjYh]”hŒSO_J1939_ERRQUEUE”…”�”}”(hj[h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjWubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjTh²hh³hÇh´Mbubhï)�”}”(hXBThe ``SO_J1939_ERRQUEUE`` option enables the socket to receive error messages from the error queue, providing diagnostic information about transmission failures, protocol violations, or other issues that occur during J1939 communication. Once this option is set, user space is required to handle ``MSG_ERRQUEUE`` messages.”h]”(hŒThe ”…”�”}”(hjnh²hh³Nh´Nubj� )�”}”(hŒ``SO_J1939_ERRQUEUE``”h]”hŒSO_J1939_ERRQUEUE”…”�”}”(hjvh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjnubhX option enables the socket to receive error messages from the error queue, providing diagnostic information about transmission failures, protocol violations, or other issues that occur during J1939 communication. Once this option is set, user space is required to handle ”…”�”}”(hjnh²hh³Nh´Nubj� )�”}”(hŒ``MSG_ERRQUEUE``”h]”hŒ MSG_ERRQUEUE”…”�”}”(hjˆh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjnubhŒ messages.”…”�”}”(hjnh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MdhjTh²hubhï)�”}”(hŒ¾Setting ``SO_J1939_ERRQUEUE`` to ``0`` will purge any currently present error messages in the error queue. When enabled, error messages can be retrieved using the ``recvmsg(2)`` system call.”h]”(hŒSetting ”…”�”}”(hj h²hh³Nh´Nubj� )�”}”(hŒ``SO_J1939_ERRQUEUE``”h]”hŒSO_J1939_ERRQUEUE”…”�”}”(hj¨h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj ubhŒ to ”…”�”}”(hj h²hh³Nh´Nubj� )�”}”(hŒ``0``”h]”hŒ0”…”�”}”(hjºh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj ubhŒ} will purge any currently present error messages in the error queue. When enabled, error messages can be retrieved using the ”…”�”}”(hj h²hh³Nh´Nubj� )�”}”(hŒ``recvmsg(2)``”h]”hŒ recvmsg(2)”…”�”}”(hjÌh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj ubhŒ system call.”…”�”}”(hj h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MjhjTh²hubhï)�”}”(hŒPWhen subscribing to the error queue, the following error events can be accessed:”h]”hŒPWhen subscribing to the error queue, the following error events can be accessed:”…”�”}”(hjäh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MnhjTh²hubj)�”}”(hhh]”(j)�”}”(hŒ:**``J1939_EE_INFO_TX_ABORT``**: Transmission abort errors.”h]”hï)�”}”(hj÷h]”(j­)�”}”(hŒ**``J1939_EE_INFO_TX_ABORT``**”h]”hŒ``J1939_EE_INFO_TX_ABORT``”…”�”}”(hjüh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j¬hjùubhŒ: Transmission abort errors.”…”�”}”(hjùh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Mqhjõubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjòh²hh³hÇh´Nubj)�”}”(hŒP**``J1939_EE_INFO_RX_RTS``**: Reception of RTS (Request to Send) control frames.”h]”hï)�”}”(hŒP**``J1939_EE_INFO_RX_RTS``**: Reception of RTS (Request to Send) control frames.”h]”(j­)�”}”(hŒ**``J1939_EE_INFO_RX_RTS``**”h]”hŒ``J1939_EE_INFO_RX_RTS``”…”�”}”(hj"h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j¬hjubhŒ4: Reception of RTS (Request to Send) control frames.”…”�”}”(hjh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Mrhjubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjòh²hh³hÇh´Nubj)�”}”(hŒT**``J1939_EE_INFO_RX_DPO``**: Reception of data packets with Data Page Offset (DPO).”h]”hï)�”}”(hŒT**``J1939_EE_INFO_RX_DPO``**: Reception of data packets with Data Page Offset (DPO).”h]”(j­)�”}”(hŒ**``J1939_EE_INFO_RX_DPO``**”h]”hŒ``J1939_EE_INFO_RX_DPO``”…”�”}”(hjHh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j¬hjDubhŒ8: Reception of data packets with Data Page Offset (DPO).”…”�”}”(hjDh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Mthj@ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjòh²hh³hÇh´Nubj)�”}”(hŒ8**``J1939_EE_INFO_RX_ABORT``**: Reception abort errors. ”h]”hï)�”}”(hŒ7**``J1939_EE_INFO_RX_ABORT``**: Reception abort errors.”h]”(j­)�”}”(hŒ**``J1939_EE_INFO_RX_ABORT``**”h]”hŒ``J1939_EE_INFO_RX_ABORT``”…”�”}”(hjnh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j¬hjjubhŒ: Reception abort errors.”…”�”}”(hjjh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Mvhjfubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjòh²hh³hÇh´Nubeh}”(h]”h ]”h"]”h$]”h&]”jbjýuh1jh³hÇh´MqhjTh²hubhï)�”}”(hŒ÷The error queue can be used to correlate errors with specific message transfer sessions using the session ID (``tskey``). The session ID is assigned via the ``SOF_TIMESTAMPING_OPT_ID`` flag, which is set by enabling the ``SO_TIMESTAMPING`` option.”h]”(hŒnThe error queue can be used to correlate errors with specific message transfer sessions using the session ID (”…”�”}”(hj’h²hh³Nh´Nubj� )�”}”(hŒ ``tskey``”h]”hŒtskey”…”�”}”(hjšh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj’ubhŒ&). The session ID is assigned via the ”…”�”}”(hj’h²hh³Nh´Nubj� )�”}”(hŒ``SOF_TIMESTAMPING_OPT_ID``”h]”hŒSOF_TIMESTAMPING_OPT_ID”…”�”}”(hj¬h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj’ubhŒ$ flag, which is set by enabling the ”…”�”}”(hj’h²hh³Nh´Nubj� )�”}”(hŒ``SO_TIMESTAMPING``”h]”hŒSO_TIMESTAMPING”…”�”}”(hj¾h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj’ubhŒ option.”…”�”}”(hj’h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MxhjTh²hubhï)�”}”(hX]If ``SO_J1939_ERRQUEUE`` is activated, the user is required to pull messages from the error queue, meaning that using plain ``recv(2)`` is not sufficient anymore. The user must use ``recvmsg(2)`` with appropriate flags to handle error messages. Failure to do so can result in the socket becoming blocked with unprocessed error messages in the queue.”h]”(hŒIf ”…”�”}”(hjÖh²hh³Nh´Nubj� )�”}”(hŒ``SO_J1939_ERRQUEUE``”h]”hŒSO_J1939_ERRQUEUE”…”�”}”(hjÞh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjÖubhŒd is activated, the user is required to pull messages from the error queue, meaning that using plain ”…”�”}”(hjÖh²hh³Nh´Nubj� )�”}”(hŒ ``recv(2)``”h]”hŒrecv(2)”…”�”}”(hjðh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjÖubhŒ. is not sufficient anymore. The user must use ”…”�”}”(hjÖh²hh³Nh´Nubj� )�”}”(hŒ``recvmsg(2)``”h]”hŒ recvmsg(2)”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjÖubhŒš with appropriate flags to handle error messages. Failure to do so can result in the socket becoming blocked with unprocessed error messages in the queue.”…”�”}”(hjÖh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M}hjTh²hubhï)�”}”(hXIt is **recommended** that ``SO_J1939_ERRQUEUE`` be used in combination with ``SO_TIMESTAMPING`` in most cases. This enables proper error handling along with session tracking and timestamping, providing a more detailed analysis of message transfers and errors.”h]”(hŒIt is ”…”�”}”(hjh²hh³Nh´Nubj­)�”}”(hŒ**recommended**”h]”hŒ recommended”…”�”}”(hj"h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j¬hjubhŒ that ”…”�”}”(hjh²hh³Nh´Nubj� )�”}”(hŒ``SO_J1939_ERRQUEUE``”h]”hŒSO_J1939_ERRQUEUE”…”�”}”(hj4h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjubhŒ be used in combination with ”…”�”}”(hjh²hh³Nh´Nubj� )�”}”(hŒ``SO_TIMESTAMPING``”h]”hŒSO_TIMESTAMPING”…”�”}”(hjFh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjubhŒ¤ in most cases. This enables proper error handling along with session tracking and timestamping, providing a more detailed analysis of message transfers and errors.”…”�”}”(hjh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MƒhjTh²hubhï)�”}”(hŒÿThe acceptable value **size** for this option is ``sizeof(int)``, and the value is only differentiated between ``0`` and non-zero. A value of ``0`` disables error queue reception and purges any existing error messages, while any non-zero value enables it.”h]”(hŒThe acceptable value ”…”�”}”(hj^h²hh³Nh´Nubj­)�”}”(hŒ**size**”h]”hŒsize”…”�”}”(hjfh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j¬hj^ubhŒ for this option is ”…”�”}”(hj^h²hh³Nh´Nubj� )�”}”(hŒ``sizeof(int)``”h]”hŒ sizeof(int)”…”�”}”(hjxh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj^ubhŒ/, and the value is only differentiated between ”…”�”}”(hj^h²hh³Nh´Nubj� )�”}”(hŒ``0``”h]”hŒ0”…”�”}”(hjŠh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj^ubhŒ and non-zero. A value of ”…”�”}”(hj^h²hh³Nh´Nubj� )�”}”(hŒ``0``”h]”hŒ0”…”�”}”(hjœh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj^ubhŒl disables error queue reception and purges any existing error messages, while any non-zero value enables it.”…”�”}”(hj^h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MˆhjTh²hubhï)�”}”(hŒExample:”h]”hŒExample:”…”�”}”(hj´h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M�hjTh²hubj¹ )�”}”(hX×int enable = 1; // Enable error queue reception setsockopt(sock, SOL_CAN_J1939, SO_J1939_ERRQUEUE, &enable, sizeof(enable)); // Enable timestamping with session tracking via tskey int timestamping = SOF_TIMESTAMPING_OPT_ID | SOF_TIMESTAMPING_TX_ACK | SOF_TIMESTAMPING_TX_SCHED | SOF_TIMESTAMPING_RX_SOFTWARE | SOF_TIMESTAMPING_OPT_CMSG; setsockopt(sock, SOL_SOCKET, SO_TIMESTAMPING, ×tamping, sizeof(timestamping));”h]”hX×int enable = 1; // Enable error queue reception setsockopt(sock, SOL_CAN_J1939, SO_J1939_ERRQUEUE, &enable, sizeof(enable)); // Enable timestamping with session tracking via tskey int timestamping = SOF_TIMESTAMPING_OPT_ID | SOF_TIMESTAMPING_TX_ACK | SOF_TIMESTAMPING_TX_SCHED | SOF_TIMESTAMPING_RX_SOFTWARE | SOF_TIMESTAMPING_OPT_CMSG; setsockopt(sock, SOL_SOCKET, SO_TIMESTAMPING, ×tamping, sizeof(timestamping));”…”�”}”hjÂsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆjÈ ‰jÉ j&jË }”uh1j¸ h³hÇh´M�hjTh²hubhï)�”}”(hX=When enabled, error messages can be retrieved using ``recvmsg(2)``. By combining ``SO_J1939_ERRQUEUE`` with ``SO_TIMESTAMPING`` (with ``SOF_TIMESTAMPING_OPT_ID`` and ``SOF_TIMESTAMPING_OPT_CMSG`` enabled), the user can track message transfers, retrieve precise timestamps, and correlate errors with specific sessions.”h]”(hŒ4When enabled, error messages can be retrieved using ”…”�”}”(hjÑh²hh³Nh´Nubj� )�”}”(hŒ``recvmsg(2)``”h]”hŒ recvmsg(2)”…”�”}”(hjÙh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjÑubhŒ. By combining ”…”�”}”(hjÑh²hh³Nh´Nubj� )�”}”(hŒ``SO_J1939_ERRQUEUE``”h]”hŒSO_J1939_ERRQUEUE”…”�”}”(hjëh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjÑubhŒ with ”…”�”}”(hjÑh²hh³Nh´Nubj� )�”}”(hŒ``SO_TIMESTAMPING``”h]”hŒSO_TIMESTAMPING”…”�”}”(hjýh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjÑubhŒ (with ”…”�”}”(hjÑh²hh³Nh´Nubj� )�”}”(hŒ``SOF_TIMESTAMPING_OPT_ID``”h]”hŒSOF_TIMESTAMPING_OPT_ID”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjÑubhŒ and ”…”�”}”(hjÑh²hh³Nh´Nubj� )�”}”(hŒ``SOF_TIMESTAMPING_OPT_CMSG``”h]”hŒSOF_TIMESTAMPING_OPT_CMSG”…”�”}”(hj!h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjÑubhŒz enabled), the user can track message transfers, retrieve precise timestamps, and correlate errors with specific sessions.”…”�”}”(hjÑh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M›hjTh²hubhï)�”}”(hŒiFor more information on enabling timestamps and session tracking, refer to the `SO_TIMESTAMPING` section.”h]”(hŒOFor more information on enabling timestamps and session tracking, refer to the ”…”�”}”(hj9h²hh³Nh´Nubj€)�”}”(hŒ`SO_TIMESTAMPING`”h]”hŒSO_TIMESTAMPING”…”�”}”(hjAh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj9ubhŒ section.”…”�”}”(hj9h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M¡hjTh²hubeh}”(h]”Œso-j1939-errqueue”ah ]”h"]”Œso_j1939_errqueue”ah$]”h&]”uh1hÈhj±h²hh³hÇh´MbubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒ``SO_TIMESTAMPING``”h]”j� )�”}”(hjfh]”hŒSO_TIMESTAMPING”…”�”}”(hjhh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjdubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjah²hh³hÇh´M¥ubhï)�”}”(hXDThe ``SO_TIMESTAMPING`` option allows the socket to receive timestamps for various events related to message transmissions and receptions in J1939. This option is often used in combination with ``SO_J1939_ERRQUEUE`` to provide detailed diagnostic information, session tracking, and precise timing data for message transfers.”h]”(hŒThe ”…”�”}”(hj{h²hh³Nh´Nubj� )�”}”(hŒ``SO_TIMESTAMPING``”h]”hŒSO_TIMESTAMPING”…”�”}”(hjƒh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj{ubhŒ« option allows the socket to receive timestamps for various events related to message transmissions and receptions in J1939. This option is often used in combination with ”…”�”}”(hj{h²hh³Nh´Nubj� )�”}”(hŒ``SO_J1939_ERRQUEUE``”h]”hŒSO_J1939_ERRQUEUE”…”�”}”(hj•h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj{ubhŒm to provide detailed diagnostic information, session tracking, and precise timing data for message transfers.”…”�”}”(hj{h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M§hjah²hubhï)�”}”(hX$In J1939, all payloads provided by user space, regardless of size, are processed by the kernel as **sessions**. This includes both single-frame messages (up to 8 bytes) and multi-frame protocols such as the Transport Protocol (TP) and Extended Transport Protocol (ETP). Even for small, single-frame messages, the kernel creates a session to manage the transmission and reception. The concept of sessions allows the kernel to manage various aspects of the protocol, such as reassembling multi-frame messages and tracking the status of transmissions.”h]”(hŒbIn J1939, all payloads provided by user space, regardless of size, are processed by the kernel as ”…”�”}”(hj­h²hh³Nh´Nubj­)�”}”(hŒ **sessions**”h]”hŒsessions”…”�”}”(hjµh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j¬hj­ubhX¶. This includes both single-frame messages (up to 8 bytes) and multi-frame protocols such as the Transport Protocol (TP) and Extended Transport Protocol (ETP). Even for small, single-frame messages, the kernel creates a session to manage the transmission and reception. The concept of sessions allows the kernel to manage various aspects of the protocol, such as reassembling multi-frame messages and tracking the status of transmissions.”…”�”}”(hj­h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M­hjah²hubhï)�”}”(hŒãWhen receiving extended error messages from the error queue, the error information is delivered through a `struct sock_extended_err`, accessible via the control message (``cmsg``) retrieved using the ``recvmsg(2)`` system call.”h]”(hŒjWhen receiving extended error messages from the error queue, the error information is delivered through a ”…”�”}”(hjÍh²hh³Nh´Nubj€)�”}”(hŒ`struct sock_extended_err`”h]”hŒstruct sock_extended_err”…”�”}”(hjÕh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjÍubhŒ&, accessible via the control message (”…”�”}”(hjÍh²hh³Nh´Nubj� )�”}”(hŒ``cmsg``”h]”hŒcmsg”…”�”}”(hjçh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjÍubhŒ) retrieved using the ”…”�”}”(hjÍh²hh³Nh´Nubj� )�”}”(hŒ``recvmsg(2)``”h]”hŒ recvmsg(2)”…”�”}”(hjùh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjÍubhŒ system call.”…”�”}”(hjÍh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M¶hjah²hubhï)�”}”(hŒGThere are two typical origins for the extended error messages in J1939:”h]”hŒGThere are two typical origins for the extended error messages in J1939:”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Mºhjah²hubhŒenumerated_list”“”)�”}”(hhh]”(j)�”}”(hXÂ``serr->ee_origin == SO_EE_ORIGIN_TIMESTAMPING``: In this case, the `serr->ee_info` field will contain one of the following timestamp types: - ``SCM_TSTAMP_SCHED``: This timestamp is valid for Extended Transport Protocol (ETP) transfers and simple transfers (8 bytes or less). It indicates when a message or set of frames has been scheduled for transmission. - For simple transfers (8 bytes or less), it marks the point when the message is queued and ready to be sent onto the CAN bus. - For ETP transfers, it is sent after receiving a CTS (Clear to Send) frame on the sender side, indicating that a new set of frames has been scheduled for transmission. - The Transport Protocol (TP) case is currently not implemented for this timestamp. - On the receiver side, the counterpart to this event for ETP is represented by the ``J1939_EE_INFO_RX_DPO`` message, which indicates the reception of a Data Page Offset (DPO) control frame. - ``SCM_TSTAMP_ACK``: This timestamp indicates the acknowledgment of the message or session. - For simple transfers (8 bytes or less), it marks when the message has been sent and an echo confirmation has been received from the CAN controller, indicating that the frame was transmitted onto the bus. - For multi-frame transfers (TP or ETP), it signifies that the entire session has been acknowledged, typically after receiving the End of Message Acknowledgment (EOMA) packet. ”h]”(hï)�”}”(hŒ1``serr->ee_origin == SO_EE_ORIGIN_TIMESTAMPING``:”h]”(j� )�”}”(hŒ0``serr->ee_origin == SO_EE_ORIGIN_TIMESTAMPING``”h]”hŒ,serr->ee_origin == SO_EE_ORIGIN_TIMESTAMPING”…”�”}”(hj,h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj(ubhŒ:”…”�”}”(hj(h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M¼hj$ubhï)�”}”(hŒZIn this case, the `serr->ee_info` field will contain one of the following timestamp types:”h]”(hŒIn this case, the ”…”�”}”(hjDh²hh³Nh´Nubj€)�”}”(hŒ`serr->ee_info`”h]”hŒ serr->ee_info”…”�”}”(hjLh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjDubhŒ9 field will contain one of the following timestamp types:”…”�”}”(hjDh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M¾hj$ubj)�”}”(hhh]”(j)�”}”(hX#``SCM_TSTAMP_SCHED``: This timestamp is valid for Extended Transport Protocol (ETP) transfers and simple transfers (8 bytes or less). It indicates when a message or set of frames has been scheduled for transmission. - For simple transfers (8 bytes or less), it marks the point when the message is queued and ready to be sent onto the CAN bus. - For ETP transfers, it is sent after receiving a CTS (Clear to Send) frame on the sender side, indicating that a new set of frames has been scheduled for transmission. - The Transport Protocol (TP) case is currently not implemented for this timestamp. - On the receiver side, the counterpart to this event for ETP is represented by the ``J1939_EE_INFO_RX_DPO`` message, which indicates the reception of a Data Page Offset (DPO) control frame. ”h]”(hï)�”}”(hŒ×``SCM_TSTAMP_SCHED``: This timestamp is valid for Extended Transport Protocol (ETP) transfers and simple transfers (8 bytes or less). It indicates when a message or set of frames has been scheduled for transmission.”h]”(j� )�”}”(hŒ``SCM_TSTAMP_SCHED``”h]”hŒSCM_TSTAMP_SCHED”…”�”}”(hjoh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjkubhŒÃ: This timestamp is valid for Extended Transport Protocol (ETP) transfers and simple transfers (8 bytes or less). It indicates when a message or set of frames has been scheduled for transmission.”…”�”}”(hjkh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MÁhjgubj)�”}”(hhh]”(j)�”}”(hŒ}For simple transfers (8 bytes or less), it marks the point when the message is queued and ready to be sent onto the CAN bus. ”h]”hï)�”}”(hŒ|For simple transfers (8 bytes or less), it marks the point when the message is queued and ready to be sent onto the CAN bus.”h]”hŒ|For simple transfers (8 bytes or less), it marks the point when the message is queued and ready to be sent onto the CAN bus.”…”�”}”(hjŽh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MÆhjŠubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj‡ubj)�”}”(hŒ§For ETP transfers, it is sent after receiving a CTS (Clear to Send) frame on the sender side, indicating that a new set of frames has been scheduled for transmission. ”h]”hï)�”}”(hŒ¦For ETP transfers, it is sent after receiving a CTS (Clear to Send) frame on the sender side, indicating that a new set of frames has been scheduled for transmission.”h]”hŒ¦For ETP transfers, it is sent after receiving a CTS (Clear to Send) frame on the sender side, indicating that a new set of frames has been scheduled for transmission.”…”�”}”(hj¦h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MÉhj¢ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj‡ubj)�”}”(hŒRThe Transport Protocol (TP) case is currently not implemented for this timestamp. ”h]”hï)�”}”(hŒQThe Transport Protocol (TP) case is currently not implemented for this timestamp.”h]”hŒQThe Transport Protocol (TP) case is currently not implemented for this timestamp.”…”�”}”(hj¾h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MÍhjºubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj‡ubj)�”}”(hŒ½On the receiver side, the counterpart to this event for ETP is represented by the ``J1939_EE_INFO_RX_DPO`` message, which indicates the reception of a Data Page Offset (DPO) control frame. ”h]”hï)�”}”(hŒ¼On the receiver side, the counterpart to this event for ETP is represented by the ``J1939_EE_INFO_RX_DPO`` message, which indicates the reception of a Data Page Offset (DPO) control frame.”h]”(hŒROn the receiver side, the counterpart to this event for ETP is represented by the ”…”�”}”(hjÖh²hh³Nh´Nubj� )�”}”(hŒ``J1939_EE_INFO_RX_DPO``”h]”hŒJ1939_EE_INFO_RX_DPO”…”�”}”(hjÞh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjÖubhŒR message, which indicates the reception of a Data Page Offset (DPO) control frame.”…”�”}”(hjÖh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MÐhjÒubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj‡ubeh}”(h]”h ]”h"]”h$]”h&]”jbjýuh1jh³hÇh´MÆhjgubeh}”(h]”h ]”h"]”h$]”h&]”uh1jhjdubj)�”}”(hXã``SCM_TSTAMP_ACK``: This timestamp indicates the acknowledgment of the message or session. - For simple transfers (8 bytes or less), it marks when the message has been sent and an echo confirmation has been received from the CAN controller, indicating that the frame was transmitted onto the bus. - For multi-frame transfers (TP or ETP), it signifies that the entire session has been acknowledged, typically after receiving the End of Message Acknowledgment (EOMA) packet. ”h]”(hï)�”}”(hŒZ``SCM_TSTAMP_ACK``: This timestamp indicates the acknowledgment of the message or session.”h]”(j� )�”}”(hŒ``SCM_TSTAMP_ACK``”h]”hŒSCM_TSTAMP_ACK”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj ubhŒH: This timestamp indicates the acknowledgment of the message or session.”…”�”}”(hj h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MÔhjubj)�”}”(hhh]”(j)�”}”(hŒÌFor simple transfers (8 bytes or less), it marks when the message has been sent and an echo confirmation has been received from the CAN controller, indicating that the frame was transmitted onto the bus. ”h]”hï)�”}”(hŒËFor simple transfers (8 bytes or less), it marks when the message has been sent and an echo confirmation has been received from the CAN controller, indicating that the frame was transmitted onto the bus.”h]”hŒËFor simple transfers (8 bytes or less), it marks when the message has been sent and an echo confirmation has been received from the CAN controller, indicating that the frame was transmitted onto the bus.”…”�”}”(hj/h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M×hj+ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj(ubj)�”}”(hŒ®For multi-frame transfers (TP or ETP), it signifies that the entire session has been acknowledged, typically after receiving the End of Message Acknowledgment (EOMA) packet. ”h]”hï)�”}”(hŒ­For multi-frame transfers (TP or ETP), it signifies that the entire session has been acknowledged, typically after receiving the End of Message Acknowledgment (EOMA) packet.”h]”hŒ­For multi-frame transfers (TP or ETP), it signifies that the entire session has been acknowledged, typically after receiving the End of Message Acknowledgment (EOMA) packet.”…”�”}”(hjGh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MÛhjCubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj(ubeh}”(h]”h ]”h"]”h$]”h&]”jbjýuh1jh³hÇh´M×hjubeh}”(h]”h ]”h"]”h$]”h&]”uh1jhjdubeh}”(h]”h ]”h"]”h$]”h&]”jbjýuh1jh³hÇh´MÁhj$ubeh}”(h]”h ]”h"]”h$]”h&]”uh1jhj!h²hh³Nh´Nubj)�”}”(hXï ``serr->ee_origin == SO_EE_ORIGIN_LOCAL``: In this case, the `serr->ee_info` field will contain one of the following J1939 stack-specific message types: - ``J1939_EE_INFO_TX_ABORT``: This message indicates that the transmission of a message or session was aborted. The cause of the abort can come from various sources: - **CAN stack failure**: The J1939 stack was unable to pass the frame to the CAN framework for transmission. - **Echo failure**: The J1939 stack did not receive an echo confirmation from the CAN controller, meaning the frame may not have been successfully transmitted to the CAN bus. - **Protocol-level issues**: For multi-frame transfers (TP/ETP), this could include protocol-related errors, such as an abort signaled by the receiver or a timeout at the protocol level, which causes the session to terminate prematurely. - The corresponding error code is stored in ``serr->ee_data`` (``session->err`` on kernel side), providing additional details about the specific reason for the abort. - ``J1939_EE_INFO_RX_RTS``: This message indicates that the J1939 stack has received a Request to Send (RTS) control frame, signaling the start of a multi-frame transfer using the Transport Protocol (TP) or Extended Transport Protocol (ETP). - It informs the receiver that the sender is ready to transmit a multi-frame message and includes details about the total message size and the number of frames to be sent. - Statistics such as ``J1939_NLA_TOTAL_SIZE``, ``J1939_NLA_PGN``, ``J1939_NLA_SRC_NAME``, and ``J1939_NLA_DEST_NAME`` are provided along with the ``J1939_EE_INFO_RX_RTS`` message, giving detailed information about the incoming transfer. - ``J1939_EE_INFO_RX_DPO``: This message indicates that the J1939 stack has received a Data Page Offset (DPO) control frame, which is part of the Extended Transport Protocol (ETP). - The DPO frame signals the continuation of an ETP multi-frame message by indicating the offset position in the data being transferred. It helps the receiver manage large data sets by identifying which portion of the message is being received. - It is typically paired with a corresponding ``SCM_TSTAMP_SCHED`` event on the sender side, which indicates when the next set of frames is scheduled for transmission. - This event includes statistics such as ``J1939_NLA_BYTES_ACKED``, which tracks the number of bytes acknowledged up to that point in the session. - ``J1939_EE_INFO_RX_ABORT``: This message indicates that the reception of a multi-frame message (Transport Protocol or Extended Transport Protocol) has been aborted. - The abort can be triggered by protocol-level errors such as timeouts, an unexpected frame, or a specific abort request from the sender. - This message signals that the receiver cannot continue processing the transfer, and the session is terminated. - The corresponding error code is stored in ``serr->ee_data`` (``session->err`` on kernel side ), providing further details about the reason for the abort, such as protocol violations or timeouts. - After receiving this message, the receiver discards the partially received frames, and the multi-frame session is considered incomplete. ”h]”(hï)�”}”(hŒ*``serr->ee_origin == SO_EE_ORIGIN_LOCAL``:”h]”(j� )�”}”(hŒ)``serr->ee_origin == SO_EE_ORIGIN_LOCAL``”h]”hŒ%serr->ee_origin == SO_EE_ORIGIN_LOCAL”…”�”}”(hj{h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjwubhŒ:”…”�”}”(hjwh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Mßhjsubhï)�”}”(hŒmIn this case, the `serr->ee_info` field will contain one of the following J1939 stack-specific message types:”h]”(hŒIn this case, the ”…”�”}”(hj“h²hh³Nh´Nubj€)�”}”(hŒ`serr->ee_info`”h]”hŒ serr->ee_info”…”�”}”(hj›h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj“ubhŒL field will contain one of the following J1939 stack-specific message types:”…”�”}”(hj“h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Máhjsubj)�”}”(hhh]”(j)�”}”(hXi``J1939_EE_INFO_TX_ABORT``: This message indicates that the transmission of a message or session was aborted. The cause of the abort can come from various sources: - **CAN stack failure**: The J1939 stack was unable to pass the frame to the CAN framework for transmission. - **Echo failure**: The J1939 stack did not receive an echo confirmation from the CAN controller, meaning the frame may not have been successfully transmitted to the CAN bus. - **Protocol-level issues**: For multi-frame transfers (TP/ETP), this could include protocol-related errors, such as an abort signaled by the receiver or a timeout at the protocol level, which causes the session to terminate prematurely. - The corresponding error code is stored in ``serr->ee_data`` (``session->err`` on kernel side), providing additional details about the specific reason for the abort. ”h]”(hï)�”}”(hŒ£``J1939_EE_INFO_TX_ABORT``: This message indicates that the transmission of a message or session was aborted. The cause of the abort can come from various sources:”h]”(j� )�”}”(hŒ``J1939_EE_INFO_TX_ABORT``”h]”hŒJ1939_EE_INFO_TX_ABORT”…”�”}”(hj¾h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjºubhŒ‰: This message indicates that the transmission of a message or session was aborted. The cause of the abort can come from various sources:”…”�”}”(hjºh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Mähj¶ubj)�”}”(hhh]”(j)�”}”(hŒk**CAN stack failure**: The J1939 stack was unable to pass the frame to the CAN framework for transmission. ”h]”hï)�”}”(hŒj**CAN stack failure**: The J1939 stack was unable to pass the frame to the CAN framework for transmission.”h]”(j­)�”}”(hŒ**CAN stack failure**”h]”hŒCAN stack failure”…”�”}”(hjáh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j¬hjÝubhŒU: The J1939 stack was unable to pass the frame to the CAN framework for transmission.”…”�”}”(hjÝh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MèhjÙubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjÖubj)�”}”(hŒ­**Echo failure**: The J1939 stack did not receive an echo confirmation from the CAN controller, meaning the frame may not have been successfully transmitted to the CAN bus. ”h]”hï)�”}”(hŒ¬**Echo failure**: The J1939 stack did not receive an echo confirmation from the CAN controller, meaning the frame may not have been successfully transmitted to the CAN bus.”h]”(j­)�”}”(hŒ**Echo failure**”h]”hŒ Echo failure”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j¬hjubhŒœ: The J1939 stack did not receive an echo confirmation from the CAN controller, meaning the frame may not have been successfully transmitted to the CAN bus.”…”�”}”(hjh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Mëhjÿubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjÖubj)�”}”(hŒì**Protocol-level issues**: For multi-frame transfers (TP/ETP), this could include protocol-related errors, such as an abort signaled by the receiver or a timeout at the protocol level, which causes the session to terminate prematurely. ”h]”hï)�”}”(hŒë**Protocol-level issues**: For multi-frame transfers (TP/ETP), this could include protocol-related errors, such as an abort signaled by the receiver or a timeout at the protocol level, which causes the session to terminate prematurely.”h]”(j­)�”}”(hŒ**Protocol-level issues**”h]”hŒProtocol-level issues”…”�”}”(hj-h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j¬hj)ubhŒÒ: For multi-frame transfers (TP/ETP), this could include protocol-related errors, such as an abort signaled by the receiver or a timeout at the protocol level, which causes the session to terminate prematurely.”…”�”}”(hj)h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Mïhj%ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjÖubj)�”}”(hŒ¥The corresponding error code is stored in ``serr->ee_data`` (``session->err`` on kernel side), providing additional details about the specific reason for the abort. ”h]”hï)�”}”(hŒ¤The corresponding error code is stored in ``serr->ee_data`` (``session->err`` on kernel side), providing additional details about the specific reason for the abort.”h]”(hŒ*The corresponding error code is stored in ”…”�”}”(hjOh²hh³Nh´Nubj� )�”}”(hŒ``serr->ee_data``”h]”hŒ serr->ee_data”…”�”}”(hjWh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjOubhŒ (”…”�”}”(hjOh²hh³Nh´Nubj� )�”}”(hŒ``session->err``”h]”hŒ session->err”…”�”}”(hjih²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjOubhŒW on kernel side), providing additional details about the specific reason for the abort.”…”�”}”(hjOh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MôhjKubah}”(h]”h ]”h"]”h$]”h&]”uh1jh•jÖubeh}”(h]”h ]”h"]”h$]”h&]”jbjýuh1jh³hÇh´Mèhj¶ubeh}”(h]”h ]”h"]”h$]”h&]”uh1jhj³ubj)�”}”(hX•``J1939_EE_INFO_RX_RTS``: This message indicates that the J1939 stack has received a Request to Send (RTS) control frame, signaling the start of a multi-frame transfer using the Transport Protocol (TP) or Extended Transport Protocol (ETP). - It informs the receiver that the sender is ready to transmit a multi-frame message and includes details about the total message size and the number of frames to be sent. - Statistics such as ``J1939_NLA_TOTAL_SIZE``, ``J1939_NLA_PGN``, ``J1939_NLA_SRC_NAME``, and ``J1939_NLA_DEST_NAME`` are provided along with the ``J1939_EE_INFO_RX_RTS`` message, giving detailed information about the incoming transfer. ”h]”(hï)�”}”(hŒï``J1939_EE_INFO_RX_RTS``: This message indicates that the J1939 stack has received a Request to Send (RTS) control frame, signaling the start of a multi-frame transfer using the Transport Protocol (TP) or Extended Transport Protocol (ETP).”h]”(j� )�”}”(hŒ``J1939_EE_INFO_RX_RTS``”h]”hŒJ1939_EE_INFO_RX_RTS”…”�”}”(hj›h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj—ubhŒ×: This message indicates that the J1939 stack has received a Request to Send (RTS) control frame, signaling the start of a multi-frame transfer using the Transport Protocol (TP) or Extended Transport Protocol (ETP).”…”�”}”(hj—h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Møhj“ubj)�”}”(hhh]”(j)�”}”(hŒªIt informs the receiver that the sender is ready to transmit a multi-frame message and includes details about the total message size and the number of frames to be sent. ”h]”hï)�”}”(hŒ©It informs the receiver that the sender is ready to transmit a multi-frame message and includes details about the total message size and the number of frames to be sent.”h]”hŒ©It informs the receiver that the sender is ready to transmit a multi-frame message and includes details about the total message size and the number of frames to be sent.”…”�”}”(hjºh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Mýhj¶ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj³ubj)�”}”(hŒëStatistics such as ``J1939_NLA_TOTAL_SIZE``, ``J1939_NLA_PGN``, ``J1939_NLA_SRC_NAME``, and ``J1939_NLA_DEST_NAME`` are provided along with the ``J1939_EE_INFO_RX_RTS`` message, giving detailed information about the incoming transfer. ”h]”hï)�”}”(hŒêStatistics such as ``J1939_NLA_TOTAL_SIZE``, ``J1939_NLA_PGN``, ``J1939_NLA_SRC_NAME``, and ``J1939_NLA_DEST_NAME`` are provided along with the ``J1939_EE_INFO_RX_RTS`` message, giving detailed information about the incoming transfer.”h]”(hŒStatistics such as ”…”�”}”(hjÒh²hh³Nh´Nubj� )�”}”(hŒ``J1939_NLA_TOTAL_SIZE``”h]”hŒJ1939_NLA_TOTAL_SIZE”…”�”}”(hjÚh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjÒubhŒ, ”…”�”}”(hjÒh²hh³Nh´Nubj� )�”}”(hŒ``J1939_NLA_PGN``”h]”hŒ J1939_NLA_PGN”…”�”}”(hjìh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjÒubhŒ, ”…”�”}”(hjÒh²hh³Nh´Nubj� )�”}”(hŒ``J1939_NLA_SRC_NAME``”h]”hŒJ1939_NLA_SRC_NAME”…”�”}”(hjþh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjÒubhŒ, and ”…”�”}”(hjÒh²hh³Nh´Nubj� )�”}”(hŒ``J1939_NLA_DEST_NAME``”h]”hŒJ1939_NLA_DEST_NAME”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjÒubhŒ are provided along with the ”…”�”}”(hjÒh²hh³Nh´Nubj� )�”}”(hŒ``J1939_EE_INFO_RX_RTS``”h]”hŒJ1939_EE_INFO_RX_RTS”…”�”}”(hj"h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjÒubhŒB message, giving detailed information about the incoming transfer.”…”�”}”(hjÒh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MhjÎubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj³ubeh}”(h]”h ]”h"]”h$]”h&]”jbjýuh1jh³hÇh´Mýhj“ubeh}”(h]”h ]”h"]”h$]”h&]”uh1jhj³ubj)�”}”(hXñ``J1939_EE_INFO_RX_DPO``: This message indicates that the J1939 stack has received a Data Page Offset (DPO) control frame, which is part of the Extended Transport Protocol (ETP). - The DPO frame signals the continuation of an ETP multi-frame message by indicating the offset position in the data being transferred. It helps the receiver manage large data sets by identifying which portion of the message is being received. - It is typically paired with a corresponding ``SCM_TSTAMP_SCHED`` event on the sender side, which indicates when the next set of frames is scheduled for transmission. - This event includes statistics such as ``J1939_NLA_BYTES_ACKED``, which tracks the number of bytes acknowledged up to that point in the session. ”h]”(hï)�”}”(hŒ²``J1939_EE_INFO_RX_DPO``: This message indicates that the J1939 stack has received a Data Page Offset (DPO) control frame, which is part of the Extended Transport Protocol (ETP).”h]”(j� )�”}”(hŒ``J1939_EE_INFO_RX_DPO``”h]”hŒJ1939_EE_INFO_RX_DPO”…”�”}”(hjTh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjPubhŒš: This message indicates that the J1939 stack has received a Data Page Offset (DPO) control frame, which is part of the Extended Transport Protocol (ETP).”…”�”}”(hjPh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MhjLubj)�”}”(hhh]”(j)�”}”(hŒòThe DPO frame signals the continuation of an ETP multi-frame message by indicating the offset position in the data being transferred. It helps the receiver manage large data sets by identifying which portion of the message is being received. ”h]”hï)�”}”(hŒñThe DPO frame signals the continuation of an ETP multi-frame message by indicating the offset position in the data being transferred. It helps the receiver manage large data sets by identifying which portion of the message is being received.”h]”hŒñThe DPO frame signals the continuation of an ETP multi-frame message by indicating the offset position in the data being transferred. It helps the receiver manage large data sets by identifying which portion of the message is being received.”…”�”}”(hjsh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M hjoubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjlubj)�”}”(hŒ¦It is typically paired with a corresponding ``SCM_TSTAMP_SCHED`` event on the sender side, which indicates when the next set of frames is scheduled for transmission. ”h]”hï)�”}”(hŒ¥It is typically paired with a corresponding ``SCM_TSTAMP_SCHED`` event on the sender side, which indicates when the next set of frames is scheduled for transmission.”h]”(hŒ,It is typically paired with a corresponding ”…”�”}”(hj‹h²hh³Nh´Nubj� )�”}”(hŒ``SCM_TSTAMP_SCHED``”h]”hŒSCM_TSTAMP_SCHED”…”�”}”(hj“h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj‹ubhŒe event on the sender side, which indicates when the next set of frames is scheduled for transmission.”…”�”}”(hj‹h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Mhj‡ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjlubj)�”}”(hŒ‘This event includes statistics such as ``J1939_NLA_BYTES_ACKED``, which tracks the number of bytes acknowledged up to that point in the session. ”h]”hï)�”}”(hŒ�This event includes statistics such as ``J1939_NLA_BYTES_ACKED``, which tracks the number of bytes acknowledged up to that point in the session.”h]”(hŒ'This event includes statistics such as ”…”�”}”(hjµh²hh³Nh´Nubj� )�”}”(hŒ``J1939_NLA_BYTES_ACKED``”h]”hŒJ1939_NLA_BYTES_ACKED”…”�”}”(hj½h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjµubhŒP, which tracks the number of bytes acknowledged up to that point in the session.”…”�”}”(hjµh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Mhj±ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjlubeh}”(h]”h ]”h"]”h$]”h&]”jbjýuh1jh³hÇh´M hjLubeh}”(h]”h ]”h"]”h$]”h&]”uh1jhj³ubj)�”}”(hXþ``J1939_EE_INFO_RX_ABORT``: This message indicates that the reception of a multi-frame message (Transport Protocol or Extended Transport Protocol) has been aborted. - The abort can be triggered by protocol-level errors such as timeouts, an unexpected frame, or a specific abort request from the sender. - This message signals that the receiver cannot continue processing the transfer, and the session is terminated. - The corresponding error code is stored in ``serr->ee_data`` (``session->err`` on kernel side ), providing further details about the reason for the abort, such as protocol violations or timeouts. - After receiving this message, the receiver discards the partially received frames, and the multi-frame session is considered incomplete. ”h]”(hï)�”}”(hŒ¤``J1939_EE_INFO_RX_ABORT``: This message indicates that the reception of a multi-frame message (Transport Protocol or Extended Transport Protocol) has been aborted.”h]”(j� )�”}”(hŒ``J1939_EE_INFO_RX_ABORT``”h]”hŒJ1939_EE_INFO_RX_ABORT”…”�”}”(hjïh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjëubhŒŠ: This message indicates that the reception of a multi-frame message (Transport Protocol or Extended Transport Protocol) has been aborted.”…”�”}”(hjëh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Mhjçubj)�”}”(hhh]”(j)�”}”(hŒˆThe abort can be triggered by protocol-level errors such as timeouts, an unexpected frame, or a specific abort request from the sender. ”h]”hï)�”}”(hŒ‡The abort can be triggered by protocol-level errors such as timeouts, an unexpected frame, or a specific abort request from the sender.”h]”hŒ‡The abort can be triggered by protocol-level errors such as timeouts, an unexpected frame, or a specific abort request from the sender.”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Mhj ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj ubj)�”}”(hŒoThis message signals that the receiver cannot continue processing the transfer, and the session is terminated. ”h]”hï)�”}”(hŒnThis message signals that the receiver cannot continue processing the transfer, and the session is terminated.”h]”hŒnThis message signals that the receiver cannot continue processing the transfer, and the session is terminated.”…”�”}”(hj& h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Mhj" ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj ubj)�”}”(hŒÃThe corresponding error code is stored in ``serr->ee_data`` (``session->err`` on kernel side ), providing further details about the reason for the abort, such as protocol violations or timeouts. ”h]”hï)�”}”(hŒÂThe corresponding error code is stored in ``serr->ee_data`` (``session->err`` on kernel side ), providing further details about the reason for the abort, such as protocol violations or timeouts.”h]”(hŒ*The corresponding error code is stored in ”…”�”}”(hj> h²hh³Nh´Nubj� )�”}”(hŒ``serr->ee_data``”h]”hŒ serr->ee_data”…”�”}”(hjF h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj> ubhŒ (”…”�”}”(hj> h²hh³Nh´Nubj� )�”}”(hŒ``session->err``”h]”hŒ session->err”…”�”}”(hjX h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj> ubhŒu on kernel side ), providing further details about the reason for the abort, such as protocol violations or timeouts.”…”�”}”(hj> h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M hj: ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj ubj)�”}”(hŒ‰After receiving this message, the receiver discards the partially received frames, and the multi-frame session is considered incomplete. ”h]”hï)�”}”(hŒˆAfter receiving this message, the receiver discards the partially received frames, and the multi-frame session is considered incomplete.”h]”hŒˆAfter receiving this message, the receiver discards the partially received frames, and the multi-frame session is considered incomplete.”…”�”}”(hjz h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M$hjv ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj ubeh}”(h]”h ]”h"]”h$]”h&]”jbjýuh1jh³hÇh´Mhjçubeh}”(h]”h ]”h"]”h$]”h&]”uh1jhj³ubeh}”(h]”h ]”h"]”h$]”h&]”jbjýuh1jh³hÇh´Mähjsubeh}”(h]”h ]”h"]”h$]”h&]”uh1jhj!h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”Œenumtype”Œarabic”Œprefix”hŒsuffix”Œ.”uh1jhjah²hh³hÇh´M¼ubhï)�”}”(hXIn both cases, if ``SOF_TIMESTAMPING_OPT_ID`` is enabled, ``serr->ee_data`` will be set to the session’s unique identifier (``session->tskey``). This allows user space to track message transfers by their session identifier across multiple frames or stages.”h]”(hŒIn both cases, if ”…”�”}”(hj± h²hh³Nh´Nubj� )�”}”(hŒ``SOF_TIMESTAMPING_OPT_ID``”h]”hŒSOF_TIMESTAMPING_OPT_ID”…”�”}”(hj¹ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj± ubhŒ is enabled, ”…”�”}”(hj± h²hh³Nh´Nubj� )�”}”(hŒ``serr->ee_data``”h]”hŒ serr->ee_data”…”�”}”(hjË h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj± ubhŒ3 will be set to the session’s unique identifier (”…”�”}”(hj± h²hh³Nh´Nubj� )�”}”(hŒ``session->tskey``”h]”hŒsession->tskey”…”�”}”(hjÝ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj± ubhŒr). This allows user space to track message transfers by their session identifier across multiple frames or stages.”…”�”}”(hj± h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M'hjah²hubhï)�”}”(hXøIn all other cases, ``serr->ee_errno`` will be set to ``ENOMSG``, except for the ``J1939_EE_INFO_TX_ABORT`` and ``J1939_EE_INFO_RX_ABORT`` cases, where the kernel sets ``serr->ee_data`` to the error stored in ``session->err``. All protocol-specific errors are converted to standard kernel error values and stored in ``session->err``. These error values are unified across system calls and ``serr->ee_errno``. Some of the known error values are described in the `Error Codes in the J1939 Stack` section.”h]”(hŒIn all other cases, ”…”�”}”(hjõ h²hh³Nh´Nubj� )�”}”(hŒ``serr->ee_errno``”h]”hŒserr->ee_errno”…”�”}”(hjý h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjõ ubhŒ will be set to ”…”�”}”(hjõ h²hh³Nh´Nubj� )�”}”(hŒ ``ENOMSG``”h]”hŒENOMSG”…”�”}”(hj!h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjõ ubhŒ, except for the ”…”�”}”(hjõ h²hh³Nh´Nubj� )�”}”(hŒ``J1939_EE_INFO_TX_ABORT``”h]”hŒJ1939_EE_INFO_TX_ABORT”…”�”}”(hj!!h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjõ ubhŒ and ”…”�”}”(hjõ h²hh³Nh´Nubj� )�”}”(hŒ``J1939_EE_INFO_RX_ABORT``”h]”hŒJ1939_EE_INFO_RX_ABORT”…”�”}”(hj3!h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjõ ubhŒ cases, where the kernel sets ”…”�”}”(hjõ h²hh³Nh´Nubj� )�”}”(hŒ``serr->ee_data``”h]”hŒ serr->ee_data”…”�”}”(hjE!h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjõ ubhŒ to the error stored in ”…”�”}”(hjõ h²hh³Nh´Nubj� )�”}”(hŒ``session->err``”h]”hŒ session->err”…”�”}”(hjW!h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjõ ubhŒ\. All protocol-specific errors are converted to standard kernel error values and stored in ”…”�”}”(hjõ h²hh³Nh´Nubj� )�”}”(hŒ``session->err``”h]”hŒ session->err”…”�”}”(hji!h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjõ ubhŒ9. These error values are unified across system calls and ”…”�”}”(hjõ h²hh³Nh´Nubj� )�”}”(hŒ``serr->ee_errno``”h]”hŒserr->ee_errno”…”�”}”(hj{!h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjõ ubhŒ7. Some of the known error values are described in the ”…”�”}”(hjõ h²hh³Nh´Nubj€)�”}”(hŒ `Error Codes in the J1939 Stack`”h]”hŒError Codes in the J1939 Stack”…”�”}”(hj�!h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjõ ubhŒ section.”…”�”}”(hjõ h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M,hjah²hubhï)�”}”(hŒ„When the `J1939_EE_INFO_RX_RTS` message is provided, it will include the following statistics for multi-frame messages (TP and ETP):”h]”(hŒ When the ”…”�”}”(hj¥!h²hh³Nh´Nubj€)�”}”(hŒ`J1939_EE_INFO_RX_RTS`”h]”hŒJ1939_EE_INFO_RX_RTS”…”�”}”(hj­!h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj¥!ubhŒe message is provided, it will include the following statistics for multi-frame messages (TP and ETP):”…”�”}”(hj¥!h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M4hjah²hubjÌ)�”}”(hXœ- ``J1939_NLA_TOTAL_SIZE``: Total size of the message in the session. - ``J1939_NLA_PGN``: Parameter Group Number (PGN) identifying the message type. - ``J1939_NLA_SRC_NAME``: 64-bit name of the source ECU. - ``J1939_NLA_DEST_NAME``: 64-bit name of the destination ECU. - ``J1939_NLA_SRC_ADDR``: 8-bit source address of the sending ECU. - ``J1939_NLA_DEST_ADDR``: 8-bit destination address of the receiving ECU. ”h]”j)�”}”(hhh]”(j)�”}”(hŒC``J1939_NLA_TOTAL_SIZE``: Total size of the message in the session.”h]”hï)�”}”(hjÎ!h]”(j� )�”}”(hŒ``J1939_NLA_TOTAL_SIZE``”h]”hŒJ1939_NLA_TOTAL_SIZE”…”�”}”(hjÓ!h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjÐ!ubhŒ+: Total size of the message in the session.”…”�”}”(hjÐ!h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M7hjÌ!ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjÉ!ubj)�”}”(hŒM``J1939_NLA_PGN``: Parameter Group Number (PGN) identifying the message type.”h]”hï)�”}”(hjó!h]”(j� )�”}”(hŒ``J1939_NLA_PGN``”h]”hŒ J1939_NLA_PGN”…”�”}”(hjø!h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjõ!ubhŒ<: Parameter Group Number (PGN) identifying the message type.”…”�”}”(hjõ!h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M8hjñ!ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjÉ!ubj)�”}”(hŒ6``J1939_NLA_SRC_NAME``: 64-bit name of the source ECU.”h]”hï)�”}”(hj"h]”(j� )�”}”(hŒ``J1939_NLA_SRC_NAME``”h]”hŒJ1939_NLA_SRC_NAME”…”�”}”(hj"h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj"ubhŒ : 64-bit name of the source ECU.”…”�”}”(hj"h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M9hj"ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjÉ!ubj)�”}”(hŒ<``J1939_NLA_DEST_NAME``: 64-bit name of the destination ECU.”h]”hï)�”}”(hj="h]”(j� )�”}”(hŒ``J1939_NLA_DEST_NAME``”h]”hŒJ1939_NLA_DEST_NAME”…”�”}”(hjB"h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj?"ubhŒ%: 64-bit name of the destination ECU.”…”�”}”(hj?"h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M:hj;"ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjÉ!ubj)�”}”(hŒ@``J1939_NLA_SRC_ADDR``: 8-bit source address of the sending ECU.”h]”hï)�”}”(hjb"h]”(j� )�”}”(hŒ``J1939_NLA_SRC_ADDR``”h]”hŒJ1939_NLA_SRC_ADDR”…”�”}”(hjg"h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjd"ubhŒ*: 8-bit source address of the sending ECU.”…”�”}”(hjd"h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M;hj`"ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjÉ!ubj)�”}”(hŒI``J1939_NLA_DEST_ADDR``: 8-bit destination address of the receiving ECU. ”h]”hï)�”}”(hŒH``J1939_NLA_DEST_ADDR``: 8-bit destination address of the receiving ECU.”h]”(j� )�”}”(hŒ``J1939_NLA_DEST_ADDR``”h]”hŒJ1939_NLA_DEST_ADDR”…”�”}”(hj�"h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj‰"ubhŒ1: 8-bit destination address of the receiving ECU.”…”�”}”(hj‰"h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M<hj…"ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjÉ!ubeh}”(h]”h ]”h"]”h$]”h&]”jbjýuh1jh³hÇh´M7hjÅ!ubah}”(h]”h ]”h"]”h$]”h&]”uh1jËh³hÇh´M7hjah²hubj)�”}”(hhh]”j)�”}”(hŒºFor other messages (including single-frame messages), only the following statistic is included: - ``J1939_NLA_BYTES_ACKED``: Number of bytes successfully acknowledged in the session. ”h]”(hï)�”}”(hŒ_For other messages (including single-frame messages), only the following statistic is included:”h]”hŒ_For other messages (including single-frame messages), only the following statistic is included:”…”�”}”(hj¾"h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M>hjº"ubj)�”}”(hhh]”j)�”}”(hŒU``J1939_NLA_BYTES_ACKED``: Number of bytes successfully acknowledged in the session. ”h]”hï)�”}”(hŒT``J1939_NLA_BYTES_ACKED``: Number of bytes successfully acknowledged in the session.”h]”(j� )�”}”(hŒ``J1939_NLA_BYTES_ACKED``”h]”hŒJ1939_NLA_BYTES_ACKED”…”�”}”(hj×"h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjÓ"ubhŒ;: Number of bytes successfully acknowledged in the session.”…”�”}”(hjÓ"h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MAhjÏ"ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjÌ"ubah}”(h]”h ]”h"]”h$]”h&]”jbjýuh1jh³hÇh´MAhjº"ubeh}”(h]”h ]”h"]”h$]”h&]”uh1jhj·"h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”jbjýuh1jh³hÇh´M>hjah²hubhï)�”}”(hŒ.The key flags for ``SO_TIMESTAMPING`` include:”h]”(hŒThe key flags for ”…”�”}”(hj#h²hh³Nh´Nubj� )�”}”(hŒ``SO_TIMESTAMPING``”h]”hŒSO_TIMESTAMPING”…”�”}”(hj#h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj#ubhŒ include:”…”�”}”(hj#h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MDhjah²hubj)�”}”(hhh]”(j)�”}”(hX``SOF_TIMESTAMPING_OPT_ID``: Enables the use of a unique session identifier (``tskey``) for each transfer. This identifier helps track message transfers and errors as distinct sessions in user space. When this option is enabled, ``serr->ee_data`` will be set to ``session->tskey``. ”h]”hï)�”}”(hX``SOF_TIMESTAMPING_OPT_ID``: Enables the use of a unique session identifier (``tskey``) for each transfer. This identifier helps track message transfers and errors as distinct sessions in user space. When this option is enabled, ``serr->ee_data`` will be set to ``session->tskey``.”h]”(j� )�”}”(hŒ``SOF_TIMESTAMPING_OPT_ID``”h]”hŒSOF_TIMESTAMPING_OPT_ID”…”�”}”(hj2#h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj.#ubhŒ2: Enables the use of a unique session identifier (”…”�”}”(hj.#h²hh³Nh´Nubj� )�”}”(hŒ ``tskey``”h]”hŒtskey”…”�”}”(hjD#h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj.#ubhŒ�) for each transfer. This identifier helps track message transfers and errors as distinct sessions in user space. When this option is enabled, ”…”�”}”(hj.#h²hh³Nh´Nubj� )�”}”(hŒ``serr->ee_data``”h]”hŒ serr->ee_data”…”�”}”(hjV#h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj.#ubhŒ will be set to ”…”�”}”(hj.#h²hh³Nh´Nubj� )�”}”(hŒ``session->tskey``”h]”hŒsession->tskey”…”�”}”(hjh#h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj.#ubhŒ.”…”�”}”(hj.#h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MFhj*#ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj'#h²hh³hÇh´Nubj)�”}”(hŒ·``SOF_TIMESTAMPING_OPT_CMSG``: Sends timestamp information through control messages (``struct scm_timestamping``), allowing the application to retrieve timestamps alongside the data. ”h]”hï)�”}”(hŒ¶``SOF_TIMESTAMPING_OPT_CMSG``: Sends timestamp information through control messages (``struct scm_timestamping``), allowing the application to retrieve timestamps alongside the data.”h]”(j� )�”}”(hŒ``SOF_TIMESTAMPING_OPT_CMSG``”h]”hŒSOF_TIMESTAMPING_OPT_CMSG”…”�”}”(hjŽ#h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjŠ#ubhŒ8: Sends timestamp information through control messages (”…”�”}”(hjŠ#h²hh³Nh´Nubj� )�”}”(hŒ``struct scm_timestamping``”h]”hŒstruct scm_timestamping”…”�”}”(hj #h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjŠ#ubhŒF), allowing the application to retrieve timestamps alongside the data.”…”�”}”(hjŠ#h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MKhj†#ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj'#h²hh³hÇh´Nubj)�”}”(hŒ``SOF_TIMESTAMPING_TX_SCHED``: Provides the timestamp for when a message is scheduled for transmission (``SCM_TSTAMP_SCHED``). ”h]”hï)�”}”(hŒ~``SOF_TIMESTAMPING_TX_SCHED``: Provides the timestamp for when a message is scheduled for transmission (``SCM_TSTAMP_SCHED``).”h]”(j� )�”}”(hŒ``SOF_TIMESTAMPING_TX_SCHED``”h]”hŒSOF_TIMESTAMPING_TX_SCHED”…”�”}”(hjÆ#h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjÂ#ubhŒK: Provides the timestamp for when a message is scheduled for transmission (”…”�”}”(hjÂ#h²hh³Nh´Nubj� )�”}”(hŒ``SCM_TSTAMP_SCHED``”h]”hŒSCM_TSTAMP_SCHED”…”�”}”(hjØ#h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjÂ#ubhŒ).”…”�”}”(hjÂ#h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MOhj¾#ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj'#h²hh³hÇh´Nubj)�”}”(hŒ€``SOF_TIMESTAMPING_TX_ACK``: Provides the timestamp for when a message transmission is fully acknowledged (``SCM_TSTAMP_ACK``). ”h]”hï)�”}”(hŒ``SOF_TIMESTAMPING_TX_ACK``: Provides the timestamp for when a message transmission is fully acknowledged (``SCM_TSTAMP_ACK``).”h]”(j� )�”}”(hŒ``SOF_TIMESTAMPING_TX_ACK``”h]”hŒSOF_TIMESTAMPING_TX_ACK”…”�”}”(hjþ#h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjú#ubhŒP: Provides the timestamp for when a message transmission is fully acknowledged (”…”�”}”(hjú#h²hh³Nh´Nubj� )�”}”(hŒ``SCM_TSTAMP_ACK``”h]”hŒSCM_TSTAMP_ACK”…”�”}”(hj$h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjú#ubhŒ).”…”�”}”(hjú#h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MRhjö#ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj'#h²hh³hÇh´Nubj)�”}”(hŒ«``SOF_TIMESTAMPING_RX_SOFTWARE``: Provides timestamps for reception-related events (e.g., ``J1939_EE_INFO_RX_RTS``, ``J1939_EE_INFO_RX_DPO``, ``J1939_EE_INFO_RX_ABORT``). ”h]”hï)�”}”(hŒª``SOF_TIMESTAMPING_RX_SOFTWARE``: Provides timestamps for reception-related events (e.g., ``J1939_EE_INFO_RX_RTS``, ``J1939_EE_INFO_RX_DPO``, ``J1939_EE_INFO_RX_ABORT``).”h]”(j� )�”}”(hŒ ``SOF_TIMESTAMPING_RX_SOFTWARE``”h]”hŒSOF_TIMESTAMPING_RX_SOFTWARE”…”�”}”(hj6$h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj2$ubhŒ:: Provides timestamps for reception-related events (e.g., ”…”�”}”(hj2$h²hh³Nh´Nubj� )�”}”(hŒ``J1939_EE_INFO_RX_RTS``”h]”hŒJ1939_EE_INFO_RX_RTS”…”�”}”(hjH$h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj2$ubhŒ, ”…”�”}”(hj2$h²hh³Nh´Nubj� )�”}”(hŒ``J1939_EE_INFO_RX_DPO``”h]”hŒJ1939_EE_INFO_RX_DPO”…”�”}”(hjZ$h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj2$ubhŒ, ”…”�”}”(hj2$h²hh³Nh´Nubj� )�”}”(hŒ``J1939_EE_INFO_RX_ABORT``”h]”hŒJ1939_EE_INFO_RX_ABORT”…”�”}”(hjl$h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj2$ubhŒ).”…”�”}”(hj2$h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MUhj.$ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj'#h²hh³hÇh´Nubeh}”(h]”h ]”h"]”h$]”h&]”jbjýuh1jh³hÇh´MFhjah²hubhï)�”}”(hŒÿThese flags enable detailed monitoring of message lifecycles, including transmission scheduling, acknowledgments, reception timestamps, and gathering detailed statistics about the communication session, especially for multi-frame payloads like TP and ETP.”h]”hŒÿThese flags enable detailed monitoring of message lifecycles, including transmission scheduling, acknowledgments, reception timestamps, and gathering detailed statistics about the communication session, especially for multi-frame payloads like TP and ETP.”…”�”}”(hj�$h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MYhjah²hubhï)�”}”(hŒExample:”h]”hŒExample:”…”�”}”(hjž$h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M^hjah²hubj¹ )�”}”(hX{// Enable timestamping with various options, including session tracking and // statistics int sock_opt = SOF_TIMESTAMPING_OPT_CMSG | SOF_TIMESTAMPING_TX_ACK | SOF_TIMESTAMPING_TX_SCHED | SOF_TIMESTAMPING_OPT_ID | SOF_TIMESTAMPING_RX_SOFTWARE; setsockopt(sock, SOL_SOCKET, SO_TIMESTAMPING, &sock_opt, sizeof(sock_opt));”h]”hX{// Enable timestamping with various options, including session tracking and // statistics int sock_opt = SOF_TIMESTAMPING_OPT_CMSG | SOF_TIMESTAMPING_TX_ACK | SOF_TIMESTAMPING_TX_SCHED | SOF_TIMESTAMPING_OPT_ID | SOF_TIMESTAMPING_RX_SOFTWARE; setsockopt(sock, SOL_SOCKET, SO_TIMESTAMPING, &sock_opt, sizeof(sock_opt));”…”�”}”hj¬$sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆjÈ ‰jÉ j&jË }”uh1j¸ h³hÇh´M`hjah²hubeh}”(h]”Œso-timestamping”ah ]”h"]”Œso_timestamping”ah$]”h&]”uh1hÈhj±h²hh³hÇh´M¥ubeh}”(h]”Œ setsockopt-2”ah ]”h"]”Œ setsockopt(2)”ah$]”h&]”uh1hÈhjs h²hh³hÇh´Mªubeh}”(h]”Œ api-calls”ah ]”h"]”Œ api calls”ah$]”h&]”uh1hÈhjb h²hh³hÇh´KýubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒDynamic Addressing”h]”hŒDynamic Addressing”…”�”}”(hjÖ$h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjÓ$h²hh³hÇh´Moubhï)�”}”(hXYDistinction has to be made between using the claimed address and doing an address claim. To use an already claimed address, one has to fill in the ``j1939.name`` member and provide it to ``bind(2)``. If the name had claimed an address earlier, all further messages being sent will use that address. And the ``j1939.addr`` member will be ignored.”h]”(hŒ“Distinction has to be made between using the claimed address and doing an address claim. To use an already claimed address, one has to fill in the ”…”�”}”(hjä$h²hh³Nh´Nubj� )�”}”(hŒ``j1939.name``”h]”hŒ j1939.name”…”�”}”(hjì$h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjä$ubhŒ member and provide it to ”…”�”}”(hjä$h²hh³Nh´Nubj� )�”}”(hŒ ``bind(2)``”h]”hŒbind(2)”…”�”}”(hjþ$h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjä$ubhŒm. If the name had claimed an address earlier, all further messages being sent will use that address. And the ”…”�”}”(hjä$h²hh³Nh´Nubj� )�”}”(hŒ``j1939.addr``”h]”hŒ j1939.addr”…”�”}”(hj%h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjä$ubhŒ member will be ignored.”…”�”}”(hjä$h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MqhjÓ$h²hubhï)�”}”(hŒªAn exception on this is PGN 0x0ee00. This is the "Address Claim/Cannot Claim Address" message and the kernel will use the ``j1939.addr`` member for that PGN if necessary.”h]”(hŒ~An exception on this is PGN 0x0ee00. This is the “Address Claim/Cannot Claim Addressâ€� message and the kernel will use the ”…”�”}”(hj(%h²hh³Nh´Nubj� )�”}”(hŒ``j1939.addr``”h]”hŒ j1939.addr”…”�”}”(hj0%h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj(%ubhŒ" member for that PGN if necessary.”…”�”}”(hj(%h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MwhjÓ$h²hubhï)�”}”(hŒ7To claim an address following code example can be used:”h]”hŒ7To claim an address following code example can be used:”…”�”}”(hjH%h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M{hjÓ$h²hubj¹ )�”}”(hXÜstruct sockaddr_can baddr = { .can_family = AF_CAN, .can_addr.j1939 = { .name = name, .addr = J1939_IDLE_ADDR, .pgn = J1939_NO_PGN, /* to disable bind() rx filter for PGN */ }, .can_ifindex = if_nametoindex("can0"), }; bind(sock, (struct sockaddr *)&baddr, sizeof(baddr)); /* for Address Claiming broadcast must be allowed */ int value = 1; setsockopt(sock, SOL_SOCKET, SO_BROADCAST, &value, sizeof(value)); /* configured advanced RX filter with PGN needed for Address Claiming */ const struct j1939_filter filt[] = { { .pgn = J1939_PGN_ADDRESS_CLAIMED, .pgn_mask = J1939_PGN_PDU1_MAX, }, { .pgn = J1939_PGN_REQUEST, .pgn_mask = J1939_PGN_PDU1_MAX, }, { .pgn = J1939_PGN_ADDRESS_COMMANDED, .pgn_mask = J1939_PGN_MAX, }, }; setsockopt(sock, SOL_CAN_J1939, SO_J1939_FILTER, &filt, sizeof(filt)); uint64_t dat = htole64(name); const struct sockaddr_can saddr = { .can_family = AF_CAN, .can_addr.j1939 = { .pgn = J1939_PGN_ADDRESS_CLAIMED, .addr = J1939_NO_ADDR, }, }; /* Afterwards do a sendto(2) with data set to the NAME (Little Endian). If the * NAME provided, does not match the j1939.name provided to bind(2), EPROTO * will be returned. */ sendto(sock, dat, sizeof(dat), 0, (const struct sockaddr *)&saddr, sizeof(saddr));”h]”hXÜstruct sockaddr_can baddr = { .can_family = AF_CAN, .can_addr.j1939 = { .name = name, .addr = J1939_IDLE_ADDR, .pgn = J1939_NO_PGN, /* to disable bind() rx filter for PGN */ }, .can_ifindex = if_nametoindex("can0"), }; bind(sock, (struct sockaddr *)&baddr, sizeof(baddr)); /* for Address Claiming broadcast must be allowed */ int value = 1; setsockopt(sock, SOL_SOCKET, SO_BROADCAST, &value, sizeof(value)); /* configured advanced RX filter with PGN needed for Address Claiming */ const struct j1939_filter filt[] = { { .pgn = J1939_PGN_ADDRESS_CLAIMED, .pgn_mask = J1939_PGN_PDU1_MAX, }, { .pgn = J1939_PGN_REQUEST, .pgn_mask = J1939_PGN_PDU1_MAX, }, { .pgn = J1939_PGN_ADDRESS_COMMANDED, .pgn_mask = J1939_PGN_MAX, }, }; setsockopt(sock, SOL_CAN_J1939, SO_J1939_FILTER, &filt, sizeof(filt)); uint64_t dat = htole64(name); const struct sockaddr_can saddr = { .can_family = AF_CAN, .can_addr.j1939 = { .pgn = J1939_PGN_ADDRESS_CLAIMED, .addr = J1939_NO_ADDR, }, }; /* Afterwards do a sendto(2) with data set to the NAME (Little Endian). If the * NAME provided, does not match the j1939.name provided to bind(2), EPROTO * will be returned. */ sendto(sock, dat, sizeof(dat), 0, (const struct sockaddr *)&saddr, sizeof(saddr));”…”�”}”hjV%sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆjÈ ‰jÉ jÊ jË }”uh1j¸ h³hÇh´M}hjÓ$h²hubhï)�”}”(hXIf no-one else contests the address claim within 250ms after transmission, the kernel marks the NAME-SA assignment as valid. The valid assignment will be kept among other valid NAME-SA assignments. From that point, any socket bound to the NAME can send packets.”h]”hXIf no-one else contests the address claim within 250ms after transmission, the kernel marks the NAME-SA assignment as valid. The valid assignment will be kept among other valid NAME-SA assignments. From that point, any socket bound to the NAME can send packets.”…”�”}”(hje%h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M®hjÓ$h²hubhï)�”}”(hX¬If another ECU claims the address, the kernel will mark the NAME-SA expired. No socket bound to the NAME can send packets (other than address claims). To claim another address, some socket bound to NAME, must ``bind(2)`` again, but with only ``j1939.addr`` changed to the new SA, and must then send a valid address claim packet. This restarts the state machine in the kernel (and any other participant on the bus) for this NAME.”h]”(hŒÑIf another ECU claims the address, the kernel will mark the NAME-SA expired. No socket bound to the NAME can send packets (other than address claims). To claim another address, some socket bound to NAME, must ”…”�”}”(hjs%h²hh³Nh´Nubj� )�”}”(hŒ ``bind(2)``”h]”hŒbind(2)”…”�”}”(hj{%h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjs%ubhŒ again, but with only ”…”�”}”(hjs%h²hh³Nh´Nubj� )�”}”(hŒ``j1939.addr``”h]”hŒ j1939.addr”…”�”}”(hj�%h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjs%ubhŒ¬ changed to the new SA, and must then send a valid address claim packet. This restarts the state machine in the kernel (and any other participant on the bus) for this NAME.”…”�”}”(hjs%h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M³hjÓ$h²hubhï)�”}”(hŒz``can-utils`` also include the ``j1939acd`` tool, so it can be used as code example or as default Address Claiming daemon.”h]”(j� )�”}”(hŒ ``can-utils``”h]”hŒ can-utils”…”�”}”(hj©%h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj¥%ubhŒ also include the ”…”�”}”(hj¥%h²hh³Nh´Nubj� )�”}”(hŒ ``j1939acd``”h]”hŒj1939acd”…”�”}”(hj»%h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj¥%ubhŒO tool, so it can be used as code example or as default Address Claiming daemon.”…”�”}”(hj¥%h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MºhjÓ$h²hubeh}”(h]”Œdynamic-addressing”ah ]”h"]”Œdynamic addressing”ah$]”h&]”uh1hÈhjb h²hh³hÇh´MoubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒ Send Examples”h]”hŒ Send Examples”…”�”}”(hjÞ%h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjÛ%h²hh³hÇh´M¾ubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒStatic Addressing”h]”hŒStatic Addressing”…”�”}”(hjï%h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjì%h²hh³hÇh´MÁubhï)�”}”(hŒ?This example will send a PGN (0x12300) from SA 0x20 to DA 0x30.”h]”hŒ?This example will send a PGN (0x12300) from SA 0x20 to DA 0x30.”…”�”}”(hjý%h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MÃhjì%h²hubhï)�”}”(hŒBind:”h]”hŒBind:”…”�”}”(hj &h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MÅhjì%h²hubj¹ )�”}”(hX5struct sockaddr_can baddr = { .can_family = AF_CAN, .can_addr.j1939 = { .name = J1939_NO_NAME, .addr = 0x20, .pgn = J1939_NO_PGN, }, .can_ifindex = if_nametoindex("can0"), }; bind(sock, (struct sockaddr *)&baddr, sizeof(baddr));”h]”hX5struct sockaddr_can baddr = { .can_family = AF_CAN, .can_addr.j1939 = { .name = J1939_NO_NAME, .addr = 0x20, .pgn = J1939_NO_PGN, }, .can_ifindex = if_nametoindex("can0"), }; bind(sock, (struct sockaddr *)&baddr, sizeof(baddr));”…”�”}”hj&sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆjÈ ‰jÉ jÊ jË }”uh1j¸ h³hÇh´MÇhjì%h²hubhï)�”}”(hŒ’Now, the socket 'sock' is bound to the SA 0x20. Since no ``connect(2)`` was called, at this point we can use only ``sendto(2)`` or ``sendmsg(2)``.”h]”(hŒ=Now, the socket ‘sock’ is bound to the SA 0x20. Since no ”…”�”}”(hj(&h²hh³Nh´Nubj� )�”}”(hŒ``connect(2)``”h]”hŒ connect(2)”…”�”}”(hj0&h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj(&ubhŒ+ was called, at this point we can use only ”…”�”}”(hj(&h²hh³Nh´Nubj� )�”}”(hŒ ``sendto(2)``”h]”hŒ sendto(2)”…”�”}”(hjB&h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj(&ubhŒ or ”…”�”}”(hj(&h²hh³Nh´Nubj� )�”}”(hŒ``sendmsg(2)``”h]”hŒ sendmsg(2)”…”�”}”(hjT&h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj(&ubhŒ.”…”�”}”(hj(&h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MÕhjì%h²hubhï)�”}”(hŒSend:”h]”hŒSend:”…”�”}”(hjl&h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MØhjì%h²hubj¹ )�”}”(hX$const struct sockaddr_can saddr = { .can_family = AF_CAN, .can_addr.j1939 = { .name = J1939_NO_NAME; .addr = 0x30, .pgn = 0x12300, }, }; sendto(sock, dat, sizeof(dat), 0, (const struct sockaddr *)&saddr, sizeof(saddr));”h]”hX$const struct sockaddr_can saddr = { .can_family = AF_CAN, .can_addr.j1939 = { .name = J1939_NO_NAME; .addr = 0x30, .pgn = 0x12300, }, }; sendto(sock, dat, sizeof(dat), 0, (const struct sockaddr *)&saddr, sizeof(saddr));”…”�”}”hjz&sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆjÈ ‰jÉ jÊ jË }”uh1j¸ h³hÇh´MÚhjì%h²hubeh}”(h]”Œstatic-addressing”ah ]”h"]”Œstatic addressing”ah$]”h&]”uh1hÈhjÛ%h²hh³hÇh´MÁubeh}”(h]”Œ send-examples”ah ]”h"]”Œ send examples”ah$]”h&]”uh1hÈhjb h²hh³hÇh´M¾ubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒError Codes in the J1939 Stack”h]”hŒError Codes in the J1939 Stack”…”�”}”(hjœ&h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhj™&h²hh³hÇh´Méubhï)�”}”(hŒØThis section lists all potential kernel error codes that can be exposed to user space when interacting with the J1939 stack. It includes both standard error codes and those derived from protocol-specific abort codes.”h]”hŒØThis section lists all potential kernel error codes that can be exposed to user space when interacting with the J1939 stack. It includes both standard error codes and those derived from protocol-specific abort codes.”…”�”}”(hjª&h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Mëhj™&h²hubj)�”}”(hhh]”(j)�”}”(hŒÑ``EAGAIN``: Operation would block; retry may succeed. One common reason is that an active TP or ETP session exists, and an attempt was made to start a new overlapping TP or ETP session between the same peers. ”h]”hï)�”}”(hŒÐ``EAGAIN``: Operation would block; retry may succeed. One common reason is that an active TP or ETP session exists, and an attempt was made to start a new overlapping TP or ETP session between the same peers.”h]”(j� )�”}”(hŒ ``EAGAIN``”h]”hŒEAGAIN”…”�”}”(hjÃ&h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj¿&ubhŒÆ: Operation would block; retry may succeed. One common reason is that an active TP or ETP session exists, and an attempt was made to start a new overlapping TP or ETP session between the same peers.”…”�”}”(hj¿&h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Mïhj»&ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj¸&h²hh³hÇh´Nubj)�”}”(hŒc``ENETDOWN``: Network is down. This occurs when the CAN interface is switched to the "down" state. ”h]”hï)�”}”(hŒb``ENETDOWN``: Network is down. This occurs when the CAN interface is switched to the "down" state.”h]”(j� )�”}”(hŒ ``ENETDOWN``”h]”hŒENETDOWN”…”�”}”(hjé&h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjå&ubhŒZ: Network is down. This occurs when the CAN interface is switched to the “downâ€� state.”…”�”}”(hjå&h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Móhjá&ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj¸&h²hh³hÇh´Nubj)�”}”(hŒ”``ENOBUFS``: No buffer space available. This error occurs when the CAN interface's transmit (TX) queue is full, and no more messages can be queued. ”h]”hï)�”}”(hŒ“``ENOBUFS``: No buffer space available. This error occurs when the CAN interface's transmit (TX) queue is full, and no more messages can be queued.”h]”(j� )�”}”(hŒ ``ENOBUFS``”h]”hŒENOBUFS”…”�”}”(hj'h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj 'ubhŒŠ: No buffer space available. This error occurs when the CAN interface’s transmit (TX) queue is full, and no more messages can be queued.”…”�”}”(hj 'h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Möhj'ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj¸&h²hh³hÇh´Nubj)�”}”(hX``EOVERFLOW``: Value too large for defined data type. In J1939, this can happen if the requested data lies outside of the queued buffer. For example, if a CTS (Clear to Send) requests an offset not available in the kernel buffer because user space did not provide enough data. ”h]”hï)�”}”(hX``EOVERFLOW``: Value too large for defined data type. In J1939, this can happen if the requested data lies outside of the queued buffer. For example, if a CTS (Clear to Send) requests an offset not available in the kernel buffer because user space did not provide enough data.”h]”(j� )�”}”(hŒ ``EOVERFLOW``”h]”hŒ EOVERFLOW”…”�”}”(hj5'h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj1'ubhX: Value too large for defined data type. In J1939, this can happen if the requested data lies outside of the queued buffer. For example, if a CTS (Clear to Send) requests an offset not available in the kernel buffer because user space did not provide enough data.”…”�”}”(hj1'h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Mùhj-'ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj¸&h²hh³hÇh´Nubj)�”}”(hŒ¡``EBUSY``: Device or resource is busy. For example, this occurs if an identical session is already active and the stack is unable to recover from the condition. ”h]”hï)�”}”(hŒ ``EBUSY``: Device or resource is busy. For example, this occurs if an identical session is already active and the stack is unable to recover from the condition.”h]”(j� )�”}”(hŒ ``EBUSY``”h]”hŒEBUSY”…”�”}”(hj['h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjW'ubhŒ—: Device or resource is busy. For example, this occurs if an identical session is already active and the stack is unable to recover from the condition.”…”�”}”(hjW'h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MþhjS'ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj¸&h²hh³hÇh´Nubj)�”}”(hŒ¦``EACCES``: Permission denied. This error can occur, for example, when attempting to send broadcast messages, but the socket is not configured with ``SO_BROADCAST``. ”h]”hï)�”}”(hŒ¥``EACCES``: Permission denied. This error can occur, for example, when attempting to send broadcast messages, but the socket is not configured with ``SO_BROADCAST``.”h]”(j� )�”}”(hŒ ``EACCES``”h]”hŒEACCES”…”�”}”(hj�'h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj}'ubhŒŠ: Permission denied. This error can occur, for example, when attempting to send broadcast messages, but the socket is not configured with ”…”�”}”(hj}'h²hh³Nh´Nubj� )�”}”(hŒ``SO_BROADCAST``”h]”hŒ SO_BROADCAST”…”�”}”(hj“'h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj}'ubhŒ.”…”�”}”(hj}'h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Mhjy'ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj¸&h²hh³hÇh´Nubj)�”}”(hX=``EADDRNOTAVAIL``: Address not available. This error occurs in cases such as: - When attempting to use ``getsockname(2)`` to retrieve the peer's address, but the socket is not connected. - When trying to send data to or from a NAME, but address claiming for the NAME was not performed or detected by the stack. ”h]”(hï)�”}”(hŒM``EADDRNOTAVAIL``: Address not available. This error occurs in cases such as:”h]”(j� )�”}”(hŒ``EADDRNOTAVAIL``”h]”hŒ EADDRNOTAVAIL”…”�”}”(hj¹'h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjµ'ubhŒ<: Address not available. This error occurs in cases such as:”…”�”}”(hjµ'h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Mhj±'ubj)�”}”(hhh]”(j)�”}”(hŒkWhen attempting to use ``getsockname(2)`` to retrieve the peer's address, but the socket is not connected. ”h]”hï)�”}”(hŒjWhen attempting to use ``getsockname(2)`` to retrieve the peer's address, but the socket is not connected.”h]”(hŒWhen attempting to use ”…”�”}”(hjØ'h²hh³Nh´Nubj� )�”}”(hŒ``getsockname(2)``”h]”hŒgetsockname(2)”…”�”}”(hjà'h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjØ'ubhŒC to retrieve the peer’s address, but the socket is not connected.”…”�”}”(hjØ'h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MhjÔ'ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjÑ'ubj)�”}”(hŒzWhen trying to send data to or from a NAME, but address claiming for the NAME was not performed or detected by the stack. ”h]”hï)�”}”(hŒyWhen trying to send data to or from a NAME, but address claiming for the NAME was not performed or detected by the stack.”h]”hŒyWhen trying to send data to or from a NAME, but address claiming for the NAME was not performed or detected by the stack.”…”�”}”(hj(h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M hjþ'ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjÑ'ubeh}”(h]”h ]”h"]”h$]”h&]”jbjýuh1jh³hÇh´Mhj±'ubeh}”(h]”h ]”h"]”h$]”h&]”uh1jhj¸&h²hh³Nh´Nubj)�”}”(hŒ÷``EBADFD``: File descriptor in bad state. This error can occur if: - Attempting to send data to an unbound socket. - The socket is bound but has no source name, and the source address is ``J1939_NO_ADDR``. - The ``can_ifindex`` is incorrect. ”h]”(hï)�”}”(hŒB``EBADFD``: File descriptor in bad state. This error can occur if:”h]”(j� )�”}”(hŒ ``EBADFD``”h]”hŒEBADFD”…”�”}”(hj*(h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj&(ubhŒ8: File descriptor in bad state. This error can occur if:”…”�”}”(hj&(h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Mhj"(ubj)�”}”(hhh]”(j)�”}”(hŒ.Attempting to send data to an unbound socket. ”h]”hï)�”}”(hŒ-Attempting to send data to an unbound socket.”h]”hŒ-Attempting to send data to an unbound socket.”…”�”}”(hjI(h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MhjE(ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjB(ubj)�”}”(hŒYThe socket is bound but has no source name, and the source address is ``J1939_NO_ADDR``. ”h]”hï)�”}”(hŒXThe socket is bound but has no source name, and the source address is ``J1939_NO_ADDR``.”h]”(hŒFThe socket is bound but has no source name, and the source address is ”…”�”}”(hja(h²hh³Nh´Nubj� )�”}”(hŒ``J1939_NO_ADDR``”h]”hŒ J1939_NO_ADDR”…”�”}”(hji(h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hja(ubhŒ.”…”�”}”(hja(h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Mhj](ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjB(ubj)�”}”(hŒ"The ``can_ifindex`` is incorrect. ”h]”hï)�”}”(hŒ!The ``can_ifindex`` is incorrect.”h]”(hŒThe ”…”�”}”(hj‹(h²hh³Nh´Nubj� )�”}”(hŒ``can_ifindex``”h]”hŒ can_ifindex”…”�”}”(hj“(h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj‹(ubhŒ is incorrect.”…”�”}”(hj‹(h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Mhj‡(ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjB(ubeh}”(h]”h ]”h"]”h$]”h&]”jbjýuh1jh³hÇh´Mhj"(ubeh}”(h]”h ]”h"]”h$]”h&]”uh1jhj¸&h²hh³Nh´Nubj)�”}”(hŒÞ``EFAULT``: Bad address. Occurs mostly when the stack can't copy from or to a sockptr, when there is insufficient data from user space, or when the buffer provided by user space is not large enough for the requested data. ”h]”hï)�”}”(hŒÝ``EFAULT``: Bad address. Occurs mostly when the stack can't copy from or to a sockptr, when there is insufficient data from user space, or when the buffer provided by user space is not large enough for the requested data.”h]”(j� )�”}”(hŒ ``EFAULT``”h]”hŒEFAULT”…”�”}”(hjÅ(h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjÁ(ubhŒÕ: Bad address. Occurs mostly when the stack can’t copy from or to a sockptr, when there is insufficient data from user space, or when the buffer provided by user space is not large enough for the requested data.”…”�”}”(hjÁ(h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Mhj½(ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj¸&h²hh³hÇh´Nubj)�”}”(hŒQ``EINTR``: A signal occurred before any data was transmitted; see ``signal(7)``. ”h]”hï)�”}”(hŒP``EINTR``: A signal occurred before any data was transmitted; see ``signal(7)``.”h]”(j� )�”}”(hŒ ``EINTR``”h]”hŒEINTR”…”�”}”(hjë(h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjç(ubhŒ9: A signal occurred before any data was transmitted; see ”…”�”}”(hjç(h²hh³Nh´Nubj� )�”}”(hŒ ``signal(7)``”h]”hŒ signal(7)”…”�”}”(hjý(h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjç(ubhŒ.”…”�”}”(hjç(h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Mhjã(ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj¸&h²hh³hÇh´Nubj)�”}”(hŒÄ``EINVAL``: Invalid argument passed. For example: - ``msg->msg_namelen`` is less than ``J1939_MIN_NAMELEN``. - ``addr->can_family`` is not equal to ``AF_CAN``. - An incorrect PGN was provided. ”h]”(hï)�”}”(hŒ1``EINVAL``: Invalid argument passed. For example:”h]”(j� )�”}”(hŒ ``EINVAL``”h]”hŒEINVAL”…”�”}”(hj#)h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj)ubhŒ': Invalid argument passed. For example:”…”�”}”(hj)h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Mhj)ubj)�”}”(hhh]”(j)�”}”(hŒ9``msg->msg_namelen`` is less than ``J1939_MIN_NAMELEN``. ”h]”hï)�”}”(hŒ8``msg->msg_namelen`` is less than ``J1939_MIN_NAMELEN``.”h]”(j� )�”}”(hŒ``msg->msg_namelen``”h]”hŒmsg->msg_namelen”…”�”}”(hjF)h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjB)ubhŒ is less than ”…”�”}”(hjB)h²hh³Nh´Nubj� )�”}”(hŒ``J1939_MIN_NAMELEN``”h]”hŒJ1939_MIN_NAMELEN”…”�”}”(hjX)h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjB)ubhŒ.”…”�”}”(hjB)h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Mhj>)ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj;)ubj)�”}”(hŒ1``addr->can_family`` is not equal to ``AF_CAN``. ”h]”hï)�”}”(hŒ0``addr->can_family`` is not equal to ``AF_CAN``.”h]”(j� )�”}”(hŒ``addr->can_family``”h]”hŒaddr->can_family”…”�”}”(hj~)h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjz)ubhŒ is not equal to ”…”�”}”(hjz)h²hh³Nh´Nubj� )�”}”(hŒ ``AF_CAN``”h]”hŒAF_CAN”…”�”}”(hj�)h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjz)ubhŒ.”…”�”}”(hjz)h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M!hjv)ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj;)ubj)�”}”(hŒAn incorrect PGN was provided. ”h]”hï)�”}”(hŒAn incorrect PGN was provided.”h]”hŒAn incorrect PGN was provided.”…”�”}”(hj²)h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M#hj®)ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj;)ubeh}”(h]”h ]”h"]”h$]”h&]”jbjýuh1jh³hÇh´Mhj)ubeh}”(h]”h ]”h"]”h$]”h&]”uh1jhj¸&h²hh³Nh´Nubj)�”}”(hŒ’``ENODEV``: No such device. This happens when the CAN network device cannot be found for the provided ``can_ifindex`` or if ``can_ifindex`` is 0. ”h]”hï)�”}”(hŒ‘``ENODEV``: No such device. This happens when the CAN network device cannot be found for the provided ``can_ifindex`` or if ``can_ifindex`` is 0.”h]”(j� )�”}”(hŒ ``ENODEV``”h]”hŒENODEV”…”�”}”(hjÚ)h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjÖ)ubhŒ\: No such device. This happens when the CAN network device cannot be found for the provided ”…”�”}”(hjÖ)h²hh³Nh´Nubj� )�”}”(hŒ``can_ifindex``”h]”hŒ can_ifindex”…”�”}”(hjì)h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjÖ)ubhŒ or if ”…”�”}”(hjÖ)h²hh³Nh´Nubj� )�”}”(hŒ``can_ifindex``”h]”hŒ can_ifindex”…”�”}”(hjþ)h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjÖ)ubhŒ is 0.”…”�”}”(hjÖ)h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M%hjÒ)ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj¸&h²hh³hÇh´Nubj)�”}”(hŒ\``ENOMEM``: Out of memory. Typically related to issues with memory allocation in the stack. ”h]”hï)�”}”(hŒ[``ENOMEM``: Out of memory. Typically related to issues with memory allocation in the stack.”h]”(j� )�”}”(hŒ ``ENOMEM``”h]”hŒENOMEM”…”�”}”(hj$*h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj *ubhŒQ: Out of memory. Typically related to issues with memory allocation in the stack.”…”�”}”(hj *h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M(hj*ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj¸&h²hh³hÇh´Nubj)�”}”(hŒ›``ENOPROTOOPT``: Protocol not available. This can occur when using ``getsockopt(2)`` or ``setsockopt(2)`` if the requested socket option is not available. ”h]”hï)�”}”(hŒš``ENOPROTOOPT``: Protocol not available. This can occur when using ``getsockopt(2)`` or ``setsockopt(2)`` if the requested socket option is not available.”h]”(j� )�”}”(hŒ``ENOPROTOOPT``”h]”hŒ ENOPROTOOPT”…”�”}”(hjJ*h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjF*ubhŒ4: Protocol not available. This can occur when using ”…”�”}”(hjF*h²hh³Nh´Nubj� )�”}”(hŒ``getsockopt(2)``”h]”hŒ getsockopt(2)”…”�”}”(hj\*h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjF*ubhŒ or ”…”�”}”(hjF*h²hh³Nh´Nubj� )�”}”(hŒ``setsockopt(2)``”h]”hŒ setsockopt(2)”…”�”}”(hjn*h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjF*ubhŒ1 if the requested socket option is not available.”…”�”}”(hjF*h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M+hjB*ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj¸&h²hh³hÇh´Nubj)�”}”(hŒü``EDESTADDRREQ``: Destination address required. This error occurs: - In the case of ``connect(2)``, if the ``struct sockaddr *uaddr`` is ``NULL``. - In the case of ``send*(2)``, if there is an attempt to send an ETP message to a broadcast address. ”h]”(hï)�”}”(hŒB``EDESTADDRREQ``: Destination address required. This error occurs:”h]”(j� )�”}”(hŒ``EDESTADDRREQ``”h]”hŒ EDESTADDRREQ”…”�”}”(hj”*h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj�*ubhŒ2: Destination address required. This error occurs:”…”�”}”(hj�*h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M/hjŒ*ubj)�”}”(hhh]”(j)�”}”(hŒNIn the case of ``connect(2)``, if the ``struct sockaddr *uaddr`` is ``NULL``. ”h]”hï)�”}”(hŒMIn the case of ``connect(2)``, if the ``struct sockaddr *uaddr`` is ``NULL``.”h]”(hŒIn the case of ”…”�”}”(hj³*h²hh³Nh´Nubj� )�”}”(hŒ``connect(2)``”h]”hŒ connect(2)”…”�”}”(hj»*h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj³*ubhŒ , if the ”…”�”}”(hj³*h²hh³Nh´Nubj� )�”}”(hŒ``struct sockaddr *uaddr``”h]”hŒstruct sockaddr *uaddr”…”�”}”(hjÍ*h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj³*ubhŒ is ”…”�”}”(hj³*h²hh³Nh´Nubj� )�”}”(hŒ``NULL``”h]”hŒNULL”…”�”}”(hjß*h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj³*ubhŒ.”…”�”}”(hj³*h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M1hj¯*ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj¬*ubj)�”}”(hŒcIn the case of ``send*(2)``, if there is an attempt to send an ETP message to a broadcast address. ”h]”hï)�”}”(hŒbIn the case of ``send*(2)``, if there is an attempt to send an ETP message to a broadcast address.”h]”(hŒIn the case of ”…”�”}”(hj+h²hh³Nh´Nubj� )�”}”(hŒ ``send*(2)``”h]”hŒsend*(2)”…”�”}”(hj +h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj+ubhŒG, if there is an attempt to send an ETP message to a broadcast address.”…”�”}”(hj+h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M3hjý*ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj¬*ubeh}”(h]”h ]”h"]”h$]”h&]”jbjýuh1jh³hÇh´M1hjŒ*ubeh}”(h]”h ]”h"]”h$]”h&]”uh1jhj¸&h²hh³Nh´Nubj)�”}”(hŒ§``EDOM``: Argument out of domain. This error may happen if attempting to send a TP or ETP message to a PGN that is reserved for control PGNs for TP or ETP operations. ”h]”hï)�”}”(hŒ¦``EDOM``: Argument out of domain. This error may happen if attempting to send a TP or ETP message to a PGN that is reserved for control PGNs for TP or ETP operations.”h]”(j� )�”}”(hŒ``EDOM``”h]”hŒEDOM”…”�”}”(hj;+h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj7+ubhŒž: Argument out of domain. This error may happen if attempting to send a TP or ETP message to a PGN that is reserved for control PGNs for TP or ETP operations.”…”�”}”(hj7+h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M6hj3+ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj¸&h²hh³hÇh´Nubj)�”}”(hŒ¥``EIO``: I/O error. This can occur if the amount of data provided to the socket for a TP or ETP session does not match the announced amount of data for the session. ”h]”hï)�”}”(hŒ¤``EIO``: I/O error. This can occur if the amount of data provided to the socket for a TP or ETP session does not match the announced amount of data for the session.”h]”(j� )�”}”(hŒ``EIO``”h]”hŒEIO”…”�”}”(hja+h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj]+ubhŒ�: I/O error. This can occur if the amount of data provided to the socket for a TP or ETP session does not match the announced amount of data for the session.”…”�”}”(hj]+h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M:hjY+ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj¸&h²hh³hÇh´Nubj)�”}”(hŒœ``ENOENT``: No such file or directory. This can happen when the stack attempts to transfer CTS or EOMA but cannot find a matching receiving socket anymore. ”h]”hï)�”}”(hŒ›``ENOENT``: No such file or directory. This can happen when the stack attempts to transfer CTS or EOMA but cannot find a matching receiving socket anymore.”h]”(j� )�”}”(hŒ ``ENOENT``”h]”hŒENOENT”…”�”}”(hj‡+h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjƒ+ubhŒ‘: No such file or directory. This can happen when the stack attempts to transfer CTS or EOMA but cannot find a matching receiving socket anymore.”…”�”}”(hjƒ+h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M>hj+ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj¸&h²hh³hÇh´Nubj)�”}”(hŒ?``ENOIOCTLCMD``: No ioctls are available for the socket layer. ”h]”hï)�”}”(hŒ>``ENOIOCTLCMD``: No ioctls are available for the socket layer.”h]”(j� )�”}”(hŒ``ENOIOCTLCMD``”h]”hŒ ENOIOCTLCMD”…”�”}”(hj­+h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj©+ubhŒ/: No ioctls are available for the socket layer.”…”�”}”(hj©+h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MBhj¥+ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj¸&h²hh³hÇh´Nubj)�”}”(hŒ}``EPERM``: Operation not permitted. For example, this can occur if a requested action requires ``CAP_NET_ADMIN`` privileges. ”h]”hï)�”}”(hŒ|``EPERM``: Operation not permitted. For example, this can occur if a requested action requires ``CAP_NET_ADMIN`` privileges.”h]”(j� )�”}”(hŒ ``EPERM``”h]”hŒEPERM”…”�”}”(hjÓ+h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjÏ+ubhŒV: Operation not permitted. For example, this can occur if a requested action requires ”…”�”}”(hjÏ+h²hh³Nh´Nubj� )�”}”(hŒ``CAP_NET_ADMIN``”h]”hŒ CAP_NET_ADMIN”…”�”}”(hjå+h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjÏ+ubhŒ privileges.”…”�”}”(hjÏ+h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MDhjË+ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj¸&h²hh³hÇh´Nubj)�”}”(hŒq``ENETUNREACH``: Network unreachable. Most likely, this occurs when frames cannot be transmitted to the CAN bus. ”h]”hï)�”}”(hŒp``ENETUNREACH``: Network unreachable. Most likely, this occurs when frames cannot be transmitted to the CAN bus.”h]”(j� )�”}”(hŒ``ENETUNREACH``”h]”hŒ ENETUNREACH”…”�”}”(hj ,h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj,ubhŒa: Network unreachable. Most likely, this occurs when frames cannot be transmitted to the CAN bus.”…”�”}”(hj,h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MGhj,ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj¸&h²hh³hÇh´Nubj)�”}”(hŒ°``ETIME``: Timer expired. This can happen if a timeout occurs while attempting to send a simple message, for example, when an echo message from the controller is not received. ”h]”hï)�”}”(hŒ¯``ETIME``: Timer expired. This can happen if a timeout occurs while attempting to send a simple message, for example, when an echo message from the controller is not received.”h]”(j� )�”}”(hŒ ``ETIME``”h]”hŒETIME”…”�”}”(hj1,h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj-,ubhŒ¦: Timer expired. This can happen if a timeout occurs while attempting to send a simple message, for example, when an echo message from the controller is not received.”…”�”}”(hj-,h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MJhj),ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj¸&h²hh³hÇh´Nubj)�”}”(hX"``EPROTO``: Protocol error. - Used for various protocol-level errors in J1939, including: - Duplicate sequence number. - Unexpected EDPO or ECTS packet. - Invalid PGN or offset in EDPO/ECTS. - Number of EDPO packets exceeded CTS allowance. - Any other protocol-level error. ”h]”(hï)�”}”(hŒ``EPROTO``: Protocol error.”h]”(j� )�”}”(hŒ ``EPROTO``”h]”hŒEPROTO”…”�”}”(hjW,h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjS,ubhŒ: Protocol error.”…”�”}”(hjS,h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MNhjO,ubj)�”}”(hhh]”j)�”}”(hŒùUsed for various protocol-level errors in J1939, including: - Duplicate sequence number. - Unexpected EDPO or ECTS packet. - Invalid PGN or offset in EDPO/ECTS. - Number of EDPO packets exceeded CTS allowance. - Any other protocol-level error. ”h]”(hï)�”}”(hŒ;Used for various protocol-level errors in J1939, including:”h]”hŒ;Used for various protocol-level errors in J1939, including:”…”�”}”(hjv,h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MPhjr,ubj)�”}”(hhh]”(j)�”}”(hŒDuplicate sequence number. ”h]”hï)�”}”(hŒDuplicate sequence number.”h]”hŒDuplicate sequence number.”…”�”}”(hj‹,h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MRhj‡,ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj„,ubj)�”}”(hŒ Unexpected EDPO or ECTS packet. ”h]”hï)�”}”(hŒUnexpected EDPO or ECTS packet.”h]”hŒUnexpected EDPO or ECTS packet.”…”�”}”(hj£,h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MThjŸ,ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj„,ubj)�”}”(hŒ$Invalid PGN or offset in EDPO/ECTS. ”h]”hï)�”}”(hŒ#Invalid PGN or offset in EDPO/ECTS.”h]”hŒ#Invalid PGN or offset in EDPO/ECTS.”…”�”}”(hj»,h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MVhj·,ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj„,ubj)�”}”(hŒ/Number of EDPO packets exceeded CTS allowance. ”h]”hï)�”}”(hŒ.Number of EDPO packets exceeded CTS allowance.”h]”hŒ.Number of EDPO packets exceeded CTS allowance.”…”�”}”(hjÓ,h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MXhjÏ,ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj„,ubj)�”}”(hŒ Any other protocol-level error. ”h]”hï)�”}”(hŒAny other protocol-level error.”h]”hŒAny other protocol-level error.”…”�”}”(hjë,h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MZhjç,ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj„,ubeh}”(h]”h ]”h"]”h$]”h&]”jbjýuh1jh³hÇh´MRhjr,ubeh}”(h]”h ]”h"]”h$]”h&]”uh1jhjo,ubah}”(h]”h ]”h"]”h$]”h&]”jbjýuh1jh³hÇh´MPhjO,ubeh}”(h]”h ]”h"]”h$]”h&]”uh1jhj¸&h²hh³Nh´Nubj)�”}”(hŒ ``EMSGSIZE``: Message too long. ”h]”hï)�”}”(hŒ``EMSGSIZE``: Message too long.”h]”(j� )�”}”(hŒ ``EMSGSIZE``”h]”hŒEMSGSIZE”…”�”}”(hj-h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj-ubhŒ: Message too long.”…”�”}”(hj-h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M\hj-ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj¸&h²hh³hÇh´Nubj)�”}”(hŒ"``ENOMSG``: No message available. ”h]”hï)�”}”(hŒ!``ENOMSG``: No message available.”h]”(j� )�”}”(hŒ ``ENOMSG``”h]”hŒENOMSG”…”�”}”(hjE-h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjA-ubhŒ: No message available.”…”�”}”(hjA-h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M^hj=-ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj¸&h²hh³hÇh´Nubj)�”}”(hŒp``EALREADY``: The ECU is already engaged in one or more connection-managed sessions and cannot support another. ”h]”hï)�”}”(hŒo``EALREADY``: The ECU is already engaged in one or more connection-managed sessions and cannot support another.”h]”(j� )�”}”(hŒ ``EALREADY``”•,h]”hŒEALREADY”…”�”}”(hjk-h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjg-ubhŒc: The ECU is already engaged in one or more connection-managed sessions and cannot support another.”…”�”}”(hjg-h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´M`hjc-ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj¸&h²hh³hÇh´Nubj)�”}”(hŒC``EHOSTUNREACH``: A timeout occurred, and the session was aborted. ”h]”hï)�”}”(hŒB``EHOSTUNREACH``: A timeout occurred, and the session was aborted.”h]”(j� )�”}”(hŒ``EHOSTUNREACH``”h]”hŒ EHOSTUNREACH”…”�”}”(hj‘-h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj�-ubhŒ2: A timeout occurred, and the session was aborted.”…”�”}”(hj�-h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Mchj‰-ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj¸&h²hh³hÇh´Nubj)�”}”(hŒj``EBADMSG``: CTS (Clear to Send) messages were received during an active data transfer, causing an abort. ”h]”hï)�”}”(hŒi``EBADMSG``: CTS (Clear to Send) messages were received during an active data transfer, causing an abort.”h]”(j� )�”}”(hŒ ``EBADMSG``”h]”hŒEBADMSG”…”�”}”(hj·-h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj³-ubhŒ^: CTS (Clear to Send) messages were received during an active data transfer, causing an abort.”…”�”}”(hj³-h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Mehj¯-ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj¸&h²hh³hÇh´Nubj)�”}”(hŒk``ENOTRECOVERABLE``: The maximum retransmission request limit was reached, and the session cannot recover. ”h]”hï)�”}”(hŒj``ENOTRECOVERABLE``: The maximum retransmission request limit was reached, and the session cannot recover.”h]”(j� )�”}”(hŒ``ENOTRECOVERABLE``”h]”hŒENOTRECOVERABLE”…”�”}”(hjÝ-h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjÙ-ubhŒW: The maximum retransmission request limit was reached, and the session cannot recover.”…”�”}”(hjÙ-h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´MhhjÕ-ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj¸&h²hh³hÇh´Nubj)�”}”(hŒ?``ENOTCONN``: An unexpected data transfer packet was received. ”h]”hï)�”}”(hŒ>``ENOTCONN``: An unexpected data transfer packet was received.”h]”(j� )�”}”(hŒ ``ENOTCONN``”h]”hŒENOTCONN”…”�”}”(hj.h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hjÿ-ubhŒ2: An unexpected data transfer packet was received.”…”�”}”(hjÿ-h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Mkhjû-ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj¸&h²hh³hÇh´Nubj)�”}”(hŒT``EILSEQ``: A bad sequence number was received, and the software could not recover. ”h]”hï)�”}”(hŒS``EILSEQ``: A bad sequence number was received, and the software could not recover.”h]”(j� )�”}”(hŒ ``EILSEQ``”h]”hŒEILSEQ”…”�”}”(hj).h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jŒ hj%.ubhŒI: A bad sequence number was received, and the software could not recover.”…”�”}”(hj%.h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hîh³hÇh´Mmhj!.ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj¸&h²hh³hÇh´Nubeh}”(h]”h ]”h"]”h$]”h&]”jbjýuh1jh³hÇh´Mïhj™&h²hubeh}”(h]”Œerror-codes-in-the-j1939-stack”ah ]”h"]”Œerror codes in the j1939 stack”ah$]”h&]”uh1hÈhjb h²hh³hÇh´Méubeh}”(h]”Œhow-to-use-j1939”ah ]”h"]”Œhow to use j1939”ah$]”h&]”uh1hÈhhÊh²hh³hÇh´Kúubeh}”(h]”Œj1939-documentation”ah ]”h"]”Œj1939 documentation”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”jŒ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”}”jq]”jfasŒnameids”}”(jb.j_.jj|jwjtj@jqj?j<j_ j\ j©j¦j‚ j jÓ jÐ jW jT jZ.jW.jÐ$jÍ$j j�j®j«jÈ$jÅ$jøjõjCj@j&j#jQjNj^j[jÀ$j½$jØ%jÕ%j–&j“&jŽ&j‹&jR.jO.uŒ nametypes”}”(jb.‰j‰jw‰j@ˆj?‰j_ ‰j©‰j‚ ‰jÓ ‰jW ‰jZ.‰jÐ$‰j ‰j®‰jÈ$‰jø‰jC‰j&‰jQ‰j^‰jÀ$‰jØ%‰j–&‰jŽ&‰jR.‰uh}”(j_.hÊj|hÝjthþjqj‚j<j‚j\ jGj¦jXj j¬jÐ j… jT jÖ jW.jb jÍ$js j�jj«j£jÅ$j±jõjâj@jûj#jFjNj)j[jTj½$jajÕ%jÓ$j“&jÛ%j‹&jì%jO.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”]”hŒsystem_message”“”)�”}”(hhh]”hï)�”}”(hhh]”hŒ6Hyperlink target "j1939-motivation" is not referenced.”…”�”}”hjñ.sbah}”(h]”h ]”h"]”h$]”h&]”uh1hîhjî.ubah}”(h]”h ]”h"]”h$]”h&]”Œlevel”KŒtype”ŒINFO”Œsource”hÇŒline”Kuh1jì.ubaŒ transformer”NŒ include_log”]”Œ decoration”Nh²hub.