Browse Source

i2ctransfer: '-f' shouldn't allow all addresses, '-a' does that

We now have the flag '-a' for all i2c-tools to allow access for all
addresses. This was tied in i2ctransfer to the '-f' flag. Remove it and
keep that feature to '-a' only. This is also more in sync with the other
i2c-tools which use '-f' only to access already busy devices.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Reviewed-by: Peter Rosin <peda@axentia.se>
tags/v4.1
Wolfram Sang 7 years ago
parent
commit
4d64ab27dc
  1. 2
      tools/i2ctransfer.8
  2. 23
      tools/i2ctransfer.c

2
tools/i2ctransfer.8

@ -41,7 +41,7 @@ This program helps you to create proper transfers for your needs.
Force access to the device even if it is already busy.
By default,
.B i2ctransfer
will refuse to access addresses marked as reserved by the I2C standard or to a device which is already under the control of a kernel driver.
will refuse to access a device which is already under the control of a kernel driver.
Using this flag is dangerous, it can seriously confuse the kernel driver in question.
It can also cause
.B i2ctransfer

23
tools/i2ctransfer.c

@ -210,22 +210,13 @@ int main(int argc, char *argv[])
* the address here.
*/
if (!force) {
address = parse_i2c_address(arg_ptr, all_addrs);
if (address < 0)
goto err_out_with_arg;
/* Ensure address is not busy */
if (set_slave_addr(file, address, 0))
goto err_out_with_arg;
} else {
/* 'force' allows whole address range */
address = strtol(arg_ptr, &end, 0);
if (arg_ptr == end || *end || address > 0x7f) {
fprintf(stderr, "Error: Invalid chip address\n");
goto err_out_with_arg;
}
}
address = parse_i2c_address(arg_ptr, all_addrs);
if (address < 0)
goto err_out_with_arg;
/* Ensure address is not busy */
if (!force && set_slave_addr(file, address, 0))
goto err_out_with_arg;
} else {
/* Reuse last address if possible */
if (address < 0) {

Loading…
Cancel
Save