atom feed1 message in org.freebsd.freebsd-currentMinor USB related sysutils/hal patch
FromSent OnAttachments
Hans Petter SelaskyMay 18, 2009 1:36 am.diff
Subject:Minor USB related sysutils/hal patch
From:Hans Petter Selasky (hsel@freebsd.org)
Date:May 18, 2009 1:36:27 am
List:org.freebsd.freebsd-current
Attachments:

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

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)