hal/tools hal_get_property.c, 1.6, 1.7 hal_set_property.c, 1.6, 1.7 lshal.c, 1.7, 1.8

David Zeuthen david at freedesktop.org
Wed Sep 1 10:39:02 PDT 2004


Update of /cvs/hal/hal/tools
In directory gabe:/tmp/cvs-serv13914/tools

Modified Files:
	hal_get_property.c hal_set_property.c lshal.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: hal_get_property.c
===================================================================
RCS file: /cvs/hal/hal/tools/hal_get_property.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- hal_get_property.c	11 Jul 2004 20:38:34 -0000	1.6
+++ hal_get_property.c	1 Sep 2004 17:38:59 -0000	1.7
@@ -176,6 +176,13 @@
 		printf ((is_hex ? "%x\n" : "%d\n"),
 			hal_device_get_property_int (hal_ctx, udi, key));
 		break;
+	case DBUS_TYPE_UINT64:
+		if (is_verbose)
+			printf ("Type is uint64 (shown in %s)\n",
+				(is_hex ? "hexadecimal" : "decimal"));
+		printf ((is_hex ? "%llx\n" : "%lld\n"),
+			hal_device_get_property_uint64 (hal_ctx, udi, key));
+		break;
 	case DBUS_TYPE_DOUBLE:
 		if (is_verbose)
 			printf ("Type is double\n");

Index: hal_set_property.c
===================================================================
RCS file: /cvs/hal/hal/tools/hal_set_property.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- hal_set_property.c	11 Jul 2004 20:38:34 -0000	1.6
+++ hal_set_property.c	1 Sep 2004 17:38:59 -0000	1.7
@@ -65,6 +65,8 @@
  "        --key            Key of the property to set\n"
  "        --int            Set value to an integer. Accepts decimal and "
  "                         hexadecimal prefixed with 0x or x\n"
+ "        --uint64         Set value to an integer. Accepts decimal and "
+ "                         hexadecimal prefixed with 0x or x\n"
  "        --string         Set value to a string\n"
  "        --double         Set value to a floating point number\n"
  "        --bool           Set value to a boolean, ie. true or false\n"
@@ -93,6 +95,7 @@
 	char *key = NULL;
 	char *str_value = NULL;
 	dbus_int32_t int_value = 0;
+	dbus_uint64_t uint64_value = 0;
 	double double_value = 0.0f;
 	dbus_bool_t bool_value = TRUE;
 	dbus_bool_t remove = FALSE;
@@ -112,6 +115,7 @@
 			{"udi", 1, NULL, 0},
 			{"key", 1, NULL, 0},
 			{"int", 1, NULL, 0},
+			{"uint64", 1, NULL, 0},
 			{"string", 1, NULL, 0},
 			{"double", 1, NULL, 0},
 			{"bool", 1, NULL, 0},
@@ -141,6 +145,9 @@
 			} else if (strcmp (opt, "int") == 0) {
 				int_value = strtol (optarg, NULL, 0);
 				type = DBUS_TYPE_INT32;
+			} else if (strcmp (opt, "uint64") == 0) {
+				uint64_value = strtoull (optarg, NULL, 0);
+				type = DBUS_TYPE_UINT64;
 			} else if (strcmp (opt, "double") == 0) {
 				double_value = (double) atof (optarg);
 				type = DBUS_TYPE_DOUBLE;
@@ -203,6 +210,10 @@
 			rc = hal_device_set_property_int (hal_ctx, udi, key,
 							  int_value);
 			break;
+		case DBUS_TYPE_UINT64:
+			rc = hal_device_set_property_uint64 (hal_ctx, udi, key,
+							  uint64_value);
+			break;
 		case DBUS_TYPE_DOUBLE:
 			rc = hal_device_set_property_double (hal_ctx, udi, key,
 							     double_value);

Index: lshal.c
===================================================================
RCS file: /cvs/hal/hal/tools/lshal.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- lshal.c	10 Apr 2004 16:51:56 -0000	1.7
+++ lshal.c	1 Sep 2004 17:38:59 -0000	1.8
@@ -110,6 +110,13 @@
 					hal_psi_get_int (&it));
 				break;
 
+			case DBUS_TYPE_UINT64:
+				printf ("  %s = %lld  (0x%llx)  (uint64)\n",
+					hal_psi_get_key (&it),
+					hal_psi_get_uint64 (&it),
+					hal_psi_get_uint64 (&it));
+				break;
+
 			case DBUS_TYPE_DOUBLE:
 				printf ("  %s = %g  (double)\n",
 					hal_psi_get_key (&it),
@@ -225,6 +232,15 @@
 				 value, value);
 		}
 		break;
+	case DBUS_TYPE_UINT64:
+		{
+			dbus_uint64_t value =
+			    hal_device_get_property_uint64 (hal_ctx, udi, key);
+			fprintf (stderr,
+				 "*** new value: %lld (0x%llx)  (uint64)\n",
+				 value, value);
+		}
+		break;
 	case DBUS_TYPE_DOUBLE:
 		fprintf (stderr, "*** new value: %g  (double)\n",
 			 hal_device_get_property_double (hal_ctx, udi, key));




More information about the hal-commit mailing list