summaryrefslogtreecommitdiff
path: root/miscutils
diff options
context:
space:
mode:
authorBartosz Golaszewski2015-05-11 17:22:10 +0200
committerDenys Vlasenko2015-05-11 17:24:03 +0200
commitb2cca32a37b969cce3b3bce693708759d44d3d15 (patch)
treeb926da73222c047b4f7119c70f730518d5701a84 /miscutils
parent17b16223f39c983a5d0eba8d3ab656a8d123b621 (diff)
downloadbusybox-b2cca32a37b969cce3b3bce693708759d44d3d15.zip
busybox-b2cca32a37b969cce3b3bce693708759d44d3d15.tar.gz
i2c-tools: fix 'i2cdetect -l'
Calling 'i2cdetect -l' only displays usage and exits. Fix it by correctly parsing command-line arguments. Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'miscutils')
-rw-r--r--miscutils/i2c_tools.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/miscutils/i2c_tools.c b/miscutils/i2c_tools.c
index 03bb039..2805cf3 100644
--- a/miscutils/i2c_tools.c
+++ b/miscutils/i2c_tools.c
@@ -1284,13 +1284,16 @@ int i2cdetect_main(int argc UNUSED_PARAM, char **argv)
unsigned opts;
opt_complementary = "q--r:r--q:" /* mutually exclusive */
- "-1:?3"; /* from 1 to 3 args */
+ "?3"; /* up to 3 args */
opts = getopt32(argv, optstr);
argv += optind;
if (opts & opt_l)
list_i2c_busses_and_exit();
+ if (!argv[0])
+ bb_show_usage();
+
bus_num = i2c_bus_lookup(argv[0]);
fd = i2c_dev_open(bus_num);
get_funcs_matrix(fd, &funcs);