python-udsoncan icon indicating copy to clipboard operation
python-udsoncan copied to clipboard

Positive response suppression is not fully checked

Open raul-klg opened this issue 1 year ago • 1 comments

Hi!

First of all thanks for this great piece of software.

I think I have found an incorrect behavior, but maybe I'm wrong.

Consider the following code snippet:

    with uds_client.suppress_positive_response(wait_nrc=True):
        response = uds_client.tester_present()
        assert response is None

If the ECU is correctly implemented there should not be positive response to the tester_present request. For example, this is the expected candump output:

(064.801721)  can0  0CDA1619   [3]  02 3E 80

For the above, the current udsoncan implementation is correct.

Now I am testing an incorrectly implemented ECU, and it incorrectly replies to the tester present request when positive response suppression is requested:

(104.301011)  can0  0CDA1619   [3]  02 3E 80
(000.006008)  can0  0CDA1916   [8]  02 7E 80 CC CC CC CC CC

I think udsoncan should check that when request is in suppress_positive_response context, there is no reply and should fail somehow. Currently, udsoncan tester_present call returns an empty response object but it internally does not check that the positive response is actually suppressed.

raul-klg avatar Oct 15 '24 10:10 raul-klg