Subject: Re: kern/34219: ubtbcmfw.c does not compile
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: Dave Tyson <Dave.Tyson@liverpool.ac.uk>
List: netbsd-bugs
Date: 08/17/2006 12:40:03
The following reply was made to PR kern/34219; it has been noted by GNATS.

From: Dave Tyson <Dave.Tyson@liverpool.ac.uk>
To: gnats-bugs@netbsd.org
Cc: netbsd-bugs@netbsd.org, Andreas Wrede <andreas@planix.com>
Subject: Re: kern/34219: ubtbcmfw.c does not compile
Date: Thu, 17 Aug 2006 11:30:12 +0100

 On Thursday 17 August 2006 00:05, andreas@planix.com wrote:
 > >Number:         34219
 > >Category:       kern
 > >Synopsis:       ubtbcmfw.c does not compile
 > >Confidential:   no
 > >Severity:       serious
 > >Priority:       medium
 > >Responsible:    kern-bug-people
 > >State:          open
 > >Class:          sw-bug
 > >Submitter-Id:   net
 > >Arrival-Date:   Wed Aug 16 23:05:00 +0000 2006
 > >Originator:     Andreas Wrede <andreas@planix.com>
 > >Release:        NetBSD 4.0_BETA
 > >Organization:
 >
 > Planix, Inc.
 >
 > >Environment:
 >
 > System: NetBSD waci 4.0_BETA NetBSD 4.0_BETA (PLANIX.MPACPI) #0: Wed Aug 16
 > 09:46:35 EDT 2006 
 > root@woffi.wrede.pvt:/m5/netbsd-4.0/obj.i386/sys/arch/i386/compile/PLANIX.M
 >PACPI i386 Architecture: i386
 > Machine: i386
 >
 > >Description:
 >
 > /m5/netbsd-4.0/src/sys/dev/usb/ubtbcmfw.c: In function 'ubtbcmfw_attach':
 > /m5/netbsd-4.0/src/sys/dev/usb/ubtbcmfw.c:156: warning: passing argument 3
 > of 'ubtbcmfw_write' discards qualifiers from pointer target type
 > /m5/netbsd-4.0/src/sys/dev/usb/ubtbcmfw.c: In function
 > 'ubtbcmfw_load_file': /m5/netbsd-4.0/src/sys/dev/usb/ubtbcmfw.c:231: error:
 > 'time' undeclared (first use in this function)
 > /m5/netbsd-4.0/src/sys/dev/usb/ubtbcmfw.c:231: error: (Each undeclared
 > identifier is reported only once
 > /m5/netbsd-4.0/src/sys/dev/usb/ubtbcmfw.c:231: error: for each function it
 > appears in.) /m5/netbsd-4.0/src/sys/dev/usb/ubtbcmfw.c:261: error: 'p'
 > undeclared (first use in this function)
 >
 > >How-To-Repeat:
 >
 > 	add 'ubtbcmfw* at uhub? port ? configuration ? interface ?'
 > 	to your kernel config, compile
 >
 > >Fix:
 The following fix works with GCC4 on NetBSD-4_BETA and allows the microcode to 
 download into the Broadcom bluetooth device. Only plug the device in after the
 kernel has booted :-)
 
 The horrible kludge with  char term[2]="#" ; works around a warning GCC issues
 about  "discards qualifiers from pointer target type"
 
 Iain Hibbert is working on a replacement userland program to do away with 
 ubtbcmfw.c
 
 Dave
 
 --- ubtbcmfw.c.orig     2006-08-17 10:01:44.000000000 +0100
 +++ ubtbcmfw.c  2006-08-17 11:12:15.000000000 +0100
 @@ -113,6 +113,7 @@
         usbd_pipe_handle intr_in_pipe;
         usbd_pipe_handle bulk_out_pipe;
         uint n;
 +       char term[2]="#" ;
 
         devinfop = usbd_devinfo_alloc(dev, 0);
         USB_ATTACH_SETUP;
 @@ -153,7 +154,7 @@
                 USB_ATTACH_ERROR_RETURN;
         }
         usbd_delay_ms(dev, 1);
 -       err = ubtbcmfw_write(dev, bulk_out_pipe, "#", 1);
 +       err = ubtbcmfw_write(dev, bulk_out_pipe, term, 1);
         if (err) {
                 printf("%s: write # failed\n", USBDEVNAME(sc->sc_dev));
                 USB_ATTACH_ERROR_RETURN;
 @@ -220,7 +221,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 +229,7 @@
                 error = vn_open(&nd, FREAD, 0);
                 if (!error)
                         break;
 +               microtime(&time) ;
                 timersub(&boottime, &time, &delta);
                 if (delta.tv_sec > 60)
                         break;
 @@ -258,7 +260,7 @@
         }
 
  out:
 -       vn_close(vp, FREAD, l->l_cred, p);
 +       vn_close(vp, FREAD, l->l_cred, l);
         return error;
  }
 
 > >Unformatted:
 
 
 -- 
 =====================================================================
 Computing Services Dept         Phone/Fax: 0151-794-3731/3759
 The University of Liverpool     Email: dtyson@liv.ac.uk
 Chadwick Tower, Peach Street    WWW:   http://www.liv.ac.uk/~dtyson
 Liverpool L69 7ZF               Open Source O/S: www.netbsd.org
 =====================================================================