Hello community, here is the log from the commit of package hal checked in at Mon Oct 30 17:58:35 CET 2006. -------- --- hal/hal.changes 2006-10-23 18:50:14.000000000 +0200 +++ /mounts/work_src_done/STABLE/hal/hal.changes 2006-10-30 16:15:10.000000000 +0100 @@ -1,0 +2,28 @@ +Mon Oct 30 15:14:44 CET 2006 - dkukawka@suse.de + +- fixed bugs: + - b.n.c #210297: added --datadir to spec file + - b.n.c #214461: detect Ipod Nano2 correct + - unreported: HAL show storage devices again +- updated patches: + - hal-performance_pci.ids_v5.diff: adapted patch to current code, + fixed code in search func and speed up the search + - hal-add-tabletPC_support.diff: adapted to current code + - hal-panasonic-acpi-suse.diff: updates from seife@suse.de +- removed patches: + - hal-performance-properties*: they don't work anymore because + of code changes in HAL ... maybe adapt them later + - hal-do-not-close-shared-connection-thoenig-01.patch: removed + upstream gone patch +- renamed patches we need to port from hal-fix-* hal-toport-* + +------------------------------------------------------------------- +Sun Oct 29 11:07:05 CET 2006 - hmacht@suse.de + +- patch hal-add-pm-utils-support.diff: + do it so that upstream will accept it +- patch hal-fix-cpufreq-dbus-restart.patch: + fix the addon so that it properly survives D-Bus restarts +- Requires: pm-utils + +------------------------------------------------------------------- Old: ---- hal-0.5.8_git20060927.tar.bz2 hal-do-not-close-shared-connection-thoenig-01.patch hal-fix-mount_159475.diff hal-fix-mount_device_fstab_with_user_option_172870.diff hal-fix-storage-policy-fixed-drives.diff hal-performance-pci_ids_v2.patch hal-performance-properties1.diff hal-performance-properties2.diff hal-performance-properties_fix_compiler_warnings.diff New: ---- hal-0.5.8_git20061027.tar.bz2 hal-fix-cpufreq-dbus-restart.patch hal-performance_pci.ids_v5.diff hal-toport-mount_159475.diff hal-toport-mount_device_fstab_with_user_option_172870.diff hal-toport-storage-policy-fixed-drives.diff ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ hal.spec ++++++ --- /var/tmp/diff_new_pack.qk4ugh/_old 2006-10-30 17:57:59.000000000 +0100 +++ /var/tmp/diff_new_pack.qk4ugh/_new 2006-10-30 17:57:59.000000000 +0100 @@ -1,5 +1,5 @@ # -# spec file for package hal (Version 0.5.8_git20060927) +# spec file for package hal (Version 0.5.8_git20061027) # # Copyright (c) 2006 SUSE LINUX Products GmbH, Nuernberg, Germany. # This file and all modifications and additions to the pristine @@ -16,47 +16,44 @@ URL: http://freedesktop.org/Software/hal %define dbus_version 0.61 %define dbus_release 1 -License: Other License(s), see package, Other uncritical OpenSource License +License: Other uncritical OpenSource License, Other License(s), see package Group: System/Daemons -Version: 0.5.8_git20060927 -Release: 14 +Version: 0.5.8_git20061027 +Release: 1 Autoreqprov: on Summary: Daemon for Collecting Hardware Information # SUSE specific patches Patch0: %{name}-add-tabletPC_support.diff -Patch1: %{name}-performance-properties1.diff -Patch2: %{name}-performance-properties2.diff -Patch3: %{name}-performance-properties_fix_compiler_warnings.diff -Patch4: %{name}-fix-mount_options.diff -Patch5: %{name}-panasonic-acpi-suse.diff -Patch6: hal-pci.diff -Patch7: hal-configure.diff +Patch1: %{name}-fix-mount_options.diff +Patch2: %{name}-panasonic-acpi-suse.diff # only on SLED10 to avoid dbus update Patch50: hal-back_to_dbus_0.6.0.diff # # submitted (or planed to do in next time) upstream patches -Patch100: hal-performance-pci_ids_v2.patch +Patch100: hal-performance_pci.ids_v5.diff Patch101: hal-add-standby-support.diff Patch102: hal-fix-util_compute_time_remaining_warning_highTime.diff Patch103: hal-fix-power-privileges.diff -Patch104: hal-do-not-close-shared-connection-thoenig-01.patch +Patch104: hal-pci.diff Patch105: hal-add-pm-utils-support.diff +Patch106: hal-configure.diff +Patch107: hal-fix-cpufreq-dbus-restart.patch # # patches for testing: #Patch300: hal_debug.diff ## ## external patches from HAL List and backports patches we need to port or to check # unclear how to fix this atm -Patch400: %{name}-fix-mount_159475.diff +Patch400: %{name}-toport-mount_159475.diff # Kay Sievers is working on a integration in the hal mount binary -Patch401: %{name}-fix-mount_device_fstab_with_user_option_172870.diff -Patch402: hal-fix-storage-policy-fixed-drives.diff +Patch401: %{name}-toport-mount_device_fstab_with_user_option_172870.diff +Patch402: %{name}-toport-storage-policy-fixed-drives.diff # Sources: Source0: %{name}-%{version}.tar.bz2 Source1: rc.hal Source2: 90-hal.rules Prereq: /usr/sbin/groupadd /usr/sbin/useradd /etc/init.d/boot.localfs -Requires: dbus-1 >= %{dbus_version}-%{dbus_release}, dbus-1-glib >= %{dbus_version}-%{dbus_release}, aaa_base, PolicyKit +Requires: dbus-1 >= %{dbus_version}-%{dbus_release}, dbus-1-glib >= %{dbus_version}-%{dbus_release}, aaa_base, PolicyKit, pm-utils Provides: hotplugctl Obsoletes: hotplugctl BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -136,20 +133,17 @@ %prep %setup -n %{name}-%{version} -q %patch0 -p1 -%patch100 +%patch100 -p1 %patch1 -p1 -#%patch2 -p1 -#%patch3 -%patch4 -p1 -%patch5 -p0 -%patch6 -%patch7 +%patch2 -p0 #%patch50 -p1 %patch101 %patch102 -p1 %patch103 -p1 -%patch104 -p1 +%patch104 %patch105 +%patch106 +%patch107 -p1 #%patch300 %build @@ -163,6 +157,7 @@ --libdir=%{_libdir} \ --libexecdir=%{_libexecdir}/hal \ --mandir=%{_mandir} \ + --datadir=%{_datadir} \ --with-init-scripts=suse \ --with-hwdata=/usr/share \ --enable-hotplug-map \ @@ -263,6 +258,28 @@ %{_bindir}/hal-device-manager %changelog -n hal +* Mon Oct 30 2006 - dkukawka@suse.de +- fixed bugs: + - b.n.c #210297: added --datadir to spec file + - b.n.c #214461: detect Ipod Nano2 correct + - unreported: HAL show storage devices again +- updated patches: + - hal-performance_pci.ids_v5.diff: adapted patch to current code, + fixed code in search func and speed up the search + - hal-add-tabletPC_support.diff: adapted to current code + - hal-panasonic-acpi-suse.diff: updates from seife@suse.de +- removed patches: + - hal-performance-properties*: they don't work anymore because + of code changes in HAL ... maybe adapt them later + - hal-do-not-close-shared-connection-thoenig-01.patch: removed + upstream gone patch +- renamed patches we need to port from hal-fix-* hal-toport-* +* Sun Oct 29 2006 - hmacht@suse.de +- patch hal-add-pm-utils-support.diff: + do it so that upstream will accept it +- patch hal-fix-cpufreq-dbus-restart.patch: + fix the addon so that it properly survives D-Bus restarts +- Requires: pm-utils * Mon Oct 23 2006 - hmacht@suse.de - patch hal-add-pm-utils-support.diff: call pm-utils first, then try powersave if not available ++++++ hal-0.5.8_git20060927.tar.bz2 -> hal-0.5.8_git20061027.tar.bz2 ++++++ ++++ 18422 lines of diff (skipped) ++++++ hal-add-tabletPC_support.diff ++++++ --- /var/tmp/diff_new_pack.qk4ugh/_old 2006-10-30 17:58:03.000000000 +0100 +++ /var/tmp/diff_new_pack.qk4ugh/_new 2006-10-30 17:58:03.000000000 +0100 @@ -56,43 +56,44 @@ check: for f in $(dist_fdi_DATA); do \ -diff --git a/hald/linux/physdev.c b/hald/linux/physdev.c -index c2ae795..fa5975b 100644 ---- a/hald/linux/physdev.c -+++ b/hald/linux/physdev.c -@@ -416,11 +416,31 @@ ide_compute_udi (HalDevice *d) +diff --git a/hald/linux/device.c b/hald/linux/device.c +index 9f1a86a..6ffe7c6 100644 +--- a/hald/linux/device.c ++++ b/hald/linux/device.c +@@ -1379,11 +1379,32 @@ ide_compute_udi (HalDevice *d) } /*--------------------------------------------------------------------------------------------------------------*/ +static void +pnp_set_serial_info (const gchar *sysfs_path, HalDevice *d) { + -+ hal_util_set_int_elem_from_file (d, "pnp.serial.irq", sysfs_path, "resources", "irq", 0, 10, TRUE); -+ ++ hal_util_set_int_elem_from_file (d, "pnp.serial.irq", sysfs_path, "resources", "irq", 0, 10, TRUE); ++ + if (hal_util_set_string_elem_from_file (d, "pnp.serial.port", sysfs_path, "resources", "io", 0, TRUE)) { + const char* port; + const char* _port; + _port = hal_device_property_get_string (d, "pnp.serial.port"); + if(_port == NULL) + return; -+ ++ + port = strtok((char*) _port, "-"); + if(port == NULL) + return; -+ ++ + hal_device_property_set_string (d, "pnp.serial.port", port); + } +} ++ static HalDevice * - pnp_add (const gchar *sysfs_path, HalDevice *parent) + pnp_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_dev, const gchar *parent_path) { HalDevice *d; + HalDevice *computer; d = hal_device_new (); hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path); -@@ -437,11 +457,29 @@ pnp_add (const gchar *sysfs_path, HalDev +@@ -1400,11 +1421,29 @@ pnp_add (const gchar *sysfs_path, const hal_util_set_string_from_file (d, "pnp.id", sysfs_path, "id"); if (hal_device_has_property (d, "pnp.id")) { gchar *pnp_description; @@ -103,19 +104,19 @@ hal_device_property_set_string (d, "info.product", pnp_description); } + pnp_id = hal_device_property_get_string (d, "pnp.id"); -+ if( !strncmp(pnp_id, "WACf00", 6) || !strcmp(pnp_id, "FUJ02e5") || ++ if( !strncmp(pnp_id, "WACf00", 6) || !strcmp(pnp_id, "FUJ02e5") || + !strcmp(pnp_id, "FUJ02e6") || !strcmp(pnp_id, "FPI2004")) { + /* a internal serial tablet --> this should be a tablet pc */ + hal_device_add_capability (d, "input"); + hal_device_add_capability (d, "input.tablet"); + hal_device_add_capability (d, "input.tablet.tabletPC"); + -+ if ((computer = hal_device_store_find (hald_get_gdl (), "/org/freedesktop/Hal/devices/computer")) != NULL || ++ if ((computer = hal_device_store_find (hald_get_gdl (), "/org/freedesktop/Hal/devices/computer")) != NULL || + (computer = hal_device_store_find (hald_get_tdl (), "/org/freedesktop/Hal/devices/computer")) != NULL) { + + hal_device_property_set_string (computer, "system.formfactor", "laptop"); + hal_device_property_set_string (computer, "system.formfactor.subtype", "tabletpc"); -+ /* collect info about serial port and irq etc. */ ++ /* collect info about serial port and irq etc. */ + pnp_set_serial_info (sysfs_path, d); + } + } ++++++ hal-fix-cpufreq-dbus-restart.patch ++++++ diff --git a/hald/linux/addons/Makefile.am b/hald/linux/addons/Makefile.am diff --git a/hald/linux/addons/addon-cpufreq.c b/hald/linux/addons/addon-cpufreq.c index e07ff69..2dc271b 100644 --- a/hald/linux/addons/addon-cpufreq.c +++ b/hald/linux/addons/addon-cpufreq.c @@ -815,7 +815,7 @@ static gboolean dbus_is_privileged(DBusC gboolean out_is_allowed; gboolean out_is_temporary; LibPolKitResult res; - + connection_new = dbus_bus_get(DBUS_BUS_SYSTEM, error); if (dbus_error_is_set(error)) { dbus_raise_error(connection, message, CPUFREQ_ERROR_GENERAL, @@ -952,6 +952,19 @@ static gboolean dbus_get_argument(DBusCo return TRUE; } +static DBusHandlerResult dbus_filter_function_local(DBusConnection *connection, + DBusMessage *message, + void *user_data) +{ + if (dbus_message_is_signal(message, DBUS_INTERFACE_LOCAL, + "Disconnected")) { + HAL_DEBUG(("DBus daemon disconnected. Trying to reconnect...")); + dbus_connection_unref(connection); + g_timeout_add(5000, (GSourceFunc)dbus_init_local, NULL); + } + return DBUS_HANDLER_RESULT_HANDLED; +} + /** dbus filter function * * @raises UnknownMethod @@ -1043,13 +1056,6 @@ #endif dbus_send_reply_strlist(connection, message, governors); g_strfreev(governors); - } else if (dbus_message_is_signal(message, DBUS_INTERFACE_LOCAL, - "Disconnected")) { - HAL_DEBUG(("DBus daemon disconnected. Trying to reconnect...")); - dbus_connection_close(connection); - dbus_connection_unref(connection); - g_timeout_add(5000, (GSourceFunc)dbus_init, NULL); - } else { return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } @@ -1071,6 +1077,26 @@ static gboolean is_supported(void) } /** returns FALSE on success because it's used as a callback */ +gboolean dbus_init_local(void) +{ + DBusConnection *dbus_connection; + DBusError dbus_error; + + dbus_error_init(&dbus_error); + + dbus_connection = dbus_bus_get(DBUS_BUS_SYSTEM, &dbus_error); + if (dbus_error_is_set(&dbus_error)) { + HAL_WARNING(("Cannot get D-Bus connection")); + return TRUE; + } + + dbus_connection_setup_with_g_main(dbus_connection, NULL); + dbus_connection_add_filter(dbus_connection, dbus_filter_function_local, + NULL, NULL); + dbus_connection_set_exit_on_disconnect(dbus_connection, 0); + return FALSE; +} + gboolean dbus_init(void) { DBusError dbus_error; @@ -1090,12 +1116,10 @@ gboolean dbus_init(void) goto Error; } - dbus_error_init (&dbus_error); if (!libhal_device_addon_is_ready (halctx, udi, &dbus_error)) { goto Error; } - if (!libhal_device_claim_interface(halctx, udi, "org.freedesktop.Hal.Device.CPUFreq", " <method name=\"SetCPUFreqGovernor\">\n" @@ -1137,11 +1161,11 @@ gboolean dbus_init(void) dbus_connection_setup_with_g_main(dbus_connection, NULL); dbus_connection_add_filter(dbus_connection, dbus_filter_function, NULL, NULL); dbus_connection_set_exit_on_disconnect(dbus_connection, 0); - return FALSE; + return TRUE; Error: dbus_error_free(&dbus_error); - return TRUE; + return FALSE; } /********************* DBus end *********************/ @@ -1179,7 +1203,7 @@ int main(int argc, char *argv[]) exit(EXIT_FAILURE); } - if (dbus_init()) + if (!dbus_init() || dbus_init_local()) exit(EXIT_FAILURE); gmain = g_main_loop_new(NULL, FALSE); diff --git a/hald/linux/addons/addon-cpufreq.h b/hald/linux/addons/addon-cpufreq.h index d812219..f4141be 100644 --- a/hald/linux/addons/addon-cpufreq.h +++ b/hald/linux/addons/addon-cpufreq.h @@ -69,4 +69,6 @@ gboolean write_governor (char *new_gove gboolean dbus_init (void); +gboolean dbus_init_local (void); + #endif /* ADDON_CPUFREQ_H */ diff --git a/hald/linux/addons/addon-macbookpro-backlight.c b/hald/linux/addons/addon-macbookpro-backlight.c ++++++ hal-panasonic-acpi-suse.diff ++++++ --- /var/tmp/diff_new_pack.qk4ugh/_old 2006-10-30 17:58:04.000000000 +0100 +++ /var/tmp/diff_new_pack.qk4ugh/_new 2006-10-30 17:58:04.000000000 +0100 @@ -1,6 +1,6 @@ --- hald/linux/acpi.c +++ hald/linux/acpi.c -@@ -1026,7 +1026,7 @@ +@@ -1037,7 +1037,7 @@ */ acpi_synthesize_display ("acpi/toshiba", "lcd", ACPI_TYPE_TOSHIBA_DISPLAY); acpi_synthesize_display ("acpi/asus", "brn", ACPI_TYPE_ASUS_DISPLAY); @@ -9,3 +9,26 @@ acpi_synthesize_display ("acpi/ibm", "brightness", ACPI_TYPE_IBM_DISPLAY); acpi_synthesize_display ("acpi/sony", "brightness", ACPI_TYPE_SONY_DISPLAY); /* omnibook does not live under acpi GNOME#331458 */ +--- tools/linux/hal-system-lcd-get-brightness-linux ++++ tools/linux/hal-system-lcd-get-brightness-linux +@@ -35,7 +35,8 @@ + elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "panasonic" ]; then + # cat /proc/acpi/pcc/brightness + # 5 +- value="`cat $HAL_PROP_LINUX_ACPI_PATH`" ++ read value < $HAL_PROP_LINUX_ACPI_PATH ++ value=$[($value-51)/13] + elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "ibm" ]; then + # cat /proc/acpi/ibm/brightness + # level: 5 +--- tools/linux/hal-system-lcd-set-brightness-linux ++++ tools/linux/hal-system-lcd-set-brightness-linux +@@ -33,7 +33,7 @@ + elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "panasonic" ]; then + # echo {0..15} > /proc/acpi/pcc/brightness + # http://readlist.com/lists/vger.kernel.org/linux-kernel/7/36405.html +- echo "$value" > $HAL_PROP_LINUX_ACPI_PATH ++ echo "$[($value*136)/10+51]" > $HAL_PROP_LINUX_ACPI_PATH + elif [ "$HAL_PROP_LAPTOP_PANEL_ACCESS_METHOD" = "ibm" ]; then + # echo "level {0..7}" > /proc/acpi/ibm/brightness + # http://ibm-acpi.sourceforge.net/README ++++++ hal-performance_pci.ids_v5.diff ++++++ diff --git a/hald/ids.c b/hald/ids.c index 223c8d4..5f253eb 100644 --- a/hald/ids.c +++ b/hald/ids.c @@ -28,14 +28,14 @@ # include <config.h> #endif #include <ctype.h> +#include <errno.h> +#include <fcntl.h> #include <stdint.h> #include <string.h> -#include <unistd.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/mman.h> -#include <fcntl.h> -#include <errno.h> +#include <unistd.h> #include <dbus/dbus.h> #include <dbus/dbus-glib.h> @@ -47,11 +47,17 @@ #include "ids.h" /** Pointer to where the pci.ids file is loaded */ static char *pci_ids = NULL; +/** Array of pointers to the beginning of the lines */ +static char **pci_ids_list = NULL; + /** Length of data store at at pci_ids */ -static size_t pci_ids_len; +static unsigned int pci_ids_len; -/** Iterator position into pci_ids */ -static size_t pci_ids_iter_pos; +/** number of lines in pci_ids_list */ +static unsigned int pci_ids_lines; + +/** Iterator position into pci_ids_list */ +static unsigned int pci_ids_iter_pos; /** Initialize the pci.ids line iterator to the beginning of the file */ static void @@ -74,22 +80,15 @@ static char * pci_ids_line_iter_get_line (unsigned int *line_len) { unsigned int i; - static char line[PCI_IDS_MAX_LINE_LEN]; - for (i = 0; - pci_ids_iter_pos < pci_ids_len && - i < PCI_IDS_MAX_LINE_LEN - 1 && - pci_ids[pci_ids_iter_pos] != '\n'; i++, pci_ids_iter_pos++) { - line[i] = pci_ids[pci_ids_iter_pos]; - } + i = strlen(pci_ids_list[pci_ids_iter_pos]); - line[i] = '\0'; if (line_len != NULL) *line_len = i; pci_ids_iter_pos++; - return line; + return pci_ids_list[pci_ids_iter_pos-1]; } /** See if there are more lines to process in pci.ids @@ -99,7 +98,7 @@ pci_ids_line_iter_get_line (unsigned int static dbus_bool_t pci_ids_line_iter_has_more () { - return pci_ids_iter_pos < pci_ids_len; + return pci_ids_iter_pos < pci_ids_lines; } @@ -133,21 +132,29 @@ ids_find_pci (int vendor_id, int product char rep_spi[8]; dbus_bool_t vendor_matched = FALSE; dbus_bool_t product_matched = FALSE; + dbus_bool_t subvendor_matched = FALSE; + dbus_bool_t subproduct_matched = FALSE; static char store_vn[PCI_IDS_MAX_LINE_LEN]; static char store_pn[PCI_IDS_MAX_LINE_LEN]; static char store_svn[PCI_IDS_MAX_LINE_LEN]; static char store_spn[PCI_IDS_MAX_LINE_LEN]; - snprintf (rep_vi, 8, "%04x", vendor_id); - snprintf (rep_pi, 8, "%04x", product_id); - snprintf (rep_svi, 8, "%04x", subsys_vendor_id); - snprintf (rep_spi, 8, "%04x", subsys_product_id); - *vendor_name = NULL; *product_name = NULL; *subsys_vendor_name = NULL; *subsys_product_name = NULL; + if (vendor_id == 0 && product_id == 0 && subsys_vendor_id == 0 && subsys_product_id == 0) { + HAL_DEBUG (("ids_find_pci: all id's == 0, nothing to search for. return.")); + goto out; + } + + snprintf (rep_vi, 8, "%04x", vendor_id); + snprintf (rep_pi, 8, "%04x", product_id); + snprintf (rep_svi, 8, "%04x", subsys_vendor_id); + snprintf (rep_spi, 8, "%04x", subsys_product_id); + + for (pci_ids_line_iter_init (); pci_ids_line_iter_has_more ();) { line = pci_ids_line_iter_get_line (&line_len); @@ -167,11 +174,12 @@ ids_find_pci (int vendor_id, int product num_tabs++; } + /* check if we already found all */ + if (vendor_matched && product_matched && subvendor_matched && subproduct_matched) + goto out; + switch (num_tabs) { case 0: - /* vendor names */ - vendor_matched = FALSE; - /* first check subsys_vendor_id, if haven't done * already */ if (*subsys_vendor_name == NULL @@ -179,6 +187,8 @@ ids_find_pci (int vendor_id, int product if ((*((dbus_uint32_t *) line)) == (*((dbus_uint32_t *) rep_svi))) { /* found it */ + subvendor_matched = TRUE; + for (i = 4; i < line_len; i++) { if (!isspace (line[i])) break; @@ -186,11 +196,14 @@ ids_find_pci (int vendor_id, int product strncpy (store_svn, line + i, PCI_IDS_MAX_LINE_LEN); *subsys_vendor_name = store_svn; + + if (vendor_matched && product_matched && subsys_product_id == 0) + goto out; } } /* check vendor_id */ - if (vendor_id != 0) { + if (vendor_id != 0 && !vendor_matched) { if (memcmp (line, rep_vi, 4) == 0) { /* found it */ vendor_matched = TRUE; @@ -202,20 +215,17 @@ ids_find_pci (int vendor_id, int product strncpy (store_vn, line + i, PCI_IDS_MAX_LINE_LEN); *vendor_name = store_vn; + + if (product_id == 0 && subsys_vendor_id == 0 && subsys_product_id == 0) + goto out; } } break; case 1: - product_matched = FALSE; - - /* product names */ - if (!vendor_matched) - continue; - - /* check product_id */ - if (product_id != 0) { + + if (product_id != 0 && vendor_matched && !product_matched) { if (memcmp (line + 1, rep_pi, 4) == 0) { /* found it */ @@ -228,6 +238,10 @@ ids_find_pci (int vendor_id, int product strncpy (store_pn, line + i, PCI_IDS_MAX_LINE_LEN); *product_name = store_pn; + + if ((subsys_vendor_id == 0 && subsys_product_id == 0) || + (subvendor_matched && subsys_product_id == 0)) + goto out; } } break; @@ -236,6 +250,8 @@ ids_find_pci (int vendor_id, int product /* subsystem_vendor subsystem_product */ if (!vendor_matched || !product_matched) continue; + if (vendor_matched && product_matched && subvendor_matched && subsys_product_id == 0) + goto out; /* check product_id */ if (subsys_vendor_id != 0 @@ -244,6 +260,8 @@ ids_find_pci (int vendor_id, int product && memcmp (line + 7, rep_spi, 4) == 0) { /* found it */ + subproduct_matched = TRUE; + for (i = 11; i < line_len; i++) { if (!isspace (line[i])) break; @@ -251,6 +269,8 @@ ids_find_pci (int vendor_id, int product strncpy (store_spn, line + i, PCI_IDS_MAX_LINE_LEN); *subsys_product_name = store_spn; + + goto out; } } @@ -261,8 +281,26 @@ ids_find_pci (int vendor_id, int product } } +out: + return; } +/** Free resources used by to store the PCI database + * + * @param #FALSE if the PCI database wasn't loaded + */ +static dbus_bool_t +pci_ids_free () +{ + if (pci_ids != NULL) { + free (pci_ids); + pci_ids = NULL; + free (pci_ids_list); + pci_ids_list = NULL; + return TRUE; + } + return FALSE; +} /** Load the PCI database used for mapping vendor, product, subsys_vendor * and subsys_product numbers into names. @@ -274,36 +312,91 @@ ids_find_pci (int vendor_id, int product static dbus_bool_t pci_ids_load (const char *path) { - int fd; - struct stat statbuf; - gboolean ret; + FILE *fp; + unsigned int num_read; + unsigned int line_count; + unsigned int i; + char *pci_ids_tmp; + char *pci_ids_tmp2; + char **pci_ids_list_tmp; + int start_of_line; + + fp = fopen (path, "r"); + if (fp == NULL) { + HAL_ERROR (("couldn't open PCI database at %s,", path)); + return FALSE; + } - ret = FALSE; + fseek (fp, 0, SEEK_END); + pci_ids_len = ftell (fp); + fseek (fp, 0, SEEK_SET); - if (stat (path, &statbuf) != 0) { - HAL_WARNING (("Couldn't stat pci.ids file '%s', errno=%d: %s", path, errno, strerror (errno))); - goto out; + pci_ids = malloc (pci_ids_len); + if (pci_ids == NULL) { + DIE (("Couldn't allocate %d bytes for PCI database file\n", + pci_ids_len)); } - pci_ids_len = statbuf.st_size; - fd = open (path, O_RDONLY); - if (fd < 0) { - HAL_WARNING (("Couldn't open pci.ids file '%s', errno=%d: %s", path, errno, strerror (errno))); - goto out; + num_read = fread (pci_ids, sizeof (char), pci_ids_len, fp); + if (pci_ids_len != num_read) { + HAL_ERROR (("Error loading PCI database file")); + pci_ids_free(); + fclose(fp); + return FALSE; } - pci_ids = mmap (NULL, pci_ids_len, PROT_READ, MAP_SHARED, fd, 0); - if (pci_ids == MAP_FAILED) { - HAL_WARNING (("Couldn't mmap pci.ids file '%s', errno=%d: %s", path, errno, strerror (errno))); - close (fd); - goto out; + fclose(fp); + + /* File loaded into mem. Build pointer list lines starting with # are skipped. */ + line_count = 0; + pci_ids_tmp = pci_ids; + start_of_line = TRUE; + do { + if (start_of_line && *pci_ids_tmp != '#') + line_count++; + + start_of_line = FALSE; + if (*pci_ids_tmp == '\n') + start_of_line = TRUE; + + pci_ids_tmp++; + } while (pci_ids_tmp < (pci_ids + pci_ids_len)); + + /* create list */ + pci_ids_list = (char **)malloc(sizeof(char *) * (line_count + 1)); + if (pci_ids_list == NULL) { + HAL_ERROR (("Error loading PCI database file")); + free (pci_ids); + pci_ids = NULL; + return FALSE; } - ret = TRUE; + memset(pci_ids_list, 0, sizeof(char *) * (line_count + 1)); + /* now the beginning of each string into the list */ + pci_ids_list_tmp = pci_ids_list; + pci_ids_tmp = pci_ids; + i = 0; + while (i < line_count) { + if (*pci_ids_tmp != '#') { + *pci_ids_list_tmp = pci_ids_tmp; + pci_ids_list_tmp++,i++; + } - close (fd); -out: - return ret; + pci_ids_tmp2 = pci_ids_tmp; + pci_ids_tmp = strchr(pci_ids_tmp,'\n'); + if (pci_ids_tmp != NULL) { + /* replace \n by \0 */ + if ((pci_ids_tmp - pci_ids_tmp2) < PCI_IDS_MAX_LINE_LEN) { + *pci_ids_tmp = '\0'; + } else { + *(pci_ids_tmp2 + PCI_IDS_MAX_LINE_LEN) = '\0'; + } + + pci_ids_tmp++; + } + } + pci_ids_lines = line_count; + return TRUE; } /*==========================================================================*/ ++++++ hal-toport-mount_159475.diff ++++++ --- fdi/policy/10osvendor/10-storage-policy.fdi 2006-03-27 18:56:34.000000000 +0200 +++ fdi/policy/10osvendor/10-storage-policy.fdi 2006-03-27 18:59:52.000000000 +0200 @@ -213,6 +213,16 @@ <match key="volume.partition.msdos_part_table_type" int="0x0e"> <merge key="volume.policy.should_mount" type="bool">true</merge> </match> + <!-- see opensuse bug #159475 --> + <!-- hidden NTFS --> + <match key="volume.partition.msdos_part_table_type" int="0x17"> + <merge key="volume.policy.should_mount" type="bool">false</merge> + <merge key="volume.ignore" type="bool">true</merge> + </match> + <match key="volume.partition.msdos_part_table_type" int="0xda"> + <merge key="volume.policy.should_mount" type="bool">false</merge> + <merge key="volume.ignore" type="bool">true</merge> + </match> </match> </match> </match> ++++++ hal-toport-mount_device_fstab_with_user_option_172870.diff ++++++ --- tools/hal-system-storage-mount 2006-05-19 13:22:55.000000000 +0200 +++ tools/hal-system-storage-mount 2006-05-19 13:30:28.000000000 +0200 @@ -35,36 +35,42 @@ exit 1 fi - check_fstab() { - awk -v dev="$1" \ + awk -v dev="$1" -v mp="$2"\ ' BEGIN { sub(/^\/dev\//,"", dev) - cmd = "/usr/bin/udevinfo -q symlink -n " dev - if (( cmd | getline) < 0 ) { - print "org.freedesktop.Hal.Device.Volume.PermissionDenied" >/dev/stderr - exit 1 - } - + ("/usr/bin/udevinfo -q symlink -n " dev " 2> /dev/null") | getline for(i=1; i <= NF; i++) { a["/dev/" $i] = 1 } a["/dev/" dev] = 1 } { - if ($1 in a) { + if ($1 in a) { + # "user" option is needed + n = split ($4, options, ",") + for (i = 1; i <= n; i++) { + if (options[i] == "user") { + # return specified mountpoint if below /media + mount = $2 + if (match(mount, "^/media/") > 0) { + sub(/^\/media\//,"", mount) + print mount + exit 0 + } + } + } + print "org.freedesktop.Hal.Device.Volume.PermissionDenied" >"/dev/stderr" - print $1 " found in /etc/fstab" >"/dev/stderr" + print "/etc/fstab configuration does not allow unprivileged operation" >"/dev/stderr" exit 1 } } ' /etc/fstab } -check_fstab "$HAL_PROP_BLOCK_DEVICE" || exit 1 - # read parameters # "MyDisk\n" # "fuse\n" @@ -78,6 +84,21 @@ read GIVEN_MOUNTOPTIONS GIVEN_MOUNTOPTIONS=${GIVEN_MOUNTOPTIONS//[^a-zA-Z0-9_=[:space:]]/_} +# deny to handle devices listed in fstab, unless the "user" option is given +# allow only use of specified mountpoint and fail for a different one +FSTAB_MOUNTPOINT=$(check_fstab "$HAL_PROP_BLOCK_DEVICE") || exit 1 +if [ -n "$FSTAB_MOUNTPOINT" ]; then + # fail if we got a request for a different mountpoint + if [ -n "$GIVEN_MOUNTPOINT" ] && [ "$GIVEN_MOUNTPOINT" != "$FSTAB_MOUNTPOINT" ]; then + echo "org.freedesktop.Hal.Device.Volume.PermissionDenied" >&2 + echo "/etc/fstab configuration does not allow this mountpoint" >&2 + exit 1; + fi + # use mountpoint from fstab + GIVEN_MOUNTPOINT="$FSTAB_MOUNTPOINT" +fi + +# if no mountpoint is given, use filesystem label, or drive_type, or "disk" if [ -z "$GIVEN_MOUNTPOINT" ]; then if [ -n "$HAL_PROP_VOLUME_LABEL" ]; then GIVEN_MOUNTPOINT="$HAL_PROP_VOLUME_LABEL" @@ -134,9 +155,13 @@ esac fi -# if no type is given, use default name +# if no type is given, use default type, or let the kernel find out if [ "$MOUNTTYPE" == "" ]; then - MOUNTTYPE=$HAL_PROP_VOLUME_FSTYPE + if [ "$HAL_PROP_VOLUME_FSTYPE" != "" ]; then + MOUNTTYPE=$HAL_PROP_VOLUME_FSTYPE + else + MOUNTTYPE="auto" + fi fi # retrieve white-list from device properties (see fdi/policy/osvendor/20-storage-methods.fdi) @@ -186,16 +211,23 @@ /usr/lib64/hal/scripts/hal-system-storage-cleanup-mountpoints fi -# append number to mountpoint if it already exists -if [ -e "$MOUNT_ROOT/$MOUNTPOINT" ]; then - NUM=1; +# append number to mountpoint if it is already in use +while read dev dir type options; do + if [ "$dir" = "$MOUNT_ROOT/$MOUNTPOINT" ]; then + MOUNTPOINT_BUSY=1 + break; + fi +done < /proc/mounts +if [ -n "$MOUNTPOINT_BUSY" ]; then + NUM=1 while [ -e "$MOUNT_ROOT/$MOUNTPOINT-$NUM" ]; do NUM=$(($NUM + 1)) done MOUNTPOINT="$MOUNTPOINT-$NUM" fi -# create directory and mark it for cleanup with an extended attribute +# possibly create mountpoint directory and mark it for +# later cleanup, if we did create it if [ ! -e "$MOUNT_ROOT/$MOUNTPOINT" ]; then MOUNTPOINT_CREATED=1 mkdir "$MOUNT_ROOT/$MOUNTPOINT" ++++++ hal-toport-storage-policy-fixed-drives.diff ++++++ --- fdi/policy/10osvendor/99-storage-policy-fixed-drives.fdi 1970-01-01 01:00:00.000000000 +0100 +++ fdi/policy/10osvendor/99-storage-policy-fixed-drives.fdi 2006-03-07 00:02:06.000000000 +0100 @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> <!-- -*- SGML -*- --> + +<deviceinfo version="0.2"> +<device> + <match key="@block.storage_device:storage.hotpluggable" bool="false"> + <match key="@block.storage_device:storage.removable" bool="false"> + <merge key="volume.ignore" type="bool">true</merge> + </match> + </match> +</device> +</deviceinfo> --- fdi/policy/10osvendor/Makefile.am 2006-03-30 18:54:42.000000000 +0200 +++ fdi/policy/10osvendor/Makefile.am 2006-03-30 18:55:09.000000000 +0200 @@ -6,7 +6,8 @@ 10-power-mgmt-policy.fdi \ 10-laptop-panel-mgmt-policy.fdi \ 15-storage-luks.fdi \ - 20-storage-methods.fdi + 20-storage-methods.fdi \ + 99-storage-policy-fixed-drives.fdi if HAVE_SELINUX dist_fdi_DATA += 20-storage-add-selinux.fdi ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... --------------------------------------------------------------------- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org