Re: [PATCH v2] i2c-tools: i2cdetect: Set I2C adapter timeout and retries using ioctl

From: Wolfram Sang

Date: Sun Nov 15 2026 - 17:41:25 EST


Hi Vasantha,

> Changes in v2:
> - Move the change from i2ctransfer to i2cdetect and add -T and -R options,
> as suggested in review.

Better, but still not quite there yet, I would think...

> ---
> tools/i2cdetect.c | 41 ++++++++++++++++++++++++++++++++++++++---
> 1 file changed, 38 insertions(+), 3 deletions(-)
>
> diff --git a/tools/i2cdetect.c b/tools/i2cdetect.c
> index 3c22f17..8b08e55 100644
> --- a/tools/i2cdetect.c
> +++ b/tools/i2cdetect.c
> @@ -35,11 +35,14 @@
> static void help(void)
> {
> fprintf(stderr,
> - "Usage: i2cdetect [-y] [-a] [-q|-r] I2CBUS [FIRST LAST]\n"
> + "Usage: i2cdetect [-y] [-a] [-q|-r] [-T TIMEOUT] [-R RETRIES]\n"
> + " I2CBUS [FIRST LAST]\n"

Putting it there to a "regular" detect means that you cannot set timeout
or retries without scanning a bus. I think we probably want to drop it
here and do something like

> " i2cdetect -F I2CBUS\n"
+ " i2cdetect -T TIMEOUT | -R RETRIES I2CBUS\n"

which allows settings these values and do nothing else.

What do you think?

Happy hacking,

Wolfram

Attachment: signature.asc
Description: PGP signature