summaryrefslogtreecommitdiffstats
path: root/tools/usb/usbip/src/usbip_list.c
diff options
context:
space:
mode:
authorShuah Khan <shuahkh@osg.samsung.com>2018-03-07 13:42:26 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-03-09 09:17:09 -0800
commitad81b15d561692df1ce2a57dce391d39633209b1 (patch)
tree34801798ed490afb0b040cc1334ccc171fa5ea7f /tools/usb/usbip/src/usbip_list.c
parentc207a10d2f0bddf691920c0d73b7e8a83e6e2fb6 (diff)
downloadlinux-stable-ad81b15d561692df1ce2a57dce391d39633209b1.tar.gz
linux-stable-ad81b15d561692df1ce2a57dce391d39633209b1.tar.bz2
linux-stable-ad81b15d561692df1ce2a57dce391d39633209b1.zip
usbip: tools: change to use new error codes in server reply messages
Changed usbip_network, usbip_attach, usbip_list, and usbipd to use and propagate the new error codes in server reply messages. usbip_net_recv_op_common() is changed to take a pointer to status return the status returned in the op_common.status to callers. usbip_attach and usbip_list use the common interface to print error messages to indicate why the request failed. With this change the messages say why a request failed: - when a client requests a device that is already exported: usbip attach -r server_name -b 3-10.2 usbip: error: Attach Request for 3-10.2 failed - Device busy (exported) - when a client requests a device that isn't exportable, usbip attach -r server_name -b 3-10.4 usbip: error: Attach Request for 3-10.4 failed - Device not found Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'tools/usb/usbip/src/usbip_list.c')
-rw-r--r--tools/usb/usbip/src/usbip_list.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/tools/usb/usbip/src/usbip_list.c b/tools/usb/usbip/src/usbip_list.c
index d65a9f444174..8d4ccf4b9480 100644
--- a/tools/usb/usbip/src/usbip_list.c
+++ b/tools/usb/usbip/src/usbip_list.c
@@ -62,6 +62,7 @@ static int get_exported_devices(char *host, int sockfd)
struct usbip_usb_interface uintf;
unsigned int i;
int rc, j;
+ int status;
rc = usbip_net_send_op_common(sockfd, OP_REQ_DEVLIST, 0);
if (rc < 0) {
@@ -69,9 +70,10 @@ static int get_exported_devices(char *host, int sockfd)
return -1;
}
- rc = usbip_net_recv_op_common(sockfd, &code);
+ rc = usbip_net_recv_op_common(sockfd, &code, &status);
if (rc < 0) {
- dbg("usbip_net_recv_op_common failed");
+ err("Exported Device List Request failed - %s\n",
+ usbip_op_common_status_string(status));
return -1;
}