You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ipctool i2cdetect is always skipping the last address in its output. So i2c address 0xff is not readable with it.
root@openipc-gk7205v210:/tmp# ./ipctool i2cdetect
0 1 2 3 4 5 6 7 8 9 a b c d e f
: xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx |
10: xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx |
20: xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx |
30: xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx |
40: xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx |
50: xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx |
60: 60 61 xx xx xx xx xx xx xx xx xx xx xx xx xx xx |
70: xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx |
80: xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx |
90: xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx |
a0: xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx |
b0: xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx |
c0: xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx |
d0: xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx |
e0: xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx |
f0: xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx
The problem is similar to #113 (but in an other function).
The solution is not as simple as #114 because the data type unsigned char used for i2caddr is always a value between 0-255 (0x00 - 0xFF). And 0xff + 1 = 0x00.
So changing the < to <=will result in an infinite loop because the condition i2c_addr <= 0xff is always true when using unsigned char.
So we have to check the condition at the end of the loop to get the desired output.
} while (i2c_addr!=0xff);
Final output:
root@openipc-gk7205v210:/tmp# ./ipctool i2cdetect
0 1 2 3 4 5 6 7 8 9 a b c d e f
: xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx |
10: xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx |
20: xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx |
30: xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx |
40: xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx |
50: xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx |
60: 60 61 xx xx xx xx xx xx xx xx xx xx xx xx xx xx |
70: xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx |
80: xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx |
90: xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx |
a0: xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx |
b0: xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx |
c0: xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx |
d0: xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx |
e0: xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx |
f0: xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx xx |
The text was updated successfully, but these errors were encountered:
Problem
ipctool i2cdetect
is always skipping the last address in its output. So i2c address0xff
is not readable with it.The problem is similar to #113 (but in an other function).
ipctool/src/i2cspi.c
Line 203 in cc2849e
Solution
The solution is not as simple as #114 because the data type
unsigned char
used fori2caddr
is always a value between 0-255 (0x00 - 0xFF). And0xff + 1 = 0x00
.So changing the
<
to<=
will result in an infinite loop because the conditioni2c_addr <= 0xff
is always true when usingunsigned char
.So we have to check the condition at the end of the loop to get the desired output.
Final output:
The text was updated successfully, but these errors were encountered: