Hello community,
here is the log from the commit of package hal
checked in at Wed Mar 21 16:01:16 CET 2007.
--------
--- hal/hal.changes 2007-03-15 11:31:47.000000000 +0100
+++ /mounts/work_src_done/STABLE/hal/hal.changes 2007-03-21 15:45:58.263237000 +0100
@@ -1,0 +2,16 @@
+Tue Mar 20 14:27:31 CET 2007 - dkukawka@suse.de
+
+- added patches:
+ - hal-validate_error_name.diff: validate DBusError name and try
+ to fix if there is output from stderr to avoid HAL call DIE()
+ - hal-add-alsa_midi_devices.diff: added support for ALSA midi
+ - hal-add_soundcard_fix_device_file_handling.diff: added alsa
+ soundcard device from sysfs if available (kernel compiled with
+ !CONFIG_SYSFS_DEPRECATED)
+ - hal-cleanup_acpi-addon_DBusError_handling.diff: cleanup/remove
+ unneeded dbus_error_init() calls
+ - hal-fix-hal_device_manager_about_dialog.diff: show about dialog
+ only one time
+ - hal-fix-eject_path.diff: fix path to eject (b.n.c #256270)
+
+-------------------------------------------------------------------
New:
----
hal-add-alsa_midi_devices.diff
hal-add_soundcard_fix_device_file_handling.diff
hal-cleanup_acpi-addon_DBusError_handling.diff
hal-fix-eject_path.diff
hal-fix-hal_device_manager_about_dialog.diff
hal-validate_error_name.diff
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ hal.spec ++++++
--- /var/tmp/diff_new_pack.X18413/_old 2007-03-21 15:58:42.000000000 +0100
+++ /var/tmp/diff_new_pack.X18413/_new 2007-03-21 15:58:42.000000000 +0100
@@ -23,7 +23,7 @@
License: Other uncritical OpenSource License
Group: System/Daemons
Version: 0.5.8_git20070314
-Release: 2
+Release: 3
Autoreqprov: on
Summary: Daemon for Collecting Hardware Information
# SUSE specific patches
@@ -42,6 +42,12 @@
Patch103: hal-add-IBMHotkey_Support_v2_incl_TabletPC.diff
Patch104: hal-usb_speed_and_version_in_double.diff
Patch105: hal-add-cdrom_capabilities.diff
+Patch106: hal-validate_error_name.diff
+Patch107: hal-add-alsa_midi_devices.diff
+Patch108: hal-add_soundcard_fix_device_file_handling.diff
+Patch109: hal-cleanup_acpi-addon_DBusError_handling.diff
+Patch110: hal-fix-hal_device_manager_about_dialog.diff
+Patch111: hal-fix-eject_path.diff
#
# need to backport
Patch400: hal-performance_pci.ids_v5.diff
@@ -150,6 +156,12 @@
%patch103 -p1
%patch104 -p1
%patch105 -p1
+%patch106 -p1
+%patch107 -p1
+%patch108 -p1
+%patch109 -p1
+%patch110 -p1
+%patch111 -p1
popd
#%patch400 -p1
@@ -281,6 +293,19 @@
%{_bindir}/hal-device-manager
%changelog
+* Tue Mar 20 2007 - dkukawka@suse.de
+- added patches:
+ - hal-validate_error_name.diff: validate DBusError name and try
+ to fix if there is output from stderr to avoid HAL call DIE()
+ - hal-add-alsa_midi_devices.diff: added support for ALSA midi
+ - hal-add_soundcard_fix_device_file_handling.diff: added alsa
+ soundcard device from sysfs if available (kernel compiled with
+ !CONFIG_SYSFS_DEPRECATED)
+ - hal-cleanup_acpi-addon_DBusError_handling.diff: cleanup/remove
+ unneeded dbus_error_init() calls
+ - hal-fix-hal_device_manager_about_dialog.diff: show about dialog
+ only one time
+ - hal-fix-eject_path.diff: fix path to eject (b.n.c #256270)
* Thu Mar 15 2007 - dkukawka@suse.de
- fixed spec file
* Wed Mar 14 2007 - dkukawka@suse.de
++++++ hal-add-alsa_midi_devices.diff ++++++
commit a0af30e5d063ca863713d365b54bb0ca45814341
Author: Danny Kukawka
Date: Mon Mar 19 14:53:24 2007 +0100
added support for ALSA MIDI devices
Added support for ALSA MIDI devices (/sys/class/sound/midiC*). Updated
SPEC for alsa.type property.
diff --git a/doc/spec/hal-spec-properties.xml b/doc/spec/hal-spec-properties.xml
index aacf370..6b88ccf 100644
--- a/doc/spec/hal-spec-properties.xml
+++ b/doc/spec/hal-spec-properties.xml
@@ -4300,6 +4300,16 @@
<row>
<entry></entry>
<entry>
+ <literal>midi</literal>
+ </entry>
+ <entry></entry>
+ <entry>
+ Stream is MIDI device.
+ </entry>
+ </row>
+ <row>
+ <entry></entry>
+ <entry>
<literal>playback</literal>
</entry>
<entry></entry>
diff --git a/hald/linux/device.c b/hald/linux/device.c
index 74e440b..29630e6 100644
--- a/hald/linux/device.c
+++ b/hald/linux/device.c
@@ -953,7 +953,8 @@ sound_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_
} else
hal_device_property_set_string (d, "info.product", "ALSA Device");
}
- } else if (sscanf (device, "hwC%dD%d", &cardnum, &devicenum) == 2) {
+ } else if ((sscanf (device, "hwC%dD%d", &cardnum, &devicenum) == 2) ||
+ (sscanf (device, "midiC%dD%d", &cardnum, &devicenum) == 2)) {
hal_device_property_set_string (d, "info.category", "alsa");
hal_device_add_capability (d, "alsa");
@@ -966,9 +967,13 @@ sound_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_
asound_card_id_set (cardnum, d, "alsa.card_id");
- hal_device_property_set_string (d, "alsa.type", "hw_specific");
-
- snprintf (buf, sizeof (buf), "%s ALSA hardware specific Device", hal_device_property_get_string (d, "alsa.card_id"));
+ if (!strncmp (device, "hwC", 3)) {
+ hal_device_property_set_string (d, "alsa.type", "hw_specific");
+ snprintf (buf, sizeof (buf), "%s ALSA hardware specific Device", hal_device_property_get_string (d, "alsa.card_id"));
+ } else if (!strncmp (device, "midiC", 5)) {
+ hal_device_property_set_string (d, "alsa.type", "midi");
+ snprintf (buf, sizeof (buf), "%s ALSA MIDI Device", hal_device_property_get_string (d, "alsa.card_id"));
+ }
hal_device_property_set_string (d, "info.product", buf);
} else if (!strncmp (device, "dsp", 3) || !strncmp (device, "adsp", 4) ||
@@ -1100,7 +1105,7 @@ sound_compute_udi (HalDevice *d)
hal_device_property_get_string (d, "oss.type"),
hal_device_property_get_int (d, "oss.device"));
} else if (hal_device_has_property(d, "alsa.type")) {
- /* handle global ALAS devices */
+ /* handle global ALSA devices */
hal_util_compute_udi (hald_get_gdl (), udi, sizeof (udi),
"%s_alsa_%s",
hal_device_property_get_string (d, "info.parent"),
++++++ hal-add_soundcard_fix_device_file_handling.diff ++++++
diff --git a/hald/linux/device.c b/hald/linux/device.c
index 29630e6..183d8b2 100644
--- a/hald/linux/device.c
+++ b/hald/linux/device.c
@@ -234,7 +234,7 @@ input_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_
int eventdev_num;
HalDevice *d = NULL;
- if (device_file == NULL)
+ if (device_file[0] == '\0')
goto out;
/* only care about evdev input devices */
@@ -630,7 +630,7 @@ usbclass_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *pare
d = NULL;
- if (parent_dev == NULL || parent_path == NULL || device_file == NULL) {
+ if (parent_dev == NULL || parent_path == NULL || device_file[0] == '\0') {
goto out;
}
@@ -853,14 +853,31 @@ sound_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_
d = NULL;
- if (device_file == NULL)
- goto out;
+ HAL_INFO (("sound_add: sysfs_path=%s device_file=%s parent_dev=0x%08x parent_path=%s", sysfs_path, device_file, parent_dev, parent_path));
d = hal_device_new ();
hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
device = hal_util_get_last_element(sysfs_path);
- if (parent_dev == NULL || parent_path == NULL) {
+
+ if (device_file[0] == '\0' && parent_dev == NULL && parent_path == NULL) {
+ goto out;
+ } else if (device_file[0] == '\0' && parent_dev != NULL && parent_path != NULL) {
+ HAL_INFO(("sound_add: handle sound card %s", sysfs_path));
+ /* handle card devices */
+ hal_device_property_set_string (d, "info.category", "sound");
+ hal_device_add_capability (d, "sound");
+ hal_device_property_set_string (d, "sound.originating_device", hal_device_get_udi (parent_dev));
+ hal_device_property_set_string (d, "sound.physical_device", hal_device_get_udi (parent_dev));
+ hal_device_property_set_string (d, "info.parent", hal_device_get_udi (parent_dev));
+
+ if (sscanf (device, "card%d", &cardnum) == 1) {
+ hal_device_property_set_int (d, "sound.card", cardnum);
+ asound_card_id_set (cardnum, d, "sound.card_id");
+ snprintf (buf, sizeof (buf), "%s Sound Card", hal_device_property_get_string (d, "sound.card_id"));
+ hal_device_property_set_string (d, "info.product", buf);
+ }
+ } else if (parent_dev == NULL || parent_path == NULL) {
/* handle global ALSA and OSS devices, these devices are for all ALSA/OSS Sound devices
so we append them to /org/freedesktop/Hal/devices/computer */
hal_device_property_set_string (d, "info.parent", "/org/freedesktop/Hal/devices/computer");
@@ -1090,7 +1107,13 @@ sound_compute_udi (HalDevice *d)
{
gchar udi[256];
- if (hal_device_has_property(d, "alsa.card")) {
+ if (hal_device_has_property(d, "sound.card")) {
+ /* don't include card number as it may not be persistent across reboots */
+ hal_util_compute_udi (hald_get_gdl (), udi, sizeof (udi),
+ "%s_sound_card_%i",
+ hal_device_property_get_string (d, "info.parent"),
+ hal_device_property_get_string (d, "sound.card"));
+ } else if (hal_device_has_property(d, "alsa.card")) {
/* don't include card number as it may not be persistent across reboots */
hal_util_compute_udi (hald_get_gdl (), udi, sizeof (udi),
"%s_alsa_%s_%i",
@@ -1138,7 +1161,7 @@ serial_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent
d = NULL;
- if (parent_dev == NULL || parent_path == NULL || device_file == NULL) {
+ if (parent_dev == NULL || parent_path == NULL || device_file[0] == '\0') {
goto out;
}
@@ -2467,7 +2490,7 @@ firewire_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *pare
if (is_device) {
- if (device_file == NULL)
+ if (device_file[0] == '\0')
goto out;
str = g_strdup_printf ("%s/config_rom", sysfs_path);
++++++ hal-cleanup_acpi-addon_DBusError_handling.diff ++++++
diff --git a/hald/linux/addons/addon-acpi.c b/hald/linux/addons/addon-acpi.c
index f0561ca..fa31c56 100644
--- a/hald/linux/addons/addon-acpi.c
+++ b/hald/linux/addons/addon-acpi.c
@@ -100,6 +100,8 @@ main_loop (LibHalContext *ctx, FILE *eventfp)
DBusError error;
char event[256];
+ dbus_error_init (&error);
+
while (fgets (event, sizeof event, eventfp))
{
HAL_DEBUG (("event is '%s'", event));
@@ -115,7 +117,6 @@ main_loop (LibHalContext *ctx, FILE *eventfp)
HAL_DEBUG (("button event"));
/* TODO: only rescan if button got state */
- dbus_error_init (&error);
if (libhal_device_rescan (ctx, udi, &error)) {
dbus_error_init (&error);
type = libhal_device_get_property_string(ctx, udi,
@@ -131,11 +132,9 @@ main_loop (LibHalContext *ctx, FILE *eventfp)
}
} else if (strncmp (acpi_path, "ac_adapter", sizeof ("ac_adapter") - 1) == 0) {
HAL_DEBUG (("ac_adapter event"));
- dbus_error_init (&error);
libhal_device_rescan (ctx, udi, &error);
} else if (strncmp (acpi_path, "battery", sizeof ("battery") - 1) == 0) {
HAL_DEBUG (("battery event"));
- dbus_error_init (&error);
libhal_device_rescan (ctx, udi, &error);
}
++++++ hal-fix-eject_path.diff ++++++
diff --git a/tools/hal-storage-shared.c b/tools/hal-storage-shared.c
index 5931cd2..d7b2c0b 100644
--- a/tools/hal-storage-shared.c
+++ b/tools/hal-storage-shared.c
@@ -489,7 +489,7 @@ line_found:
g_free (mount_point_to_unmount);
}
-#define EJECT "/usr/bin/eject"
+#define EJECT "eject"
void
handle_eject (LibHalContext *hal_ctx,
@@ -577,7 +577,7 @@ try_open_excl_again:
if (!g_spawn_sync ("/",
args,
NULL,
- 0,
+ G_SPAWN_SEARCH_PATH | G_SPAWN_LEAVE_DESCRIPTORS_OPEN,
NULL,
NULL,
&sout,
++++++ hal-fix-hal_device_manager_about_dialog.diff ++++++
diff --git a/tools/device-manager/DeviceManager.py b/tools/device-manager/DeviceManager.py
index 3477b64..914f183 100644
--- a/tools/device-manager/DeviceManager.py
+++ b/tools/device-manager/DeviceManager.py
@@ -29,8 +29,12 @@ class DeviceManager(LibGladeApplication):
def on_about_activate(self, w):
"""Show the about dialog."""
- gnome.ui.About(Const.NAME_LONG, Const.VERSION, Const.COPYRIGHT,
- Const.INFO, Const.AUTHORS).show()
+ try:
+ self.about.destroy()
+ finally:
+ self.about = gnome.ui.About(Const.NAME_LONG, Const.VERSION, Const.COPYRIGHT,
+ Const.INFO, Const.AUTHORS).show()
+ self.about.show()
def on_virtual_devices_activate(self, obj):
self.dont_show_virtual = 1 - self.dont_show_virtual
++++++ hal-validate_error_name.diff ++++++
diff --git a/hald/hald_dbus.c b/hald/hald_dbus.c
index 07612c5..cdd6bd4 100644
--- a/hald/hald_dbus.c
+++ b/hald/hald_dbus.c
@@ -3299,6 +3299,10 @@ hald_exec_method_cb (HalDevice *d, guint32 exit_type,
}
dbus_message_unref (reply);
} else if (exp_name != NULL && exp_detail != NULL) {
+ if (!is_valid_interface_name (exp_name)) {
+ exp_detail = g_strconcat (exp_name, " \n ", exp_detail, NULL);
+ exp_name = "org.freedesktop.Hal.Device.UnknownError";
+ }
reply = dbus_message_new_error (message, exp_name, exp_detail);
if (reply == NULL) {
/* error name may be invalid - assume caller fucked up and use a generic HAL error name */
@@ -3331,6 +3335,7 @@ hald_exec_method_cb (HalDevice *d, guint32 exit_type,
dbus_message_unref (reply);
}
+ g_free(exp_detail);
dbus_message_unref (message);
}
diff --git a/hald/util.c b/hald/util.c
index 0356943..3179277 100644
--- a/hald/util.c
+++ b/hald/util.c
@@ -54,6 +54,26 @@
#include "util.h"
+/**
+ * Determine wether the given character is valid as the first character
+ * in a name.
+ */
+#define VALID_INITIAL_NAME_CHARACTER(c) \
+ ( ((c) >= 'A' && (c) <= 'Z') || \
+ ((c) >= 'a' && (c) <= 'z') || \
+ ((c) == '_') )
+
+/**
+ * Determine wether the given character is valid as a second or later
+ * character in a name
+ */
+#define VALID_NAME_CHARACTER(c) \
+ ( ((c) >= '0' && (c) <= '9') || \
+ ((c) >= 'A' && (c) <= 'Z') || \
+ ((c) >= 'a' && (c) <= 'z') || \
+ ((c) == '_') )
+
+
gboolean
hal_util_remove_trailing_slash (gchar *path)
{
@@ -1203,3 +1223,44 @@ hal_util_readlink (const char *link)
return path_buffer;
}
+
+gboolean
+is_valid_interface_name (const char *name) {
+
+ const char *end;
+ const char *last_dot;
+
+ last_dot = NULL;
+
+ if (strlen(name) == 0)
+ return FALSE;
+
+ end = name + strlen(name);
+
+ if (*name == '.') /* disallow starting with a . */
+ return FALSE;
+ else if (!VALID_INITIAL_NAME_CHARACTER (*name))
+ return FALSE;
+ else
+ ++name;
+
+ while (name != end) {
+ if (*name == '.') {
+ if ((name + 1) == end)
+ return FALSE;
+ else if (!VALID_INITIAL_NAME_CHARACTER (*(name + 1)))
+ return FALSE;
+ last_dot = name;
+ ++name; /* we just validated the next char, so skip two */
+ }
+ else if (!VALID_NAME_CHARACTER (*name)) {
+ return FALSE;
+ }
+ ++name;
+ }
+ if (last_dot == NULL)
+ return FALSE;
+
+ return TRUE;
+}
+
diff --git a/hald/util.h b/hald/util.h
index 5265b6d..27ad0d5 100644
--- a/hald/util.h
+++ b/hald/util.h
@@ -112,4 +112,6 @@ gboolean hal_util_is_mounted_by_hald (const char *mount_point);
char *hal_util_readlink (const char *link);
+gboolean is_valid_interface_name (const char *name);
+
#endif /* UTIL_H */
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
---------------------------------------------------------------------
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org