From owner-freebsd-ports@FreeBSD.ORG Mon May 18 09:34:19 2009 Return-Path: Delivered-To: ports@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4046B1065674; Mon, 18 May 2009 09:34:19 +0000 (UTC) (envelope-from hselasky@freebsd.org) Received: from swip.net (mailfe07.swip.net [212.247.154.193]) by mx1.freebsd.org (Postfix) with ESMTP id 496EB8FC2B; Mon, 18 May 2009 09:34:18 +0000 (UTC) (envelope-from hselasky@freebsd.org) X-Cloudmark-Score: 0.000000 [] X-Cloudmark-Analysis: v=1.0 c=1 a=ezY8gES9d9YA:10 a=j+k/Ze5hWUCaCztCgEjzDQ==:17 a=RRgnrM4ICHkkUpFZu5kA:9 a=hTeHOaKq-z6AlGNJI1RKctCXjiEA:4 a=UlvUavXRAAAA:8 a=rL6TIayMHYZ-YPLjhE0A:9 a=_aIzSSXiGnr7tqotQBo1JtEGD3AA:4 a=6FRLwHsFNoYA:10 Received: from [81.191.55.181] (account mc467741@c2i.net HELO laptop) by mailfe07.swip.net (CommuniGate Pro SMTP 5.2.13) with ESMTPA id 1241156808; Mon, 18 May 2009 10:34:15 +0200 Received-SPF: softfail receiver=mailfe07.swip.net; client-ip=81.191.55.181; envelope-from=hselasky@freebsd.org From: Hans Petter Selasky To: gnome@FreeBSD.org, ports@freebsd.org, freebsd-usb@freebsd.org, freebsd-current@freebsd.org Date: Mon, 18 May 2009 10:36:50 +0200 User-Agent: KMail/1.9.7 MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_j4REKGJO9Qvs4M9" Message-Id: <200905181036.51184.hselasky@freebsd.org> Cc: Subject: Minor USB related sysutils/hal patch X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 May 2009 09:34:20 -0000 --Boundary-00=_j4REKGJO9Qvs4M9 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi, I've made some minor patches for sysutils/hal If the device is detached during config read, the config can be NULL. Check that. Make sure that we close the device handles as we go, to save number of open files. When the backend is freed any leftover file handles will get freed, so it is not absolutely needed to close the device handle in every case. --HPS --Boundary-00=_j4REKGJO9Qvs4M9 Content-Type: text/x-diff; charset="us-ascii"; name="files.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="files.diff" diff -u -r files.org/patch-configure files/patch-configure --- files.org/patch-configure 2009-05-18 09:35:47.000000000 +0200 +++ files/patch-configure 2009-05-18 10:23:05.000000000 +0200 @@ -286,7 +286,7 @@ +main () +{ +return libusb20_dev_get_info (); -+ ; ++ + return 0; +} +_ACEOF @@ -325,8 +325,8 @@ +if test $ac_cv_lib_usb_libusb20_dev_get_info = yes; then + USE_LIBUSB=yes +else -+ USE_LIBUSB=np ++ USE_LIBUSB=no +fi + +fi diff -u -r files.org/patch-hald_freebsd_probing_probe-usb2-device.c files/patch-hald_freebsd_probing_probe-usb2-device.c --- files.org/patch-hald_freebsd_probing_probe-usb2-device.c 2009-05-18 09:35:47.000000000 +0200 +++ files/patch-hald_freebsd_probing_probe-usb2-device.c 2009-05-18 09:45:27.000000000 +0200 @@ -96,9 +96,9 @@ + pcfg = libusb20_dev_alloc_config(pdev, curr_config); + cdesc = &(pcfg->desc); + -+ if (libusb20_dev_get_info(pdev, &di)) -+ { -+ free(pcfg); ++ if ((pcfg == NULL) || libusb20_dev_get_info(pdev, &di)) ++ { ++ if (pcfg != NULL) free(pcfg); + continue; + } + @@ -196,7 +196,7 @@ + libhal_device_set_property_string(hfp_ctx, hfp_udi, + "info.vendor", di.udi_vendor, &hfp_error); + -+ free(pcfg); ++ libusb20_dev_close(pdev); free(pcfg); + } +end: + if (pbe) --Boundary-00=_j4REKGJO9Qvs4M9--