Code Monkey home page Code Monkey logo

Comments (9)

pylessard avatar pylessard commented on June 11, 2024 1

Ohhh my bad, sorry. I somehow was conviced you were parsing DIDs, but your not. I see, I see.

Well.. your server is wrong here. It seems to encode the subfunction on a 16 bits ID. It should be 8bits.
See the standard

image

from python-udsoncan.

pylessard avatar pylessard commented on June 11, 2024 1

I have push a correction so that the reported error is better.
Here : a4b4047

from python-udsoncan.

pylessard avatar pylessard commented on June 11, 2024

EDIT. The below answer is wrong. I was confused

Hi
You title talks about "interpret_response" but in your code example, you decode the response yourself. Not sure what,s going on here.

For the explanation, your can response can be dissected like this:
 - 07  - isotp header. length of 7 bytes
 - 50 - service ID with bit 7 set to 1  (0x40 | 0x10)
 - 0200 - DID id in a 16bits field
 - 3201f404 : you did payload, which is indeed 4 bytes long.

Cheers

from python-udsoncan.

jeanot1314 avatar jeanot1314 commented on June 11, 2024

Thanks you for the quick answer.

I am not sure I understand what you mean by decoding yourself.

When the UDS server device answer, I have the error "struct.error: unpack requires a buffer of 4 bytes"

it's coming from (a, b) = struct.unpack('>HH', response.data[1:])

If I print (response.data[1:])
I have 5 bytes instead of 4.

Could it be possible that my DID configuration client is 1byte instead of 2? So I have a 5bytes long payload?

from python-udsoncan.

jeanot1314 avatar jeanot1314 commented on June 11, 2024

I am sorry, I was sure the server part was reliable... that's the reason I was looking at the library.

Merci beaucoup pour le support ! ;)

from python-udsoncan.

pylessard avatar pylessard commented on June 11, 2024

That's the purpose of the library, finding those defects :) Glad it helped

Cheers

from python-udsoncan.

jeanot1314 avatar jeanot1314 commented on June 11, 2024

Hi Pylessard,

I have another strange behavior but I can't find if it's coming from client or server. I already used ReadDataByIdentifier on others DID, so it's surprising.

Here are the Log :

2024-02-09 09:26:53 [INFO] Connection: Connection opened
2024-02-09 09:26:53 [INFO] UdsClient: ReadDataByIdentifier<0x22> - Reading data identifier : 0xf080 (VehicleManufacturerSpecific)
2024-02-09 09:26:53 [DEBUG] Connection: Sending 3 bytes : [22f080]
2024-02-09 09:26:53 [DEBUG] Connection: Received 25 bytes : [62f080985513198000b09855131980ffffffffff01ffffffff]
2024-02-09 09:26:53 [INFO] UdsClient: Received positive response for service ReadDataByIdentifier (0x22) from server.
2024-02-09 09:26:53 [ERROR] UdsClient: [InvalidResponseException] : ReadDataByIdentifier service execution returned an invalid response. Response given by server is incomplete.
2024-02-09 09:26:53 [INFO] Connection: Connection closed

The exchange seems allright because it expect 25 bytes (0x19) and receive 25 bytes.
To better understand, I recorded the traffic, but everything seems good

ID=1711,Type=D,Length=8,Data=0322F080
ID=1679,Type=D,Length=8,Data=101962F080985513

ID=1711,Type=D,Length=8,Data=300820
ID=1679,Type=D,Length=8,Data=21198000B0985513
ID=1679,Type=D,Length=8,Data=221980FFFFFFFFFF
ID=1679,Type=D,Length=6,Data=2301FFFFFFFF

Do you want me to open another topic?

Thanks a lot

from python-udsoncan.

jeanot1314 avatar jeanot1314 commented on June 11, 2024

The problem seems to come from here :

raise InvalidResponseException(response, "Response given by server is incomplete.")

At this moment, "len(response.data)" is 24 bytes ( 25 bytes minus 0x62 answer )
The offset+1 is 24 as well

from python-udsoncan.

jeanot1314 avatar jeanot1314 commented on June 11, 2024

Ok, nevermind. It come from the length I send
Really sorry to have disturb you. :(

from python-udsoncan.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.