Skip to content
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

Question about reply checksum logic #55

Open
aleclarson opened this issue Aug 1, 2019 · 3 comments
Open

Question about reply checksum logic #55

aleclarson opened this issue Aug 1, 2019 · 3 comments
Labels

Comments

@aleclarson
Copy link

How did you come up with the logic for the "reply checksum" below?

ddcctl/DDC.c

Line 223 in 4818757

result = (result && reply_data[0] == request.sendAddress && reply_data[2] == 0x2 && reply_data[4] == read->control_id && reply_data[10] == (request.replyAddress ^ request.replySubAddress ^ reply_data[1] ^ reply_data[2] ^ reply_data[3] ^ reply_data[4] ^ reply_data[5] ^ reply_data[6] ^ reply_data[7] ^ reply_data[8] ^ reply_data[9]));

For the Samsung monitors I'm testing with (U28E590 & S22E310), the checksum is failing, so I'm wondering if maybe that logic isn't 100% correct.

@aleclarson
Copy link
Author

Also, any guess as to why a display's reply wouldn't pass the checksum? Could it be using a different "version" of DDC or something?

@aleclarson
Copy link
Author

aleclarson commented Aug 1, 2019

I'm also curious how you conjured the IOI2CRequest incantations. Is there any guidance out there on that? Apple doesn't seem to document such things, although I found this example (but that's only for EDID test).

edit: Nevermind the next part here. Just a bug with lldb I guess.

Interestingly, lldb spits out the following when I execute p request while paused right before the DisplayRequest(displayID, &request) call:

{
  sendTransactionType = 1
  replyTransactionType = 1
  sendAddress = 110
  replyAddress = 111
  sendSubAddress = '\0'
  replySubAddress = 'Q'
  __reservedA = ([0] = '\0', [1] = '\0')
  minReplyDelay = 0
  result = 0
  commFlags = 0
  __padA = 5
  sendBytes = 0
  __reservedB = ([0] = 0, [1] = 0)
  __padB = 11
  replyBytes = 0
  completion = 0xefbfd75000000000
  sendBuffer = 17275764039804289022
  replyBuffer = 32766
  __reservedC = ([0] = 0, [1] = 0, [2] = 0, [3] = 0, [4] = 0, [5] = 0, [6] = 0, [7] = 0, [8] = 0, [9] = 32767)
}

That's a read request for the display's brightness. Notice how sendBytes and replyBytes are strangely zero. Not sure why the assignment isn't being respected. Any ideas?

@kfix
Copy link
Owner

kfix commented Sep 10, 2019

How did you come up with the logic for the "reply checksum" below?

ddcctl/DDC.c

Line 223 in 4818757

result = (result && reply_data[0] == request.sendAddress && reply_data[2] == 0x2 && reply_data[4] == read->control_id && reply_data[10] == (request.replyAddress ^ request.replySubAddress ^ reply_data[1] ^ reply_data[2] ^ reply_data[3] ^ reply_data[4] ^ reply_data[5] ^ reply_data[6] ^ reply_data[7] ^ reply_data[8] ^ reply_data[9]));

For the Samsung monitors I'm testing with (U28E590 & S22E310), the checksum is failing, so I'm wondering if maybe that logic isn't 100% correct.

I didn't come up with it, code came from this: https://github.com/jontaylor/DDC-CI-Tools-for-OS-X/blob/master/ddc/ddc.c#L118

@kfix kfix added the question label Sep 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants