patch-2.4.0-test7 linux/drivers/usb/bluetooth.c

Next file: linux/drivers/usb/dc2xx.c
Previous file: linux/drivers/usb/Makefile
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.0-test6/linux/drivers/usb/bluetooth.c linux/drivers/usb/bluetooth.c
@@ -1,5 +1,5 @@
 /*
- * bluetooth.c   Version 0.3
+ * bluetooth.c   Version 0.4
  *
  * Copyright (c) 2000 Greg Kroah-Hartman	<greg@kroah.com>
  * Copyright (c) 2000 Mark Douglas Corner	<mcorner@umich.edu>
@@ -7,6 +7,13 @@
  * USB Bluetooth driver, based on the Bluetooth Spec version 1.0B
  *
  *
+ * (07/11/2000) Version 0.4 gkh
+ *	Fixed bug in disconnect for when we call tty_hangup
+ *	Fixed bug in bluetooth_ctrl_msg where the bluetooth struct was not
+ *	getting attached to the control urb properly.
+ *	Fixed bug in bluetooth_write where we pay attention to the result
+ *	of bluetooth_ctrl_msg.
+ *
  * (08/03/2000) Version 0.3 gkh mdc
  *	Merged in Mark's changes to make the driver play nice with the Axis
  *	stack.
@@ -251,7 +258,7 @@
 	dr->length = cpu_to_le16p(&len);
 	
 	FILL_CONTROL_URB (urb, bluetooth->dev, usb_sndctrlpipe(bluetooth->dev, 0),
-			  (unsigned char*)dr, buf, len, bluetooth_ctrl_callback, 0);
+			  (unsigned char*)dr, buf, len, bluetooth_ctrl_callback, bluetooth);
 
 	/* send it down the pipe */
 	status = usb_submit_urb(urb);
@@ -400,7 +407,10 @@
 			else
 				memcpy (new_buffer, buf+1, count-1);
 
-			bluetooth_ctrl_msg (bluetooth, 0x00, 0x00, new_buffer, count-1);
+			if (bluetooth_ctrl_msg (bluetooth, 0x00, 0x00, new_buffer, count-1) != 0) {
+				kfree (new_buffer);
+				return 0;
+			}
 
 			/* need to free new_buffer somehow... FIXME */
 			return count;
@@ -1099,6 +1109,9 @@
 	int i;
 
 	if (bluetooth) {
+		if ((bluetooth->active) && (bluetooth->tty))
+			tty_hangup(bluetooth->tty);
+
 		bluetooth->active = 0;
 
 		if (bluetooth->read_urb) {
@@ -1116,9 +1129,6 @@
 			kfree (bluetooth->interrupt_in_buffer);
 
 		tty_unregister_devfs (&bluetooth_tty_driver, bluetooth->minor);
-
-		if (bluetooth->tty)
-			tty_hangup(bluetooth->tty);
 
 		for (i = 0; i < NUM_BULK_URBS; ++i) {
 			if (bluetooth->write_urb_pool[i]) {

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)