All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick Menschel <menschel.p@posteo.de>
To: Bartosz Zdanowicz <zdanowiczb@gmail.com>
Cc: Oliver Hartkopp <socketcan@hartkopp.net>,
	linux-can <linux-can@vger.kernel.org>
Subject: Re: CAN ISO-TP
Date: Tue, 11 May 2021 16:37:12 +0000	[thread overview]
Message-ID: <43d77f58-1ec9-302c-d8f0-654444046cab@posteo.de> (raw)
In-Reply-To: <7ad89748-c309-1153-aa8f-b0e98160e39d@posteo.de>

Am 10.05.21 um 20:04 schrieb Patrick Menschel:
> Am 10.05.21 um 12:02 schrieb Bartosz Zdanowicz:
>> pt., 7 maj 2021 o 09:59 Patrick Menschel <menschel.p@posteo.de> napisał(a):
>>> try to enable CAN_ISOTP_WAIT_TX_DONE via socket.setsockopt() .
>>> https://github.com/raspberrypi/linux/blob/rpi-5.10.y/net/can/isotp.c#L14
>>>
>>> https://gitlab.com/Menschel/socketcan/-/blob/master/socketcan/socketcan.py#L583
>>>
>>> and wrap tx into a try-except block.
>>>
>>> try:
>>>     self.process_data(socket=socket)
>>> except OSError as e:
>>>     print(e)
>>>
>>> With this you actually have a chance to do error handling on tx path
>>> instead of hitting an already present error of the previous op.
>>>
>> I used following code:
>>
>> import isotp
>> import time
>> s = isotp.socket()
>> s._socket.settimeout(2)
>> s.set_opts(s.flags.WAIT_TX_DONE)
>> s.bind("can0", isotp.Address(rxid=1, txid=2))
>>
>> s.send(b"aaaaaaaaa") -> returns immediately with number of bytes
>> s.send(b"aaaaaaaaa") -> same OS error as above (Error 70)
>>
> 
> OK,
> 
> this is really strange. I have no clue how that is possible unless it's
> on kernel side.
> 
> I have to write a test for it later.

I can confirm this behaviour, it is definetly kernel-side of the socket.

tests/test_socketcan.py::TestCanIsoTpSocket::test_should_fail_missing_flow_control_on_transfer

--------------------------------------------------------------------------------------------------
live log call
--------------------------------------------------------------------------------------------------
2021-05-11 18:14:00 [    INFO] Return value of IsoTpSend without flow
control: 64 (test_socketcan.py:720)
2021-05-11 18:14:01 [   ERROR] Return value of IsoTpSend without flow
control: None, Raised [Errno 70] Communication error on send
(test_socketcan.py:718)

Apparently there is another message thread for this and something was fixed.

https://marc.info/?i=97e2ddd5-cc8b-9c7b-6198-2eceee39dfd4%20()%20hartkopp%20!%20net

Funny thing is, it does not care about the wait_tx_done flag, this
happens with and without it.

Regards,
Patrick

  reply	other threads:[~2021-05-11 16:37 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAERdor5nY73X4qip=up8fNU=xT+H7r2XnKiob66=4DxovkBiGw@mail.gmail.com>
2021-05-06 18:01 ` CAN ISO-TP Oliver Hartkopp
2021-05-06 20:52   ` Patrick Menschel
2021-05-06 21:28   ` Bartosz Zdanowicz
2021-05-07  7:02     ` Patrick Menschel
2021-05-07  7:24       ` Bartosz Zdanowicz
2021-05-07  7:59         ` Patrick Menschel
2021-05-10 10:02           ` Bartosz Zdanowicz
2021-05-10 18:04             ` Patrick Menschel
2021-05-11 16:37               ` Patrick Menschel [this message]
2021-05-11 17:44                 ` Oliver Hartkopp
2021-05-11 19:02                   ` Patrick Menschel
2021-05-12 19:15                     ` Patrick Menschel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=43d77f58-1ec9-302c-d8f0-654444046cab@posteo.de \
    --to=menschel.p@posteo.de \
    --cc=linux-can@vger.kernel.org \
    --cc=socketcan@hartkopp.net \
    --cc=zdanowiczb@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.