From: Soeren Apel Date: Tue, 1 Oct 2024 12:03:18 +0000 (+0200) Subject: usb_packet: Add test case for truncated packets X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=d3bae90b6c78b44de386463154d4921eb194c06b;p=sigrok-test.git usb_packet: Add test case for truncated packets --- diff --git a/decoder/test/usb_packet/test.conf b/decoder/test/usb_packet/test.conf index 2c9000f..ff36d98 100644 --- a/decoder/test/usb_packet/test.conf +++ b/decoder/test/usb_packet/test.conf @@ -140,3 +140,11 @@ test cp2102_setup_with_outdata_nak input usb/cdc/silabs_cp2102/cp2102_setup_with_outdata_nak.sr output usb_packet annotation match cp2102_setup_with_outdata_nak.output output usb_packet python match cp2102_setup_with_outdata_nak.bin_pcap + +# Check that truncated data packets are recognized +test truncated_packets + protocol-decoder usb_signalling channel dp=0 channel dm=1 option signalling=full-speed + protocol-decoder usb_packet option signalling=full-speed + stack usb_signalling usb_packet + input usb/truncated_packets.sr + output usb_packet annotation match truncated_packets.output diff --git a/decoder/test/usb_packet/truncated_packets.output b/decoder/test/usb_packet/truncated_packets.output new file mode 100644 index 0000000..8fa64f6 --- /dev/null +++ b/decoder/test/usb_packet/truncated_packets.output @@ -0,0 +1,54 @@ +114-177 usb_packet: sync-ok: "SYNC: 00000001" "SYNC" "S" +177-241 usb_packet: pid: "PID: SETUP" "SETUP" "S" +241-298 usb_packet: addr: "Address: 0" "Addr: 0" "Addr" "A" +298-329 usb_packet: ep: "Endpoint: 0" "EP: 0" "EP" "E" +329-369 usb_packet: crc5-ok: "CRC5: 0x02" "CRC5" "C" +114-394 usb_packet: packet-setup: "SETUP ADDR 0 EP 0" +426-489 usb_packet: sync-ok: "SYNC: 00000001" "SYNC" "S" +489-553 usb_packet: pid: "PID: DATA0" "DATA0" "D" +553-618 usb_packet: data: "Databyte: 00" "Data: 00" "DB: 00" "00" +618-682 usb_packet: data: "Databyte: 05" "Data: 05" "DB: 05" "05" +682-746 usb_packet: data: "Databyte: 06" "Data: 06" "DB: 06" "06" +746-809 usb_packet: data: "Databyte: 00" "Data: 00" "DB: 00" "00" +809-873 usb_packet: data: "Databyte: 00" "Data: 00" "DB: 00" "00" +873-937 usb_packet: data: "Databyte: 00" "Data: 00" "DB: 00" "00" +937-1001 usb_packet: data: "Databyte: 00" "Data: 00" "DB: 00" "00" +1001-1065 usb_packet: data: "Databyte: 00" "Data: 00" "DB: 00" "00" +1065-1194 usb_packet: crc16-ok: "CRC16: 0x92EA" "CRC16" "C" +426-1218 usb_packet: packet-data0: "DATA0 [ 00 05 06 00 00 00 00 00 ]" +1238-1301 usb_packet: sync-ok: "SYNC: 00000001" "SYNC" "S" +1301-1365 usb_packet: pid: "PID: ACK" "ACK" "A" +1238-1389 usb_packet: packet-ack: "ACK" +1434-1497 usb_packet: sync-ok: "SYNC: 00000001" "SYNC" "S" +1497-1561 usb_packet: pid: "PID: IN" "IN" "I" +1561-1617 usb_packet: addr: "Address: 5" "Addr: 5" "Addr" "A" +1617-1649 usb_packet: ep: "Endpoint: 1" "EP: 1" "EP" "E" +1649-1690 usb_packet: crc5-ok: "CRC5: 0x0C" "CRC5" "C" +1434-1714 usb_packet: packet-in: "IN ADDR 5 EP 1" +2074-2137 usb_packet: sync-ok: "SYNC: 00000001" "SYNC" "S" +2137-2201 usb_packet: pid: "PID: IN" "IN" "I" +2201-2258 usb_packet: addr: "Address: 0" "Addr: 0" "Addr" "A" +2258-2289 usb_packet: ep: "Endpoint: 0" "EP: 0" "EP" "E" +2289-2329 usb_packet: crc5-ok: "CRC5: 0x02" "CRC5" "C" +2074-2354 usb_packet: packet-in: "IN ADDR 0 EP 0" +2374-2437 usb_packet: sync-ok: "SYNC: 00000001" "SYNC" "S" +2437-2501 usb_packet: pid: "PID: DATA1" "DATA1" "D" +2374-2525 usb_packet: packet-invalid: "Invalid packet (shorter than 32 bits)" +2698-2761 usb_packet: sync-ok: "SYNC: 00000001" "SYNC" "S" +2761-2825 usb_packet: pid: "PID: IN" "IN" "I" +2825-2882 usb_packet: addr: "Address: 0" "Addr: 0" "Addr" "A" +2882-2913 usb_packet: ep: "Endpoint: 0" "EP: 0" "EP" "E" +2913-2953 usb_packet: crc5-ok: "CRC5: 0x02" "CRC5" "C" +2698-2978 usb_packet: packet-in: "IN ADDR 0 EP 0" +2998-3061 usb_packet: sync-ok: "SYNC: 00000001" "SYNC" "S" +3061-3125 usb_packet: pid: "PID: DATA1" "DATA1" "D" +2998-3149 usb_packet: packet-invalid: "Invalid packet (shorter than 32 bits)" +3322-3385 usb_packet: sync-ok: "SYNC: 00000001" "SYNC" "S" +3385-3449 usb_packet: pid: "PID: IN" "IN" "I" +3449-3506 usb_packet: addr: "Address: 0" "Addr: 0" "Addr" "A" +3506-3537 usb_packet: ep: "Endpoint: 0" "EP: 0" "EP" "E" +3537-3577 usb_packet: crc5-ok: "CRC5: 0x02" "CRC5" "C" +3322-3602 usb_packet: packet-in: "IN ADDR 0 EP 0" +3622-3685 usb_packet: sync-ok: "SYNC: 00000001" "SYNC" "S" +3685-3749 usb_packet: pid: "PID: DATA1" "DATA1" "D" +3622-3773 usb_packet: packet-invalid: "Invalid packet (shorter than 32 bits)"