Skip to content

Add ISOBUS (ISO 11783 / SAE J1939) protocol support#27

Draft
Copilot wants to merge 2 commits into
masterfrom
copilot/implement-isobus-protocol
Draft

Add ISOBUS (ISO 11783 / SAE J1939) protocol support#27
Copilot wants to merge 2 commits into
masterfrom
copilot/implement-isobus-protocol

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 17, 2026

Adds a new contrib module implementing the ISOBUS protocol (ISO 11783), the CAN-based communication standard for agricultural and forestry machinery built on SAE J1939.

New module: scapy/contrib/automotive/isobus.py

Core layer:

  • ISOBUS — Extends CAN, replacing the 29-bit identifier with individual J1939 fields (priority, reserved, data_page, pdu_format, pdu_specific, source_address). Computed pgn property handles both PDU1 (peer-to-peer, pdu_format < 0xF0) and PDU2 (broadcast, pdu_format >= 0xF0) addressing correctly.

PGN packet classes with bind_layers dispatch:

Class PGN
ISOBUSAddressClaimed 0x00EE00
ISOBUSRequestForPGN 0x00EA00
ISOBUSAcknowledgment 0x00E800
ISOBUSTransportProtocolCM 0x00EC00
ISOBUSTransportProtocolDT 0x00EB00
ISOBUSWorkingSetMaster 0x00E600
ISOBUSWorkingSetMember 0x00E700
ISOBUSCommandedAddress 0x00FED8

ISOBUSTransportProtocolCM uses ConditionalField to handle all five TP.CM variants (BAM, RTS, CTS, EOM ACK, Abort) in a single class.

ISOBUSAddressClaimed stores the 8-byte little-endian J1939 NAME as a LELongField with read properties for all sub-fields (identity_number, manufacturer_code, industry_group, device_class, etc.).

Helper: build_isobus_name() constructs the 64-bit NAME integer from named component fields.

from scapy.contrib.automotive.isobus import *

# Address Claiming
nn = build_isobus_name(identity_number=0x001, manufacturer_code=0x123,
                       industry_group=2, device_class=4)
pkt = ISOBUS(priority=6, pdu_format=0xEE, pdu_specific=0xFF,
             source_address=0x80, length=8) / ISOBUSAddressClaimed(node_name=nn)

# Auto-dissection by pdu_format
parsed = ISOBUS(bytes(pkt))
assert isinstance(parsed.payload, ISOBUSAddressClaimed)
assert parsed.payload.industry_group == 2
assert parsed.pgn == 0x00EE00

# Multi-packet BAM
pkt = ISOBUS(priority=7, pdu_format=0xEC, pdu_specific=0xFF,
             source_address=0x80, length=8) / \
      ISOBUSTransportProtocolCM(control_byte=32, total_message_size=20,
                                total_number_of_packets=3, pgn=0x00FED8)

Tests: test/contrib/automotive/isobus.uts

33 regression tests covering build/dissect round-trips, PGN computation, NAME subfield access, all TP.CM variants, and automatic layer dispatch.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: polybassa <1676055+polybassa@users.noreply.github.com>
Copilot AI changed the title [WIP] Add ISOBUS protocol implementation Add ISOBUS (ISO 11783 / SAE J1939) protocol support Mar 17, 2026
Copilot AI requested a review from polybassa March 17, 2026 22:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants