[PATCH] commands: i2c: Listen for CTRL-C when probing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 commands/i2c.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/commands/i2c.c b/commands/i2c.c
index ae7f7fc..573032a 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, &reg, 0);
 		if (ret == 0)
-- 
2.5.5


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux