]> Repositories - Adafruit_Blinka-hackapet.git/commit
mcp2221: allow empty i2c payload
authorFrancois Gervais <francoisgervais@gmail.com>
Sun, 15 Aug 2021 02:49:37 +0000 (22:49 -0400)
committerFrancois Gervais <francoisgervais@gmail.com>
Sun, 15 Aug 2021 02:49:37 +0000 (22:49 -0400)
commitd3636d7313d5a05b6f321ad09d53f92d3d47fee0
treeb5d1ba4a72988016370d954ee2529a6edc3448b5
parent4f4e6af0a2c2912d7662f0160849806507b125bd
mcp2221: allow empty i2c payload

This fix allow sending I2C transactions with an empty payload.

Before this change, sending an empty payload is bogus as it won't transfer
anything but will still try to get the status of the transaction. It will
basically get the current status of the bus.

One way to manifest this problem is when connecting to a device.

On I2CDevice() init, it will probe the device by sending en empty payload
message. This actually works fine if the bus is in a good state like on
first use. It won't actually send the probe out but we will read the
good initial state and things will go smoothly from here.

However if we start by initializing a device with an address at which
there is no device, it won't send the empty payload probe but will fail
later on as there is no device at that address.

At this point the bus is basically in DoS as trying to init a device
will again not send the empty payload but now since the bus is in the
error state it will fail even if the device is in fact present.
src/adafruit_blinka/microcontroller/mcp2221/mcp2221.py