summaryrefslogtreecommitdiffstats
path: root/sys/netgraph/bluetooth/drivers
diff options
context:
space:
mode:
authorjulian <julian@FreeBSD.org>2002-11-26 18:30:45 +0000
committerjulian <julian@FreeBSD.org>2002-11-26 18:30:45 +0000
commit5ede7f46cea1bd8c183305d72b43018d41c1aa48 (patch)
treea1b7e246f768aa11ebc52f1311158f4bf68c94f5 /sys/netgraph/bluetooth/drivers
parentfa7971ab704ca66bdedfd46fc3848768b13fc91e (diff)
downloadFreeBSD-src-5ede7f46cea1bd8c183305d72b43018d41c1aa48.zip
FreeBSD-src-5ede7f46cea1bd8c183305d72b43018d41c1aa48.tar.gz
fixes for this driver:
1) "ubt" driver did not work when system is booted with the device attached 2) missing "break;" in ubt_rcvmsg() function; Submitted by: Maksim Yevmenkin <Maksim.Yevmenkin@cw.com> Approved by: re (jhb)
Diffstat (limited to 'sys/netgraph/bluetooth/drivers')
-rw-r--r--sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c40
1 files changed, 38 insertions, 2 deletions
diff --git a/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c b/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c
index 982b939..00bd663 100644
--- a/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c
+++ b/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c
@@ -62,6 +62,8 @@
USB_DECLARE_DRIVER(ubt);
+Static int ubt_modevent (module_t, int, void *);
+
Static usbd_status ubt_request_start (ubt_softc_p, struct mbuf *);
Static void ubt_request_complete (usbd_xfer_handle,
usbd_private_handle, usbd_status);
@@ -191,14 +193,14 @@ Static struct ng_type typestruct = {
ng_ubt_disconnect, /* disconnect hook */
ng_ubt_cmdlist /* node command list */
};
-NETGRAPH_INIT(ubt, &typestruct);
/*
* Module
*/
-DRIVER_MODULE(ubt, uhub, ubt_driver, ubt_devclass, usbd_driver_load, 0);
+DRIVER_MODULE(ubt, uhub, ubt_driver, ubt_devclass, ubt_modevent, 0);
MODULE_VERSION(ng_ubt, NG_BLUETOOTH_VERSION);
+MODULE_DEPEND(ng_ubt, netgraph, NG_ABI_VERSION, NG_ABI_VERSION, NG_ABI_VERSION);
/****************************************************************************
****************************************************************************
@@ -207,6 +209,39 @@ MODULE_VERSION(ng_ubt, NG_BLUETOOTH_VERSION);
****************************************************************************/
/*
+ * Load/Unload the driver module
+ */
+
+Static int
+ubt_modevent(module_t mod, int event, void *data)
+{
+ int error;
+
+ switch (event) {
+ case MOD_LOAD:
+ error = ng_newtype(&typestruct);
+ if (error != 0)
+ printf("%s: Could not register Netgraph node type, " \
+ "error=%d\n", NG_UBT_NODE_TYPE, error);
+ else
+ error = usbd_driver_load(mod, event, data);
+ break;
+
+ case MOD_UNLOAD:
+ error = ng_rmtype(&typestruct);
+ if (error == 0)
+ error = usbd_driver_load(mod, event, data);
+ break;
+
+ default:
+ error = EOPNOTSUPP;
+ break;
+ }
+
+ return (error);
+} /* ubt_modevent */
+
+/*
* Probe for a USB Bluetooth device
*/
@@ -2039,6 +2074,7 @@ ng_ubt_rcvmsg(node_p node, item_p item, hook_p lasthook)
error = EINVAL;
break;
}
+ break;
default:
error = EINVAL;
OpenPOWER on IntegriCloud