mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH] detect command: Add -a option to detect all devices
Date: Thu, 20 Jun 2013 16:06:05 +0200	[thread overview]
Message-ID: <1371737165-1313-1-git-send-email-s.hauer@pengutronix.de> (raw)

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 commands/detect.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/commands/detect.c b/commands/detect.c
index 0010a17..fbce4eb 100644
--- a/commands/detect.c
+++ b/commands/detect.c
@@ -28,8 +28,9 @@ static int do_detect(int argc, char *argv[])
 	int opt, i, ret;
 	int option_list = 0;
 	int option_error = 0;
+	int option_all = 0;
 
-	while ((opt = getopt(argc, argv, "el")) > 0) {
+	while ((opt = getopt(argc, argv, "ela")) > 0) {
 		switch (opt) {
 		case 'l':
 			option_list = 1;
@@ -37,6 +38,11 @@ static int do_detect(int argc, char *argv[])
 		case 'e':
 			option_error = 1;
 			break;
+		case 'a':
+			option_all = 1;
+			break;
+		default:
+			return COMMAND_ERROR_USAGE;
 		}
 	}
 
@@ -48,6 +54,15 @@ static int do_detect(int argc, char *argv[])
 		return 0;
 	}
 
+	if (option_all) {
+		for_each_device(dev) {
+			ret = device_detect(dev);
+			if (ret && ret != -ENOSYS && option_error)
+				return ret;
+		}
+		return 0;
+	}
+
 	if (argc == optind)
 		return COMMAND_ERROR_USAGE;
 
-- 
1.8.3.1


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

                 reply	other threads:[~2013-06-20 14:06 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1371737165-1313-1-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox