From owner-freebsd-ports-bugs@FreeBSD.ORG Fri Dec 15 22:10:17 2006 Return-Path: X-Original-To: freebsd-ports-bugs@hub.freebsd.org Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id AB11E16A415 for ; Fri, 15 Dec 2006 22:10:17 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [69.147.83.40]) by mx1.FreeBSD.org (Postfix) with ESMTP id 545E343C9D for ; Fri, 15 Dec 2006 22:08:25 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id kBFMA86f085121 for ; Fri, 15 Dec 2006 22:10:08 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id kBFMA8b1085120; Fri, 15 Dec 2006 22:10:08 GMT (envelope-from gnats) Resent-Date: Fri, 15 Dec 2006 22:10:08 GMT Resent-Message-Id: <200612152210.kBFMA8b1085120@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Coleman Kane Received: from mx1.FreeBSD.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 16FC816A417 for ; Fri, 15 Dec 2006 22:03:02 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [69.147.83.33]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6F5D843CAB for ; Fri, 15 Dec 2006 22:01:09 +0000 (GMT) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.13.1/8.13.1) with ESMTP id kBFM2rJd024810 for ; Fri, 15 Dec 2006 22:02:53 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.13.1/8.13.1/Submit) id kBFM2qYn024809; Fri, 15 Dec 2006 22:02:52 GMT (envelope-from nobody) Message-Id: <200612152202.kBFM2qYn024809@www.freebsd.org> Date: Fri, 15 Dec 2006 22:02:52 GMT From: Coleman Kane To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.0 Cc: Subject: ports/106794: Port multimedia/pwcbsd is out of date with latest usb_port.h changes X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Dec 2006 22:10:17 -0000 >Number: 106794 >Category: ports >Synopsis: Port multimedia/pwcbsd is out of date with latest usb_port.h changes >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Dec 15 22:10:08 GMT 2006 >Closed-Date: >Last-Modified: >Originator: Coleman Kane >Release: 7-CURRENT >Organization: IntelliTree Solutions llc. >Environment: FreeBSD erwin 7.0-CURRENT FreeBSD 7.0-CURRENT #0: Wed Dec 6 17:11:38 EST 2006 root@erwin:/usr/obj/usr/src/sys/ERWIN amd64 >Description: The port multimedia/pwcbsd has become unbuildable due to the changes applied to sys/dev/usb/usb_port.h to remove a bunch of compatibility #defines, such as USBDEVNAME(x) and USBBASEDEV. This port was overdue for a cleanup anyhow. >How-To-Repeat: Install -CURRENT. cd /usr/ports/multimedia/pwcbsd sudo make .. watch it die. >Fix: The following patch adds a set of patch files to the files/ subdir that properly replace a bunch of printf statements with canonical device_printf's that do the same basic thing (but more correctly). In addition, other defines have been manually resolved by me. This fix also is tested working under RELENG_6 and should be supported by all releases that originally supported this port (not a -CURRENT only patchset). As stated, these breakages were only exposed when deprecated compatibility code was removed from the USB system. Patch attached with submission follows: diff -u -r -N pwcbsd.old/Makefile pwcbsd/Makefile --- pwcbsd.old/Makefile Sat Oct 7 10:58:30 2006 +++ pwcbsd/Makefile Fri Dec 15 14:50:36 2006 @@ -7,6 +7,7 @@ PORTNAME= pwcbsd PORTVERSION= 1.3.1 +PORTREVISION= 1 CATEGORIES= multimedia sysutils MASTER_SITES= http://raaf.atspace.org/ \ ${MASTER_SITE_LOCAL} diff -u -r -N pwcbsd.old/files/patch-pwc-ctrl.c pwcbsd/files/patch-pwc-ctrl.c --- pwcbsd.old/files/patch-pwc-ctrl.c Wed Dec 31 17:00:00 1969 +++ pwcbsd/files/patch-pwc-ctrl.c Fri Dec 15 14:46:38 2006 @@ -0,0 +1,14 @@ +--- pwc-ctrl.c Thu Jun 8 20:28:32 2006 ++++ pwc-ctrl.c Fri Dec 15 14:37:57 2006 +@@ -434,8 +434,9 @@ + if (ret == -ENOENT) + Info("Video mode %s@%d fps is only supported with the decompressor module (pwcx).\n", size2name[size], frames); + else { +- printf("%s: Failed to set video mode to %s@%d fps; return code = %d\n", +- USBDEVNAME(pdev->sc_dev),size2name[size], frames, -ret); ++ device_printf(pdev->sc_dev, ++ "Failed to set video mode to %s@%d fps; return code = %d\n", ++ size2name[size], frames, -ret); + } + return ret; + } diff -u -r -N pwcbsd.old/files/patch-pwc.c pwcbsd/files/patch-pwc.c --- pwcbsd.old/files/patch-pwc.c Wed Dec 31 17:00:00 1969 +++ pwcbsd/files/patch-pwc.c Fri Dec 15 14:46:11 2006 @@ -0,0 +1,196 @@ +--- pwc.c Sun Sep 24 06:58:43 2006 ++++ pwc.c Fri Dec 15 14:37:13 2006 +@@ -149,8 +149,9 @@ + + info = pwc_lookup(uaa->vendor, uaa->product); + if(info == NULL) { +- printf("%s: attach error vendor/product mismatch (vendor=0x%x product=0x%x)\n", +- USBDEVNAME(sc->sc_dev),uaa->vendor,uaa->product); ++ device_printf(sc->sc_dev, ++ "attach error vendor/product mismatch (vendor=0x%x product=0x%x)\n", ++ uaa->vendor,uaa->product); + USB_ATTACH_ERROR_RETURN; + } + +@@ -159,7 +160,7 @@ + + err = usbd_device2interface_handle(uaa->device,0,&sc->sc_iface); + if(err) { +- printf("%s: failed to get interface handle\n",USBDEVNAME(sc->sc_dev)); ++ device_printf(sc->sc_dev, "failed to get interface handle\n"); + USB_ATTACH_ERROR_RETURN; + } + +@@ -192,7 +193,7 @@ + } + } + +- mtx_init(&sc->ptrlock,USBDEVNAME(sc->sc_dev),NULL,MTX_DEF); ++ mtx_init(&sc->ptrlock,device_get_name(sc->sc_dev),NULL,MTX_DEF); + + tmpstr = "video"; + resource_string_value("pwc",device_get_unit(self),"devname",&tmpstr); +@@ -256,7 +257,7 @@ + resource_int_value("pwc",device_get_unit(self),"pad",&sc->pwc_pad); + + pwc_construct(sc); +- printf("%s: %s USB webcam\n",USBDEVNAME(sc->sc_dev),sc->name); ++ device_printf(sc->sc_dev, "%s USB webcam\n", sc->name); + + if(pwc_get_cmos_sensor(sc, &i) >= 0) { + +@@ -274,7 +275,8 @@ + default: tmpstr = "unknown type of sensor"; break; + } + +- printf("%s: This camera is equipped with a %s (%d)\n",USBDEVNAME(sc->sc_dev),tmpstr, i); ++ device_printf(sc->sc_dev, "This camera is equipped with a %s (%d)\n", ++ tmpstr, i); + } + + pwc_set_leds(sc, 0, 0); +@@ -308,7 +310,7 @@ + sc->state &= ~PWC_POLL; + selwakeuppri(&sc->rsel,PZERO); + } +- printf("%s: Disconnected while webcam is in use!\n",USBDEVNAME(sc->sc_dev)); ++ device_printf(sc->sc_dev, "Disconnected while webcam is in use!\n"); + } + + if(sc->sc_dev_t != NULL) +@@ -345,7 +347,8 @@ + if (sc->power_save) { + err = pwc_camera_power(sc, 1); + if (err < 0) +- printf("%s: Failed to restore power to the camera! (%d)\n", USBDEVNAME(sc->sc_dev),-err); ++ device_printf(sc->sc_dev, ++ "Failed to restore power to the camera! (%d)\n", -err); + } + + pwc_set_leds(sc, sc->led_on, sc->led_off); +@@ -354,7 +357,8 @@ + /* Allocate frame buffer structure */ + sc->fbuf = malloc(sc->pwc_fbufs * sizeof(struct pwc_frame_buf), M_USBDEV, M_WAITOK); + if (sc->fbuf == NULL) { +- printf("%s: Failed to allocate frame buffer structure.\n",USBDEVNAME(sc->sc_dev)); ++ device_printf(sc->sc_dev, ++ "Failed to allocate frame buffer structure.\n"); + goto bad; + } + memset(sc->fbuf, 0, sc->pwc_fbufs * sizeof(struct pwc_frame_buf)); +@@ -364,7 +368,7 @@ + + sc->fbuf[i].data = malloc(PWC_FRAME_SIZE,M_USBDEV,M_WAITOK); + if (sc->fbuf[i].data == NULL) { +- printf("%s: Failed to allocate frame buffer\n", USBDEVNAME(sc->sc_dev)); ++ device_printf(sc->sc_dev, "Failed to allocate frame buffer\n"); + goto bad; + } + memset(sc->fbuf[i].data, 128, PWC_FRAME_SIZE); +@@ -376,7 +380,7 @@ + sc->decompress_data = malloc(sizeof(struct pwc_dec23_private), M_USBDEV, M_WAITOK);/* Timon & Kiara */ + + if(sc->decompress_data == NULL) { +- printf("%s: Failed to allocate decompress table.\n",USBDEVNAME(sc->sc_dev)); ++ device_printf(sc->sc_dev, "Failed to allocate decompress table.\n"); + goto bad; + } + +@@ -384,7 +388,7 @@ + if(sc->image_data == NULL) { + sc->image_data = malloc(sc->pwc_mbufs * round_page(sc->len_per_image), M_USBDEV, M_WAITOK); + if(sc->image_data == NULL) { +- printf("%s: Failed to allocate image buffers\n",USBDEVNAME(sc->sc_dev)); ++ device_printf(sc->sc_dev, "Failed to allocate image buffers\n"); + goto bad; + } + } +@@ -404,13 +408,13 @@ + sc->sbuf[i].xfer = usbd_alloc_xfer(sc->udev); + + if(sc->sbuf[i].xfer == NULL) { +- printf("%s: Failed to allocate transfer\n",USBDEVNAME(sc->sc_dev)); ++ device_printf(sc->sc_dev, "Failed to allocate transfer\n"); + goto bad; + } + + sc->sbuf[i].data = usbd_alloc_buffer(sc->sbuf[i].xfer, ISO_BUFFER_SIZE); + if(sc->sbuf[i].data == NULL) { +- printf("%s: Failed to allocate transferbuffer\n",USBDEVNAME(sc->sc_dev)); ++ device_printf(sc->sc_dev, "Failed to allocate transferbuffer\n"); + goto bad; + } + } +@@ -466,8 +470,9 @@ + programs) + */ + if(sc->vframe_count > 20 && sc->stats) { +- printf("%s: %d frames received, dumped %d frames, %d frames with errors.\n" +- ,USBDEVNAME(sc->sc_dev),sc->vframe_count, sc->vframes_dumped, sc->vframes_error); ++ device_printf(sc->sc_dev, ++ "%d frames received, dumped %d frames, %d frames with errors.\n", ++ sc->vframe_count, sc->vframes_dumped, sc->vframes_error); + } + + if(sc->type == 645 || sc->type == 646) +@@ -491,7 +496,7 @@ + + if(sc->power_save) { + if(pwc_camera_power(sc, 0) < 0) +- printf("%s: Failed to power down the camera\n", USBDEVNAME(sc->sc_dev)); ++ device_printf(sc->sc_dev, "Failed to power down the camera\n"); + } + } + +@@ -662,13 +667,15 @@ + + err = usbd_set_interface(sc->sc_iface,sc->valternate); + if(err != USBD_NORMAL_COMPLETION) { +- printf("%s: Failed to set alternate interface to: %d (%d)\n",USBDEVNAME(sc->sc_dev),sc->valternate,err); ++ device_printf(sc->sc_dev, ++ "Failed to set alternate interface to: %d (%d)\n", ++ sc->valternate,err); + return -err; + } + + err = usbd_endpoint_count(sc->sc_iface, &nendpt); + if(err != USBD_NORMAL_COMPLETION) { +- printf("%s: Failed to get endpoint count (%d)\n",USBDEVNAME(sc->sc_dev),err); ++ device_printf(sc->sc_dev, "Failed to get endpoint count (%d)\n",err); + return -err; + } + for (i = 0; i < nendpt; i++) { +@@ -677,20 +684,20 @@ + break; + } + if(i == nendpt) { +- printf("%s: Failed to find videoendpoint\n",USBDEVNAME(sc->sc_dev)); ++ device_printf(sc->sc_dev, "Failed to find videoendpoint\n"); + return -EINVAL; + } + + sc->vmax_packet_size = UGETW(edesc->wMaxPacketSize); + if(sc->vmax_packet_size < 0 || sc->vmax_packet_size > ISO_MAX_FRAME_SIZE) { +- printf("%s: Invalid packetsize (%d) for endpoint %d\n",USBDEVNAME(sc->sc_dev), ++ device_printf(sc->sc_dev, "Invalid packetsize (%d) for endpoint %d\n", + sc->vmax_packet_size,edesc->bEndpointAddress); + return -EINVAL; + } + + err = usbd_open_pipe(sc->sc_iface,edesc->bEndpointAddress, 0, &sc->sc_videopipe); + if(err != USBD_NORMAL_COMPLETION) { +- printf("%s: Failed to open videopipe (%d)\n",USBDEVNAME(sc->sc_dev),err); ++ device_printf(sc->sc_dev, "Failed to open videopipe (%d)\n", err); + return -err; + } + +@@ -771,7 +778,8 @@ + if (++sc->visoc_errors > MAX_ISOC_ERRORS) { + + if(sc->error_status != EIO) +- printf("%s: Too many ISOC errors, bailing out.\n",USBDEVNAME(sc->sc_dev)); ++ device_printf(sc->sc_dev, ++ "Too many ISOC errors, bailing out.\n"); + + sc->error_status = EIO; + awake = 1; diff -u -r -N pwcbsd.old/files/patch-pwc.h pwcbsd/files/patch-pwc.h --- pwcbsd.old/files/patch-pwc.h Wed Dec 31 17:00:00 1969 +++ pwcbsd/files/patch-pwc.h Fri Dec 15 14:45:55 2006 @@ -0,0 +1,11 @@ +--- pwc.h Thu Jun 8 20:27:39 2006 ++++ pwc.h Fri Dec 15 14:29:52 2006 +@@ -133,7 +133,7 @@ + + struct pwc_softc + { +- USBBASEDEVICE sc_dev; ++ device_t sc_dev; + usbd_device_handle udev; + usbd_interface_handle sc_iface; + usbd_pipe_handle sc_videopipe; >Release-Note: >Audit-Trail: >Unformatted: