Contents of /trunk/hal/patches/hal-0.5.12-set-property-direct.patch
Parent Directory | Revision Log
Revision 870 -
(show annotations)
(download)
Wed Jul 15 17:15:11 2009 UTC (15 years, 2 months ago) by niro
File size: 3746 byte(s)
Wed Jul 15 17:15:11 2009 UTC (15 years, 2 months ago) by niro
File size: 3746 byte(s)
added set-property-direct patch
1 | diff -up hal-0.5.10/tools/hal_set_property.c.jx hal-0.5.10/tools/hal_set_property.c |
2 | --- hal-0.5.10/tools/hal_set_property.c.jx 2007-07-26 14:00:28.000000000 -0400 |
3 | +++ hal-0.5.10/tools/hal_set_property.c 2008-03-10 14:22:58.000000000 -0400 |
4 | @@ -66,7 +66,7 @@ usage (int argc, char *argv[]) |
5 | " (--int <value> | --string <value> | --bool <value> |\n" |
6 | " --strlist-pre <value> | --strlist-post <value> |\n" |
7 | " --strlist-rem <value> | --double <value> | --remove)\n" |
8 | - " [--help] [--version]\n"); |
9 | + " [--direct] [--help] [--version]\n"); |
10 | fprintf (stderr, |
11 | "\n" " --udi Unique Device Id\n" |
12 | " --key Key of the property to set\n" |
13 | @@ -81,6 +81,7 @@ usage (int argc, char *argv[]) |
14 | " --strlist-post Append a string to a list\n" |
15 | " --strlist-rem Remove a string from a list\n" |
16 | " --remove Indicates that the property should be removed\n" |
17 | + " --direct Use direct HAL connection\n" |
18 | " --version Show version and exit\n" |
19 | " --help Show this information and exit\n" |
20 | "\n" |
21 | @@ -114,6 +115,7 @@ main (int argc, char *argv[]) |
22 | dbus_bool_t is_version = FALSE; |
23 | int type = PROP_INVALID; |
24 | DBusError error; |
25 | + dbus_bool_t direct = FALSE; |
26 | |
27 | if (argc <= 1) { |
28 | usage (argc, argv); |
29 | @@ -135,6 +137,7 @@ main (int argc, char *argv[]) |
30 | {"strlist-pre", 1, NULL, 0}, |
31 | {"strlist-post", 1, NULL, 0}, |
32 | {"strlist-rem", 1, NULL, 0}, |
33 | + {"direct", 0, NULL, 0}, |
34 | {"remove", 0, NULL, 0}, |
35 | {"version", 0, NULL, 0}, |
36 | {"help", 0, NULL, 0}, |
37 | @@ -188,6 +191,8 @@ main (int argc, char *argv[]) |
38 | type = PROP_STRLIST_REM; |
39 | } else if (strcmp (opt, "remove") == 0) { |
40 | remove = TRUE; |
41 | + } else if (strcmp (opt, "direct") == 0) { |
42 | + direct = TRUE; |
43 | } else if (strcmp (opt, "udi") == 0) { |
44 | udi = strdup (optarg); |
45 | } else if (strcmp (opt, "version") == 0) { |
46 | @@ -215,24 +220,32 @@ main (int argc, char *argv[]) |
47 | |
48 | fprintf (stderr, "\n"); |
49 | |
50 | - dbus_error_init (&error); |
51 | - if ((hal_ctx = libhal_ctx_new ()) == NULL) { |
52 | - fprintf (stderr, "error: libhal_ctx_new\n"); |
53 | - return 1; |
54 | - } |
55 | - if (!libhal_ctx_set_dbus_connection (hal_ctx, dbus_bus_get (DBUS_BUS_SYSTEM, &error))) { |
56 | - fprintf (stderr, "error: libhal_ctx_set_dbus_connection: %s: %s\n", error.name, error.message); |
57 | - LIBHAL_FREE_DBUS_ERROR (&error); |
58 | - return 1; |
59 | - } |
60 | - if (!libhal_ctx_init (hal_ctx, &error)) { |
61 | - if (dbus_error_is_set(&error)) { |
62 | - fprintf (stderr, "error: libhal_ctx_init: %s: %s\n", error.name, error.message); |
63 | - dbus_error_free (&error); |
64 | + dbus_error_init (&error); |
65 | + if (direct) { |
66 | + if ((hal_ctx = libhal_ctx_init_direct (&error)) == NULL) { |
67 | + fprintf (stderr, "error: libhal_ctx_init_direct\n"); |
68 | + LIBHAL_FREE_DBUS_ERROR (&error); |
69 | + return 1; |
70 | + } |
71 | + } else { |
72 | + if ((hal_ctx = libhal_ctx_new ()) == NULL) { |
73 | + fprintf (stderr, "error: libhal_ctx_new\n"); |
74 | + return 1; |
75 | + } |
76 | + if (!libhal_ctx_set_dbus_connection (hal_ctx, dbus_bus_get (DBUS_BUS_SYSTEM, &error))) { |
77 | + fprintf (stderr, "error: libhal_ctx_set_dbus_connection: %s: %s\n", error.name, error.message); |
78 | + LIBHAL_FREE_DBUS_ERROR (&error); |
79 | + return 1; |
80 | + } |
81 | + if (!libhal_ctx_init (hal_ctx, &error)) { |
82 | + if (dbus_error_is_set(&error)) { |
83 | + fprintf (stderr, "error: libhal_ctx_init: %s: %s\n", error.name, error.message); |
84 | + dbus_error_free (&error); |
85 | + } |
86 | + fprintf (stderr, "Could not initialise connection to hald.\n" |
87 | + "Normally this means the HAL daemon (hald) is not running or not ready.\n"); |
88 | + return 1; |
89 | } |
90 | - fprintf (stderr, "Could not initialise connection to hald.\n" |
91 | - "Normally this means the HAL daemon (hald) is not running or not ready.\n"); |
92 | - return 1; |
93 | } |
94 | |
95 | if (remove) { |