[PATCH v6 00/11] usbip: features to USB over WebSocket

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dear all,

This series of patches introduces WebSocket to USB/IP. 

0. Version info

v6)
# Added __rcu annotation to a RCU pointer to clear sparse warnings.
# Corrected a copy to RCU pointer with rcu_rcu_assign_pointer(). 
# Added __user annotations to arguments of read/write method. 
# Added static to some functions which are not called from other files.
# Removed unnecessary EXPORT_SYMBOLs.

v5)
# Added vendor/pruduct name conversion to port command.
# Put initial value to pool_head in name.c.
# Fixed list command exception when host option is omitted.
# Fixed exception in case gai_strerror() returns NULL.
# Fixed WebSocket connection close via proxy.
# Fixed to stop WebSocket ping-pong on connection close.
# Removed redundant usbipd daemon option.
# Removed redundant SSL code had not been deleted.
# Removed an unused local variable in WebSocket code.
# Modified C++ reserved word in names.c as same as headers.

v4)
# Fixed regression of usbip list --remote

v3)
# Coding style for goto err labels are fixed.
# Defined magic numbers for open_hc_device() argument.
# Corrected include .../uapi/linux/usbip_ux.h as <linux/usbip_ux.h>.
# Modified parameter notation in manuals not to use '='.
# Fixed inappropriate version definition in 
tools/.../websocket/configure.ac.
# Remved unnecessary COPYING and AUTHORS fil from tools/.../websocket/.
# Added -version-info to libraries in tools/.../src.

v2)
# Formatted patches from linux-next.
# Fixed change log word wrapping.
# Removed SSL patches.
# Fixed a bug that vendor and product names are not shown by 'usbws 
list -l' because usbip_names_init() was not called in libusbip.la.

1. Features included

It also includes some independent features effective in themselves.

1) Exporting devices

Export request and response PDU had been defined in a header but not 
been used.
Now it works!
   
Also, it supports senarios, for example, connect ubiquetous devices to 
a Linux based cloud service.
In this senario, it's needed to establish connection from a device 
inside of firewall to a service outside. Exporting is suit for the 
senario.

2) User space transmission

USB/IP transfer URBs in kernel space. It's better for performance but 
difficult to introduce application protocols.

Like fuse for file systems, it allows to transfer URBs in user space.

When usbip_ux.ko is loaded, it replaces kernel_sendmsg() and 
kernel_recvmsg() with user spcace interface. When USB/IP utilities find 
usbip_ux.ko, they start threads to read/write PDUs from/to usbip_ux.ko 
and send/recv them.

3) Replaceable protocols

Both transmission(send/receive) and connection establishment are 
replaceable.

4) a WebSocket implementation

It's made with Poco C++. DNS and proxy client are supported.

I published scripts I used while developed the patches.
http://linux-usbip-additions.blogspot.jp/2015/03/scripts-to-patch-and-ma
ke-locally.html
http://linux-usbip-additions.blogspot.jp/2015/03/test-scripts.html

2. Why WebSocket?

It allows to use USB/IP in internet. WebSocket is widely used to 
encapsulate packets in HTTP and to carry them through firewall using 
HTTP port numbers.

Assumed use case is a system that service in internet serves 
distributes devices in home or office networks. Service may be called 
as cloud and devices as ubiquitous.

   Home/SOHO/Intranet                Internet  
                         +--------+            +--------+
 +------+   +------+     |Router, |            |Internet|
+|device|---|Linux |-----|proxy,  |------------|service |
|+------+   +------+     |firewall|            |on Linux|
+------+   controller    +--------+            +--------+
ex)
Device                                      Service 
 sensors ................................... environment analysis 
 cameras ................................... monitoring, recording
 ID/biometric readers ...................... authentication

3. Why userspace transmission?

Userspace transmission and APIs provided by this series allow to apply 
application protocols to USB/IP.
 
Why not use usbfs or libusb?
a) Not only device(usbip-host) side, application(vhci-hcd) side must be 
handled.
b) In device side, if using usbfs or libusb, many parts of usbip-common 
and usbip-host driver must be copied to userspace. It's not good for 
maintainability. 

Tunneling daemons can wrap TCP/IP with application protocol. They pass 
packets through loopback so this series has certain advantage regarding 
performance. It's important for small (IoT) devices.

4. Why exporting devices?

Connection from outside firewall is usually blocked.
So existing import request sent with attach command doesn't work.

# usbipd                 (blocked)|| <--------- # usbip attach

