From f2ec255a33d1cf9d95e94c2c47599198c43cd71a Mon Sep 17 00:00:00 2001 From: Julian Elischer Date: Tue, 26 Nov 2002 18:30:45 +0000 Subject: 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 Approved by: re (jhb) --- sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c | 40 +++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) (limited to 'sys/netgraph') 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); /**************************************************************************** **************************************************************************** @@ -206,6 +208,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; -- cgit v1.3