lkml.org 
[lkml]   [2018]   [Mar]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Subject[PATCH 0/3] More error codes for usbip request/reply messages
Date
Currently ST_OK and ST_NA are the only values defined to communicate
status of a request from a client. Client doesn't know what failed
and prints a cryptic error message that something failed.

This patch series adds more error codes to clearly indicate what failed.
For example, when client sends request to import a device that isn't
export-able, server can send a specific error code to the client.

The first patch moves existing error codes to a common library header
and adds more codes. It also adds an interface to map the code to a
string to print messages from tools.

The second patch changes the server/host to return the right codes
in reply messages when client request fails.

The third patch changes the clinet tools to recognize the new error
codes and print messages.

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

Shuah Khan (3):
usbip: tools: add more error codes for usbip request/reply messages
usbip: usbip_host_common: Use new error codes to return request status
usbip: tools: change to use new error codes in server reply messages

tools/usb/usbip/libsrc/usbip_common.c | 23 +++++++++++++++++++++++
tools/usb/usbip/libsrc/usbip_common.h | 11 +++++++++++
tools/usb/usbip/libsrc/usbip_host_common.c | 5 ++++-
tools/usb/usbip/src/usbip_attach.c | 11 +++++------
tools/usb/usbip/src/usbip_list.c | 6 ++++--
tools/usb/usbip/src/usbip_network.c | 6 +++++-
tools/usb/usbip/src/usbip_network.h | 6 ++----
tools/usb/usbip/src/usbipd.c | 18 +++++++++---------
8 files changed, 63 insertions(+), 23 deletions(-)

--
2.14.1

\
 
 \ /
  Last update: 2018-03-07 21:43    [W:0.025 / U:34.448 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site