diff options
author | Andrey Smirnov <andrew.smirnov@gmail.com> | 2016-11-15 06:46:27 -0800 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2017-01-10 08:27:33 +0100 |
commit | 883fa873979d6757effc474ca1de6cf0c8f2a79f (patch) | |
tree | c45f24253021a6225f2d5d2369bd272d307a2bfa /commands/i2c.c | |
parent | c97fc31b8d7eda8754f299bfcb30db9d0d299365 (diff) | |
download | barebox-883fa873979d6757effc474ca1de6cf0c8f2a79f.tar.gz barebox-883fa873979d6757effc474ca1de6cf0c8f2a79f.tar.xz |
commands: i2c: Listen for CTRL-C when probing
Allow I2C bus probing to be interrupted early by sending CTRL-C. This is
usefull when calling the tool without any arguments and one of the busses
is misconfigured (waiting for 100+ failures is pretty inconvenient).
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'commands/i2c.c')
-rw-r--r-- | commands/i2c.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/commands/i2c.c b/commands/i2c.c index ae7f7fc6d0..573032ab15 100644 --- a/commands/i2c.c +++ b/commands/i2c.c @@ -32,7 +32,7 @@ static void i2c_probe_range(struct i2c_adapter *adapter, int startaddr, int stop client.adapter = adapter; printf("probing i2c%d range 0x%02x-0x%02x: ", adapter->nr, startaddr, stopaddr); - for (addr = startaddr; addr <= stopaddr; addr++) { + for (addr = startaddr; addr <= stopaddr && !ctrlc(); addr++) { client.addr = addr; ret = i2c_write_reg(&client, 0x00, ®, 0); if (ret == 0) |