A C++ class that uses libusb to interface with CP2130 devices. It can be used to configure the OTP ROM of such devices, as well as to control them. The class was made for Qt. If you wish to use a derived non-Qt version, please refer to https://github.com/bloguetronica/cp2130.
0
stars
0
forks
source link
Line 393 of "cp2130.cpp" contains a mild incorrection #27
This is incorrect in its form, because both the mask to be shifted and the int of comparison should represent 16bit numbers. This is a mild incorrection, because all values will be promoted to int, nevertheless. However, the previous line should be rewritten as follows:
To sumarize, line 393 contains the following:
cs = (0x01 << channel & (controlBufferIn[0] << 8 | controlBufferIn[1])) != 0x00;
This is incorrect in its form, because both the mask to be shifted and the int of comparison should represent 16bit numbers. This is a mild incorrection, because all values will be promoted to int, nevertheless. However, the previous line should be rewritten as follows:
cs = (0x0001 << channel & (controlBufferIn[0] << 8 | controlBufferIn[1])) != 0x0000;
This conveys the intention much more clearly, despite the fact that it results in the same code.