Hello community,
here is the log from the commit of package hal
checked in at Sat Mar 10 23:57:37 CET 2007.
--------
--- hal/hal.changes 2007-03-07 14:56:28.000000000 +0100
+++ /mounts/work_src_done/STABLE/hal/hal.changes 2007-03-09 13:55:15.864281000 +0100
@@ -1,0 +2,21 @@
+Fri Mar 9 12:32:48 CET 2007 - dkukawka@suse.de
+
+- fixed typo in spec file s/SOurce/Source/
+- added patcheS:
+ - fixed compiler warnings:
+ - hal-fix-compiler_warning_dell-addon.diff
+ - hal-fix-compiler_warning_storage-cleanup-mountpoint.diff
+ - hal-fix-compiler_warning_libhal.diff
+ - hal-fix-compiler_warning_create_cache.diff
+ - hal-fix-compiler_warning_UID_data_type.diff
+ - hal-fix-libhal_validate_parameter_fd.o_bug10133_v2.diff:
+ validate library parameter if != NULL, return with error if not
+ - hal-usb_speed_and_version_in_double.diff: Change the property
+ for usb*.*_bcd from int as BCD to double as type
+- updated patches:
+ - hal-add-tabletPC_support_v2.diff: extended helper to call
+ setserial with baud_rate parameter if needed, updated FDI file
+ to call setserial only for devices which not setup correct by
+ the kernel, added support for Gateway tablet PCs
+
+-------------------------------------------------------------------
Old:
----
hal-add-tabletPC_support.diff
New:
----
hal-add-tabletPC_support_v2.diff
hal-fix-libhal_validate_parameter_fd.o_bug10133_v2.diff
hal-info-20070305.tar.bz2
hal-usb_speed_and_version_in_double.diff
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ hal.spec ++++++
--- /var/tmp/diff_new_pack.g30280/_old 2007-03-10 23:57:20.000000000 +0100
+++ /var/tmp/diff_new_pack.g30280/_new 2007-03-10 23:57:20.000000000 +0100
@@ -23,11 +23,11 @@
License: Other uncritical OpenSource License
Group: System/Daemons
Version: 0.5.8_git20070305
-Release: 2
+Release: 3
Autoreqprov: on
Summary: Daemon for Collecting Hardware Information
# SUSE specific patches
-Patch0: %{name}-add-tabletPC_support.diff
+Patch0: %{name}-add-tabletPC_support_v2.diff
Patch1: %{name}-panasonic-acpi-suse.diff
Patch2: %{name}-allow_uid_for_ntfs.diff
Patch3: %{name}-fix-storage-policy-fixed-drives.diff
@@ -45,12 +45,14 @@
Patch106: hal-fix-compiler_warning_libhal.diff
Patch107: hal-fix-compiler_warning_create_cache.diff
Patch108: hal-fix-compiler_warning_UID_data_type.diff
+Patch109: hal-fix-libhal_validate_parameter_fd.o_bug10133_v2.diff
+Patch110: hal-usb_speed_and_version_in_double.diff
#
# need to backport
Patch400: hal-performance_pci.ids_v5.diff
# Sources:
Source0: %{name}-%{version}.tar.bz2
-SOurce1: hal-info-20070305.tar.bz2
+Source1: hal-info-20070305.tar.bz2
Source2: rc.hal
Source3: 90-hal.rules
Prereq: /usr/sbin/groupadd /usr/sbin/useradd /etc/init.d/boot.localfs
@@ -155,6 +157,8 @@
%patch106 -p1
%patch107 -p1
%patch108 -p1
+%patch109 -p1
+%patch110 -p1
popd
#%patch400 -p1
@@ -288,6 +292,24 @@
%{_bindir}/hal-device-manager
%changelog
+* Fri Mar 09 2007 - dkukawka@suse.de
+- fixed typo in spec file s/SOurce/Source/
+- added patcheS:
+ - fixed compiler warnings:
+ - hal-fix-compiler_warning_dell-addon.diff
+ - hal-fix-compiler_warning_storage-cleanup-mountpoint.diff
+ - hal-fix-compiler_warning_libhal.diff
+ - hal-fix-compiler_warning_create_cache.diff
+ - hal-fix-compiler_warning_UID_data_type.diff
+ - hal-fix-libhal_validate_parameter_fd.o_bug10133_v2.diff:
+ validate library parameter if != NULL, return with error if not
+ - hal-usb_speed_and_version_in_double.diff: Change the property
+ for usb*.*_bcd from int as BCD to double as type
+- updated patches:
+ - hal-add-tabletPC_support_v2.diff: extended helper to call
+ setserial with baud_rate parameter if needed, updated FDI file
+ to call setserial only for devices which not setup correct by
+ the kernel, added support for Gateway tablet PCs
* Wed Mar 07 2007 - sbrabec@suse.cz
- Updated BuildRequires: PolicyKit -> PolicyKit-devel.
* Mon Mar 05 2007 - dkukawka@suse.de
++++++ hal-add-tabletPC_support_v2.diff ++++++
commit 0275ed7d783c3d149f86ad6c397657ae8b2d04ea
Author: Danny Kukawka
Date: Thu Mar 8 16:56:09 2007 +0100
added support for Tablet PCs
Added support for Tablet PCs with these features:
* identify Wacom and Finepoint Tablet PC devices and port/irq
* set system.formfactor.subtype to 'tabletpc' this allow the desktop
to handle special tasks for Tablet PCs as e.g. show OnScreen Keyboard
* added setserial helper to setup /dev/ttyS* devices with sepcial
parameter if needed
* added fdi-file to call for special Tablet devices setserial with
needed parameter where the kernel can't setup the device correct
This patch is already included in the SUSE hal package since 08/2005.
diff --git a/fdi/policy/10osvendor/10-tabletPCs.fdi b/fdi/policy/10osvendor/10-tabletPCs.fdi
new file mode 100644
index 0000000..2d16560
--- /dev/null
+++ b/fdi/policy/10osvendor/10-tabletPCs.fdi
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deviceinfo version="0.2">
+
+ <device>
+ <match key="info.capabilities" contains="input.tablet.tabletPC">
+ <!-- There is a report that we should use ttyS2 instead of ttyS0 -->
+ <match key="@info.parent:smbios.system.product" contains="HP Compaq tc4200">
+ <merge key="input.device.set" type="string">/dev/ttyS2</merge>
+ </match>
+ <!-- to get the device up we need to set the baud_rate correct -->
+ <match key="pnp.id" contains="FPI2004">
+ <merge key="input.device.set" type="string">/dev/ttyS0</merge>
+ <merge key="pnp.serial.baud_base" type="int">38400</merge>
+ </match>
+ </match>
+
+ <!-- add addon if need special ttySx settings -->
+ <match key="input.device.set" exists="true">
+ <append key="info.callouts.add" type="strlist">hal-system-setserial</append>
+ </match>
+ </device>
+
+</deviceinfo>
diff --git a/fdi/policy/10osvendor/Makefile.am b/fdi/policy/10osvendor/Makefile.am
index 55666ef..c08bb30 100644
--- a/fdi/policy/10osvendor/Makefile.am
+++ b/fdi/policy/10osvendor/Makefile.am
@@ -7,6 +7,7 @@ dist_fdi_DATA = \
10-toshiba-buttons.fdi \
10-bluetooth-switch.fdi \
10-laptop-panel-mgmt-policy.fdi \
+ 10-tabletPCs.fdi \
15-storage-luks.fdi \
20-storage-methods.fdi
diff --git a/hald/linux/device.c b/hald/linux/device.c
index 74e440b..058f12f 100644
--- a/hald/linux/device.c
+++ b/hald/linux/device.c
@@ -1678,11 +1678,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);
+
+ 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, 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);
@@ -1699,11 +1720,29 @@ pnp_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_de
hal_util_set_string_from_file (d, "pnp.id", sysfs_path, "id");
if (hal_device_has_property (d, "pnp.id")) {
gchar *pnp_description;
+ const char *pnp_id;
ids_find_pnp (hal_device_property_get_string (d, "pnp.id"), &pnp_description);
if (pnp_description != NULL) {
hal_device_property_set_string (d, "pnp.description", pnp_description);
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") ||
+ !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 ||
+ (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. */
+ pnp_set_serial_info (sysfs_path, d);
+ }
+ }
}
if (!hal_device_has_property (d, "info.product")) {
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 4909974..f7f9986 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -55,7 +55,8 @@ libexec_PROGRAMS = \
hal-storage-eject \
hal-storage-closetray \
hal-storage-cleanup-mountpoint \
- hal-storage-cleanup-all-mountpoints
+ hal-storage-cleanup-all-mountpoints \
+ hal-system-setserial
if HAVE_PMU
libexec_PROGRAMS += \
@@ -94,6 +95,9 @@ hal_storage_cleanup_mountpoint_LDADD = @GLIB_LIBS@ @POLKIT_LIBS@ @DBUS_LIBS@ $(t
hal_storage_cleanup_all_mountpoints_SOURCES = hal-storage-cleanup-all-mountpoints.c hal-storage-shared.c hal-storage-shared.h
hal_storage_cleanup_all_mountpoints_LDADD = @GLIB_LIBS@ @POLKIT_LIBS@ @DBUS_LIBS@ $(top_builddir)/libhal/libhal.la $(top_builddir)/libhal-storage/libhal-storage.la
+hal_system_setserial_SOURCES = hal-system-setserial.c
+hal_system_setserial_LDADD = -lpopt @GLIB_LIBS@ @DBUS_LIBS@ $(top_builddir)/libhal/libhal.la
+
if HAVE_PMU
hal_system_power_pmu_SOURCES = hal-system-power-pmu.c
hal_system_power_pmu_LDADD = @DBUS_LIBS@ $(top_builddir)/libhal/libhal.la
diff --git a/tools/hal-system-setserial.c b/tools/hal-system-setserial.c
new file mode 100644
index 0000000..8cc2068
--- /dev/null
+++ b/tools/hal-system-setserial.c
@@ -0,0 +1,115 @@
+/*
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+
+#define _GNU_SOURCE
+
+#ifdef HAVE_CONFIG_H
+# include
+#endif
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+
+#include
+
+#define MAX_CMD_LENGTH 256
+
+static int debug = FALSE;
+
+
+int main (int argc, const char *argv[])
+{
+ int i;
+ int ret_val = EXIT_FAILURE;
+ poptContext popt_context;
+ char *udi = NULL;
+ char *irq = NULL;
+ char *port = NULL;
+ char *baud_base = NULL;
+ char *input_dev = NULL;
+ char cmd[MAX_CMD_LENGTH+1];
+ const char **left_over_args = NULL;
+
+ struct poptOption options[] = {
+ {"udi", 's', POPT_ARG_STRING, &udi, 0, "udi of the related serial device", "UDI"},
+ {"irq", 'i', POPT_ARG_STRING, &irq, 0, "irq of the serial device", "PORT"},
+ {"port", 'p', POPT_ARG_STRING, &port, 0, "port of the serial device", "IRQ"},
+ {"baud_base", 'b', POPT_ARG_STRING, &baud_base, 0, "baud_base to set", "BAUD_BASE"},
+ {"input-device", 'd', POPT_ARG_STRING, &input_dev, 0, "the input device to which should bind the device", "INPUT_DEVICE"},
+
+ POPT_AUTOHELP
+ {NULL, '\0', 0, NULL, 0, NULL, NULL}
+ };
+
+ popt_context = poptGetContext ("hal-system-setserial", argc, argv, options, 0);
+
+ while ((i = poptGetNextOpt (popt_context)) != -1) {
+ if (i < -1) {
+ poptPrintHelp (popt_context, stderr, 0);
+ ret_val = EXIT_FAILURE;
+ goto early_out;
+ }
+ }
+
+ left_over_args = poptGetArgs (popt_context);
+
+ if (getenv ("HALD_VERBOSE") != NULL )
+ debug = TRUE;
+ if (debug)
+ syslog (LOG_INFO, "hal-system-setserial started in debug mode." );
+
+ if(udi == NULL)
+ udi = getenv("UDI");
+ if(irq == NULL)
+ irq = getenv("HAL_PROP_PNP_SERIAL_IRQ");
+ if(port == NULL)
+ port = getenv("HAL_PROP_PNP_SERIAL_PORT");
+ if(baud_base == NULL)
+ port = getenv("HAL_PROP_PNP_SERIAL_BAUD_BASE");
+ if(input_dev == NULL)
+ input_dev = getenv("HAL_PROP_INPUT_DEVICE_SET");
+
+ if (!udi || !irq || !port || !input_dev) {
+ syslog (LOG_INFO, "Missing env variable, exit NOW." );
+ goto early_out;
+ }
+
+
+ if (baud_base != NULL)
+ snprintf( cmd, MAX_CMD_LENGTH, "/bin/setserial %s port %s irq %s baud_base %s", input_dev, port, irq, baud_base);
+ else
+ snprintf( cmd, MAX_CMD_LENGTH, "/bin/setserial %s port %s irq %s autoconfig", input_dev, port, irq);
+
+ syslog (LOG_INFO, "Collected setserial options and called(%d): %s ", system(cmd), cmd);
+
+ ret_val = EXIT_SUCCESS;
+
+early_out:
+ poptFreeContext (popt_context);
+ return ret_val;
+}
+
++++++ hal-fix-libhal_validate_parameter_fd.o_bug10133_v2.diff ++++++
commit 71770748b84f512e6b98e2dcf0cbaacdfe7f70da
Author: Danny Kukawka
Date: Wed Mar 7 10:31:41 2007 +0100
libhal: validate parameter to be != NULL
This fixes fd.o bug #10133 and check several function parameter for
!= NULL to aviod problems with D-Bus calls where e.g. given udi or
key is NULL (it's at least the same code as check for a valid
LibHalContext).
diff --git a/libhal/libhal.c b/libhal/libhal.c
index f40d6a4..a5baeeb 100644
--- a/libhal/libhal.c
+++ b/libhal/libhal.c
@@ -53,12 +53,30 @@
# define N_(String) (String)
#endif
+/**
+ * LIBHAL_CHECK_PARAM_VALID:
+ * @_param_: the prameter to check for
+ * @_name_: the name of the prameter (for debug output)
+ * @_ret_: what to use for return value if the prameter is NULL
+ *
+ * Handy macro for checking whether a parameter is valid and not NULL.
+ */
+#define LIBHAL_CHECK_PARAM_VALID(_param_,_name_,_ret_) \
+ do { \
+ if (_param_ == NULL) { \
+ fprintf (stderr, \
+ "%s %d : invalid paramater. %s is NULL.\n", \
+ __FILE__, __LINE__, _name_); \
+ return _ret_; \
+ } \
+ } while(0)
+
+
static char **libhal_get_string_array_from_iter (DBusMessageIter *iter, int *num_elements);
static dbus_bool_t libhal_property_fill_value_from_variant (LibHalProperty *p, DBusMessageIter *var_iter);
-
/**
* libhal_free_string_array:
* @str_array: the array to be freed
@@ -375,6 +393,7 @@ libhal_device_get_all_properties (LibHalContext *ctx, const char *udi, DBusError
DBusError _error;
LIBHAL_CHECK_LIBHALCONTEXT(ctx, NULL);
+ LIBHAL_CHECK_PARAM_VALID(udi, "*udi", NULL);
message = dbus_message_new_method_call ("org.freedesktop.Hal", udi,
"org.freedesktop.Hal.Device",
@@ -952,6 +971,8 @@ libhal_device_get_property_type (LibHalContext *ctx, const char *udi, const char
DBusError _error;
LIBHAL_CHECK_LIBHALCONTEXT(ctx, LIBHAL_PROPERTY_TYPE_INVALID); /* or return NULL? */
+ LIBHAL_CHECK_PARAM_VALID(udi, "*udi", LIBHAL_PROPERTY_TYPE_INVALID);
+ LIBHAL_CHECK_PARAM_VALID(key, "*key", LIBHAL_PROPERTY_TYPE_INVALID);
message = dbus_message_new_method_call ("org.freedesktop.Hal", udi,
"org.freedesktop.Hal.Device",
@@ -1012,6 +1033,8 @@ libhal_device_get_property_strlist (LibHalContext *ctx, const char *udi, const c
DBusError _error;
LIBHAL_CHECK_LIBHALCONTEXT(ctx, NULL);
+ LIBHAL_CHECK_PARAM_VALID(udi, "*udi", NULL);
+ LIBHAL_CHECK_PARAM_VALID(key, "*key", NULL);
message = dbus_message_new_method_call ("org.freedesktop.Hal", udi,
"org.freedesktop.Hal.Device",
@@ -1083,6 +1106,8 @@ libhal_device_get_property_string (LibHalContext *ctx,
DBusError _error;
LIBHAL_CHECK_LIBHALCONTEXT(ctx, NULL);
+ LIBHAL_CHECK_PARAM_VALID(udi, "*udi", NULL);
+ LIBHAL_CHECK_PARAM_VALID(key, "*key", NULL);
message = dbus_message_new_method_call ("org.freedesktop.Hal", udi,
"org.freedesktop.Hal.Device",
@@ -1159,6 +1184,8 @@ libhal_device_get_property_int (LibHalContext *ctx,
DBusError _error;
LIBHAL_CHECK_LIBHALCONTEXT(ctx, -1);
+ LIBHAL_CHECK_PARAM_VALID(udi, "*udi", -1);
+ LIBHAL_CHECK_PARAM_VALID(key, "*key", -1);
message = dbus_message_new_method_call ("org.freedesktop.Hal", udi,
"org.freedesktop.Hal.Device",
@@ -1230,6 +1257,8 @@ libhal_device_get_property_uint64 (LibHalContext *ctx,
DBusError _error;
LIBHAL_CHECK_LIBHALCONTEXT(ctx, -1);
+ LIBHAL_CHECK_PARAM_VALID(udi, "*udi", -1);
+ LIBHAL_CHECK_PARAM_VALID(key, "*key", -1);
message = dbus_message_new_method_call ("org.freedesktop.Hal", udi,
"org.freedesktop.Hal.Device",
@@ -1300,6 +1329,8 @@ libhal_device_get_property_double (LibHalContext *ctx,
DBusError _error;
LIBHAL_CHECK_LIBHALCONTEXT(ctx, -1.0);
+ LIBHAL_CHECK_PARAM_VALID(udi, "*udi", -1.0);
+ LIBHAL_CHECK_PARAM_VALID(key, "*key", -1.0);
message = dbus_message_new_method_call ("org.freedesktop.Hal", udi,
"org.freedesktop.Hal.Device",
@@ -1370,6 +1401,8 @@ libhal_device_get_property_bool (LibHalContext *ctx,
DBusError _error;
LIBHAL_CHECK_LIBHALCONTEXT(ctx, FALSE);
+ LIBHAL_CHECK_PARAM_VALID(udi, "*udi", FALSE);
+ LIBHAL_CHECK_PARAM_VALID(key, "*key", FALSE);
message = dbus_message_new_method_call ("org.freedesktop.Hal", udi,
"org.freedesktop.Hal.Device",
@@ -1438,6 +1471,8 @@ libhal_device_set_property_helper (LibHalContext *ctx,
char *method_name = NULL;
LIBHAL_CHECK_LIBHALCONTEXT(ctx, FALSE);
+ LIBHAL_CHECK_PARAM_VALID(udi, "*udi", FALSE);
+ LIBHAL_CHECK_PARAM_VALID(key, "*key", FALSE);
/** @todo sanity check incoming params */
switch (type) {
@@ -1533,6 +1568,10 @@ libhal_device_set_property_string (LibHalContext *ctx,
const char *value,
DBusError *error)
{
+ LIBHAL_CHECK_LIBHALCONTEXT(ctx, FALSE);
+ LIBHAL_CHECK_PARAM_VALID(udi, "*udi", FALSE);
+ LIBHAL_CHECK_PARAM_VALID(key, "*key", FALSE);
+
return libhal_device_set_property_helper (ctx, udi, key,
DBUS_TYPE_STRING,
value, 0, 0, 0.0f, FALSE, error);
@@ -1555,6 +1594,10 @@ dbus_bool_t
libhal_device_set_property_int (LibHalContext *ctx, const char *udi,
const char *key, dbus_int32_t value, DBusError *error)
{
+ LIBHAL_CHECK_LIBHALCONTEXT(ctx, FALSE);
+ LIBHAL_CHECK_PARAM_VALID(udi, "*udi", FALSE);
+ LIBHAL_CHECK_PARAM_VALID(key, "*key", FALSE);
+
return libhal_device_set_property_helper (ctx, udi, key,
DBUS_TYPE_INT32,
NULL, value, 0, 0.0f, FALSE, error);
@@ -1577,6 +1620,10 @@ dbus_bool_t
libhal_device_set_property_uint64 (LibHalContext *ctx, const char *udi,
const char *key, dbus_uint64_t value, DBusError *error)
{
+ LIBHAL_CHECK_LIBHALCONTEXT(ctx, FALSE);
+ LIBHAL_CHECK_PARAM_VALID(udi, "*udi", FALSE);
+ LIBHAL_CHECK_PARAM_VALID(key, "*key", FALSE);
+
return libhal_device_set_property_helper (ctx, udi, key,
DBUS_TYPE_UINT64,
NULL, 0, value, 0.0f, FALSE, error);
@@ -1599,6 +1646,10 @@ dbus_bool_t
libhal_device_set_property_double (LibHalContext *ctx, const char *udi,
const char *key, double value, DBusError *error)
{
+ LIBHAL_CHECK_LIBHALCONTEXT(ctx, FALSE);
+ LIBHAL_CHECK_PARAM_VALID(udi, "*udi", FALSE);
+ LIBHAL_CHECK_PARAM_VALID(key, "*key", FALSE);
+
return libhal_device_set_property_helper (ctx, udi, key,
DBUS_TYPE_DOUBLE,
NULL, 0, 0, value, FALSE, error);
@@ -1621,6 +1672,10 @@ dbus_bool_t
libhal_device_set_property_bool (LibHalContext *ctx, const char *udi,
const char *key, dbus_bool_t value, DBusError *error)
{
+ LIBHAL_CHECK_LIBHALCONTEXT(ctx, FALSE);
+ LIBHAL_CHECK_PARAM_VALID(udi, "*udi", FALSE);
+ LIBHAL_CHECK_PARAM_VALID(key, "*key", FALSE);
+
return libhal_device_set_property_helper (ctx, udi, key,
DBUS_TYPE_BOOLEAN,
NULL, 0, 0, 0.0f, value, error);
@@ -1643,6 +1698,10 @@ dbus_bool_t
libhal_device_remove_property (LibHalContext *ctx,
const char *udi, const char *key, DBusError *error)
{
+ LIBHAL_CHECK_LIBHALCONTEXT(ctx, FALSE);
+ LIBHAL_CHECK_PARAM_VALID(udi, "*udi", FALSE);
+ LIBHAL_CHECK_PARAM_VALID(key, "*key", FALSE);
+
return libhal_device_set_property_helper (ctx, udi, key, DBUS_TYPE_INVALID,
/* DBUS_TYPE_INVALID means remove */
NULL, 0, 0, 0.0f, FALSE, error);
@@ -1673,6 +1732,8 @@ libhal_device_property_strlist_append (LibHalContext *ctx,
DBusMessageIter iter;
LIBHAL_CHECK_LIBHALCONTEXT(ctx, FALSE);
+ LIBHAL_CHECK_PARAM_VALID(udi, "*udi", FALSE);
+ LIBHAL_CHECK_PARAM_VALID(key, "*key", FALSE);
message = dbus_message_new_method_call ("org.freedesktop.Hal", udi,
"org.freedesktop.Hal.Device",
@@ -1726,6 +1787,8 @@ libhal_device_property_strlist_prepend (LibHalContext *ctx,
DBusMessageIter iter;
LIBHAL_CHECK_LIBHALCONTEXT(ctx, FALSE);
+ LIBHAL_CHECK_PARAM_VALID(udi, "*udi", FALSE);
+ LIBHAL_CHECK_PARAM_VALID(key, "*key", FALSE);
message = dbus_message_new_method_call ("org.freedesktop.Hal", udi,
"org.freedesktop.Hal.Device",
@@ -1779,6 +1842,8 @@ libhal_device_property_strlist_remove_index (LibHalContext *ctx,
DBusMessageIter iter;
LIBHAL_CHECK_LIBHALCONTEXT(ctx, FALSE);
+ LIBHAL_CHECK_PARAM_VALID(udi, "*udi", FALSE);
+ LIBHAL_CHECK_PARAM_VALID(key, "*key", FALSE);
message = dbus_message_new_method_call ("org.freedesktop.Hal", udi,
"org.freedesktop.Hal.Device",
@@ -1831,6 +1896,8 @@ libhal_device_property_strlist_remove (LibHalContext *ctx,
DBusMessageIter iter;
LIBHAL_CHECK_LIBHALCONTEXT(ctx, FALSE);
+ LIBHAL_CHECK_PARAM_VALID(udi, "*udi", FALSE);
+ LIBHAL_CHECK_PARAM_VALID(key, "*key", FALSE);
message = dbus_message_new_method_call ("org.freedesktop.Hal", udi,
"org.freedesktop.Hal.Device",
@@ -1883,6 +1950,7 @@ libhal_device_lock (LibHalContext *ctx,
DBusMessage *reply;
LIBHAL_CHECK_LIBHALCONTEXT(ctx, FALSE);
+ LIBHAL_CHECK_PARAM_VALID(udi, "*udi", FALSE);
if (reason_why_locked != NULL)
*reason_why_locked = NULL;
@@ -1950,6 +2018,7 @@ libhal_device_unlock (LibHalContext *ctx,
DBusMessage *reply;
LIBHAL_CHECK_LIBHALCONTEXT(ctx, FALSE);
+ LIBHAL_CHECK_PARAM_VALID(udi, "*udi", FALSE);
message = dbus_message_new_method_call ("org.freedesktop.Hal",
udi,
@@ -2086,6 +2155,8 @@ libhal_device_commit_to_gdl (LibHalContext *ctx,
DBusMessageIter iter;
LIBHAL_CHECK_LIBHALCONTEXT(ctx, FALSE);
+ LIBHAL_CHECK_PARAM_VALID(temp_udi, "*temop_udi", FALSE);
+ LIBHAL_CHECK_PARAM_VALID(udi, "*udi", FALSE);
message = dbus_message_new_method_call ("org.freedesktop.Hal",
"/org/freedesktop/Hal/Manager",
@@ -2143,6 +2214,7 @@ libhal_remove_device (LibHalContext *ctx, const char *udi, DBusError *error)
DBusMessageIter iter;
LIBHAL_CHECK_LIBHALCONTEXT(ctx, FALSE);
+ LIBHAL_CHECK_PARAM_VALID(udi, "*udi", FALSE);
message = dbus_message_new_method_call ("org.freedesktop.Hal",
"/org/freedesktop/Hal/Manager",
@@ -2196,6 +2268,7 @@ libhal_device_exists (LibHalContext *ctx, const char *udi, DBusError *error)
DBusError _error;
LIBHAL_CHECK_LIBHALCONTEXT(ctx, FALSE);
+ LIBHAL_CHECK_PARAM_VALID(udi, "*udi", FALSE);
message = dbus_message_new_method_call ("org.freedesktop.Hal",
"/org/freedesktop/Hal/Manager",
@@ -2267,6 +2340,8 @@ libhal_device_property_exists (LibHalContext *ctx,
DBusError _error;
LIBHAL_CHECK_LIBHALCONTEXT(ctx, FALSE);
+ LIBHAL_CHECK_PARAM_VALID(udi, "*udi", FALSE);
+ LIBHAL_CHECK_PARAM_VALID(key, "*key", FALSE);
message = dbus_message_new_method_call ("org.freedesktop.Hal", udi,
"org.freedesktop.Hal.Device",
@@ -2334,6 +2409,8 @@ libhal_merge_properties (LibHalContext *ctx,
DBusMessageIter iter;
LIBHAL_CHECK_LIBHALCONTEXT(ctx, FALSE);
+ LIBHAL_CHECK_PARAM_VALID(target_udi, "*target_udi", FALSE);
+ LIBHAL_CHECK_PARAM_VALID(source_udi, "*sourcE_udi", FALSE);
message = dbus_message_new_method_call ("org.freedesktop.Hal",
"/org/freedesktop/Hal/Manager",
@@ -2401,6 +2478,9 @@ libhal_device_matches (LibHalContext *ctx,
DBusError _error;
LIBHAL_CHECK_LIBHALCONTEXT(ctx, FALSE);
+ LIBHAL_CHECK_PARAM_VALID(udi1, "*udi1", FALSE);
+ LIBHAL_CHECK_PARAM_VALID(udi2, "*udi2", FALSE);
+ LIBHAL_CHECK_PARAM_VALID(property_namespace, "*property_namespace", FALSE);
message = dbus_message_new_method_call ("org.freedesktop.Hal",
"/org/freedesktop/Hal/Manager",
@@ -2470,6 +2550,7 @@ libhal_device_print (LibHalContext *ctx, const char *udi, DBusError *error)
LibHalPropertySetIterator i;
LIBHAL_CHECK_LIBHALCONTEXT(ctx, FALSE);
+ LIBHAL_CHECK_PARAM_VALID(udi, "*udi", FALSE);
printf ("device_id = %s\n", udi);
@@ -2557,6 +2638,7 @@ libhal_manager_find_device_string_match (LibHalContext *ctx,
DBusError _error;
LIBHAL_CHECK_LIBHALCONTEXT(ctx, NULL);
+ LIBHAL_CHECK_PARAM_VALID(key, "*key", NULL);
message = dbus_message_new_method_call ("org.freedesktop.Hal",
"/org/freedesktop/Hal/Manager",
@@ -2626,6 +2708,8 @@ libhal_device_add_capability (LibHalContext *ctx,
DBusMessageIter iter;
LIBHAL_CHECK_LIBHALCONTEXT(ctx, FALSE);
+ LIBHAL_CHECK_PARAM_VALID(udi, "*udi", FALSE);
+ LIBHAL_CHECK_PARAM_VALID(capability, "*capability", FALSE);
message = dbus_message_new_method_call ("org.freedesktop.Hal", udi,
"org.freedesktop.Hal.Device",
@@ -2679,6 +2763,8 @@ libhal_device_query_capability (LibHalContext *ctx, const char *udi, const char
dbus_bool_t ret;
LIBHAL_CHECK_LIBHALCONTEXT(ctx, FALSE);
+ LIBHAL_CHECK_PARAM_VALID(udi, "*udi", FALSE);
+ LIBHAL_CHECK_PARAM_VALID(capability, "*capability", FALSE);
ret = FALSE;
@@ -2718,6 +2804,7 @@ libhal_find_device_by_capability (LibHalContext *ctx,
DBusError _error;
LIBHAL_CHECK_LIBHALCONTEXT(ctx, NULL);
+ LIBHAL_CHECK_PARAM_VALID(capability, "*capability", FALSE);
message = dbus_message_new_method_call ("org.freedesktop.Hal",
"/org/freedesktop/Hal/Manager",
@@ -2811,6 +2898,7 @@ libhal_device_add_property_watch (LibHalContext *ctx, const char *udi, DBusError
char buf[512];
LIBHAL_CHECK_LIBHALCONTEXT(ctx, FALSE);
+ LIBHAL_CHECK_PARAM_VALID(udi, "*udi", FALSE);
snprintf (buf, 512,
"type='signal',"
@@ -2841,6 +2929,7 @@ libhal_device_remove_property_watch (LibHalContext *ctx, const char *udi, DBusEr
char buf[512];
LIBHAL_CHECK_LIBHALCONTEXT(ctx, FALSE);
+ LIBHAL_CHECK_PARAM_VALID(udi, "*udi", FALSE);
snprintf (buf, 512,
"type='signal',"
@@ -3247,6 +3336,7 @@ libhal_device_rescan (LibHalContext *ctx, const char *udi, DBusError *error)
dbus_bool_t result;
LIBHAL_CHECK_LIBHALCONTEXT(ctx, FALSE);
+ LIBHAL_CHECK_PARAM_VALID(udi, "*udi", FALSE);
message = dbus_message_new_method_call ("org.freedesktop.Hal", udi,
"org.freedesktop.Hal.Device",
@@ -3306,6 +3396,7 @@ libhal_device_reprobe (LibHalContext *ctx, const char *udi, DBusError *error)
dbus_bool_t result;
LIBHAL_CHECK_LIBHALCONTEXT(ctx, FALSE);
+ LIBHAL_CHECK_PARAM_VALID(udi, "*udi", FALSE);
message = dbus_message_new_method_call ("org.freedesktop.Hal",
udi,
@@ -3373,6 +3464,8 @@ dbus_bool_t libhal_device_emit_condition (LibHalContext *ctx,
dbus_bool_t result;
LIBHAL_CHECK_LIBHALCONTEXT(ctx, FALSE);
+ LIBHAL_CHECK_PARAM_VALID(udi, "*udi", FALSE);
+ LIBHAL_CHECK_PARAM_VALID(condition_name, "*condition_name", FALSE);
message = dbus_message_new_method_call ("org.freedesktop.Hal",
udi,
@@ -3441,6 +3534,7 @@ libhal_device_addon_is_ready (LibHalContext *ctx, const char *udi, DBusError *er
dbus_bool_t result;
LIBHAL_CHECK_LIBHALCONTEXT(ctx, FALSE);
+ LIBHAL_CHECK_PARAM_VALID(udi, "*udi", FALSE);
message = dbus_message_new_method_call ("org.freedesktop.Hal",
udi,
@@ -3510,6 +3604,8 @@ libhal_device_claim_interface (LibHalContext *ctx,
dbus_bool_t result;
LIBHAL_CHECK_LIBHALCONTEXT(ctx, FALSE);
+ LIBHAL_CHECK_PARAM_VALID(udi, "*udi", FALSE);
+ LIBHAL_CHECK_PARAM_VALID(interface_name, "*interface_name", FALSE);
message = dbus_message_new_method_call ("org.freedesktop.Hal",
udi,
@@ -3596,6 +3692,8 @@ libhal_device_new_changeset (const char *udi)
{
LibHalChangeSet *changeset;
+ LIBHAL_CHECK_PARAM_VALID(udi, "*udi", NULL);
+
changeset = calloc (1, sizeof (LibHalChangeSet));
if (changeset == NULL)
goto out;
diff --git a/libhal/libhal.h b/libhal/libhal.h
index 4556189..acddc11 100644
--- a/libhal/libhal.h
+++ b/libhal/libhal.h
@@ -42,6 +42,13 @@ extern "C" {
#endif
+/**
+ * LIBHAL_LIBHAL_FREE_DBUS_ERROR:
+ * @_dbus_error_: the DBusError
+ *
+ * Handy macro for checking whether a DBusError is set and free the error if
+ * the error is set.
+ */
#define LIBHAL_FREE_DBUS_ERROR(_dbus_error_) \
do { \
if (dbus_error_is_set(_dbus_error_)) \
++++++ hal-usb_speed_and_version_in_double.diff ++++++
diff --git a/doc/spec/hal-spec-properties.xml b/doc/spec/hal-spec-properties.xml
index aacf370..98b09b3 100644
--- a/doc/spec/hal-spec-properties.xml
+++ b/doc/spec/hal-spec-properties.xml
@@ -600,6 +600,14 @@
</row>
<row>
<entry>
+ <literal>usb_device.speed</literal> (double)
+ </entry>
+ <entry>examples: 1.5, 12.0, 480.0</entry>
+ <entry>Yes</entry>
+ <entry>Speed of device, in Mbit/s</entry>
+ </row>
+ <row>
+ <entry>
<literal>usb_device.version_bcd</literal> (int)
</entry>
<entry>examples: 0x0100, 0x0110, 0x0200</entry>
@@ -608,6 +616,14 @@
</row>
<row>
<entry>
+ <literal>usb_device.version</literal> (int)
+ </entry>
+ <entry>examples: 1.0, 1.1, 2.0</entry>
+ <entry>Yes</entry>
+ <entry>USB version of device</entry>
+ </row>
+ <row>
+ <entry>
<literal>usb_device.level_number</literal> (int)
</entry>
<entry>example: 2</entry>
diff --git a/hald/linux/device.c b/hald/linux/device.c
index aab6f4f..b718cef 100644
--- a/hald/linux/device.c
+++ b/hald/linux/device.c
@@ -1505,7 +1505,9 @@ usb_add (const gchar *sysfs_path, const gchar *device_file, HalDevice *parent_de
hal_util_set_string_from_file (d, "usb_device.serial", sysfs_path, "serial");
hal_util_set_bcd2_from_file (d, "usb_device.speed_bcd", sysfs_path, "speed");
+ hal_util_set_double_from_file (d, "usb_device.speed", sysfs_path, "speed");
hal_util_set_bcd2_from_file (d, "usb_device.version_bcd", sysfs_path, "version");
+ hal_util_set_double_from_file (d, "usb_device.version", sysfs_path, "version");
hal_util_get_int_from_file (sysfs_path, "bmAttributes", &bmAttributes, 16);
hal_device_property_set_bool (d, "usb_device.is_self_powered", (bmAttributes & 0x40) != 0);
diff --git a/hald/util.c b/hald/util.c
index 0356943..6c10a65 100644
--- a/hald/util.c
+++ b/hald/util.c
@@ -403,6 +403,25 @@ hal_util_set_string_from_file (HalDevice *d, const gchar *key, const gchar *dire
return ret;
}
+gboolean
+hal_util_set_double_from_file (HalDevice *d, const gchar *key, const gchar *directory, const gchar *file)
+{
+ double value;
+ gchar *buf, *end;
+ gboolean ret;
+
+ ret = FALSE;
+
+ if ((buf = hal_util_get_string_from_file (directory, file)) != NULL) {
+ value = strtod(buf, &end);
+ if (errno != ERANGE) {
+ ret = hal_device_property_set_double (d, key, value);
+ }
+ }
+
+ return ret;
+}
+
void
hal_util_compute_udi (HalDeviceStore *store, gchar *dst, gsize dstsize, const gchar *format, ...)
{
diff --git a/hald/util.h b/hald/util.h
index 5265b6d..7abd807 100644
--- a/hald/util.h
+++ b/hald/util.h
@@ -65,6 +65,8 @@ gboolean hal_util_get_bcd2_from_file (const gchar *directory, const gchar *file,
gboolean hal_util_set_bcd2_from_file (HalDevice *d, const gchar *key, const gchar *directory, const gchar *file);
+gboolean hal_util_set_double_from_file (HalDevice *d, const gchar *key, const gchar *directory, const gchar *file);
+
void hal_util_compute_udi (HalDeviceStore *store, gchar *dst, gsize dstsize, const gchar *format, ...);
gboolean hal_util_path_ascend (gchar *path);
diff --git a/tools/lshal.c b/tools/lshal.c
index ca417d8..372c2f5 100644
--- a/tools/lshal.c
+++ b/tools/lshal.c
@@ -150,8 +150,9 @@ print_props (const char *udi)
break;
case LIBHAL_PROPERTY_TYPE_DOUBLE:
- printf (" %s = %g (double)\n",
+ printf (" %s = %.1f (%g) (double)\n",
libhal_psi_get_key (&it),
+ libhal_psi_get_double (&it),
libhal_psi_get_double (&it));
break;
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
---------------------------------------------------------------------
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org