[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    [PATCH 2/3] i2cdetect: don't scan non-regular addresses without the '-a' option
From:       Bartosz Golaszewski <bartekgola () gmail ! com>
Date:       2015-05-25 10:40:02
Message-ID: 1432550403-2588-3-git-send-email-bartekgola () gmail ! com
[Download RAW message or body]

Addresses 0x00-0x02 shouldn't be scanned by default. This patch makes
'first' default to 0x03 and only enables lower addresses if '-a' option
is passed

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
---
 miscutils/i2c_tools.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/miscutils/i2c_tools.c b/miscutils/i2c_tools.c
index b05968b..29d0c81 100644
--- a/miscutils/i2c_tools.c
+++ b/miscutils/i2c_tools.c
@@ -1282,7 +1282,7 @@ int i2cdetect_main(int argc UNUSED_PARAM, char **argv)
 	const char *const optstr = "yaqrFl";
 
 	int fd, bus_num, i, j, mode = DETECT_MODE_AUTO, status;
-	unsigned first = 0x00, last = 0x77, opts;
+	unsigned first = 0x03, last = 0x77, opts;
 	unsigned long funcs;
 
 	opt_complementary = "q--r:r--q:" /* mutually exclusive */
@@ -1316,8 +1316,10 @@ int i2cdetect_main(int argc UNUSED_PARAM, char **argv)
 	else if (opts & opt_q)
 		mode = DETECT_MODE_QUICK;
 
-	if (opts & opt_a)
+	if (opts & opt_a) {
+		first = 0x00;
 		last = 0x7f;
+	}
 
 	/* Read address range. */
 	if (argv[1]) {
-- 
2.1.4

_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic