kplindegaard / smbus2

A drop-in replacement for smbus-cffi/smbus-python in pure Python
MIT License
243 stars 68 forks source link

Witting message with length > 32 to trigger device functionality #63

Closed mefistotelis closed 3 years ago

mefistotelis commented 3 years ago

Here is a link do an image taken from spec of a device which uses SMBus communication (BQ series chip from TI). https://github.com/o-gs/dji-firmware-tools/issues/17#issuecomment-766040778

Note that the use of specific function of the device (read firmware version) requires to write block_data with size=62. (actual data is never sent, as the device responds with NACK on the size) Currently, the smbus2 implementation will prevent sending such packet, making it impossible to use this functionality of the BQ series chips.

The restriction should be lifted, or another lower level API should be prepared.

mefistotelis commented 3 years ago

Wait, isn't that pull request exactly what is needed to solve this problem?

https://github.com/kplindegaard/smbus2/pull/23

EDIT: Tested - yes, that's exactly what was needed. And the implementation from that PR works properly.

kplindegaard commented 3 years ago

Already supported. 32 byte max buffer length only apply to the SMBus operations and not pure i2c. Please see the I2C section of the readme.

The read and write methods introduced in that PR are just for convenience, and as per my comment to that PR it's still unfinished business associated with and not going in as it stands.

mefistotelis commented 3 years ago

You are right. I should have read the readme. (though these convenience functions from PR are very convenient)

Thank you!