Firewall opens some ports, usually HTTP(80) and HTTPS(443), from inside.
Then export request sent with new connect command works.

# usbip connect  -----------------------------> # usbipa
                         (passed)

Thank you,

Nobuo Iwata <nobuo.iwata@xxxxxxxxxxxxxxx>
//

*** BLURB HERE ***

Nobuo Iwata (11):
  usbip: exporting devices
  usbip: readme and manuals about exporting devices
  usbip: safe completion against usb_kill_urb()
  usbip: kernel module for userspace URBs transmission
  usbip: tools for userspace URBs transmission
  usbip: readme about user space URBs transmission
  usbip: letting send and receive replaceable
  usbip: letting connection establishment replaceable
  usbip: deriving functions as libraries
  usbip: added const qualifier to arguments of some functions
  usbip: USB over WebSocket

 drivers/usb/usbip/Kconfig                     |  10 +
 drivers/usb/usbip/Makefile                    |   3 +
 drivers/usb/usbip/stub_dev.c                  |  16 +-
 drivers/usb/usbip/stub_rx.c                   |   3 +-
 drivers/usb/usbip/stub_tx.c                   |   9 +-
 drivers/usb/usbip/usbip_common.c              |  79 ++-
 drivers/usb/usbip/usbip_common.h              |  29 +-
 drivers/usb/usbip/usbip_ux.c                  | 598 ++++++++++++++++++
 drivers/usb/usbip/usbip_ux.h                  |  82 +++
 drivers/usb/usbip/vhci_hcd.c                  |   9 +-
 drivers/usb/usbip/vhci_rx.c                   |   3 +-
 drivers/usb/usbip/vhci_sysfs.c                |  40 +-
 drivers/usb/usbip/vhci_tx.c                   |   6 +-
 include/uapi/linux/usbip_ux.h                 |  39 ++
 tools/usb/usbip/Makefile.am                   |   2 +-
 tools/usb/usbip/README                        |  92 ++-
 tools/usb/usbip/doc/usbip.8                   |  82 ++-
 tools/usb/usbip/doc/usbipa.8                  |  77 +++
 tools/usb/usbip/doc/usbipd.8                  |  29 +-
 tools/usb/usbip/libsrc/Makefile.am            |  11 +-
 tools/usb/usbip/libsrc/list.h                 |  24 +-
 tools/usb/usbip/libsrc/names.c                |  19 +-
 tools/usb/usbip/libsrc/usbip_common.c         |  38 +-
 tools/usb/usbip/libsrc/usbip_common.h         |  27 +-
 tools/usb/usbip/libsrc/usbip_host_driver.c    |  24 +-
 tools/usb/usbip/libsrc/usbip_host_driver.h    |   1 +
 tools/usb/usbip/libsrc/usbip_ux.c             | 256 ++++++++
 tools/usb/usbip/libsrc/usbip_ux.h             |  30 +
 tools/usb/usbip/libsrc/vhci_driver.c          | 144 ++++-
 tools/usb/usbip/libsrc/vhci_driver.h          |  10 +-
 tools/usb/usbip/src/Makefile.am               |  31 +-
 tools/usb/usbip/src/usbip.c                   |  18 +-
 tools/usb/usbip/src/usbip.h                   |  20 +-
 tools/usb/usbip/src/usbip_attach.c            | 111 ++--
 tools/usb/usbip/src/usbip_bind.c              |  17 +-
 tools/usb/usbip/src/usbip_connect.c           | 236 +++++++
 tools/usb/usbip/src/usbip_detach.c            |  28 +-
 tools/usb/usbip/src/usbip_disconnect.c        | 212 +++++++
 tools/usb/usbip/src/usbip_list.c              | 102 +--
 tools/usb/usbip/src/usbip_netconn.c           |  98 +++
 tools/usb/usbip/src/usbip_network.c           | 104 ++-
 tools/usb/usbip/src/usbip_network.h           |  16 +-
 tools/usb/usbip/src/usbip_port.c              |  30 +-
 tools/usb/usbip/src/usbip_unbind.c            |  13 +-
 tools/usb/usbip/src/usbipd.c                  | 241 +------
 tools/usb/usbip/src/usbipd.h                  |  38 ++
 tools/usb/usbip/src/usbipd_app.c              | 256 ++++++++
 tools/usb/usbip/src/usbipd_dev.c              | 266 ++++++++
 tools/usb/usbip/src/utils.c                   |   2 +-
 tools/usb/usbip/src/utils.h                   |   2 +-
 tools/usb/usbip/websocket/INSTALL             | 237 +++++++
 tools/usb/usbip/websocket/Makefile.am         |   3 +
 tools/usb/usbip/websocket/README              | 184 ++++++
 tools/usb/usbip/websocket/autogen.sh          |   9 +
 tools/usb/usbip/websocket/cleanup.sh          |  12 +
 tools/usb/usbip/websocket/configure.ac        |  55 ++
 tools/usb/usbip/websocket/doc/usbws.8         | 192 ++++++
 tools/usb/usbip/websocket/doc/usbwsa.8        | 101 +++
 tools/usb/usbip/websocket/doc/usbwsd.8        | 109 ++++
 tools/usb/usbip/websocket/poco/Makefile.am    |  18 +
 .../usb/usbip/websocket/poco/USBWSCommand.cpp | 410 ++++++++++++
 tools/usb/usbip/websocket/poco/USBWSCommand.h |  99 +++
 .../usb/usbip/websocket/poco/USBWSDaemon.cpp  | 228 +++++++
 tools/usb/usbip/websocket/poco/USBWSDaemon.h  |  80 +++
 .../websocket/poco/USBWSRequestHandler.cpp    |  90 +++
 .../websocket/poco/USBWSRequestHandler.h      |  49 ++
 .../poco/USBWSRequestHandlerFactory.cpp       |  49 ++
 .../poco/USBWSRequestHandlerFactory.h         |  48 ++
 tools/usb/usbip/websocket/poco/USBWSUtil.h    |  52 ++
 .../usbip/websocket/poco/USBWSWebSocket.cpp   | 204 ++++++
 .../usb/usbip/websocket/poco/USBWSWebSocket.h |  69 ++
 71 files changed, 5337 insertions(+), 594 deletions(-)
 create mode 100644 drivers/usb/usbip/usbip_ux.c
 create mode 100644 drivers/usb/usbip/usbip_ux.h
 create mode 100644 include/uapi/linux/usbip_ux.h
 create mode 100644 tools/usb/usbip/doc/usbipa.8
 create mode 100644 tools/usb/usbip/libsrc/usbip_ux.c
 create mode 100644 tools/usb/usbip/libsrc/usbip_ux.h
 create mode 100644 tools/usb/usbip/src/usbip_connect.c
 create mode 100644 tools/usb/usbip/src/usbip_disconnect.c
 create mode 100644 tools/usb/usbip/src/usbip_netconn.c
 create mode 100644 tools/usb/usbip/src/usbipd.h
 create mode 100644 tools/usb/usbip/src/usbipd_app.c
 create mode 100644 tools/usb/usbip/src/usbipd_dev.c
 create mode 100644 tools/usb/usbip/websocket/INSTALL
 create mode 100644 tools/usb/usbip/websocket/Makefile.am
 create mode 100644 tools/usb/usbip/websocket/README
 create mode 100755 tools/usb/usbip/websocket/autogen.sh
 create mode 100755 tools/usb/usbip/websocket/cleanup.sh
 create mode 100644 tools/usb/usbip/websocket/configure.ac
 create mode 100644 tools/usb/usbip/websocket/doc/usbws.8
 create mode 100644 tools/usb/usbip/websocket/doc/usbwsa.8
 create mode 100644 tools/usb/usbip/websocket/doc/usbwsd.8
 create mode 100644 tools/usb/usbip/websocket/poco/Makefile.am
 create mode 100644 tools/usb/usbip/websocket/poco/USBWSCommand.cpp
 create mode 100644 tools/usb/usbip/websocket/poco/USBWSCommand.h
 create mode 100644 tools/usb/usbip/websocket/poco/USBWSDaemon.cpp
 create mode 100644 tools/usb/usbip/websocket/poco/USBWSDaemon.h
 create mode 100644 
tools/usb/usbip/websocket/poco/USBWSRequestHandler.cpp
 create mode 100644 tools/usb/usbip/websocket/poco/USBWSRequestHandler.h
 create mode 100644 
tools/usb/usbip/websocket/poco/USBWSRequestHandlerFactory.cpp
 create mode 100644 
tools/usb/usbip/websocket/poco/USBWSRequestHandlerFactory.h
 create mode 100644 tools/usb/usbip/websocket/poco/USBWSUtil.h
 create mode 100644 tools/usb/usbip/websocket/poco/USBWSWebSocket.cpp
 create mode 100644 tools/usb/usbip/websocket/poco/USBWSWebSocket.h

-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux