Re: [PATCH] i2c-tools: i2ctransfer: Set I2C adapter timeout using I2C_TIMEOUT ioctl

Wolfram Sang <[email protected]> Tue, 21 Jul 2026 00:10:33 +0200
Newsgroups org.kernel.vger.linux-i2c
Message-ID <al6c2VXwLFcNRLu7@shikoro>
Hi,

thank you for this patch!

On Mon, Jul 20, 2026 at 10:04:01PM +0530, Vasantha Likitha T wrote:
> Add a -t TIMEOUT option that calls ioctl(I2C_TIMEOUT) before the
> I2C_RDWR transfer. This allows the adapter timeout to be set from
> user space at runtime, controlling how long the I2C core waits for
> a transfer to complete before returning an error. Drivers that rely
> on the adapter timeout will use the value set by this ioctl.
> 
> The timeout value is specified in units of 10 ms, as this is the unit
> the Linux kernel expects for the I2C_TIMEOUT ioctl: i2c-dev converts it
> with adapter->timeout = msecs_to_jiffies(arg * 10). Omitting -t leaves
> the driver default unchanged.

I agree that reading/setting TIMEOUT is missing in i2c-tools (same with
RETRIES) and it would be nice to have.

I don't think 'i2ctransfer' is the right place for it, though. One might
also want a different timeout with 'i2cget' or so.

My suggestion is to add it to 'i2cdetect'. It already has '-F' to list
the features of an adapter. We could add '-T' to read the timeout value
and '-R' to read the retries value. If '-T' or '-R' parameters also
contain a value, then this value will be written to the adapter.

Was this undestandable? Do you agree?

Another option would be to write a dedicated tool ('i2cconfig'?) for
handling extra parameters, but it feels a bit bloated IMHO.

Opinions?

All the best,

   Wolfram
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEEOZGx6rniZ1Gk92RdFA3kzBSgKbYFAmpenNUACgkQFA3kzBSg
Kbaz7g/+JIzyaJLN0wFcHMOYPESF2okHFt3emdsi0zA4p20CyzqaMtaB5L3M3kvf
ZPTmPjh5VhE3bXwNqYn9gEpgB075HF9hHwH61+zpUbeoRE/7JQpOQ+5eYqREjWe+
40fRyILCGNyxAKeeVWWMtsOPEazjGAsUkVwaFsAE3PgATarigSlk4hnoehdPJPxx
5vfXrUn6BR4P/gUOA7z2+6edSmE7a8Pzgmr01TpAw9h/lVlTbDnxD/COYzfsc6z9
OaXBqde1PauutY+3lXC/ElzOKbb9HpKKCpwuv1EobexJ4jCbU0nig5Kv470zay+4
oR5RPdu4z7bKOjU5X48WeRvz+lvErYY7Ks/EBOJOX+ScgHNyRSCMgaZ4uduJi66y
37it0ld/rjj8lSJe97oOD4B6hIEO4IbBNADTr8QS4rhFCjgr+AXpLetU/b7Ty9b9
yRo1IsRYx2ygBV8X7KEor3pRQ/PGH6NfBjipabbrXQFR45tXH0mn9dkAvMqTLADY
fq1uGE4SbnJ1iEDn005gq65Ys8mcXjNzpEikotXiYz5U/J15PPgFFSRBSHCvlo2I
PGTImYiJD7w5tDJBIDf+d/yxUM4rpwj6eJAG4FHloy3RsL64mfOhWAcf/9+3wW3/
qFxQW8B9zhFcdlU7DJBXLzSzkaoG0CEKD2162YYlxJ/X+lhA1Bs=
=yMQ0
-----END PGP SIGNATURE-----