hal/hald/linux common.c, 1.13, 1.14 common.h, 1.9,
1.10 ieee1394_node_class_device.c, 1.5, 1.6 net_class_device.c,
1.16, 1.17
David Zeuthen
david at freedesktop.org
Wed Sep 1 10:39:00 PDT 2004
Update of /cvs/hal/hal/hald/linux
In directory gabe:/tmp/cvs-serv13914/hald/linux
Modified Files:
common.c common.h ieee1394_node_class_device.c
net_class_device.c
Log Message:
2004-09-01 David Zeuthen <david at fubar.dk>
Patch from Jon Lech Johansen <jon at nanocrew.net>. Add support for
properties of 64-bit unsigned integers. Right now this is not used
as the D-BUS python bindings needs a patch.
* hald/device.c: (hal_device_merge_with_rewrite),
(hal_device_merge), (hal_device_matches),
(hal_device_property_get_uint64), (hal_device_property_set_uint64),
(hal_device_print):
* hald/device.h:
* hald/device_info.c: (handle_match), (handle_merge), (end):
* hald/hald_dbus.c: (foreach_property_append),
(device_get_property), (device_set_property):
* hald/linux/common.c: (parse_hex_uint64):
* hald/linux/common.h:
* hald/linux/ieee1394_node_class_device.c:
(ieee1394_node_class_pre_process):
* hald/linux/net_class_device.c: (net_class_pre_process):
* hald/property.c: (hal_property_new_uint64),
(hal_property_get_uint64), (hal_property_to_string),
(hal_property_set_uint64):
* hald/property.h:
* hald/pstore.c: (hal_pstore_save_property),
(hal_pstore_load_property):
* libhal/libhal.c: (hal_device_get_all_properties),
(hal_psi_get_uint64), (hal_device_get_property_uint64),
(hal_device_set_property_helper), (hal_device_set_property_string),
(hal_device_set_property_int), (hal_device_set_property_uint64),
(hal_device_set_property_double), (hal_device_set_property_bool),
(hal_device_remove_property), (hal_device_print):
* libhal/libhal.h:
* tools/device-manager/DeviceManager.py:
* tools/hal_get_property.c: (main):
* tools/hal_set_property.c: (usage), (main):
* tools/lshal.c: (dump_devices), (print_property):
Index: common.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/common.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- common.c 15 Aug 2004 18:54:57 -0000 1.13
+++ common.c 1 Sep 2004 17:38:58 -0000 1.14
@@ -101,6 +101,22 @@
return value;
}
+/** Parse an integer represented as a hexa-decimal number (base 16) in
+ * a string.
+ *
+ * @param str String to parse
+ * @return Integer; If there was an error parsing the
+ * result is undefined.
+ */
+dbus_uint64_t
+parse_hex_uint64 (const char *str)
+{
+ dbus_uint64_t value;
+ value = strtoull (str, NULL, 16);
+ /** @todo Check error condition */
+ return value;
+}
+
/** Find an integer appearing right after a substring in a string.
*
* The result is LONG_MAX if the number isn't properly formatted or
Index: common.h
===================================================================
RCS file: /cvs/hal/hal/hald/linux/common.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- common.h 25 Aug 2004 20:55:13 -0000 1.9
+++ common.h 1 Sep 2004 17:38:58 -0000 1.10
@@ -40,6 +40,7 @@
double parse_double (const char *str);
dbus_int32_t parse_dec (const char *str);
dbus_int32_t parse_hex (const char *str);
+dbus_uint64_t parse_hex_uint64 (const char *str);
long int find_num (char *pre, char *s, int base);
double find_double (char *pre, char *s);
Index: ieee1394_node_class_device.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/ieee1394_node_class_device.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- ieee1394_node_class_device.c 9 Aug 2004 18:33:29 -0000 1.5
+++ ieee1394_node_class_device.c 1 Sep 2004 17:38:58 -0000 1.6
@@ -66,7 +66,8 @@
struct sysfs_device *sysdevice;
struct sysfs_attribute *cur;
char attr_name[SYSFS_NAME_LEN];
- int tmp;
+ dbus_int32_t tmp;
+ dbus_uint64_t tmp2;
const char *vendor_name = NULL;
int vendor_id = 0;
@@ -92,9 +93,11 @@
"ieee1394.capabilities",
tmp);
} else if (strcmp (attr_name, "guid") == 0) {
- tmp = parse_hex (cur->value);
+ tmp2 = parse_hex_uint64 (cur->value);
- hal_device_property_set_int (d, "ieee1394.guid", tmp);
+ /* TODO: comment out when 64-bit python patch is in dbus */
+ /*hal_device_property_set_uint64 (d, "ieee1394.guid", tmp2);*/
+ hal_device_property_set_int (d, "ieee1394.guid", (dbus_int32_t) tmp2);
} else if (strcmp (attr_name, "nodeid") == 0) {
tmp = parse_hex (cur->value);
Index: net_class_device.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/net_class_device.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- net_class_device.c 15 Aug 2004 18:54:57 -0000 1.16
+++ net_class_device.c 1 Sep 2004 17:38:58 -0000 1.17
@@ -515,12 +515,14 @@
mac_upper = (a5 << 16) | (a4 << 8) | a3;
mac_lower = (a2 << 16) | (a1 << 8) | a0;
- hal_device_property_set_int (d,
- "net.ethernet.mac_addr_upper24",
+ hal_device_property_set_int (d, "net.ethernet.mac_addr_upper24",
(dbus_int32_t) mac_upper);
- hal_device_property_set_int (d,
- "net.ethernet.mac_addr_lower24",
+ hal_device_property_set_int (d, "net.ethernet.mac_addr_lower24",
(dbus_int32_t) mac_lower);
+
+ /* TODO: comment out when 64-bit python patch is in dbus */
+ /*hal_device_property_set_uint64 (d, "net.ethernet.address",
+ (dbus_uint64_t) ((mac_upper<<24) | mac_lower));*/
}
/* Get the initial link state from the MII registers */
More information about the hal-commit
mailing list