From: Chris Kelly Date: Mon, 20 Feb 2012 21:11:17 +0000 (+0000) Subject: staging: ozwpan: Added driver entry code X-Git-Tag: firefly_0821_release~3680^2~3347^2~146 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=62450bca861f206b09b44492b829b419222c4968;p=firefly-linux-kernel-4.4.55.git staging: ozwpan: Added driver entry code This series of patches adds the Ozmo USB over WiFi driver to the driver staging directory. This is a driver for a virtual USB HCD and uses an L2 network protocol to talk to the device. This patch adds the driver entry code and a README file with more details. Signed-off-by: Chris Kelly Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/ozwpan/README b/drivers/staging/ozwpan/README new file mode 100644 index 000000000000..bb1a69b94541 --- /dev/null +++ b/drivers/staging/ozwpan/README @@ -0,0 +1,25 @@ +OZWPAN USB Host Controller Driver +--------------------------------- +This driver is a USB HCD driver that does not have an associated a physical +device but instead uses Wi-Fi to communicate with the wireless peripheral. +The USB requests are converted into a layer 2 network protocol and transmitted +on the network using an ethertype (0x892e) regestered to Ozmo Device Inc. +This driver is compatible with existing wireless devices that use Ozmo Devices +technology. + +To operate the driver must be bound to a suitable network interface. This can +be done when the module is loaded (specifying the name of the network interface +as a paramter - e.g. 'insmod ozwpan g_net_dev=go0') or can be bound after +loading using an ioctl call. See the ozappif.h file and the ioctls +OZ_IOCTL_ADD_BINDING and OZ_IOCTL_REMOVE_BINDING. + +The devices connect to the host use Wi-Fi Direct so a network card that supports +Wi-Fi direct is required. A recent version (0.8.x or later) version of the +wpa_supplicant can be used to setup the network interface to create a persistent +autonomous group (for older pre-WFD peripherals) or put in a listen state to +allow group negotiation to occur for more recent devices that support WFD. + +The protocol used over the network does not directly mimic the USB bus +transactions as this would be rather busy and inefficient. Instead the chapter 9 +requests are converted into a request/response pair of messages. (See +ozprotocol.h for data structures used in the protocol). diff --git a/drivers/staging/ozwpan/ozconfig.h b/drivers/staging/ozwpan/ozconfig.h new file mode 100644 index 000000000000..a8c97265c5f6 --- /dev/null +++ b/drivers/staging/ozwpan/ozconfig.h @@ -0,0 +1,28 @@ +/* ----------------------------------------------------------------------------- + * Copyright (c) 2011 Ozmo Inc + * Released under the GNU General Public License Version 2 (GPLv2). + * ---------------------------------------------------------------------------*/ +#ifndef _OZCONFIG_H +#define _OZCONFIG_H + +/* #define WANT_DEBUG_KMALLOC */ +/* #define WANT_TRACE */ +#ifdef WANT_TRACE +#define WANT_VERBOSE_TRACE +#endif /* #ifdef WANT_TRACE */ +/* #define WANT_URB_PARANOIA */ + +/* #define WANT_PRE_2_6_39 */ +#define WANT_EVENT_TRACE + +/* These defines determine what verbose trace is displayed. */ +#ifdef WANT_VERBOSE_TRACE +/* #define WANT_TRACE_STREAM */ +/* #define WANT_TRACE_URB */ +/* #define WANT_TRACE_CTRL_DETAIL */ +#define WANT_TRACE_HUB +/* #define WANT_TRACE_RX_FRAMES */ +/* #define WANT_TRACE_TX_FRAMES */ +#endif /* WANT_VERBOSE_TRACE */ + +#endif /* _OZCONFIG_H */ diff --git a/drivers/staging/ozwpan/ozmain.c b/drivers/staging/ozwpan/ozmain.c new file mode 100644 index 000000000000..d34242b6e9e3 --- /dev/null +++ b/drivers/staging/ozwpan/ozmain.c @@ -0,0 +1,60 @@ +/* ----------------------------------------------------------------------------- + * Copyright (c) 2011 Ozmo Inc + * Released under the GNU General Public License Version 2 (GPLv2). + * ----------------------------------------------------------------------------- + */ +#include +#include +#include +#include +#include +#include +#include +#include "ozconfig.h" +#include "ozpd.h" +#include "ozproto.h" +#include "ozcdev.h" +#include "ozalloc.h" +#include "oztrace.h" +#include "ozevent.h" +/*------------------------------------------------------------------------------ + * The name of the 802.11 mac device. Empty string is the default value but a + * value can be supplied as a parameter to the module. An empty string means + * bind to nothing. '*' means bind to all netcards - this includes non-802.11 + * netcards. Bindings can be added later using an IOCTL. + */ +char *g_net_dev = ""; +/*------------------------------------------------------------------------------ + * Context: process + */ +static int __init ozwpan_init(void) +{ + oz_event_init(); + oz_cdev_register(); + oz_protocol_init(g_net_dev); + oz_app_enable(OZ_APPID_USB, 1); + oz_apps_init(); + return 0; +} +/*------------------------------------------------------------------------------ + * Context: process + */ +static void __exit ozwpan_exit(void) +{ + oz_protocol_term(); + oz_apps_term(); + oz_cdev_deregister(); + oz_trace_leaks(); + oz_event_term(); +} +/*------------------------------------------------------------------------------ + */ +module_param(g_net_dev, charp, S_IRUGO); +module_init(ozwpan_init); +module_exit(ozwpan_exit); + +MODULE_AUTHOR("Chris Kelly"); +MODULE_DESCRIPTION("Ozmo Devices USB over WiFi hcd driver"); +MODULE_VERSION("1.0.8"); +MODULE_LICENSE("GPL"); +