Skip to content

Fixed : retransmission of discarded segments starts at beginning of new block #546

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion canopen/sdo/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ def _retransmit(self):
response = self.sdo_client.read_response()
res_command, = struct.unpack_from("B", response)
seqno = res_command & 0x7F
if seqno == self._ackseq + 1:
if seqno == 1:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering why the self._ack_block() call doesn't simply reset the self._ackseq attribute to zero in all cases. Then this check would be fine as is?

Just thinking out loud, let's hear your thoughts on why this is the better place to fix it.

# We should be back in sync
self._ackseq = seqno
return response
Expand Down
308 changes: 308 additions & 0 deletions test/test_sdo.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,314 @@ def test_block_upload(self):
data = fp.read()
self.assertEqual(data, 'Tiny Node - Mega Domains !')

def test_sdo_block_upload_retransmit(self):
"""Send 'the crazy fox jumps over the lazy dog\n' multiple times
and trigger a retransmit by only validating a block partially.
"""
self.data = [
(TX, b"\xa4\x08\x10\x00\x7f\x00\x00\x00"),
(RX, b"\xc4\x08\x10\x00\x00\x00\x00\x00"),
(TX, b"\xa3\x00\x00\x00\x00\x00\x00\x00"),
(RX, b"\x01\x74\x68\x65\x20\x63\x72\x61"),
(RX, b"\x02\x7a\x79\x20\x66\x6f\x78\x20"),
(RX, b"\x03\x6a\x75\x6d\x70\x73\x20\x6f"),
(RX, b"\x04\x76\x65\x72\x20\x74\x68\x65"),
(RX, b"\x05\x20\x6c\x61\x7a\x79\x20\x64"),
(RX, b"\x06\x6f\x67\x0a\x74\x68\x65\x20"),
(RX, b"\x07\x63\x72\x61\x7a\x79\x20\x66"),
(RX, b"\x08\x6f\x78\x20\x6a\x75\x6d\x70"),
(RX, b"\x09\x73\x20\x6f\x76\x65\x72\x20"),
(RX, b"\x0a\x74\x68\x65\x20\x6c\x61\x7a"),
(RX, b"\x0b\x79\x20\x64\x6f\x67\x0a\x74"),
(RX, b"\x0c\x68\x65\x20\x63\x72\x61\x7a"),
(RX, b"\x0d\x79\x20\x66\x6f\x78\x20\x6a"),
(RX, b"\x0e\x75\x6d\x70\x73\x20\x6f\x76"),
(RX, b"\x0f\x65\x72\x20\x74\x68\x65\x20"),
(RX, b"\x10\x6c\x61\x7a\x79\x20\x64\x6f"),
(RX, b"\x11\x67\x0a\x74\x68\x65\x20\x63"),
(RX, b"\x12\x72\x61\x7a\x79\x20\x66\x6f"),
(RX, b"\x13\x78\x20\x6a\x75\x6d\x70\x73"),
(RX, b"\x14\x20\x6f\x76\x65\x72\x20\x74"),
(RX, b"\x15\x68\x65\x20\x6c\x61\x7a\x79"),
(RX, b"\x16\x20\x64\x6f\x67\x0a\x74\x68"),
(RX, b"\x17\x65\x20\x63\x72\x61\x7a\x79"),
(RX, b"\x18\x20\x66\x6f\x78\x20\x6a\x75"),
(RX, b"\x19\x6d\x70\x73\x20\x6f\x76\x65"),
(RX, b"\x1a\x72\x20\x74\x68\x65\x20\x6c"),
(RX, b"\x1b\x61\x7a\x79\x20\x64\x6f\x67"),
(RX, b"\x1c\x0a\x74\x68\x65\x20\x63\x72"),
(RX, b"\x1d\x61\x7a\x79\x20\x66\x6f\x78"),
(RX, b"\x1e\x20\x6a\x75\x6d\x70\x73\x20"),
(RX, b"\x1f\x6f\x76\x65\x72\x20\x74\x68"),
(RX, b"\x20\x65\x20\x6c\x61\x7a\x79\x20"),
(RX, b"\x21\x64\x6f\x67\x0a\x74\x68\x65"),
(RX, b"\x22\x20\x63\x72\x61\x7a\x79\x20"),
(RX, b"\x23\x66\x6f\x78\x20\x6a\x75\x6d"),
(RX, b"\x24\x70\x73\x20\x6f\x76\x65\x72"),
(RX, b"\x25\x20\x74\x68\x65\x20\x6c\x61"),
(RX, b"\x26\x7a\x79\x20\x64\x6f\x67\x0a"),
(RX, b"\x27\x74\x68\x65\x20\x63\x72\x61"),
(RX, b"\x28\x7a\x79\x20\x66\x6f\x78\x20"),
(RX, b"\x29\x6a\x75\x6d\x70\x73\x20\x6f"),
(RX, b"\x2a\x76\x65\x72\x20\x74\x68\x65"),
(RX, b"\x2b\x20\x6c\x61\x7a\x79\x20\x64"),
(RX, b"\x2c\x6f\x67\x0a\x74\x68\x65\x20"),
(RX, b"\x2d\x63\x72\x61\x7a\x79\x20\x66"),
(RX, b"\x2e\x6f\x78\x20\x6a\x75\x6d\x70"),
(RX, b"\x2f\x73\x20\x6f\x76\x65\x72\x20"),
(RX, b"\x30\x74\x68\x65\x20\x6c\x61\x7a"),
(RX, b"\x31\x79\x20\x64\x6f\x67\x0a\x74"),
(RX, b"\x32\x68\x65\x20\x63\x72\x61\x7a"),
(RX, b"\x34\x79\x20\x66\x6f\x78\x20\x6a"),
(RX, b"\x34\x75\x6d\x70\x73\x20\x6f\x76"), # --> Wrong seqno (x34 instead of x33)
Comment on lines +231 to +232
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these lines intentionally using the same sequence number? From the comment I'd assume the previous segment should have been missing, not misunderstood.

(RX, b"\x35\x65\x72\x20\x74\x68\x65\x20"), # All the following frames until end of block
(RX, b"\x36\x6c\x61\x7a\x79\x20\x64\x6f"), # will be ignored by the client and should be
(RX, b"\x37\x67\x0a\x74\x68\x65\x20\x63"), # resent by server.
(RX, b"\x38\x72\x61\x7a\x79\x20\x66\x6f"),
(RX, b"\x39\x78\x20\x6a\x75\x6d\x70\x73"),
(RX, b"\x3a\x20\x6f\x76\x65\x72\x20\x74"),
(RX, b"\x3b\x68\x65\x20\x6c\x61\x7a\x79"),
(RX, b"\x3c\x20\x64\x6f\x67\x0a\x74\x68"),
(RX, b"\x3d\x65\x20\x63\x72\x61\x7a\x79"),
(RX, b"\x3e\x20\x66\x6f\x78\x20\x6a\x75"),
(RX, b"\x3f\x6d\x70\x73\x20\x6f\x76\x65"),
(RX, b"\x40\x72\x20\x74\x68\x65\x20\x6c"),
(RX, b"\x41\x61\x7a\x79\x20\x64\x6f\x67"),
(RX, b"\x42\x0a\x74\x68\x65\x20\x63\x72"),
(RX, b"\x43\x61\x7a\x79\x20\x66\x6f\x78"),
(RX, b"\x44\x20\x6a\x75\x6d\x70\x73\x20"),
(RX, b"\x45\x6f\x76\x65\x72\x20\x74\x68"),
(RX, b"\x46\x65\x20\x6c\x61\x7a\x79\x20"),
(RX, b"\x47\x64\x6f\x67\x0a\x74\x68\x65"),
(RX, b"\x48\x20\x63\x72\x61\x7a\x79\x20"),
(RX, b"\x49\x66\x6f\x78\x20\x6a\x75\x6d"),
(RX, b"\x4a\x70\x73\x20\x6f\x76\x65\x72"),
(RX, b"\x4b\x20\x74\x68\x65\x20\x6c\x61"),
(RX, b"\x4c\x7a\x79\x20\x64\x6f\x67\x0a"),
(RX, b"\x4d\x74\x68\x65\x20\x63\x72\x61"),
(RX, b"\x4e\x7a\x79\x20\x66\x6f\x78\x20"),
(RX, b"\x4f\x6a\x75\x6d\x70\x73\x20\x6f"),
(RX, b"\x50\x76\x65\x72\x20\x74\x68\x65"),
(RX, b"\x51\x20\x6c\x61\x7a\x79\x20\x64"),
(RX, b"\x52\x6f\x67\x0a\x74\x68\x65\x20"),
(RX, b"\x53\x63\x72\x61\x7a\x79\x20\x66"),
(RX, b"\x54\x6f\x78\x20\x6a\x75\x6d\x70"),
(RX, b"\x55\x73\x20\x6f\x76\x65\x72\x20"),
(RX, b"\x56\x74\x68\x65\x20\x6c\x61\x7a"),
(RX, b"\x57\x79\x20\x64\x6f\x67\x0a\x74"),
(RX, b"\x58\x68\x65\x20\x63\x72\x61\x7a"),
(RX, b"\x59\x79\x20\x66\x6f\x78\x20\x6a"),
(RX, b"\x5a\x75\x6d\x70\x73\x20\x6f\x76"),
(RX, b"\x5b\x65\x72\x20\x74\x68\x65\x20"),
(RX, b"\x5c\x6c\x61\x7a\x79\x20\x64\x6f"),
(RX, b"\x5d\x67\x0a\x74\x68\x65\x20\x63"),
(RX, b"\x5e\x72\x61\x7a\x79\x20\x66\x6f"),
(RX, b"\x5f\x78\x20\x6a\x75\x6d\x70\x73"),
(RX, b"\x60\x20\x6f\x76\x65\x72\x20\x74"),
(RX, b"\x61\x68\x65\x20\x6c\x61\x7a\x79"),
(RX, b"\x62\x20\x64\x6f\x67\x0a\x74\x68"),
(RX, b"\x63\x65\x20\x63\x72\x61\x7a\x79"),
(RX, b"\x64\x20\x66\x6f\x78\x20\x6a\x75"),
(RX, b"\x65\x6d\x70\x73\x20\x6f\x76\x65"),
(RX, b"\x66\x72\x20\x74\x68\x65\x20\x6c"),
(RX, b"\x67\x61\x7a\x79\x20\x64\x6f\x67"),
(RX, b"\x68\x0a\x74\x68\x65\x20\x63\x72"),
(RX, b"\x69\x61\x7a\x79\x20\x66\x6f\x78"),
(RX, b"\x6a\x20\x6a\x75\x6d\x70\x73\x20"),
(RX, b"\x6b\x6f\x76\x65\x72\x20\x74\x68"),
(RX, b"\x6c\x65\x20\x6c\x61\x7a\x79\x20"),
(RX, b"\x6d\x64\x6f\x67\x0a\x74\x68\x65"),
(RX, b"\x6e\x20\x63\x72\x61\x7a\x79\x20"),
(RX, b"\x6f\x66\x6f\x78\x20\x6a\x75\x6d"),
(RX, b"\x70\x70\x73\x20\x6f\x76\x65\x72"),
(RX, b"\x71\x20\x74\x68\x65\x20\x6c\x61"),
(RX, b"\x72\x7a\x79\x20\x64\x6f\x67\x0a"),
(RX, b"\x73\x74\x68\x65\x20\x63\x72\x61"),
(RX, b"\x74\x7a\x79\x20\x66\x6f\x78\x20"),
(RX, b"\x75\x6a\x75\x6d\x70\x73\x20\x6f"),
(RX, b"\x76\x76\x65\x72\x20\x74\x68\x65"),
(RX, b"\x77\x20\x6c\x61\x7a\x79\x20\x64"),
(RX, b"\x78\x6f\x67\x0a\x74\x68\x65\x20"),
(RX, b"\x79\x63\x72\x61\x7a\x79\x20\x66"),
(RX, b"\x7a\x6f\x78\x20\x6a\x75\x6d\x70"),
(RX, b"\x7b\x73\x20\x6f\x76\x65\x72\x20"),
(RX, b"\x7c\x74\x68\x65\x20\x6c\x61\x7a"),
(RX, b"\x7d\x79\x20\x64\x6f\x67\x0a\x74"),
(RX, b"\x7e\x68\x65\x20\x63\x72\x61\x7a"),
(RX, b"\x7f\x79\x20\x66\x6f\x78\x20\x6a"), # --> Last element of block
(TX, b"\xa2\x32\x7f\x00\x00\x00\x00\x00"), # --> Last good seqno (x32)
(RX, b"\x01\x79\x20\x66\x6f\x78\x20\x6a"), # --> Server starts resending from last acknowledged block
(RX, b"\x02\x75\x6d\x70\x73\x20\x6f\x76"),
(RX, b"\x03\x65\x72\x20\x74\x68\x65\x20"),
(RX, b"\x04\x6c\x61\x7a\x79\x20\x64\x6f"),
(RX, b"\x05\x67\x0a\x74\x68\x65\x20\x63"),
(RX, b"\x06\x72\x61\x7a\x79\x20\x66\x6f"),
(RX, b"\x07\x78\x20\x6a\x75\x6d\x70\x73"),
(RX, b"\x08\x20\x6f\x76\x65\x72\x20\x74"),
(RX, b"\x09\x68\x65\x20\x6c\x61\x7a\x79"),
(RX, b"\x0a\x20\x64\x6f\x67\x0a\x74\x68"),
(RX, b"\x0b\x65\x20\x63\x72\x61\x7a\x79"),
(RX, b"\x0c\x20\x66\x6f\x78\x20\x6a\x75"),
(RX, b"\x0d\x6d\x70\x73\x20\x6f\x76\x65"),
(RX, b"\x0e\x72\x20\x74\x68\x65\x20\x6c"),
(RX, b"\x0f\x61\x7a\x79\x20\x64\x6f\x67"),
(RX, b"\x10\x0a\x74\x68\x65\x20\x63\x72"),
(RX, b"\x11\x61\x7a\x79\x20\x66\x6f\x78"),
(RX, b"\x12\x20\x6a\x75\x6d\x70\x73\x20"),
(RX, b"\x13\x6f\x76\x65\x72\x20\x74\x68"),
(RX, b"\x14\x65\x20\x6c\x61\x7a\x79\x20"),
(RX, b"\x15\x64\x6f\x67\x0a\x74\x68\x65"),
(RX, b"\x16\x20\x63\x72\x61\x7a\x79\x20"),
(RX, b"\x17\x66\x6f\x78\x20\x6a\x75\x6d"),
(RX, b"\x18\x70\x73\x20\x6f\x76\x65\x72"),
(RX, b"\x19\x20\x74\x68\x65\x20\x6c\x61"),
(RX, b"\x1a\x7a\x79\x20\x64\x6f\x67\x0a"),
(RX, b"\x1b\x74\x68\x65\x20\x63\x72\x61"),
(RX, b"\x1c\x7a\x79\x20\x66\x6f\x78\x20"),
(RX, b"\x1d\x6a\x75\x6d\x70\x73\x20\x6f"),
(RX, b"\x1e\x76\x65\x72\x20\x74\x68\x65"),
(RX, b"\x1f\x20\x6c\x61\x7a\x79\x20\x64"),
(RX, b"\x20\x6f\x67\x0a\x74\x68\x65\x20"),
(RX, b"\x21\x63\x72\x61\x7a\x79\x20\x66"),
(RX, b"\x22\x6f\x78\x20\x6a\x75\x6d\x70"),
(RX, b"\x23\x73\x20\x6f\x76\x65\x72\x20"),
(RX, b"\x24\x74\x68\x65\x20\x6c\x61\x7a"),
(RX, b"\x25\x79\x20\x64\x6f\x67\x0a\x74"),
(RX, b"\x26\x68\x65\x20\x63\x72\x61\x7a"),
(RX, b"\x27\x79\x20\x66\x6f\x78\x20\x6a"),
(RX, b"\x28\x75\x6d\x70\x73\x20\x6f\x76"),
(RX, b"\x29\x65\x72\x20\x74\x68\x65\x20"),
(RX, b"\x2a\x6c\x61\x7a\x79\x20\x64\x6f"),
(RX, b"\x2b\x67\x0a\x74\x68\x65\x20\x63"),
(RX, b"\x2c\x72\x61\x7a\x79\x20\x66\x6f"),
(RX, b"\x2d\x78\x20\x6a\x75\x6d\x70\x73"),
(RX, b"\x2e\x20\x6f\x76\x65\x72\x20\x74"),
(RX, b"\x2f\x68\x65\x20\x6c\x61\x7a\x79"),
(RX, b"\x30\x20\x64\x6f\x67\x0a\x74\x68"),
(RX, b"\x31\x65\x20\x63\x72\x61\x7a\x79"),
(RX, b"\x32\x20\x66\x6f\x78\x20\x6a\x75"),
(RX, b"\x33\x6d\x70\x73\x20\x6f\x76\x65"),
(RX, b"\x34\x72\x20\x74\x68\x65\x20\x6c"),
(RX, b"\x35\x61\x7a\x79\x20\x64\x6f\x67"),
(RX, b"\x36\x0a\x74\x68\x65\x20\x63\x72"),
(RX, b"\x37\x61\x7a\x79\x20\x66\x6f\x78"),
(RX, b"\x38\x20\x6a\x75\x6d\x70\x73\x20"),
(RX, b"\x39\x6f\x76\x65\x72\x20\x74\x68"),
(RX, b"\x3a\x65\x20\x6c\x61\x7a\x79\x20"),
(RX, b"\x3b\x64\x6f\x67\x0a\x74\x68\x65"),
(RX, b"\x3c\x20\x63\x72\x61\x7a\x79\x20"),
(RX, b"\x3d\x66\x6f\x78\x20\x6a\x75\x6d"),
(RX, b"\x3e\x70\x73\x20\x6f\x76\x65\x72"),
(RX, b"\x3f\x20\x74\x68\x65\x20\x6c\x61"),
(RX, b"\x40\x7a\x79\x20\x64\x6f\x67\x0a"),
(RX, b"\x41\x74\x68\x65\x20\x63\x72\x61"),
(RX, b"\x42\x7a\x79\x20\x66\x6f\x78\x20"),
(RX, b"\x43\x6a\x75\x6d\x70\x73\x20\x6f"),
(RX, b"\x44\x76\x65\x72\x20\x74\x68\x65"),
(RX, b"\x45\x20\x6c\x61\x7a\x79\x20\x64"),
(RX, b"\x46\x6f\x67\x0a\x74\x68\x65\x20"),
(RX, b"\x47\x63\x72\x61\x7a\x79\x20\x66"),
(RX, b"\x48\x6f\x78\x20\x6a\x75\x6d\x70"),
(RX, b"\x49\x73\x20\x6f\x76\x65\x72\x20"),
(RX, b"\x4a\x74\x68\x65\x20\x6c\x61\x7a"),
(RX, b"\x4b\x79\x20\x64\x6f\x67\x0a\x74"),
(RX, b"\x4c\x68\x65\x20\x63\x72\x61\x7a"),
(RX, b"\x4d\x79\x20\x66\x6f\x78\x20\x6a"),
(RX, b"\x4e\x75\x6d\x70\x73\x20\x6f\x76"),
(RX, b"\x4f\x65\x72\x20\x74\x68\x65\x20"),
(RX, b"\x50\x6c\x61\x7a\x79\x20\x64\x6f"),
(RX, b"\x51\x67\x0a\x74\x68\x65\x20\x63"),
(RX, b"\x52\x72\x61\x7a\x79\x20\x66\x6f"),
(RX, b"\x53\x78\x20\x6a\x75\x6d\x70\x73"),
(RX, b"\x54\x20\x6f\x76\x65\x72\x20\x74"),
(RX, b"\x55\x68\x65\x20\x6c\x61\x7a\x79"),
(RX, b"\x56\x20\x64\x6f\x67\x0a\x74\x68"),
(RX, b"\x57\x65\x20\x63\x72\x61\x7a\x79"),
(RX, b"\x58\x20\x66\x6f\x78\x20\x6a\x75"),
(RX, b"\x59\x6d\x70\x73\x20\x6f\x76\x65"),
(RX, b"\x5a\x72\x20\x74\x68\x65\x20\x6c"),
(RX, b"\x5b\x61\x7a\x79\x20\x64\x6f\x67"),
(RX, b"\x5c\x0a\x74\x68\x65\x20\x63\x72"),
(RX, b"\x5d\x61\x7a\x79\x20\x66\x6f\x78"),
(RX, b"\x5e\x20\x6a\x75\x6d\x70\x73\x20"),
(RX, b"\x5f\x6f\x76\x65\x72\x20\x74\x68"),
(RX, b"\x60\x65\x20\x6c\x61\x7a\x79\x20"),
(RX, b"\x61\x64\x6f\x67\x0a\x74\x68\x65"),
(RX, b"\x62\x20\x63\x72\x61\x7a\x79\x20"),
(RX, b"\x63\x66\x6f\x78\x20\x6a\x75\x6d"),
(RX, b"\x64\x70\x73\x20\x6f\x76\x65\x72"),
(RX, b"\x65\x20\x74\x68\x65\x20\x6c\x61"),
(RX, b"\x66\x7a\x79\x20\x64\x6f\x67\x0a"),
(RX, b"\x67\x74\x68\x65\x20\x63\x72\x61"),
(RX, b"\x68\x7a\x79\x20\x66\x6f\x78\x20"),
(RX, b"\x69\x6a\x75\x6d\x70\x73\x20\x6f"),
(RX, b"\x6a\x76\x65\x72\x20\x74\x68\x65"),
(RX, b"\x6b\x20\x6c\x61\x7a\x79\x20\x64"),
(RX, b"\x6c\x6f\x67\x0a\x74\x68\x65\x20"),
(RX, b"\x6d\x63\x72\x61\x7a\x79\x20\x66"),
(RX, b"\x6e\x6f\x78\x20\x6a\x75\x6d\x70"),
(RX, b"\x6f\x73\x20\x6f\x76\x65\x72\x20"),
(RX, b"\x70\x74\x68\x65\x20\x6c\x61\x7a"),
(RX, b"\x71\x79\x20\x64\x6f\x67\x0a\x74"),
(RX, b"\x72\x68\x65\x20\x63\x72\x61\x7a"),
(RX, b"\x73\x79\x20\x66\x6f\x78\x20\x6a"),
(RX, b"\x74\x75\x6d\x70\x73\x20\x6f\x76"),
(RX, b"\x75\x65\x72\x20\x74\x68\x65\x20"),
(RX, b"\x76\x6c\x61\x7a\x79\x20\x64\x6f"),
(RX, b"\x77\x67\x0a\x74\x68\x65\x20\x63"),
(RX, b"\x78\x72\x61\x7a\x79\x20\x66\x6f"),
(RX, b"\x79\x78\x20\x6a\x75\x6d\x70\x73"),
(RX, b"\x7a\x20\x6f\x76\x65\x72\x20\x74"),
(RX, b"\x7b\x68\x65\x20\x6c\x61\x7a\x79"),
(RX, b"\x7c\x20\x64\x6f\x67\x0a\x74\x68"),
(RX, b"\x7d\x65\x20\x63\x72\x61\x7a\x79"),
(RX, b"\x7e\x20\x66\x6f\x78\x20\x6a\x75"),
(RX, b"\x7f\x6d\x70\x73\x20\x6f\x76\x65"),
(TX, b"\xa2\x7f\x7f\x00\x00\x00\x00\x00"), # --> This block is acknlowedged without issues
(RX, b"\x01\x72\x20\x74\x68\x65\x20\x6c"),
(RX, b"\x02\x61\x7a\x79\x20\x64\x6f\x67"),
(RX, b"\x03\x0a\x74\x68\x65\x20\x63\x72"),
(RX, b"\x04\x61\x7a\x79\x20\x66\x6f\x78"),
(RX, b"\x05\x20\x6a\x75\x6d\x70\x73\x20"),
(RX, b"\x06\x6f\x76\x65\x72\x20\x74\x68"),
(RX, b"\x07\x65\x20\x6c\x61\x7a\x79\x20"),
(RX, b"\x08\x64\x6f\x67\x0a\x74\x68\x65"),
(RX, b"\x09\x20\x63\x72\x61\x7a\x79\x20"),
(RX, b"\x0a\x66\x6f\x78\x20\x6a\x75\x6d"),
(RX, b"\x0b\x70\x73\x20\x6f\x76\x65\x72"),
(RX, b"\x0c\x20\x74\x68\x65\x20\x6c\x61"),
(RX, b"\x0d\x7a\x79\x20\x64\x6f\x67\x0a"),
(RX, b"\x0e\x74\x68\x65\x20\x63\x72\x61"),
(RX, b"\x0f\x7a\x79\x20\x66\x6f\x78\x20"),
(RX, b"\x10\x6a\x75\x6d\x70\x73\x20\x6f"),
(RX, b"\x11\x76\x65\x72\x20\x74\x68\x65"),
(RX, b"\x12\x20\x6c\x61\x7a\x79\x20\x64"),
(RX, b"\x13\x6f\x67\x0a\x74\x68\x65\x20"),
(RX, b"\x14\x63\x72\x61\x7a\x79\x20\x66"),
(RX, b"\x15\x6f\x78\x20\x6a\x75\x6d\x70"),
(RX, b"\x16\x73\x20\x6f\x76\x65\x72\x20"),
(RX, b"\x17\x74\x68\x65\x20\x6c\x61\x7a"),
(RX, b"\x18\x79\x20\x64\x6f\x67\x0a\x74"),
(RX, b"\x19\x68\x65\x20\x63\x72\x61\x7a"),
(RX, b"\x1a\x79\x20\x66\x6f\x78\x20\x6a"),
(RX, b"\x1b\x75\x6d\x70\x73\x20\x6f\x76"),
(RX, b"\x1c\x65\x72\x20\x74\x68\x65\x20"),
(RX, b"\x1d\x6c\x61\x7a\x79\x20\x64\x6f"),
(RX, b"\x1e\x67\x0a\x74\x68\x65\x20\x63"),
(RX, b"\x1f\x72\x61\x7a\x79\x20\x66\x6f"),
(RX, b"\x20\x78\x20\x6a\x75\x6d\x70\x73"),
(RX, b"\x21\x20\x6f\x76\x65\x72\x20\x74"),
(RX, b"\x22\x68\x65\x20\x6c\x61\x7a\x79"),
(RX, b"\xa3\x20\x64\x6f\x67\x0a\x00\x00"),
(TX, b"\xa2\x23\x7f\x00\x00\x00\x00\x00"),
(RX, b"\xc9\x3b\x49\x00\x00\x00\x00\x00"),
(TX, b"\xa1\x00\x00\x00\x00\x00\x00\x00"), # --> Transfer ends without issues
]
data = []
with self.network[2].sdo[0x1008].open("r", block_transfer=True) as fp:
data = fp.read()
assert data == 39 * "the crazy fox jumps over the lazy dog\n"

def test_writable_file(self):
self.data = [
(TX, b'\x20\x00\x20\x00\x00\x00\x00\x00'),
Expand Down
Loading