diff options
Diffstat (limited to 'drivers/staging/usbip/userspace/src/usbip_network.c')
-rw-r--r-- | drivers/staging/usbip/userspace/src/usbip_network.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/drivers/staging/usbip/userspace/src/usbip_network.c b/drivers/staging/usbip/userspace/src/usbip_network.c index b12448ec69ab..c39a07f1d38c 100644 --- a/drivers/staging/usbip/userspace/src/usbip_network.c +++ b/drivers/staging/usbip/userspace/src/usbip_network.c @@ -28,6 +28,36 @@ #include "usbip_common.h" #include "usbip_network.h" +int usbip_port = 3240; +char *usbip_port_string = "3240"; + +void usbip_setup_port_number(char *arg) +{ + dbg("parsing port arg '%s'", arg); + char *end; + unsigned long int port = strtoul(arg, &end, 10); + + if (end == arg) { + err("port: could not parse '%s' as a decimal integer", arg); + return; + } + + if (*end != '\0') { + err("port: garbage at end of '%s'", arg); + return; + } + + if (port > UINT16_MAX) { + err("port: %s too high (max=%d)", + arg, UINT16_MAX); + return; + } + + usbip_port = port; + usbip_port_string = arg; + info("using port %d (\"%s\")", usbip_port, usbip_port_string); +} + void usbip_net_pack_uint32_t(int pack, uint32_t *num) { uint32_t i; |