[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <bbfb8cad6b8d0d7715ff6316c6ca9ccc533c0ed5.1308547654.git.mfm@muteddisk.com>
Date: Sun, 19 Jun 2011 22:44:45 -0700
From: matt mooney <mfm@...eddisk.com>
To: Greg KH <greg@...ah.com>
Cc: linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH 15/22] staging: usbip: userspace: usbip list: move output header
Delay the printing of the output header until the list is received
from the remote host. This allows notification that the host does not
have any exportable devices.
Signed-off-by: matt mooney <mfm@...eddisk.com>
---
drivers/staging/usbip/userspace/src/usbip_list.c | 17 +++++++++++------
1 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/drivers/staging/usbip/userspace/src/usbip_list.c b/drivers/staging/usbip/userspace/src/usbip_list.c
index afff469..973bf8c 100644
--- a/drivers/staging/usbip/userspace/src/usbip_list.c
+++ b/drivers/staging/usbip/userspace/src/usbip_list.c
@@ -45,7 +45,7 @@ void usbip_list_usage(void)
printf("usage: %s", usbip_list_usage_string);
}
-static int get_exported_devices(int sockfd)
+static int get_exported_devices(char *host, int sockfd)
{
char product_name[100];
char class_name[100];
@@ -77,6 +77,15 @@ static int get_exported_devices(int sockfd)
PACK_OP_DEVLIST_REPLY(0, &reply);
dbg("exportable devices: %d\n", reply.ndev);
+ if (reply.ndev == 0) {
+ info("no exportable devices found on %s", host);
+ return 0;
+ }
+
+ printf("Exportable USB devices\n");
+ printf("======================\n");
+ printf(" - %s\n", host);
+
for (i = 0; i < reply.ndev; i++) {
memset(&udev, 0, sizeof(udev));
rc = usbip_recv(sockfd, &udev, sizeof(udev));
@@ -128,11 +137,7 @@ static int list_exported_devices(char *host)
}
dbg("connected to %s:%s", host, USBIP_PORT_STRING);
- printf("Exportable USB devices\n");
- printf("======================\n");
- printf(" - %s\n", host);
-
- rc = get_exported_devices(sockfd);
+ rc = get_exported_devices(host, sockfd);
if (rc < 0) {
err("failed to get device list from %s", host);
return -1;
--
1.7.5.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists