[PATCH] Extend I2C tools to read unlimited lengths

Olliver Schinagl oliver+busybox at schinagl.nl
Fri Jul 7 09:17:38 UTC 2023


Gentle ping :)

On 12-05-2023 10:35, Olliver Schinagl wrote:
> The I2C tools suggest they can do block read/writes using either
> 's'(mbus) or 'i'(2c) access. However the current code limits reads
> specifically to a single block, which depending on the driver, may limit
> this to even less bytes. Looking closer, we actually see that the commands
> to read via either access is really the same, where the only difference
> is, that SMBus access can at most read 32 bytes (but can read less) but
> cannot be told to read less, and I2C access can read up to 1 byte
> granularity. Everything else works the same, and thus the loop to read
> multiple bytes works for both cases equally well. This change thus also
> reduces the code a tiny bit, but makes it more readable at the least.
>
> Further more, while here, a little bit of cleanup. One cosmetic and one
> where instead of always returning -1 (which is horrible to debug when
> your console just tells you this) instead returns errno that ioctl had
> already set for us anyway.
>
>
> _______________________________________________
> busybox mailing list
> busybox at busybox.net
> http://lists.busybox.net/mailman/listinfo/busybox




More information about the busybox mailing list