diff options
author | Romain Porte <romain.porte@nokia.com> | 2018-03-02 11:17:05 +0100 |
---|---|---|
committer | Wolfram Sang <wsa@the-dreams.de> | 2018-03-24 15:04:09 +0100 |
commit | 702804251c366bd4e4af8036984c7bde6bd268a8 (patch) | |
tree | ef4874e5b5b9e98f633c631b42210dd88e87a5b3 /tools/i2cdump.c | |
parent | e1fcba6924a9a1b0a00829cdc5525391f278b51b (diff) | |
download | i2c-tools-git-702804251c366bd4e4af8036984c7bde6bd268a8.tar.gz |
tools: add all_addrs option for i2c tools
If the user is sure that the reserved 0x00 - 0x02 and 0x77 - 0x7f ranges
are not needed by its devices, then the "-a" option can be passed for
allowing all theorical addresses to be used. It is then possible to
access devices in this address range.
Signed-off-by: Romain Porte <romain.porte@nokia.com>
Reviewed-by: Peter Rosin <peda@axentia.se>
[wsa: imonr fixes to commit message]
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Diffstat (limited to 'tools/i2cdump.c')
-rw-r--r-- | tools/i2cdump.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/tools/i2cdump.c b/tools/i2cdump.c index a7bba72..3bd2077 100644 --- a/tools/i2cdump.c +++ b/tools/i2cdump.c @@ -36,9 +36,9 @@ static void help(void) { fprintf(stderr, - "Usage: i2cdump [-f] [-y] [-r first-last] I2CBUS ADDRESS [MODE [BANK [BANKREG]]]\n" + "Usage: i2cdump [-f] [-y] [-r first-last] [-a] I2CBUS ADDRESS [MODE [BANK [BANKREG]]]\n" " I2CBUS is an integer or an I2C bus name\n" - " ADDRESS is an integer (0x03 - 0x77)\n" + " ADDRESS is an integer (0x03 - 0x77, or 0x00 - 0x7f if -a is given)\n" " MODE is one of:\n" " b (byte, default)\n" " w (word)\n" @@ -119,7 +119,7 @@ int main(int argc, char *argv[]) int block[256], s_length = 0; int pec = 0, even = 0; int flags = 0; - int force = 0, yes = 0, version = 0; + int force = 0, yes = 0, version = 0, all_addrs = 0; const char *range = NULL; int first = 0x00, last = 0xff; @@ -130,6 +130,7 @@ int main(int argc, char *argv[]) case 'f': force = 1; break; case 'r': range = argv[1+(++flags)]; break; case 'y': yes = 1; break; + case 'a': all_addrs = 1; break; default: fprintf(stderr, "Error: Unsupported option " "\"%s\"!\n", argv[1+flags]); @@ -160,7 +161,7 @@ int main(int argc, char *argv[]) help(); exit(1); } - address = parse_i2c_address(argv[flags+2]); + address = parse_i2c_address(argv[flags+2], all_addrs); if (address < 0) { help(); exit(1); |