Skip to content

More error codes for usbip request/reply messages

Shuah Khan linux-usb lkml 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3usbip: tools: add more error codes for usbip request/reply messagestools/usb/usbip/libsrc/usbip_common.c tools/usb/usbip/libsrc/usbip_common.h tools/usb/usbip/src/usbip_network.h+35 -30 replies
2/3usbip: usbip_host_common: Use new error codes to return request statustools/usb/usbip/libsrc/usbip_host_common.c+4 -10 replies
3/3usbip: tools: change to use new error codes in server reply messagestools/usb/usbip/src/usbip_attach.c tools/usb/usbip/src/usbip_list.c tools/usb/usbip/src/usbip_network.c +2 more+24 -190 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/3] More error codes for usbip request/reply messages

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(-)
Signature · 1 line
2.14.1