[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    [PATCH] Extend I2C tools to read unlimited lengths
From:       Olliver Schinagl <oliver+busybox () schinagl ! nl>
Date:       2023-05-12 8:35:22
Message-ID: 20230512083525.3164148-1-oliver+busybox () schinagl ! nl
[Download RAW message or body]

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@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic