From 52e039f3b0a5749f706b97491087b9632d30512f Mon Sep 17 00:00:00 2001 From: Dmitry Torokhov Date: Mon, 2 Nov 2009 16:59:10 -0800 Subject: Correctly identify touchpads BTN_TOUCH (as well as ABS_PRESSURE) is used not only by touchpads but by touchscreens as well. The proper ceck for a touchpad is presence of BTN_TOOL_FINGER and absence of BTN_TOOL_PEN (the latter to filter out some tablets that use BTN_TOOL_FINGER). Tablet matching should be on either BTN_TOOL_PEN or BTN_STYLUS. Signed-off-by: Dmitry Torokhov --- hald/linux/device.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/hald/linux/device.c b/hald/linux/device.c index 2eca1ef3..e7c9d4fa 100644 --- a/hald/linux/device.c +++ b/hald/linux/device.c @@ -1157,12 +1157,12 @@ input_test_abs (HalDevice *d, const char *sysfs_path) { num_bits_key = input_str_to_bitmask (s, bitmask_key, sizeof (bitmask_key)); - if (test_bit (BTN_STYLUS, bitmask_key)) { + if (test_bit (BTN_STYLUS, bitmask_key) || test_bit (BTN_TOOL_PEN, bitmask_key)) { hal_device_add_capability (d, "input.tablet"); goto out; } - if (test_bit (BTN_TOUCH, bitmask_key)) { + if (test_bit (BTN_TOOL_FINGER, bitmask_key) && !test_bit (BTN_TOOL_PEN, bitmask_key)) { hal_device_add_capability (d, "input.touchpad"); goto out; } @@ -1181,11 +1181,6 @@ input_test_abs (HalDevice *d, const char *sysfs_path) goto out; } } - - if (test_bit (ABS_PRESSURE, bitmask_abs)) { - hal_device_add_capability (d, "input.touchpad"); - goto out; - } } out: ; -- cgit v1.2.3 From 17f24242b5739a27940e0cc164a856b9584481f7 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Mon, 30 Nov 2009 23:19:48 +0100 Subject: update NEWS for 0.5.14 release --- NEWS | 105 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 103 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 12b3b56a..05b368d2 100644 --- a/NEWS +++ b/NEWS @@ -1,8 +1,8 @@ ========== -HAL 0.5.14 +HAL 0.5.14 "Dave, this conversation can serve no purpose anymore. Goodbye." ========== -Released Month 00, 2009. +Released November 30, 2009. Requirements for HAL 0.5.14: @@ -31,6 +31,107 @@ Requirements for HAL 0.5.14: Contributors to HAL 0.5.14: +Arnout Vandecappelle (1): + don't remove scsi_host if there are still targets using it + +Aurelien Jarno (2): + Fix build failure on GNU/kFreeBSD + generalize keyboard detection code for FreeBSD + +C. Scott Ananian (1): + remove action_parameters from DBus XML for IsCallerPrivileged + +Danny Kukawka (40): + fixed commit 36d076bf26350e022731cb7c2c9f4e840dd25e37 + move ssb bus code to the correct place + add SSB bus to SPEC + cleanup: don't set udi manually if hal_device_set_udi() was used + add IBM Ebus to SPEC + hide more MBR, bootstrap and other partitions from desktop + fix code doc for resolve_udiprop_path() + hald_dbus.c: fix DBusError handling + hald_runner.c: fix usage of DBusError + ci-tracker.c: fix usage of DBusError + ck-tracker.c: fix usage of DBusError + more DBusError fixes + another DBusError fix + fix configure to get --disable-console-kit working + fix probe-ieee1394-unit.c DBusError and LibHalContext handling + fix DBusError handling in probe directory + free string after usage + fix usage of deprected g_io_channel_seek() + replace deprecated g_basename() with g_path_get_basename() + replace another deprecated g_basename() with g_path_get_basename() + replace deprecated g_strcasecmp() with g_ascii_strcasecmp() + fix DBusError handling in linux addon directory + Merge branch 'master' of ssh://dkukawka@git.freedesktop.org/git/hal + fix compiler warning in libhal-storage + fix commit 141ca8cd7b768ddefa1bfaa563cbef4337e32b7c + extend debug message in device_reprobe() + fix hotplug_event_process_queue() to get reprobe working + handle keyboard backlight leds via org.freedesktop.Hal.Device.KeyboardBacklight + changed massif-hald.sh to work the same way as run-hald.sh + changed valgrind-hald.sh to write a logfile + fix memory leaks due to usage of g_path_get_basename() + add hald/valgrind.log to .gitignore + fix memory leak in acpi_button_add() in error case + fix memory leak due to usage of g_strdup() + fix DBusError handling in freebsd code + adopted version of commit 122e41a10 to fix docking stations + add keyboard_backlight.* and *.num_levels to led class + update SPEC with kbd_backlight(.*) and leds.num_levels + always set leds.num_levels since it's mandatory + add a check for leds.num_levels to addon-leds.c + +Dmitry Torokhov (1): + Correctly identify touchpads + +Drew Moseley (1): + add libhal_device_property_remove_watch_all() to libhal + +Frederic Crozat (1): + hide Windows recovery partitions on pre-installed Futjisu laptops + +Joe Marcus Clarke (17): + re-enable libvolume_id support for FreeBSD + add USB2 support to the FreeBSD backend + add support for reading ufsids + add some missing storage properties + add USB2 support + fix support for power and brightness management + fix a problem building the FreeBSD backend + add USB2 support + add support for mouse device probing + add support for Fuse mounts + add support for newer GEOM types + add support for polling of mouse devices + add missing LDADD and CFLAGS for addon-mouse.c + add locking support to the storage addon + update time handling functions + ignore probe devices + fix DBusError handling and a memory leak + +Johannes Hessellund (1): + read brightness from actual_brightness and not from brightness + +Kay Sievers (1): + configure.in: require blkid >= 2.15 from util-linux-ng + +Maciej Grela (1): + Remove the 512 byte limit for PATH in hald.c + +Martin Poole (1): + Fix a segfault in the mdraid code -- see rh#507782 for more info + +Michael Biebl (7): + Make libhald_freebsd_probe.la a noinst library. + fix a misleading warning in ondemand_set_consider_nice() + Fix a crasher in hal_util_get_last_element + Fix unconditional usage of PATH_MAX + Support relative paths in umount.hal + list "relatime" as valid mount option on Linux. + Fix build failures with binutils-gold + ========== HAL 0.5.13 ========== -- cgit v1.2.3 From 8e26deb441fe07fe940eeabadc7ff41a0564e0bb Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Mon, 30 Nov 2009 23:41:46 +0100 Subject: post-release bump to 0.5.14 bump version in configure.in, add stub to NEWS --- NEWS | 33 +++++++++++++++++++++++++++++++++ configure.in | 2 +- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 05b368d2..779cedaa 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,36 @@ +========== +HAL 0.5.15 +========== + +Released Month 00, 2009. + +Requirements for HAL 0.5.15: + + - Linux kernel >= 2.6.22 (CONFIG_SYSFS_DEPRECATED=n) + - udev >= 125 (Linux only) + - util-linux-ng >= 2.15 + - bash >= 2.0 + - dbus >= 0.61 (with glib bindings) + - glib >= 2.10.0 + - expat >= 1.95.8 + - hal-info >= 20080310 (older versions can work too) + - libusb >= 0.1.10a (optional) + - pciutils >= 2.2.3 (optional) + - dmidecode >= 2.7 (optional) + - parted >= 1.7.1 (optional) + - cryptsetup-luks >= 1.0.1 (optional, needs LUKS patches) + - libsmbios >= 0.13.4 (optional, for DELL machines, Linux only, + prefered version >= 2.0.3) + - dellWirelessCtl >= 0.13.4 (optional, for Dell machines, must live in + /usr/bin/, Linux only, prefered version >= 2.0.3) + - gperf >= 3.0.3-2 (optional, for Re-map multimedia keys, + Linux only) + - PolicyKit >= 0.5 (optional) + - ConsoleKit >= 0.2.0 (optional, needed if use PolicyKit) + - pm-utils >= 0.99.2 or newer (optional) + +Contributors to HAL 0.5.15: + ========== HAL 0.5.14 "Dave, this conversation can serve no purpose anymore. Goodbye." ========== diff --git a/configure.in b/configure.in index e8aa021e..a8fda516 100644 --- a/configure.in +++ b/configure.in @@ -7,7 +7,7 @@ dnl Process this file with autoconf to produce a configure script. # AC_PREREQ(2.59c) -AC_INIT(hal, 0.5.14, david@fubar.dk) +AC_INIT(hal, 0.5.15, david@fubar.dk) AM_INIT_AUTOMAKE([gnu 1.9]) AM_MAINTAINER_MODE m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) -- cgit v1.2.3 From fce91df8ba7f305c624baf1f06961c040b088ecc Mon Sep 17 00:00:00 2001 From: Joe Marcus Clarke Date: Mon, 7 Dec 2009 19:05:27 -0500 Subject: Fix libusb detection on Linux Adjust the FreeBSD libusb20 code so that it does not interfere with the Linux libusb detection. Reported by: Robby Workman --- configure.in | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/configure.in b/configure.in index a8fda516..83635950 100644 --- a/configure.in +++ b/configure.in @@ -479,9 +479,6 @@ if test "x$with_libpci" != xno ; then fi AM_CONDITIONAL([HAVE_LIBPCI], [test "x$USE_LIBPCI" = "xyes"]) -USE_LIBUSB20=no -USE_LIBUSB=no -LIBUSB20_LIBS="" AC_ARG_WITH([backend], AS_HELP_STRING([--with-backend=], [backend to use (linux/solaris/freebsd/dummy)]), @@ -510,21 +507,25 @@ AM_CONDITIONAL(HALD_COMPILE_FREEBSD, [test x$HALD_BACKEND = xfreebsd], [Compilin AM_CONDITIONAL(HALD_COMPILE_SOLARIS, [test x$HALD_BACKEND = xsolaris], [Compiling for Solaris]) AC_SUBST(HALD_BACKEND) if test "x$HALD_BACKEND" = "xfreebsd"; then - AC_CHECK_LIB([usb20], [libusb20_dev_get_info], [USE_LIBUSB20=yes], [USE_LIBUSB20=no]) -fi -if test "x$USE_LIBUSB20" = "xno"; then - AC_CHECK_LIB([usb], [libusb20_dev_get_info], [USE_LIBUSB=yes], [USE_LIBUSB=no]) -fi -AM_CONDITIONAL([HAVE_LIBUSB20],[test "x$USE_LIBUSB20" = "xyes"]) -AM_CONDITIONAL([HAVE_LIBUSB20],[test "x$USE_LIBUSB" = "xyes"]) -if test "x$USE_LIBUSB20" = "xyes"; then - AC_DEFINE(HAVE_LIBUSB20, 1, [Set if we need libusb20]) - LIBUSB20_LIBS="-lusb20" -elif test "x$USE_LIBUSB" = "xyes"; then - AC_DEFINE(HAVE_LIBUSB20, 1, [Set if we need libsub20]) - LIBUSB20_LIBS="-lusb" + USE_BSDLIBUSB20=no + USE_BSDLIBUSB=no + LIBUSB20_LIBS="" + AC_CHECK_LIB([usb20], [libusb20_dev_get_info], [USE_BSDLIBUSB20=yes], [USE_BSDLIBUSB20=no]) + if test "x$USE_BSDLIBUSB20" = "xno"; then + AC_CHECK_LIB([usb], [libusb20_dev_get_info], [USE_BSDLIBUSB=yes], [USE_BSDLIBUSB=no]) + fi + AM_CONDITIONAL([HAVE_LIBUSB20],[test "x$USE_BSDLIBUSB20" = "xyes" -o "x$USE_BSDLIBUSB" = "xyes"]) + if test "x$USE_BSDLIBUSB20" = "xyes"; then + AC_DEFINE(HAVE_LIBUSB20, 1, [Set if we need libusb20]) + LIBUSB20_LIBS="-lusb20" + elif test "x$USE_BSDLIBUSB" = "xyes"; then + AC_DEFINE(HAVE_LIBUSB20, 1, [Set if we need libsub20]) + LIBUSB20_LIBS="-lusb" + fi + AC_SUBST(LIBUSB20_LIBS) +else + AM_CONDITIONAL([HAVE_LIBUSB20], [false]) fi -AC_SUBST(LIBUSB20_LIBS) dnl DBUS API is subject to changes AC_DEFINE_UNQUOTED(DBUS_API_SUBJECT_TO_CHANGE, [], [DBUS API is subject to change]) -- cgit v1.2.3 From b293b2677de7f733412113a590086f719580020d Mon Sep 17 00:00:00 2001 From: Joe Marcus Clarke Date: Fri, 25 Dec 2009 11:18:06 -0500 Subject: Fix (or workaround) quite a few bugs with newusb interaction * Remove needless uses of hfp_error which can help avoid assertion crashes. * Reduce the number of times storage devices are refreshed. * Allow hald to forcibly unmount devices which disappear. --- hald/freebsd/addons/addon-storage.c | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/hald/freebsd/addons/addon-storage.c b/hald/freebsd/addons/addon-storage.c index 31250373..cd285811 100644 --- a/hald/freebsd/addons/addon-storage.c +++ b/hald/freebsd/addons/addon-storage.c @@ -107,8 +107,7 @@ hf_addon_storage_update (void) if (hf_addon_storage_cdrom_eject_pressed(cdrom)) { - libhal_device_emit_condition(hfp_ctx, hfp_udi, "EjectPressed", "", &hfp_error); - dbus_error_free(&hfp_error); + libhal_device_emit_condition(hfp_ctx, hfp_udi, "EjectPressed", "", NULL); } hfp_cdrom_free(cdrom); @@ -164,19 +163,17 @@ unmount_volumes (void) "block.storage_device", hfp_udi, &num_volumes, - &hfp_error)) != NULL) + NULL)) != NULL) { int i; - dbus_error_free(&hfp_error); - for (i = 0; i < num_volumes; i++) { char *vol_udi; vol_udi = volumes[i]; - if (libhal_device_get_property_bool(hfp_ctx, vol_udi, "volume.is_mounted", &hfp_error)) + if (libhal_device_get_property_bool(hfp_ctx, vol_udi, "volume.is_mounted", NULL)) { DBusMessage *msg = NULL; DBusMessage *reply = NULL; @@ -185,7 +182,6 @@ unmount_volumes (void) char **options = NULL; char *devfile; - dbus_error_free(&hfp_error); hfp_info("Forcing unmount of volume '%s'", vol_udi); dbus_connection = libhal_ctx_get_dbus_connection(hfp_ctx); @@ -265,10 +261,9 @@ poll_for_media (boolean check_only, boolean force) check_lock_state = FALSE; hfp_info("Checking whether device %s is locked by HAL", addon.device_file); - if (libhal_device_is_locked_by_others(hfp_ctx, hfp_udi, "org.freedesktop.Hal.Device.Storage", &hfp_error)) + if (libhal_device_is_locked_by_others(hfp_ctx, hfp_udi, "org.freedesktop.Hal.Device.Storage", NULL)) { hfp_info("... device %s is locked by HAL", addon.device_file); - dbus_error_free(&hfp_error); is_locked_by_hal = TRUE; update_proc_title(addon.device_file); goto skip_check; @@ -278,10 +273,8 @@ poll_for_media (boolean check_only, boolean force) hfp_info("... device %s is not locked by HAL", addon.device_file); is_locked_by_hal = FALSE; } - dbus_error_free(&hfp_error); - should_poll = libhal_device_get_property_bool(hfp_ctx, hfp_udi, "storage.media_check_enabled", &hfp_error); - dbus_error_free(&hfp_error); + should_poll = libhal_device_get_property_bool(hfp_ctx, hfp_udi, "storage.media_check_enabled", NULL); polling_disabled = ! should_poll; update_proc_title(addon.device_file); } @@ -314,8 +307,7 @@ poll_for_media (boolean check_only, boolean force) unmount_volumes(); #endif - libhal_device_rescan(hfp_ctx, hfp_udi, &hfp_error); - dbus_error_free(&hfp_error); + libhal_device_rescan(hfp_ctx, hfp_udi, NULL); addon.had_media = has_media; return TRUE; @@ -412,12 +404,10 @@ main (int argc, char **argv) ! strcmp(driver, "cd")))) && ! strcmp(removable, "true"); addon.had_media = poll_for_media(TRUE, FALSE); - if (! libhal_device_addon_is_ready(hfp_ctx, hfp_udi, &hfp_error)) + if (! libhal_device_addon_is_ready(hfp_ctx, hfp_udi, NULL)) goto end; - dbus_error_free(&hfp_error); - syscon = dbus_bus_get(DBUS_BUS_SYSTEM, &hfp_error); - dbus_error_free(&hfp_error); + syscon = dbus_bus_get(DBUS_BUS_SYSTEM, NULL); assert(syscon != NULL); dbus_connection_set_exit_on_disconnect(syscon, 0); @@ -452,12 +442,11 @@ main (int argc, char **argv) " \n" " \n" " \n", - &hfp_error)) + NULL)) { hfp_critical("Cannot claim interface 'org.freedesktop.Hal.Device.Storage.Removable'"); goto end; } - dbus_error_free(&hfp_error); while (TRUE) { -- cgit v1.2.3 From a3ea9ecc75a414e35ae763a92a2c3fa05a7ca0b3 Mon Sep 17 00:00:00 2001 From: Joe Marcus Clarke Date: Fri, 25 Dec 2009 11:21:23 -0500 Subject: Fix (or workaround) quite a few bugs with newusb interaction * Allow the newusb module to compile with the recent input changes from kFreeBSD. * Make sure usb2 devices attach properly to the device tree with the correct parent. * Properly detect when newusb devices are added and removed. --- hald/freebsd/hf-usb2.c | 47 ++++++++++++++++++++++++++++++++++++----------- 1 file changed, 36 insertions(+), 11 deletions(-) diff --git a/hald/freebsd/hf-usb2.c b/hald/freebsd/hf-usb2.c index fff49e0a..f1a02e20 100644 --- a/hald/freebsd/hf-usb2.c +++ b/hald/freebsd/hf-usb2.c @@ -98,10 +98,10 @@ hf_usb2_probe_interfaces(HalDevice *parent) if (driver) { if (! strcmp(driver, "ukbd")) - hf_device_set_input(device, "keyboard", NULL); - else if (! strcmp(driver, "ums")) + hf_device_set_input(device, "keyboard", "keys", devname); + else if (! strcmp(driver, "ums") || ! strcmp(driver, "atp")) { - hf_device_set_input(device, "mouse", devname); + hf_device_set_input(device, "mouse", NULL, devname); hf_runner_run_sync(device, 0, "hald-probe-mouse", NULL); } else if (! strcmp(driver, "uhid")) @@ -192,11 +192,12 @@ hf_usb2_probe (void) addr = libusb20_dev_get_address(pdev); if (addr == 1) - parent = hf_devtree_find_parent_from_info(hald_get_gdl(), "usbus", bus); + parent = hf_devtree_find_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); + HAL_PROPERTY_TYPE_INT32, addr - 1, "info.bus", + HAL_PROPERTY_TYPE_STRING, "usb_device", NULL); if (! parent || hal_device_property_get_bool(parent, "info.ignore")) continue; @@ -216,7 +217,13 @@ hf_usb2_devd_add (const char *name, HalDevice *parent_device; int bus, addr, pbus, paddr; - if (strncmp(name, "ugen", strlen("ugen"))) + if (! parent) + return FALSE; + + if (strncmp(name, "ugen", strlen("ugen")) && + ! strncmp(parent, "uhub", strlen("uhub"))) + return TRUE; + else if (strncmp(name, "ugen", strlen("ugen"))) return FALSE; else if (strncmp(parent, "ugen", strlen("ugen"))) return TRUE; @@ -232,7 +239,8 @@ hf_usb2_devd_add (const char *name, 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); + "usb_device.port_number", HAL_PROPERTY_TYPE_INT32, paddr, "info.bus", + HAL_PROPERTY_TYPE_STRING, "usb_device", NULL); if (parent_device && ! hal_device_property_get_bool(parent_device, "info.ignore")) @@ -255,8 +263,6 @@ hf_usb2_devd_remove (const char *name, 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; @@ -265,7 +271,8 @@ hf_usb2_devd_remove (const char *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); + HAL_PROPERTY_TYPE_INT32, addr, "info.bus", + HAL_PROPERTY_TYPE_STRING, "usb_device", NULL); if (device) { @@ -276,6 +283,23 @@ hf_usb2_devd_remove (const char *name, return FALSE; } +static gboolean +hf_usb2_devd_notify (const char *system, + const char *subsystem, + const char *type, + const char *data) +{ + if (! data || strcmp(system, "DEVFS") || strcmp(subsystem, "CDEV") || + (strcmp(type, "CREATE") && strcmp(type, "DESTROY"))) + return FALSE; + + if (! strncmp(data, "cdev=ugen", strlen("cdev=ugen")) || + ! strncmp(data, "cdev=usb", strlen("cdev=usb"))) + return TRUE; + + return FALSE; +} + HFHandler hf_usb2_handler = { .privileged_init = hf_usb2_privileged_init, .probe = hf_usb2_probe @@ -283,5 +307,6 @@ HFHandler hf_usb2_handler = { HFDevdHandler hf_usb2_devd_handler = { .add = hf_usb2_devd_add, - .remove = hf_usb2_devd_remove + .remove = hf_usb2_devd_remove, + .notify = hf_usb2_devd_notify }; -- cgit v1.2.3 From 44cf7dc7ec4e8d8eb92e816e94d6611256e1e0d6 Mon Sep 17 00:00:00 2001 From: Joe Marcus Clarke Date: Fri, 25 Dec 2009 11:23:01 -0500 Subject: Fix a use-after-free bug Do not use a freed pointer in the Fuse support code. --- hald/freebsd/hf-volume.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hald/freebsd/hf-volume.c b/hald/freebsd/hf-volume.c index 249d2bd1..07cf8050 100644 --- a/hald/freebsd/hf-volume.c +++ b/hald/freebsd/hf-volume.c @@ -86,9 +86,12 @@ hf_volume_resolve_fuse (const char *special) { 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); -- cgit v1.2.3 From c4deea5c3413ed8272d7bbdd75594d136c31ea42 Mon Sep 17 00:00:00 2001 From: Joe Marcus Clarke Date: Fri, 25 Dec 2009 11:24:05 -0500 Subject: Fix some bugs with volume probing * Fix support for the dynamic UFSID labels. * Do not crash on an assertion due to a "dirty" DBusError object. --- hald/freebsd/probing/probe-volume.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/hald/freebsd/probing/probe-volume.c b/hald/freebsd/probing/probe-volume.c index 73e03182..e4e16899 100644 --- a/hald/freebsd/probing/probe-volume.c +++ b/hald/freebsd/probing/probe-volume.c @@ -574,6 +574,7 @@ main (int argc, char **argv) snprintf(ufsid, sizeof(ufsid), "%08x%08x", ufsdisk.d_fs.fs_id[0], ufsdisk.d_fs.fs_id[1]); libhal_device_set_property_string(hfp_ctx, hfp_udi, "volume.freebsd.ufsid", ufsid, &hfp_error); + dbus_error_free(&hfp_error); ufs_devs = libhal_manager_find_device_string_match(hfp_ctx, "volume.freebsd.ufsid", ufsid, @@ -582,16 +583,17 @@ main (int argc, char **argv) dbus_error_free(&hfp_error); for (i = 0; i < num_udis; i++) { - if (ufs_devs[i] != NULL) + if (ufs_devs[i] != NULL && strcmp(ufs_devs[i], hfp_udi)) { gboolean mounted; mounted = libhal_device_get_property_bool(hfp_ctx, ufs_devs[i], "volume.is_mounted", &hfp_error); - dbus_error_free(&hfp_error); + dbus_error_free(&hfp_error); if (mounted) - { + { libhal_device_set_property_bool(hfp_ctx, hfp_udi, "volume.ignore", TRUE, &hfp_error); dbus_error_free(&hfp_error); + break; } } } -- cgit v1.2.3 From 1ef86a4af1c88faf9f9d89e2399dda1b0d693d0f Mon Sep 17 00:00:00 2001 From: Joe Marcus Clarke Date: Fri, 25 Dec 2009 11:26:08 -0500 Subject: Fix some bugs in detecting storage object changes * Add support for file systems with spaces in their label names. * Ignore ufsid labels outright. These labels are special since they are created and destroyed based on whether or not the underlying device is mounted or not. This should fix some weird remounting problems with UFS volumes as well as some mount contention. * Attempt to workaround the GEOM lock race by sleeping half of a second when a DESTROY event is seen by the storage subsystem. Additionally, protect against kern.geom.conftxt returning NULL. When this happens, all disks would get removed, and that's bad. --- hald/freebsd/hf-storage.c | 39 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/hald/freebsd/hf-storage.c b/hald/freebsd/hf-storage.c index 3bc5ab92..3833ec8e 100644 --- a/hald/freebsd/hf-storage.c +++ b/hald/freebsd/hf-storage.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -418,10 +419,39 @@ hf_storage_parse_conftxt (const char *conftxt) continue; } + /* XXX This is a hack, but we need to ignore dynamic labels like + * ufsids which are created and destroyed based on whether or not + * the actual device is mounted or not. If we don't then strange + * things happen in applications like nautilus. + */ + if ((! strcmp(fields[1], "LABEL") || + ! strcmp(fields[1], "BSD")) && + ! strncmp(fields[2], "ufsid/", strlen("ufsid/"))) + { + g_strfreev(fields); + continue; + } + geom_obj = g_new0(Geom_Object, 1); geom_obj->class = g_strdup(fields[1]); geom_obj->dev = g_strdup(fields[2]); + /* Allow for spaces in label names. */ + if (! strcmp(fields[1], "LABEL")) + { + int j; + + for (j = 3; g_strv_length(fields) > (j + 2) && + strcmp(fields[j + 2], "i"); j++) + { + char *tmp; + + tmp = g_strdup_printf("%s %s", geom_obj->dev, fields[j]); + g_free(geom_obj->dev); + geom_obj->dev = tmp; + } + } + geom_obj->type = -1; /* We use -1 here to denote a missing type. */ geom_obj->hash = hash; @@ -589,11 +619,16 @@ hf_storage_devd_notify (const char *system, char *conftxt; GSList *new_disks; - if (strcmp(system, "DEVFS") || strcmp(subsystem, "CDEV") || + if (! data || strcmp(system, "DEVFS") || strcmp(subsystem, "CDEV") || (strcmp(type, "CREATE") && strcmp(type, "DESTROY"))) return FALSE; + if (! strcmp(type, "DESTROY")) + g_usleep(G_USEC_PER_SEC/2); + conftxt = hf_get_string_sysctl(NULL, "kern.geom.conftxt"); + if (! conftxt) + return FALSE; new_disks = hf_storage_parse_conftxt(conftxt); g_free(conftxt); @@ -669,7 +704,7 @@ hf_storage_conftxt_timeout_cb (gpointer data) if (hf_is_waiting) return TRUE; - hf_storage_devd_notify("DEVFS", "CDEV", "CREATE", NULL); + hf_storage_devd_notify("DEVFS", "CDEV", "CREATE", ""); return TRUE; } -- cgit v1.2.3 From dcb2829b8eff61463b0869614ddb07b1c86cecaa Mon Sep 17 00:00:00 2001 From: Sebastian Andrzej Siewior Date: Wed, 30 Dec 2009 12:42:52 +0100 Subject: linux/probe-input: don't use error prio init it may happen in the out: case that LIBHAL_FREE_DBUS_ERROR (&error) is called before the error structure is initialized via dbus_error_init (&error). This could lead to a segfault during startup as seen in dmesg: |Intel AES-NI instructions are not detected. |padlock: VIA PadLock not detected. |hald-probe-inpu[1793]: segfault at 2 ip 00007f656fb68969 sp 00007fff39eeb950 error 4 in libc-2.10.2.so[7f656faf3000+14a000] |hald-probe-inpu[1796]: segfault at 2 ip 00007fa2c3293969 sp 00007fffd92a5dd0 error 4 in libc-2.10.2.so[7fa2c321e000+14a000] |hald-probe-inpu[1797]: segfault at 2 ip 00007f1d08ba2969 sp 00007fff34244e30 error 4 in libc-2.10.2.so[7f1d08b2d000+14a000] |hald-probe-inpu[1799]: segfault at 2 ip 00007f35c0e3d969 sp 00007fffe5ec7ee0 error 4 in libc-2.10.2.so[7f35c0dc8000+14a000] |hald-probe-inpu[1800]: segfault at 2 ip 00007f931c556969 sp 00007fffe1825b60 error 4 in libc-2.10.2.so[7f931c4e1000+14a000] |hald-probe-inpu[1801]: segfault at 2 ip 00007f5156d9a969 sp 00007fff4e620af0 error 4 in libc-2.10.2.so[7f5156d25000+14a000] |RPC: Registered udp transport module. |RPC: Registered tcp transport module. What I run into seems to be reported as Debian #562068 [0]. This patch makes the segfault go away on my machine. [0] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=562068 Signed-off-by: Sebastian Andrzej Siewior Signed-off-by: Martin Pitt --- hald/linux/probing/probe-input.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hald/linux/probing/probe-input.c b/hald/linux/probing/probe-input.c index 94e9929b..cad47d30 100644 --- a/hald/linux/probing/probe-input.c +++ b/hald/linux/probing/probe-input.c @@ -70,6 +70,7 @@ main (int argc, char *argv[]) fd = -1; setup_logger (); + dbus_error_init (&error); button_type = getenv ("HAL_PROP_BUTTON_TYPE"); if (button_type == NULL) @@ -96,7 +97,6 @@ main (int argc, char *argv[]) if (udi == NULL) goto out; - dbus_error_init (&error); if ((ctx = libhal_ctx_init_direct (&error)) == NULL) goto out; -- cgit v1.2.3 From a2c3dd5a04d79265772c09c4280606d5c2ed72c6 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Mon, 4 Jan 2010 16:56:13 +0100 Subject: Bump HAL_PATH_MAX to 4096 Some bits in the code use realpath() with destination paths of size HAL_PATH_MAX. This potentially breaks on systems where PATH_MAX is bigger than HAL_PATH_MAX (which was 512 until now). Since we can't use PATH_MAX directly (due to platforms like GNU/Hurd, which apparently don't have it), just bump HAL_PATH_MAX to 4096 (as PATH_MAX is on Linux), to avoid potential buffer overflows and also fix hal on Linux when enabling FORTIFY in gcc. https://bugs.freedesktop.org/show_bug.cgi?id=25888 --- hald/util.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hald/util.h b/hald/util.h index c2a1584b..7883333c 100644 --- a/hald/util.h +++ b/hald/util.h @@ -38,7 +38,7 @@ #endif #define HAL_NAME_MAX 256 -#define HAL_PATH_MAX 512 +#define HAL_PATH_MAX 4096 gboolean hal_util_remove_trailing_slash (gchar *path); -- cgit v1.2.3 From 6dccf8e3ad181e8f56b1d2a994ec50a1953a1c2d Mon Sep 17 00:00:00 2001 From: Michael Witten Date: Tue, 5 Jan 2010 18:53:17 -0600 Subject: Policy: handle `input.touchpad' explicitly This commit essentially duplicates the policy for: and then changes `input.mouse' to `input.touchpad'. This is necessary because in Linus Torvalds's Linux repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git the following commit: commit 7105d2ea73e1391b681d0e1212c42f561c64d429 Author: Dmitry Torokhov Date: Fri Dec 11 23:54:54 2009 -0800 Input: ALPS - do not set REL_X/REL_Y capabilities on the touchpad Relative events are only reported via secondary device therefore device associated with the touchpad should not advertise these capabilities. Signed-off-by: Dmitry Torokhov made these few changes: diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c index a3f492a..b03e7e0 100644 --- a/drivers/input/mouse/alps.c +++ b/drivers/input/mouse/alps.c @@ -487,6 +487,17 @@ int alps_init(struct psmouse *psmouse) if (alps_hw_init(psmouse)) goto init_fail; + /* + * Undo part of setup done for us by psmouse core since touchpad + * is not a relative device. + */ + __clear_bit(EV_REL, dev1->evbit); + __clear_bit(REL_X, dev1->relbit); + __clear_bit(REL_Y, dev1->relbit); + + /* + * Now set up our capabilities. + */ dev1->evbit[BIT_WORD(EV_KEY)] |= BIT_MASK(EV_KEY); dev1->keybit[BIT_WORD(BTN_TOUCH)] |= BIT_MASK(BTN_TOUCH); dev1->keybit[BIT_WORD(BTN_TOOL_FINGER)] |= BIT_MASK(BTN_TOOL_FINGER); so that HAL no longer adds: input.mouse to an ALPS touchpad's: info.capabilities so that HAL no longer marks the ALPS touchpad with: input.x11_driver = 'evdev' because the policy file: fdi/policy/10osvendor/10-x11-input.fdi doesn't define the policy for: which was previous unnecessary because everything used to be caught by the policy for: Signed-off-by: Michael Witten Signed-off-by: Martin Pitt --- fdi/policy/10osvendor/10-x11-input.fdi | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/fdi/policy/10osvendor/10-x11-input.fdi b/fdi/policy/10osvendor/10-x11-input.fdi index cff8fc55..8bbe263e 100644 --- a/fdi/policy/10osvendor/10-x11-input.fdi +++ b/fdi/policy/10osvendor/10-x11-input.fdi @@ -16,6 +16,14 @@ + + mouse + + evdev + + + -- cgit v1.2.3 From c083adf8e79036a2e9a7218ea556f73671c08ff1 Mon Sep 17 00:00:00 2001 From: Michael Biebl Date: Sat, 23 Jan 2010 14:58:03 -0500 Subject: Link against -lrt for clock_gettime Link against -lrt as we need that for clock_gettime on kfreebsd. AC_SEARCH_LIBS should handle the case nicely that on freebsd this function is already part of libc. --- configure.in | 1 + 1 file changed, 1 insertion(+) diff --git a/configure.in b/configure.in index 83635950..2c74863f 100644 --- a/configure.in +++ b/configure.in @@ -507,6 +507,7 @@ AM_CONDITIONAL(HALD_COMPILE_FREEBSD, [test x$HALD_BACKEND = xfreebsd], [Compilin AM_CONDITIONAL(HALD_COMPILE_SOLARIS, [test x$HALD_BACKEND = xsolaris], [Compiling for Solaris]) AC_SUBST(HALD_BACKEND) if test "x$HALD_BACKEND" = "xfreebsd"; then + AC_SEARCH_LIBS([clock_gettime], [rt]) USE_BSDLIBUSB20=no USE_BSDLIBUSB=no LIBUSB20_LIBS="" -- cgit v1.2.3 From eb3879122867c6376c9c7e155d8919e0609f9fdf Mon Sep 17 00:00:00 2001 From: Michael Biebl Date: Sat, 23 Jan 2010 15:01:21 -0500 Subject: Check for availability of libufs on (k)freebsd Check for availability of libufs on (k)freebsd and compile the code conditionally. --- configure.in | 8 ++++++++ hald/freebsd/probing/Makefile.am | 2 +- hald/freebsd/probing/probe-volume.c | 4 ++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/configure.in b/configure.in index 2c74863f..2394c456 100644 --- a/configure.in +++ b/configure.in @@ -508,6 +508,14 @@ AM_CONDITIONAL(HALD_COMPILE_SOLARIS, [test x$HALD_BACKEND = xsolaris], [Compilin AC_SUBST(HALD_BACKEND) if test "x$HALD_BACKEND" = "xfreebsd"; then AC_SEARCH_LIBS([clock_gettime], [rt]) + LIBUFS_LIBS="" + AC_CHECK_HEADERS([libufs.h], + [AC_CHECK_LIB([libufs], [ufs_disk_fillout], [USE_LIBUFS="yes"], [], [])]) + if test "x$USE_LIBUFS" = "xyes"; then + AC_DEFINE(HAVE_LIBUFS, 1, [Set if we have libufs]) + LIBUFS_LIBS="-lufs" + AC_SUBST(LIBUFS_LIBS) + fi USE_BSDLIBUSB20=no USE_BSDLIBUSB=no LIBUSB20_LIBS="" diff --git a/hald/freebsd/probing/Makefile.am b/hald/freebsd/probing/Makefile.am index 3e439b5f..67b8dcf5 100644 --- a/hald/freebsd/probing/Makefile.am +++ b/hald/freebsd/probing/Makefile.am @@ -67,5 +67,5 @@ hald_probe_volume_CPPFLAGS = $(AM_CPPFLAGS) @GLIB_CFLAGS@ @VOLUME_ID_CFLAGS@ hald_probe_volume_LDADD = \ @GLIB_LIBS@ \ @VOLUME_ID_LIBS@ \ - -lufs \ + @LIBUFS_LIBS@ \ $(top_builddir)/hald/freebsd/libprobe/libhald_freebsd_probe.la diff --git a/hald/freebsd/probing/probe-volume.c b/hald/freebsd/probing/probe-volume.c index e4e16899..9c8abde4 100644 --- a/hald/freebsd/probing/probe-volume.c +++ b/hald/freebsd/probing/probe-volume.c @@ -38,10 +38,12 @@ #include #include #include +#ifdef HAVE_LIBUFS #include #include #include #include +#endif /* HAVE_LIBUFS */ #include #include #include @@ -561,6 +563,7 @@ main (int argc, char **argv) libhal_device_set_property_bool(hfp_ctx, hfp_udi, "volume.ignore", has_children || is_swap, &hfp_error); +#ifdef HAVE_LIBUFS if (vid && ! strcmp (vid->type, "ufs")) { struct uufsd ufsdisk; @@ -602,6 +605,7 @@ main (int argc, char **argv) ufs_disk_close(&ufsdisk); } } +#endif /* HAVE_LIBUFS */ if (has_children) usage = "partitiontable"; -- cgit v1.2.3 From 8f7a14e44b019b80a1e77fea7896fd8533011a1f Mon Sep 17 00:00:00 2001 From: Michael Biebl Date: Sat, 23 Jan 2010 15:04:14 -0500 Subject: Fix compilation when building against libusb2 Use the correct macros for kFreeBSD. --- hald/freebsd/hf-usb.c | 8 ++++---- hald/freebsd/probing/probe-hiddev.c | 2 +- hald/freebsd/probing/probe-usb2-device.c | 4 ++-- hald/freebsd/probing/probe-usb2-interface.c | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/hald/freebsd/hf-usb.c b/hald/freebsd/hf-usb.c index 280e0dbd..3f360871 100644 --- a/hald/freebsd/hf-usb.c +++ b/hald/freebsd/hf-usb.c @@ -32,8 +32,8 @@ #include #include #include -#if __FreeBSD_version < 800092 -#if __FreeBSD_version >= 800064 +#if (__FreeBSD_version < 800092) || (__FreeBSD_kernel_version < 800092) +#if (__FreeBSD_version >= 800064) || (__FreeBSD_kernel_version >= 800064) #include #else #include @@ -47,9 +47,9 @@ #include "hf-devtree.h" #include "hf-util.h" -#if __FreeBSD_version < 800092 +#if (__FreeBSD_version < 800092) || (__FreeBSD_kernel_version < 800092) #define HF_USB_DEVICE "/dev/usb" -#if __FreeBSD_version < 800066 +#if (__FreeBSD_version < 800066) || (__FreeBSD_kernel_version < 800066) #define HF_USB2_DEVICE "/dev/usb " #else #define HF_USB2_DEVICE "/dev/usbctl" diff --git a/hald/freebsd/probing/probe-hiddev.c b/hald/freebsd/probing/probe-hiddev.c index f0c598b3..054b159c 100644 --- a/hald/freebsd/probing/probe-hiddev.c +++ b/hald/freebsd/probing/probe-hiddev.c @@ -34,7 +34,7 @@ #include #include #else -#if __FreeBSD_version >= 800064 +#if (__FreeBSD_version >= 800064) || (__FreeBSD_kernel_version >= 800064) #include #else #include diff --git a/hald/freebsd/probing/probe-usb2-device.c b/hald/freebsd/probing/probe-usb2-device.c index 129a1b1f..8a3596a4 100644 --- a/hald/freebsd/probing/probe-usb2-device.c +++ b/hald/freebsd/probing/probe-usb2-device.c @@ -34,7 +34,7 @@ #include #include -#if __FreeBSD_version >= 800064 +#if (__FreeBSD_version >= 800064) || (__FreeBSD_kernel_version >= 800064) #include #else #include @@ -73,7 +73,7 @@ main(int argc, char **argv) { struct LIBUSB20_DEVICE_DESC_DECODED *ddesc; struct LIBUSB20_CONFIG_DESC_DECODED *cdesc; -#if __FreeBSD_version >= 800092 +#if (__FreeBSD_version >= 800092) || (__FreeBSD_kernel_version >= 800092) struct usb_device_info di; #else struct usb2_device_info di; diff --git a/hald/freebsd/probing/probe-usb2-interface.c b/hald/freebsd/probing/probe-usb2-interface.c index f57bb77a..a41e047e 100644 --- a/hald/freebsd/probing/probe-usb2-interface.c +++ b/hald/freebsd/probing/probe-usb2-interface.c @@ -34,7 +34,7 @@ #include #include -#if __FreeBSD_version >= 800064 +#if (__FreeBSD_version >= 800064) || (__FreeBSD_kernel_version >= 800064) #include #else #include -- cgit v1.2.3 From 0065d6e2d15f1d3c6c46b8f23781508286b85b23 Mon Sep 17 00:00:00 2001 From: Joe Marcus Clarke Date: Sat, 23 Jan 2010 15:05:39 -0500 Subject: Fix the properties for USB interface devices USB interfaces in hal should have usb.X for properties, compared to usb_device for the parent. --- hald/freebsd/hf-usb2.c | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/hald/freebsd/hf-usb2.c b/hald/freebsd/hf-usb2.c index f1a02e20..301846f7 100644 --- a/hald/freebsd/hf-usb2.c +++ b/hald/freebsd/hf-usb2.c @@ -41,22 +41,6 @@ static struct libusb20_backend *hf_usb2_be = NULL; -static void -hf_usb2_copy_parent (HalDevice *parent, - const char *key, - gpointer user_data) -{ - HalDevice *device; - - g_return_if_fail(HAL_IS_DEVICE(parent)); - g_return_if_fail(HAL_IS_DEVICE(user_data)); - - device = HAL_DEVICE(user_data); - - if (! strncmp(key, "usb_device.", strlen("usb_device."))) - hal_device_copy_property(parent, key, device, key); -} - static void hf_usb2_probe_interfaces(HalDevice *parent) { @@ -79,9 +63,9 @@ hf_usb2_probe_interfaces(HalDevice *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"); + hal_device_merge_with_rewrite(device, parent, "usb.", "usb_device."); if (hf_device_preprobe(device)) { -- cgit v1.2.3 From 4c1d80dd2a77adf3392ca7f9479abb727636b9e5 Mon Sep 17 00:00:00 2001 From: Joe Marcus Clarke Date: Sat, 23 Jan 2010 20:32:17 -0500 Subject: Fix the environment variable names Now that the property names for USB interfaces have been fixed, correct the environment variable names. --- hald/freebsd/probing/probe-usb2-interface.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hald/freebsd/probing/probe-usb2-interface.c b/hald/freebsd/probing/probe-usb2-interface.c index a41e047e..9c0523a7 100644 --- a/hald/freebsd/probing/probe-usb2-interface.c +++ b/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 From 9c940ee21009abb338182f5774d6ece0e9dd6eb9 Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Thu, 26 Nov 2009 10:39:05 +0000 Subject: If /usr/sbin/hald does not exist then exit the haldaemon init script with retval 1 for LSB compliance --- hald/haldaemon.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hald/haldaemon.in b/hald/haldaemon.in index cd6dfde4..33ee31a5 100755 --- a/hald/haldaemon.in +++ b/hald/haldaemon.in @@ -12,7 +12,7 @@ # # Sanity checks. -[ -x @sbindir@/hald ] || exit 0 +[ -x @sbindir@/hald ] || exit 1 # Source function library. . @sysconfdir@/rc.d/init.d/functions -- cgit v1.2.3