Subject: Re: Bluetooth adapter not attaching to ubt
To: None <plunky@rya-online.net>
From: Havard Eidnes <he@uninett.no>
List: current-users
Date: 08/18/2006 00:43:47
----Next_Part(Fri_Aug_18_00_43_48_2006_899)--
Content-Type: Text/Plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

> Yes I am working on that just now - the ubtbcmfw device will apparent=
ly
> work if you fix it to compile with gcc4 -

It's not so much gcc4, as e.g. post-timecounter adaptation and a
couple of other interface changes, among them compensating for
usbd_bulk_transfer() both being able to read and write, so for
the write case it can't take a const buffer...  The attached diff
should fix it to at least build.

Regards,

- H=E5vard

----Next_Part(Fri_Aug_18_00_43_48_2006_899)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename=diff

Index: ubtbcmfw.c
===================================================================
RCS file: /u/nb/src/sys/dev/usb/ubtbcmfw.c,v
retrieving revision 1.13
diff -u -r1.13 ubtbcmfw.c
--- ubtbcmfw.c	21 Jul 2006 16:48:53 -0000	1.13
+++ ubtbcmfw.c	17 Aug 2006 22:34:57 -0000
@@ -79,7 +79,7 @@
 		   const char *filename);
 Static usbd_status
 ubtbcmfw_write(usbd_device_handle dev, usbd_pipe_handle out,
-	       char *buf, uint count);
+	       const char *buf, uint count);
 Static usbd_status
 ubtbcmfw_read(usbd_device_handle dev, usbd_pipe_handle in,
 	      char *buf, uint *count);
@@ -220,7 +220,7 @@
 	size_t resid, offs, size;
 	int error;
 	char buf[1024];
-	struct timeval delta;
+	struct timeval delta, time;
 
 	NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, filename, curlwp);
 	/* Loop until we are well passed boot */
@@ -228,6 +228,7 @@
 		error = vn_open(&nd, FREAD, 0);
 		if (!error)
 			break;
+		getmicrotime(&time);
 		timersub(&boottime, &time, &delta);
 		if (delta.tv_sec > 60)
 			break;
@@ -258,13 +259,13 @@
 	}
 
 out:
-	vn_close(vp, FREAD, l->l_cred, p);
+	vn_close(vp, FREAD, l->l_cred, l);
 	return error;
 }
 
 Static usbd_status
 ubtbcmfw_write(usbd_device_handle dev, usbd_pipe_handle out,
-	       char *buf, uint count)
+	       const char *buf, uint count)
 {
 	usbd_xfer_handle xfer;
 	usbd_status err;
@@ -275,7 +276,7 @@
 		return (USBD_NOMEM);
 	n = count;
 	err = usbd_bulk_transfer(xfer, out, 0, USBD_DEFAULT_TIMEOUT,
-				 buf, &n, "ubtfwr");
+				 __UNCONST(buf), &n, "ubtfwr");
 	usbd_free_xfer(xfer);
 	return (err);
 }

----Next_Part(Fri_Aug_18_00_43_48_2006_899)----