From 79d20972a2e8eea4f9807da4a8899365b4b9092a Mon Sep 17 00:00:00 2001 From: ryoon Date: Sat, 31 Mar 2012 16:06:56 +0000 Subject: Bump PKGREVISION * Fix build on FreeBSD 9.0 ** Patches are borrowed from FreeBSD ports ** Split FreeBSD support from DragonFly/FreeBSD support --- sysutils/hal/Makefile | 12 +- sysutils/hal/PLIST.DragonFly | 15 + sysutils/hal/PLIST.FreeBSD | 4 +- sysutils/hal/distinfo | 12 +- sysutils/hal/patches/patch-ak | 24 +- sysutils/hal/patches/patch-ao | 25 +- .../patch-hald_freebsd_addons_addon-storage.c | 142 +++++++ sysutils/hal/patches/patch-hald_freebsd_hf-devd.c | 42 +++ sysutils/hal/patches/patch-hald_freebsd_hf-usb2.c | 417 +++++++++++++++++++++ .../hal/patches/patch-hald_freebsd_hf-volume.c | 20 + .../patch-hald_freebsd_probing_probe-usb2-device.c | 46 +++ ...tch-hald_freebsd_probing_probe-usb2-interface.c | 20 + 12 files changed, 767 insertions(+), 12 deletions(-) create mode 100755 sysutils/hal/PLIST.DragonFly create mode 100644 sysutils/hal/patches/patch-hald_freebsd_addons_addon-storage.c create mode 100644 sysutils/hal/patches/patch-hald_freebsd_hf-devd.c create mode 100644 sysutils/hal/patches/patch-hald_freebsd_hf-usb2.c create mode 100644 sysutils/hal/patches/patch-hald_freebsd_hf-volume.c create mode 100644 sysutils/hal/patches/patch-hald_freebsd_probing_probe-usb2-device.c create mode 100644 sysutils/hal/patches/patch-hald_freebsd_probing_probe-usb2-interface.c (limited to 'sysutils') diff --git a/sysutils/hal/Makefile b/sysutils/hal/Makefile index 64cdd6f1e15..25f4956de18 100644 --- a/sysutils/hal/Makefile +++ b/sysutils/hal/Makefile @@ -1,7 +1,7 @@ -# $NetBSD: Makefile,v 1.59 2012/03/03 00:12:20 wiz Exp $ +# $NetBSD: Makefile,v 1.60 2012/03/31 16:06:56 ryoon Exp $ DISTNAME= hal-0.5.14 -PKGREVISION= 5 +PKGREVISION= 6 CATEGORIES= sysutils MASTER_SITES= http://hal.freedesktop.org/releases/ EXTRACT_SUFX= .tar.bz2 @@ -36,7 +36,13 @@ CONFIGURE_ARGS+= --without-os-type .include "../../mk/bsd.prefs.mk" -.if ${OPSYS} == "FreeBSD" || ${OPSYS} == "DragonFly" +.if ${OPSYS} == "DragonFly" +.include "../../devel/libvolume_id/buildlink3.mk" +CONFIGURE_ARGS+= --with-eject=/usr/sbin/cdcontrol +CONFIGURE_ARGS+= --with-backend=freebsd +PLIST_SRC= PLIST.DragonFly PLIST + +.elif ${OPSYS} == "FreeBSD" .include "../../devel/libvolume_id/buildlink3.mk" CONFIGURE_ARGS+= --with-eject=/usr/sbin/cdcontrol CONFIGURE_ARGS+= --with-backend=freebsd diff --git a/sysutils/hal/PLIST.DragonFly b/sysutils/hal/PLIST.DragonFly new file mode 100755 index 00000000000..2d7baf7c73b --- /dev/null +++ b/sysutils/hal/PLIST.DragonFly @@ -0,0 +1,15 @@ +@comment $NetBSD: PLIST.DragonFly,v 1.1 2012/03/31 16:06:56 ryoon Exp $ +libexec/hald-addon-mouse-sysmouse +libexec/hald-addon-storage +libexec/hald-probe-hiddev +libexec/hald-probe-mouse +libexec/hald-probe-scsi +libexec/hald-probe-smbios +libexec/hald-probe-storage +libexec/hald-probe-volume +libexec/scripts/freebsd/hal-system-lcd-get-brightness-freebsd +libexec/scripts/freebsd/hal-system-lcd-set-brightness-freebsd +libexec/scripts/freebsd/hal-system-power-reboot-freebsd +libexec/scripts/freebsd/hal-system-power-set-power-save-freebsd +libexec/scripts/freebsd/hal-system-power-shutdown-freebsd +libexec/scripts/freebsd/hal-system-power-suspend-freebsd diff --git a/sysutils/hal/PLIST.FreeBSD b/sysutils/hal/PLIST.FreeBSD index ea32d857bec..f1b79972ef0 100644 --- a/sysutils/hal/PLIST.FreeBSD +++ b/sysutils/hal/PLIST.FreeBSD @@ -1,4 +1,4 @@ -@comment $NetBSD: PLIST.FreeBSD,v 1.3 2011/01/08 13:00:13 obache Exp $ +@comment $NetBSD: PLIST.FreeBSD,v 1.4 2012/03/31 16:06:56 ryoon Exp $ libexec/hald-addon-mouse-sysmouse libexec/hald-addon-storage libexec/hald-probe-hiddev @@ -6,6 +6,8 @@ libexec/hald-probe-mouse libexec/hald-probe-scsi libexec/hald-probe-smbios libexec/hald-probe-storage +libexec/hald-probe-usb2-device +libexec/hald-probe-usb2-interface libexec/hald-probe-volume libexec/scripts/freebsd/hal-system-lcd-get-brightness-freebsd libexec/scripts/freebsd/hal-system-lcd-set-brightness-freebsd diff --git a/sysutils/hal/distinfo b/sysutils/hal/distinfo index df3b1f3a82a..23ec948ab67 100644 --- a/sysutils/hal/distinfo +++ b/sysutils/hal/distinfo @@ -1,4 +1,4 @@ -$NetBSD: distinfo,v 1.22 2011/10/04 10:31:37 dsainty Exp $ +$NetBSD: distinfo,v 1.23 2012/03/31 16:06:56 ryoon Exp $ SHA1 (hal-0.5.14.tar.bz2) = a6ec098d78112e18e2773afa5f9ed642b00c4c59 RMD160 (hal-0.5.14.tar.bz2) = 0314dace9512bf49a62bd1556963fc60a6c9caf9 @@ -12,11 +12,11 @@ SHA1 (patch-af) = 161b59ee30d59dbc9e0c79f7f3162bcec5480d99 SHA1 (patch-ag) = 3fd8b7d10b1a43311541d2c6ad67a944e286c5ec SHA1 (patch-ah) = 6d801a2c30cee6199b25acf46d7e9866f6004182 SHA1 (patch-aj) = f20e4b1286d177e53a550b2ba1608d22e4b5c609 -SHA1 (patch-ak) = c6e9f20df9230de1bbf599315ad7f32fe6433f48 +SHA1 (patch-ak) = 2964207f8907229b5d00ecce7f56fb3359d01f0d SHA1 (patch-al) = fe567d7504e961cb623e492f8dc155ef2f3b4c9e SHA1 (patch-am) = 6a4940006e583300d9a983511bdcb05268f74b1a SHA1 (patch-an) = 0307b2f0f6bb5e4a6d7bf837163e74749b7d24b2 -SHA1 (patch-ao) = 2bbd39404284c5c05068e87c9d20b8f6a65c3503 +SHA1 (patch-ao) = 5413ef5a9810dcf9dbed54243d5af26a4486a810 SHA1 (patch-ap) = 9051ced9c00911b993198c98c6d02f5846c16728 SHA1 (patch-aq) = 7d0b224b4b1e6052983a6512217eee4f530e0720 SHA1 (patch-ar) = bf44c939b338359f18457b1e65434731c3605130 @@ -25,6 +25,12 @@ SHA1 (patch-at) = 040a018a7be5b28a0dc23dd66a0c10bbb0abc6bf SHA1 (patch-au) = c9e843f57b8a31f1bdc42478d450ea5606b4d7db SHA1 (patch-av) = 075ab5e265be4733d856a17184129d0b301bc0b8 SHA1 (patch-ax) = 278cbf10dd288f7a4aeedd7545b325c1a82715db +SHA1 (patch-hald_freebsd_addons_addon-storage.c) = 0a9f63690224c11b38f2ad1c814e7b1433c5597d +SHA1 (patch-hald_freebsd_hf-devd.c) = 37394dfd49e56659cfe5282f66781d4845f5ee97 +SHA1 (patch-hald_freebsd_hf-usb2.c) = 9a1a612fe6f81078ea246fb49ec60157b8641e75 +SHA1 (patch-hald_freebsd_hf-volume.c) = 45f27050f2b0ef8825d32d2bbdcac168c8f5b2b5 +SHA1 (patch-hald_freebsd_probing_probe-usb2-device.c) = eb655ef42d02cd2c6a86004c309e20de942f033b +SHA1 (patch-hald_freebsd_probing_probe-usb2-interface.c) = 8ad0ac33ae366f7f470b2cb751a31bb99b2e6313 SHA1 (patch-na) = 2786db8149a55dbd5ea11419d789f420bac1993c SHA1 (patch-nb) = 1693b7a2faa5bee20a594f0b60b8ff6caea0efdc SHA1 (patch-nc) = 32453e49734902749ce24eb4364fc7f531986227 diff --git a/sysutils/hal/patches/patch-ak b/sysutils/hal/patches/patch-ak index 8bdd6c28bc7..15053025ce6 100644 --- a/sysutils/hal/patches/patch-ak +++ b/sysutils/hal/patches/patch-ak @@ -1,4 +1,4 @@ -$NetBSD: patch-ak,v 1.3 2011/01/08 13:00:13 obache Exp $ +$NetBSD: patch-ak,v 1.4 2012/03/31 16:06:56 ryoon Exp $ --- hald/freebsd/probing/probe-volume.c.orig 2009-09-17 13:45:09.000000000 +0000 +++ hald/freebsd/probing/probe-volume.c @@ -85,7 +85,25 @@ $NetBSD: patch-ak,v 1.3 2011/01/08 13:00:13 obache Exp $ libhal_device_set_property_string(hfp_ctx, hfp_udi, "volume.freebsd.ufsid", ufsid, &hfp_error); ufs_devs = libhal_manager_find_device_string_match(hfp_ctx, "volume.freebsd.ufsid", -@@ -597,7 +632,9 @@ main (int argc, char **argv) +@@ -582,7 +617,11 @@ main (int argc, char **argv) + dbus_error_free(&hfp_error); + for (i = 0; i < num_udis; i++) + { ++#if defined(__FreeBSD__) ++ if (ufs_devs[i] != NULL && strcmp(ufs_devs[i], hfp_udi)) ++#else + if (ufs_devs[i] != NULL) ++#endif + { + gboolean mounted; + +@@ -592,12 +631,15 @@ main (int argc, char **argv) + { + libhal_device_set_property_bool(hfp_ctx, hfp_udi, "volume.ignore", TRUE, &hfp_error); + dbus_error_free(&hfp_error); ++ break; + } + } } if (ufs_devs) libhal_free_string_array(ufs_devs); @@ -95,7 +113,7 @@ $NetBSD: patch-ak,v 1.3 2011/01/08 13:00:13 obache Exp $ } } -@@ -628,7 +665,11 @@ main (int argc, char **argv) +@@ -628,7 +670,11 @@ main (int argc, char **argv) libhal_device_set_property_string(hfp_ctx, hfp_udi, "volume.uuid", vid ? vid->uuid : "", &hfp_error); diff --git a/sysutils/hal/patches/patch-ao b/sysutils/hal/patches/patch-ao index fa91c4f3b42..030c290e31b 100644 --- a/sysutils/hal/patches/patch-ao +++ b/sysutils/hal/patches/patch-ao @@ -1,4 +1,4 @@ -$NetBSD: patch-ao,v 1.3 2011/01/08 13:00:13 obache Exp $ +$NetBSD: patch-ao,v 1.4 2012/03/31 16:06:56 ryoon Exp $ On DragonFly /dev/usb will be taken by usbd(8), but that does not mean that one cannot check usbX devices. The same behaviour was present @@ -20,7 +20,19 @@ in older versions of hald(8). #include "../logger.h" #include "../osspec.h" -@@ -613,7 +617,6 @@ hf_usb_privileged_init (void) +@@ -392,7 +396,11 @@ hf_usb_device_new (HalDevice *parent, + hf_devtree_device_set_name(device, di->udi_devnames[0]); + + if ((devname = hf_usb_get_devname(di, "ukbd"))) /* USB keyboard */ ++#if defined(__FreeBSD__) ++ hf_device_set_input(device, "keyboard", "keys", NULL); ++#else + hf_device_set_input(device, "keyboard", "keys", devname); ++#endif + else if ((devname = hf_usb_get_devname(di, "ums"))) /* USB mouse */ + hf_device_set_input(device, "mouse", NULL, devname); + else if ((devname = hf_usb_get_devname(di, "uhid"))) /* UHID device */ +@@ -613,7 +621,6 @@ hf_usb_privileged_init (void) if (hf_usb_fd < 0) { HAL_INFO(("unable to open %s: %s", HF_USB_DEVICE, g_strerror(errno))); @@ -28,3 +40,12 @@ in older versions of hald(8). } for (i = 0; i < 16; i++) +@@ -908,6 +915,8 @@ hf_usb_add_webcam_properties (HalDevice + + hal_device_property_set_string(device, "info.category", "video4linux"); + hal_device_add_capability(device, "video4linux"); ++ hal_device_add_capability(device, "video4linux.video_capture"); + hf_device_property_set_string_printf(device, "video4linux.device", "/dev/video%i", unit); + hal_device_property_set_string(device, "info.product", "Video Device"); ++ hal_device_property_set_string(device, "video4linux.version", "1"); + } diff --git a/sysutils/hal/patches/patch-hald_freebsd_addons_addon-storage.c b/sysutils/hal/patches/patch-hald_freebsd_addons_addon-storage.c new file mode 100644 index 00000000000..018083f8a4d --- /dev/null +++ b/sysutils/hal/patches/patch-hald_freebsd_addons_addon-storage.c @@ -0,0 +1,142 @@ +$NetBSD: patch-hald_freebsd_addons_addon-storage.c,v 1.1 2012/03/31 16:06:56 ryoon Exp $ + +* From FreeBSD ports repository to fix build on FreeBSD 9.0 RELEASE. + +--- hald/freebsd/addons/addon-storage.c.orig 2009-08-24 12:42:29.000000000 +0000 ++++ hald/freebsd/addons/addon-storage.c +@@ -107,8 +107,12 @@ hf_addon_storage_update (void) + + if (hf_addon_storage_cdrom_eject_pressed(cdrom)) + { ++#if defined(__FreeBSD__) ++ libhal_device_emit_condition(hfp_ctx, hfp_udi, "EjectPressed", "", NULL); ++#else + libhal_device_emit_condition(hfp_ctx, hfp_udi, "EjectPressed", "", &hfp_error); + dbus_error_free(&hfp_error); ++#endif + } + + hfp_cdrom_free(cdrom); +@@ -164,11 +168,17 @@ unmount_volumes (void) + "block.storage_device", + hfp_udi, + &num_volumes, ++#if defined(__FreeBSD__) ++ NULL)) != NULL) ++#else + &hfp_error)) != NULL) ++#endif + { + int i; + ++#if !defined(__FreeBSD__) + dbus_error_free(&hfp_error); ++#endif + + for (i = 0; i < num_volumes; i++) + { +@@ -176,7 +186,11 @@ unmount_volumes (void) + + vol_udi = volumes[i]; + ++#if defined(__FreeBSD__) ++ if (libhal_device_get_property_bool(hfp_ctx, vol_udi, "volume.is_mounted", NULL)) ++#else + if (libhal_device_get_property_bool(hfp_ctx, vol_udi, "volume.is_mounted", &hfp_error)) ++#endif + { + DBusMessage *msg = NULL; + DBusMessage *reply = NULL; +@@ -185,7 +199,9 @@ unmount_volumes (void) + char **options = NULL; + char *devfile; + ++#if !defined(__FreeBSD__) + dbus_error_free(&hfp_error); ++#endif + hfp_info("Forcing unmount of volume '%s'", vol_udi); + + dbus_connection = libhal_ctx_get_dbus_connection(hfp_ctx); +@@ -265,10 +281,16 @@ poll_for_media (boolean check_only, bool + check_lock_state = FALSE; + + hfp_info("Checking whether device %s is locked by HAL", addon.device_file); ++#if defined(__FreeBSD__) ++ if (libhal_device_is_locked_by_others(hfp_ctx, hfp_udi, "org.freedesktop.Hal.Device.Storage", NULL)) ++#else + if (libhal_device_is_locked_by_others(hfp_ctx, hfp_udi, "org.freedesktop.Hal.Device.Storage", &hfp_error)) ++#endif + { + hfp_info("... device %s is locked by HAL", addon.device_file); ++#if !defined(__FreeBSD__) + dbus_error_free(&hfp_error); ++#endif + is_locked_by_hal = TRUE; + update_proc_title(addon.device_file); + goto skip_check; +@@ -278,9 +300,13 @@ poll_for_media (boolean check_only, bool + hfp_info("... device %s is not locked by HAL", addon.device_file); + is_locked_by_hal = FALSE; + } ++#if defined(__FreeBSD__) ++ should_poll = libhal_device_get_property_bool(hfp_ctx, hfp_udi, "storage.media_check_enabled", NULL); ++#else + dbus_error_free(&hfp_error); + + should_poll = libhal_device_get_property_bool(hfp_ctx, hfp_udi, "storage.media_check_enabled", &hfp_error); ++#endif + dbus_error_free(&hfp_error); + polling_disabled = ! should_poll; + update_proc_title(addon.device_file); +@@ -314,8 +340,12 @@ poll_for_media (boolean check_only, bool + unmount_volumes(); + #endif + ++#if defined(__FreeBSD__) ++ libhal_device_rescan(hfp_ctx, hfp_udi, NULL); ++#else + libhal_device_rescan(hfp_ctx, hfp_udi, &hfp_error); + dbus_error_free(&hfp_error); ++#endif + addon.had_media = has_media; + + return TRUE; +@@ -412,12 +442,19 @@ main (int argc, char **argv) + ! strcmp(driver, "cd")))) && ! strcmp(removable, "true"); + addon.had_media = poll_for_media(TRUE, FALSE); + ++#if defined(__FreeBSD__) ++ if (! libhal_device_addon_is_ready(hfp_ctx, hfp_udi, NULL)) ++ goto end; ++ ++ syscon = dbus_bus_get(DBUS_BUS_SYSTEM, NULL); ++#else + if (! libhal_device_addon_is_ready(hfp_ctx, hfp_udi, &hfp_error)) + goto end; + dbus_error_free(&hfp_error); + + syscon = dbus_bus_get(DBUS_BUS_SYSTEM, &hfp_error); + dbus_error_free(&hfp_error); ++#endif + assert(syscon != NULL); + dbus_connection_set_exit_on_disconnect(syscon, 0); + +@@ -452,12 +489,18 @@ main (int argc, char **argv) + " \n" + " \n" + " \n", ++#if defined(__FreeBSD__) ++ NULL)) ++#else + &hfp_error)) ++#endif + { + hfp_critical("Cannot claim interface 'org.freedesktop.Hal.Device.Storage.Removable'"); + goto end; + } ++#if !defined(__FreeBSD__) + dbus_error_free(&hfp_error); ++#endif + + while (TRUE) + { diff --git a/sysutils/hal/patches/patch-hald_freebsd_hf-devd.c b/sysutils/hal/patches/patch-hald_freebsd_hf-devd.c new file mode 100644 index 00000000000..99ccd28d86c --- /dev/null +++ b/sysutils/hal/patches/patch-hald_freebsd_hf-devd.c @@ -0,0 +1,42 @@ +$NetBSD: patch-hald_freebsd_hf-devd.c,v 1.1 2012/03/31 16:06:56 ryoon Exp $ + +* From FreeBSD ports repository to fix build on FreeBSD 9.0 RELEASE. + +--- hald/freebsd/hf-devd.c.orig 2009-08-24 12:42:29.000000000 +0000 ++++ hald/freebsd/hf-devd.c +@@ -122,7 +122,11 @@ hf_devd_parse_add_remove (const char *ev + g_return_val_if_fail(parent != NULL, FALSE); + + if ((params_ptr = strchr(event, ' ')) ++#if defined(__FreeBSD__) ++ && (at_ptr = strstr(params_ptr, "at ")) ++#else + && (at_ptr = strstr(params_ptr + 1, " at ")) ++#endif + && (parent_ptr = strstr(at_ptr + 4, " on "))) + { + char *params_str; +@@ -130,7 +134,11 @@ hf_devd_parse_add_remove (const char *ev + + *name = g_strndup(event, params_ptr - event); + params_str = g_strndup(params_ptr + 1, at_ptr - params_ptr - 1); ++#if defined(__FreeBSD__) ++ at_str = g_strndup(at_ptr + 3, parent_ptr - at_ptr - 3); ++#else + at_str = g_strndup(at_ptr + 4, parent_ptr - at_ptr - 4); ++#endif + *parent = g_strdup(parent_ptr + 4); + + if (! strcmp(*parent, ".")) /* sys/kern/subr_bus.c */ +@@ -398,7 +406,11 @@ hf_devd_event_cb (GIOChannel *source, GI + hf_devd_process_event(event); + g_free(event); + } ++#if defined(__FreeBSD__) ++ else if (status == G_IO_STATUS_AGAIN || status == G_IO_STATUS_EOF) ++#else + else if (status == G_IO_STATUS_AGAIN) ++#endif + { + hf_devd_init(); + if (hf_devd_inited) diff --git a/sysutils/hal/patches/patch-hald_freebsd_hf-usb2.c b/sysutils/hal/patches/patch-hald_freebsd_hf-usb2.c new file mode 100644 index 00000000000..59806ce24cf --- /dev/null +++ b/sysutils/hal/patches/patch-hald_freebsd_hf-usb2.c @@ -0,0 +1,417 @@ +$NetBSD: patch-hald_freebsd_hf-usb2.c,v 1.1 2012/03/31 16:06:56 ryoon Exp $ + +* From FreeBSD ports repository to fix build on FreeBSD 9.0 RELEASE. + +--- hald/freebsd/hf-usb2.c.orig 2009-08-24 12:42:29.000000000 +0000 ++++ hald/freebsd/hf-usb2.c +@@ -22,7 +22,7 @@ + **************************************************************************/ + + #ifdef HAVE_CONFIG_H +-# include ++#include + #endif + + #include +@@ -42,246 +42,200 @@ + static struct libusb20_backend *hf_usb2_be = NULL; + + static void +-hf_usb2_copy_parent (HalDevice *parent, +- const char *key, +- gpointer user_data) ++hf_usb2_probe_interfaces(HalDevice * parent) + { +- HalDevice *device; ++ int num_interfaces; ++ int i; + +- g_return_if_fail(HAL_IS_DEVICE(parent)); +- g_return_if_fail(HAL_IS_DEVICE(user_data)); ++ g_return_if_fail(HAL_IS_DEVICE(parent)); + +- device = HAL_DEVICE(user_data); +- +- if (! strncmp(key, "usb_device.", strlen("usb_device."))) +- hal_device_copy_property(parent, key, device, key); ++ if (hal_device_property_get_bool(parent, "info.ignore")) ++ return; ++ ++ num_interfaces = hal_device_property_get_int(parent, ++ "usb_device.num_interfaces"); ++ ++ for (i = 0; i < num_interfaces; i++) { ++ HalDevice *device; ++ ++ device = hf_device_new(parent); ++ ++ hal_device_property_set_string(device, "info.subsystem", "usb"); ++ hal_device_property_set_int(device, "usb.interface.number", i); ++ hal_device_copy_property(parent, "info.product", device, "info.product"); ++ hal_device_copy_property(parent, "info.vendor", device, "info.vendor"); ++ hal_device_merge_with_rewrite(device, parent, "usb.", "usb_device."); ++ ++ if (hf_device_preprobe(device)) { ++ const char *driver, *devname; ++ ++ hf_runner_run_sync(device, 0, "hald-probe-usb2-interface", NULL); ++ ++ devname = hal_device_property_get_string(device, ++ "usb.freebsd.devname"); ++ if (devname) ++ hf_devtree_device_set_name(device, devname); ++ ++ driver = hal_device_property_get_string(device, "freebsd.driver"); ++ if (driver) { ++ if (!strcmp(driver, "ukbd")) ++ hf_device_set_input(device, "keyboard", "keys", NULL); ++ else if (!strcmp(driver, "ums") || !strcmp(driver, "atp")) { ++ hf_device_set_input(device, "mouse", NULL, devname); ++ hf_runner_run_sync(device, 0, "hald-probe-mouse", NULL); ++ } else if (!strcmp(driver, "uhid")) { ++ hal_device_property_set_string(device, "info.category", ++ "hiddev"); ++ hal_device_add_capability(device, "hiddev"); ++ hf_device_property_set_string_printf(device, "hiddev.device", ++ "/dev/%s", devname); ++ hal_device_copy_property(device, "info.product", device, ++ "hiddev.product"); ++ hf_runner_run_sync(device, 0, "hald-probe-hiddev", NULL); ++ } else if (!strcmp(driver, "ldev")) { ++ /* Linux driver (webcam) */ ++ ++ /* ++ * XXX This is a hack. Currently, all ldev devices are ++ * webcams. That may not always be the case. Hopefully, ++ * when other Linux driver support is added, there will be ++ * a sysctl or some other way to determine device class. ++ */ ++ hf_usb_add_webcam_properties(device); ++ } else if (!strcmp(driver, "pwc")) { ++ /* Phillips Web Cam */ ++ hf_usb_add_webcam_properties(device); ++ } ++ } else { ++ /* Try and detect webcamd devices. */ ++ hf_runner_run_sync(device, 0, "hald-probe-video4linux", NULL); ++ } ++ ++ hf_usb_device_compute_udi(device); ++ hf_device_add(device); ++ } ++ } + } + + static void +-hf_usb2_probe_interfaces(HalDevice *parent) ++hf_usb2_probe_device(HalDevice * parent, int bus, int addr) + { +- int num_interfaces; +- int i; ++ HalDevice *device; + +- g_return_if_fail(HAL_IS_DEVICE(parent)); ++ g_return_if_fail(HAL_IS_DEVICE(parent)); + +- if (hal_device_property_get_bool(parent, "info.ignore")) +- return; ++ device = hf_device_new(parent); + +- num_interfaces = hal_device_property_get_int(parent, +- "usb_device.num_interfaces"); +- +- for (i = 0; i < num_interfaces; i++) +- { +- HalDevice *device; +- +- device = hf_device_new(parent); +- +- hal_device_property_set_string(device, "info.subsystem", "usb"); +- hal_device_property_set_int(device, "usb.interface.number", i); +- hal_device_property_foreach(parent, hf_usb2_copy_parent, device); +- hal_device_copy_property(parent, "info.product", device, "info.product"); +- hal_device_copy_property(parent, "info.vendor", device, "info.vendor"); +- +- if (hf_device_preprobe(device)) +- { +- const char *driver, *devname; +- +- hf_runner_run_sync(device, 0, "hald-probe-usb2-interface", NULL); +- +- devname = hal_device_property_get_string(device, +- "usb.freebsd.devname"); +- if (devname) +- hf_devtree_device_set_name(device, devname); +- +- driver = hal_device_property_get_string(device, "freebsd.driver"); +- if (driver) +- { +- if (! strcmp(driver, "ukbd")) +- hf_device_set_input(device, "keyboard", NULL); +- else if (! strcmp(driver, "ums")) +- { +- hf_device_set_input(device, "mouse", devname); +- hf_runner_run_sync(device, 0, "hald-probe-mouse", NULL); +- } +- else if (! strcmp(driver, "uhid")) +- { +- hal_device_property_set_string(device, "info.category", +- "hiddev"); +- hal_device_add_capability(device, "hiddev"); +- hf_device_property_set_string_printf(device, "hiddev.device", +- "/dev/%s", devname); +- hal_device_copy_property(device, "info.product", device, +- "hiddev.product"); +- hf_runner_run_sync(device, 0, "hald-probe-hiddev", NULL); +- } +- else if (! strcmp(driver, "ldev")) +- { +- /* Linux driver (webcam) */ +- +- /* +- * XXX This is a hack. Currently, all ldev devices are +- * webcams. That may not always be the case. Hopefully, +- * when other Linux driver support is added, there will be +- * a sysctl or some other way to determine device class. +- */ +- hf_usb_add_webcam_properties(device); +- } +- else if (! strcmp(driver, "pwc")) +- { +- /* Phillips Web Cam */ +- hf_usb_add_webcam_properties(device); +- } +- } ++ hal_device_property_set_string(device, "info.subsystem", "usb_device"); ++ hal_device_property_set_int(device, "usb_device.bus_number", bus); ++ hal_device_property_set_int(device, "usb_device.level_number", 1); ++ hal_device_property_set_int(device, "usb_device.port_number", addr); + +- hf_usb_device_compute_udi(device); +- hf_device_add(device); ++ if (hf_device_preprobe(device)) { ++ hf_runner_run_sync(device, 0, "hald-probe-usb2-device", NULL); ++ hf_usb_device_compute_udi(device); ++ hf_device_add(device); ++ hf_usb2_probe_interfaces(device); + } +- } + } + + static void +-hf_usb2_probe_device (HalDevice *parent, int bus, int addr) ++hf_usb2_privileged_init(void) + { +- HalDevice *device; +- +- g_return_if_fail(HAL_IS_DEVICE(parent)); +- +- device = hf_device_new(parent); ++ hf_usb2_be = libusb20_be_alloc_default(); ++ if (hf_usb2_be == NULL) ++ HAL_INFO(("unable to open USB backend: %s", g_strerror(errno))); ++} + +- hal_device_property_set_string(device, "info.subsystem", "usb_device"); +- hal_device_property_set_int(device, "usb_device.bus_number", bus); +- hal_device_property_set_int(device, "usb_device.level_number", addr - 1); +- hal_device_property_set_int(device, "usb_device.port_number", addr); ++static void ++hf_usb2_new_device(int bus, int addr) ++{ ++ HalDevice *parent; + +- if (hf_device_preprobe(device)) +- { +- hf_runner_run_sync(device, 0, "hald-probe-usb2-device", NULL); +- hf_usb_device_compute_udi(device); ++ parent = hf_devtree_find_from_info(hald_get_gdl(), "usbus", bus); + +- hf_device_add(device); +- } +- else +- return; ++ if (!parent || hal_device_property_get_bool(parent, "info.ignore")) ++ return; + +- hf_usb2_probe_interfaces(device); ++ hf_usb2_probe_device(parent, bus, addr); + } + + static void +-hf_usb2_privileged_init (void) ++hf_usb2_probe(void) + { +- hf_usb2_be = libusb20_be_alloc_default(); +- if (hf_usb2_be == NULL) +- HAL_INFO(("unable to open USB backend: %s", g_strerror(errno))); +-} ++ struct libusb20_device *pdev = NULL; + +-static void +-hf_usb2_probe (void) +-{ +- struct libusb20_device *pdev = NULL; ++ if (hf_usb2_be == NULL) ++ return; + +- if (hf_usb2_be == NULL) +- return; ++ while ((pdev = libusb20_be_device_foreach(hf_usb2_be, pdev))) { ++ hf_usb2_new_device(libusb20_dev_get_bus_number(pdev), ++ libusb20_dev_get_address(pdev)); ++ } + +- while ((pdev = libusb20_be_device_foreach(hf_usb2_be, pdev))) +- { +- HalDevice *parent; +- int bus, addr; +- +- bus = libusb20_dev_get_bus_number(pdev); +- addr = libusb20_dev_get_address(pdev); +- +- if (addr == 1) +- parent = hf_devtree_find_parent_from_info(hald_get_gdl(), "usbus", bus); +- else +- parent = hf_device_store_match(hald_get_gdl(), "usb_device.bus_number", +- HAL_PROPERTY_TYPE_INT32, bus, "usb_device.port_number", +- HAL_PROPERTY_TYPE_INT32, addr - 1, NULL); +- if (! parent || hal_device_property_get_bool(parent, "info.ignore")) +- continue; ++ libusb20_be_free(hf_usb2_be); ++ hf_usb2_be = NULL; ++} + +- hf_usb2_probe_device(parent, bus, addr); +- } ++static gboolean ++hf_usb2_devd_notify(const char *system, ++ const char *subsystem, ++ const char *type, ++ const char *data) ++{ ++ const char *ugen; ++ int bus; ++ int addr; ++ ++ if (!data || strcmp(system, "USB") || strcmp(subsystem, "DEVICE") || ++ (strcmp(type, "ATTACH") && strcmp(type, "DETACH"))) ++ return FALSE; ++ ++ ugen = strstr(data, "ugen="); ++ if (ugen == NULL) { ++ /* ++ * The following case is not required in ++ * FreeBSD 8-stable and newer: ++ */ ++ ugen = strstr(data, "cdev="); ++ if (ugen == NULL) ++ return FALSE; ++ ++ if (sscanf(ugen, "cdev=ugen%i.%i", &bus, &addr) != 2) ++ return FALSE; ++ } else { ++ if (sscanf(ugen, "ugen=ugen%i.%i", &bus, &addr) != 2) ++ return FALSE; ++ } + +- libusb20_be_free(hf_usb2_be); +- hf_usb2_be = NULL; +-} ++ if (strcmp(type, "ATTACH") == 0) { + +-static gboolean +-hf_usb2_devd_add (const char *name, +- GHashTable *params, +- GHashTable *at, +- const char *parent) +-{ +- HalDevice *parent_device; +- int bus, addr, pbus, paddr; ++ HAL_INFO(("received devd attach event, device %s", data)); + +- if (strncmp(name, "ugen", strlen("ugen"))) +- return FALSE; +- else if (strncmp(parent, "ugen", strlen("ugen"))) +- return TRUE; +- +- if (sscanf(name, "ugen%i.%i", &bus, &addr) != 2) +- return FALSE; +- +- if (sscanf(parent, "ugen%i.%i", &pbus, &paddr) != 2) +- return FALSE; +- +- HAL_INFO(("received devd add event for device '%s' with parent '%s'", +- name, parent)); +- +- parent_device = hf_device_store_match(hald_get_gdl(), +- "usb_device.bus_number", HAL_PROPERTY_TYPE_INT32, pbus, +- "usb_device.port_number", HAL_PROPERTY_TYPE_INT32, paddr, NULL); +- +- if (parent_device && ! hal_device_property_get_bool(parent_device, +- "info.ignore")) +- { +- hf_usb2_probe_device(parent_device, bus, addr); +- return TRUE; +- } ++ hf_usb2_new_device(bus, addr); ++ } ++ if (strcmp(type, "DETACH") == 0) { + +- return FALSE; +-} ++ HalDevice *device; + +-static gboolean +-hf_usb2_devd_remove (const char *name, +- GHashTable *params, +- GHashTable *at, +- const char *parent) +-{ +- HalDevice *device; +- int bus, addr; ++ HAL_INFO(("received devd detach event, device %s", data)); + +- if (strncmp(name, "ugen", strlen("ugen"))) +- return FALSE; +- else if (strncmp(parent, "ugen", strlen("ugen"))) +- return TRUE; +- +- if (sscanf(name, "ugen%i.%i", &bus, &addr) != 2) +- return FALSE; +- +- HAL_INFO(("received devd remove event, device %s", name)); +- +- device = hf_device_store_match(hald_get_gdl(), "usb_device.bus_number", +- HAL_PROPERTY_TYPE_INT32, bus, "usb_device.port_number", +- HAL_PROPERTY_TYPE_INT32, addr, NULL); +- +- if (device) +- { +- hf_device_remove_tree(device); +- return TRUE; +- } ++ device = hf_device_store_match(hald_get_gdl(), ++ "usb_device.bus_number", HAL_PROPERTY_TYPE_INT32, bus, ++ "usb_device.port_number", HAL_PROPERTY_TYPE_INT32, addr, ++ "info.bus", HAL_PROPERTY_TYPE_STRING, "usb_device", NULL); + +- return FALSE; ++ if (device) ++ hf_device_remove_tree(device); ++ } ++ return TRUE; + } + + HFHandler hf_usb2_handler = { +- .privileged_init = hf_usb2_privileged_init, +- .probe = hf_usb2_probe ++ .privileged_init = hf_usb2_privileged_init, ++ .probe = hf_usb2_probe + }; + + HFDevdHandler hf_usb2_devd_handler = { +- .add = hf_usb2_devd_add, +- .remove = hf_usb2_devd_remove ++ .notify = hf_usb2_devd_notify + }; diff --git a/sysutils/hal/patches/patch-hald_freebsd_hf-volume.c b/sysutils/hal/patches/patch-hald_freebsd_hf-volume.c new file mode 100644 index 00000000000..090b62f2e64 --- /dev/null +++ b/sysutils/hal/patches/patch-hald_freebsd_hf-volume.c @@ -0,0 +1,20 @@ +$NetBSD: patch-hald_freebsd_hf-volume.c,v 1.1 2012/03/31 16:06:56 ryoon Exp $ + +* From FreeBSD ports repository to fix build on FreeBSD 9.0 RELEASE. + +--- hald/freebsd/hf-volume.c.orig 2009-08-24 12:42:29.000000000 +0000 ++++ hald/freebsd/hf-volume.c +@@ -86,9 +86,12 @@ hf_volume_resolve_fuse (const char *spec + { + if (strcmp(fields[0], special) == 0) + { ++ char *ret; ++ ++ ret = g_strdup(fields[1]); + g_strfreev(fields); + g_strfreev(lines); +- return g_strdup(fields[1]); ++ return ret; + } + } + g_strfreev(fields); diff --git a/sysutils/hal/patches/patch-hald_freebsd_probing_probe-usb2-device.c b/sysutils/hal/patches/patch-hald_freebsd_probing_probe-usb2-device.c new file mode 100644 index 00000000000..1320862172a --- /dev/null +++ b/sysutils/hal/patches/patch-hald_freebsd_probing_probe-usb2-device.c @@ -0,0 +1,46 @@ +$NetBSD: patch-hald_freebsd_probing_probe-usb2-device.c,v 1.1 2012/03/31 16:06:56 ryoon Exp $ + +* From FreeBSD ports repository to fix build on FreeBSD 9.0 RELEASE. + +--- hald/freebsd/probing/probe-usb2-device.c.orig 2009-08-24 12:42:29.000000000 +0000 ++++ hald/freebsd/probing/probe-usb2-device.c +@@ -147,16 +147,16 @@ main(int argc, char **argv) + speed = 12.0; + bcdspeed = 0x01200; + break; +- case LIBUSB20_SPEED_HIGH: ++ case LIBUSB20_SPEED_VARIABLE: + speed = 480.0; + bcdspeed = 0x48000; + break; + case LIBUSB20_SPEED_SUPER: +- speed = 4800.0; +- bcdspeed = 0x480000; ++ speed = 5000.0; ++ bcdspeed = 0x500000; + break; + default: +- ; ++ break; + } + + libhal_device_set_property_double(hfp_ctx, hfp_udi, "usb_device.speed", +@@ -169,6 +169,9 @@ main(int argc, char **argv) + case UD_USB_2_0: + version = 2.0; + break; ++ case 0x0250: ++ version = 2.5; ++ break; + case UD_USB_3_0: + version = 3.0; + break; +@@ -184,7 +187,7 @@ main(int argc, char **argv) + libhal_device_set_property_int(hfp_ctx, hfp_udi, + "usb_device.vendor_id", di.udi_vendorNo, &hfp_error); + libhal_device_set_property_int(hfp_ctx, hfp_udi, +- "usb_device.device_revision_bcd", ddesc->bcdUSB, &hfp_error); ++ "usb_device.device_revision_bcd", ddesc->bcdDevice, &hfp_error); + libhal_device_set_property_string(hfp_ctx, hfp_udi, + "usb_device.serial", di.udi_serial, &hfp_error); + libhal_device_set_property_string(hfp_ctx, hfp_udi, diff --git a/sysutils/hal/patches/patch-hald_freebsd_probing_probe-usb2-interface.c b/sysutils/hal/patches/patch-hald_freebsd_probing_probe-usb2-interface.c new file mode 100644 index 00000000000..a17871c3f8b --- /dev/null +++ b/sysutils/hal/patches/patch-hald_freebsd_probing_probe-usb2-interface.c @@ -0,0 +1,20 @@ +$NetBSD: patch-hald_freebsd_probing_probe-usb2-interface.c,v 1.1 2012/03/31 16:06:56 ryoon Exp $ + +* From FreeBSD ports repository to fix build on FreeBSD 9.0 RELEASE. + +--- hald/freebsd/probing/probe-usb2-interface.c.orig 2009-08-24 12:42:29.000000000 +0000 ++++ hald/freebsd/probing/probe-usb2-interface.c +@@ -58,11 +58,11 @@ main(int argc, char **argv) + if (pbe == NULL) + goto end; + +- busstr = getenv("HAL_PROP_USB_DEVICE_BUS_NUMBER"); ++ busstr = getenv("HAL_PROP_USB_BUS_NUMBER"); + if (! busstr) + goto end; + +- addrstr = getenv("HAL_PROP_USB_DEVICE_PORT_NUMBER"); ++ addrstr = getenv("HAL_PROP_USB_PORT_NUMBER"); + if (! addrstr) + goto end; + -- cgit v1.2.3