aboutsummaryrefslogtreecommitdiff
path: root/sys/netgraph
diff options
context:
space:
mode:
authorJulian Elischer <julian@FreeBSD.org>2002-11-26 18:30:45 +0000
committerJulian Elischer <julian@FreeBSD.org>2002-11-26 18:30:45 +0000
commitf2ec255a33d1cf9d95e94c2c47599198c43cd71a (patch)
treea1b7e246f768aa11ebc52f1311158f4bf68c94f5 /sys/netgraph
parentf685377c2ec1ebd2df2b2d866f1432621c8dc9b6 (diff)
Notes
Diffstat (limited to 'sys/netgraph')
-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 982b9397f9300..00bd6637665a9 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;