Merge lp:~sforshee/powerd/add-name-arg into lp:powerd
- add-name-arg
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Matt Fischer |
Approved revision: | 77 |
Merged at revision: | 77 |
Proposed branch: | lp:~sforshee/powerd/add-name-arg |
Merge into: | lp:powerd |
Diff against target: |
624 lines (+101/-92) 9 files modified
cli/client-test.c (+3/-3) cli/powerd-cli.c (+50/-40) cli/powerd-cli.h (+1/-1) data/com.canonical.powerd.xml (+4/-2) src/display-request.c (+16/-19) src/display.c (+2/-1) src/power-request.c (+14/-18) src/powerd-internal.h (+7/-5) src/powerd.cpp (+4/-3) |
To merge this branch: | bzr merge lp:~sforshee/powerd/add-name-arg |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Matt Fischer (community) | Approve | ||
PS Jenkins bot | continuous-integration | Approve | |
Review via email:
|
Commit message
Add "name" argument to dbus request APIs to help in debugging power problems
Description of the change
Add "name" argument to dbus request APIs to help in debugging power problems
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Matt Fischer (mfisch) wrote : | # |
434 - if (req->owner)
435 - g_free(
436 + g_free(
437 + g_free(
546 - if (sr->owner) {
547 - g_free(sr->owner);
548 - sr->owner = NULL;
549 - }
550 + g_free(
551 + g_free(
Why remove the check and set to NULL?
Also should we modify the tests to ensure a name and owner are set? I assume it's impossible not to be, but it does help validate that list*Requests is working.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Seth Forshee (sforshee) wrote : | # |
On Mon, Jul 29, 2013 at 07:04:29PM -0000, Matthew Fischer wrote:
> Review: Needs Information
>
> 434 - if (req->owner)
> 435 - g_free(
> 436 + g_free(
> 437 + g_free(
>
> 546 - if (sr->owner) {
> 547 - g_free(sr->owner);
> 548 - sr->owner = NULL;
> 549 - }
> 550 + g_free(
> 551 + g_free(
>
> Why remove the check and set to NULL?
Because it should never be null. We either strdup the dbus owner string
or else strdup a hard-coded "internal" string.
sr is free right after freeing the strings, so setting to NULL is
unnecessary.
> Also should we modify the tests to ensure a name and owner are set? I assume it's impossible not to be, but it does help validate that list*Requests is working.
We can't make a test to set owner to NULL, as the owner string isn't
passed as an argument over the dbus API.
I tried adding a test with name == NULL, but it doesn't work. I get the
output below. Rather than getting NULL, handle_
a pointer to a string which contains "[Invalid UTF-8]". So I'm not
really sure how to test it.
Test: requestSysState
(process:2526): GLib-CRITICAL **: g_variant_
'string != NULL' failed
result: FAILED
Preview Diff
1 | === modified file 'cli/client-test.c' | |||
2 | --- cli/client-test.c 2013-07-24 20:02:49 +0000 | |||
3 | +++ cli/client-test.c 2013-07-29 16:08:44 +0000 | |||
4 | @@ -174,7 +174,7 @@ | |||
5 | 174 | test_data.ack_delay = 0; | 174 | test_data.ack_delay = 0; |
6 | 175 | reset_test_state(); | 175 | reset_test_state(); |
7 | 176 | test_data.ack_timeout_id = g_timeout_add(5000, ack_timeout_handler, NULL); | 176 | test_data.ack_timeout_id = g_timeout_add(5000, ack_timeout_handler, NULL); |
9 | 177 | requestSysState(test_data.state, &test_data.cookie); | 177 | requestSysState("ack-test", test_data.state, &test_data.cookie); |
10 | 178 | return FALSE; | 178 | return FALSE; |
11 | 179 | } | 179 | } |
12 | 180 | 180 | ||
13 | @@ -207,7 +207,7 @@ | |||
14 | 207 | test_data.state = POWERD_SYS_STATE_ACTIVE; | 207 | test_data.state = POWERD_SYS_STATE_ACTIVE; |
15 | 208 | test_data.ack_delay = -1; | 208 | test_data.ack_delay = -1; |
16 | 209 | test_data.ack_timeout_id = g_timeout_add(5000, ack_timeout_handler, NULL); | 209 | test_data.ack_timeout_id = g_timeout_add(5000, ack_timeout_handler, NULL); |
18 | 210 | requestSysState(test_data.state, &test_data.cookie); | 210 | requestSysState("no-ack-test", test_data.state, &test_data.cookie); |
19 | 211 | return FALSE; | 211 | return FALSE; |
20 | 212 | } | 212 | } |
21 | 213 | 213 | ||
22 | @@ -231,7 +231,7 @@ | |||
23 | 231 | test_data.state = POWERD_SYS_STATE_SUSPEND; | 231 | test_data.state = POWERD_SYS_STATE_SUSPEND; |
24 | 232 | test_data.ack_delay = 0; | 232 | test_data.ack_delay = 0; |
25 | 233 | test_data.ack_timeout_id = g_timeout_add(5000, ack_timeout_handler, NULL); | 233 | test_data.ack_timeout_id = g_timeout_add(5000, ack_timeout_handler, NULL); |
27 | 234 | requestSysState(POWERD_SYS_STATE_ACTIVE, &test_data.cookie); | 234 | requestSysState("bad-ack-test", POWERD_SYS_STATE_ACTIVE, &test_data.cookie); |
28 | 235 | return FALSE; | 235 | return FALSE; |
29 | 236 | } | 236 | } |
30 | 237 | 237 | ||
31 | 238 | 238 | ||
32 | === modified file 'cli/powerd-cli.c' | |||
33 | --- cli/powerd-cli.c 2013-07-23 20:43:37 +0000 | |||
34 | +++ cli/powerd-cli.c 2013-07-29 16:08:44 +0000 | |||
35 | @@ -45,12 +45,14 @@ | |||
36 | 45 | const char *powerd_cli_bus_name; | 45 | const char *powerd_cli_bus_name; |
37 | 46 | 46 | ||
38 | 47 | struct PublicSysRequest { | 47 | struct PublicSysRequest { |
40 | 48 | const gchar *owner; | 48 | const char *name; |
41 | 49 | const char *owner; | ||
42 | 49 | int state; | 50 | int state; |
43 | 50 | }; | 51 | }; |
44 | 51 | 52 | ||
45 | 52 | struct PublicDispRequest { | 53 | struct PublicDispRequest { |
47 | 53 | const gchar *owner; | 54 | const char *name; |
48 | 55 | const char *owner; | ||
49 | 54 | enum powerd_display_state state; | 56 | enum powerd_display_state state; |
50 | 55 | guint32 flags; | 57 | guint32 flags; |
51 | 56 | }; | 58 | }; |
52 | @@ -93,7 +95,7 @@ | |||
53 | 93 | } | 95 | } |
54 | 94 | 96 | ||
55 | 95 | gboolean | 97 | gboolean |
57 | 96 | requestSysState(int state, | 98 | requestSysState(const char *name, int state, |
58 | 97 | powerd_cookie_t *cookie) | 99 | powerd_cookie_t *cookie) |
59 | 98 | { | 100 | { |
60 | 99 | GVariant *ret = NULL; | 101 | GVariant *ret = NULL; |
61 | @@ -108,7 +110,7 @@ | |||
62 | 108 | 110 | ||
63 | 109 | ret = g_dbus_proxy_call_sync(powerd_proxy, | 111 | ret = g_dbus_proxy_call_sync(powerd_proxy, |
64 | 110 | "requestSysState", | 112 | "requestSysState", |
66 | 111 | g_variant_new("(i)", state), | 113 | g_variant_new("(si)", name, state), |
67 | 112 | G_DBUS_CALL_FLAGS_NONE, | 114 | G_DBUS_CALL_FLAGS_NONE, |
68 | 113 | -1, | 115 | -1, |
69 | 114 | NULL, | 116 | NULL, |
70 | @@ -133,7 +135,7 @@ | |||
71 | 133 | } | 135 | } |
72 | 134 | 136 | ||
73 | 135 | static gboolean | 137 | static gboolean |
75 | 136 | requestDisplayState(struct PublicDispRequest pdr, | 138 | requestDisplayState(struct PublicDispRequest pdr, const char *name, |
76 | 137 | powerd_cookie_t *cookie) | 139 | powerd_cookie_t *cookie) |
77 | 138 | { | 140 | { |
78 | 139 | GVariant *ret = NULL; | 141 | GVariant *ret = NULL; |
79 | @@ -148,7 +150,7 @@ | |||
80 | 148 | 150 | ||
81 | 149 | ret = g_dbus_proxy_call_sync(powerd_proxy, | 151 | ret = g_dbus_proxy_call_sync(powerd_proxy, |
82 | 150 | "requestDisplayState", | 152 | "requestDisplayState", |
84 | 151 | g_variant_new("(iu)", pdr.state, pdr.flags), | 153 | g_variant_new("(siu)", name, pdr.state, pdr.flags), |
85 | 152 | G_DBUS_CALL_FLAGS_NONE, | 154 | G_DBUS_CALL_FLAGS_NONE, |
86 | 153 | -1, | 155 | -1, |
87 | 154 | NULL, | 156 | NULL, |
88 | @@ -193,7 +195,7 @@ | |||
89 | 193 | NULL, | 195 | NULL, |
90 | 194 | &error); | 196 | &error); |
91 | 195 | if (!ret) { | 197 | if (!ret) { |
93 | 196 | cli_warn("requestDisplayState failed: %s", error->message); | 198 | cli_warn("updateDisplayState failed: %s", error->message); |
94 | 197 | g_error_free(error); | 199 | g_error_free(error); |
95 | 198 | return FALSE; | 200 | return FALSE; |
96 | 199 | } | 201 | } |
97 | @@ -223,10 +225,11 @@ | |||
98 | 223 | g_error_free(error); | 225 | g_error_free(error); |
99 | 224 | } | 226 | } |
100 | 225 | else { | 227 | else { |
102 | 226 | g_variant_get(ret, "(a(si))", &iter); | 228 | g_variant_get(ret, "(a(ssi))", &iter); |
103 | 227 | while ((item = g_variant_iter_next_value (iter))) { | 229 | while ((item = g_variant_iter_next_value (iter))) { |
106 | 228 | g_variant_get_child (item, 0, "s", &psr.owner); | 230 | g_variant_get_child (item, 0, "s", &psr.name); |
107 | 229 | g_variant_get_child (item, 1, "i", &psr.state); | 231 | g_variant_get_child (item, 1, "s", &psr.owner); |
108 | 232 | g_variant_get_child (item, 2, "i", &psr.state); | ||
109 | 230 | g_array_append_val(retarray, psr); | 233 | g_array_append_val(retarray, psr); |
110 | 231 | g_variant_unref(item); | 234 | g_variant_unref(item); |
111 | 232 | } | 235 | } |
112 | @@ -246,7 +249,8 @@ | |||
113 | 246 | } else { | 249 | } else { |
114 | 247 | for (i = 0; i < requests->len; i++) { | 250 | for (i = 0; i < requests->len; i++) { |
115 | 248 | psr = &g_array_index(requests, struct PublicSysRequest, i); | 251 | psr = &g_array_index(requests, struct PublicSysRequest, i); |
117 | 249 | printf(" Owner: %s, State: %d\n", psr->owner, psr->state); | 252 | printf(" Name: %s, Owner: %s, State: %d\n", psr->name, |
118 | 253 | psr->owner, psr->state); | ||
119 | 250 | } | 254 | } |
120 | 251 | } | 255 | } |
121 | 252 | } | 256 | } |
122 | @@ -272,11 +276,12 @@ | |||
123 | 272 | g_error_free(error); | 276 | g_error_free(error); |
124 | 273 | } | 277 | } |
125 | 274 | else { | 278 | else { |
127 | 275 | g_variant_get(ret, "(a(siu))", &iter); | 279 | g_variant_get(ret, "(a(ssiu))", &iter); |
128 | 276 | while ((item = g_variant_iter_next_value (iter))) { | 280 | while ((item = g_variant_iter_next_value (iter))) { |
132 | 277 | g_variant_get_child(item, 0, "s", &pdr.owner); | 281 | g_variant_get_child(item, 0, "s", &pdr.name); |
133 | 278 | g_variant_get_child(item, 1, "i", &pdr.state); | 282 | g_variant_get_child(item, 1, "s", &pdr.owner); |
134 | 279 | g_variant_get_child(item, 2, "u", &pdr.flags); | 283 | g_variant_get_child(item, 2, "i", &pdr.state); |
135 | 284 | g_variant_get_child(item, 3, "u", &pdr.flags); | ||
136 | 280 | g_array_append_val(retarray, pdr); | 285 | g_array_append_val(retarray, pdr); |
137 | 281 | g_variant_unref(item); | 286 | g_variant_unref(item); |
138 | 282 | } | 287 | } |
139 | @@ -296,8 +301,8 @@ | |||
140 | 296 | } else { | 301 | } else { |
141 | 297 | for (i = 0; i < requests->len; i++) { | 302 | for (i = 0; i < requests->len; i++) { |
142 | 298 | pdr = &g_array_index(requests, struct PublicDispRequest, i); | 303 | pdr = &g_array_index(requests, struct PublicDispRequest, i); |
145 | 299 | printf(" Owner: %s, State: %d, Flags: %#08x\n", | 304 | printf(" Name: %s, Owner: %s, State: %d, Flags: %#08x\n", |
146 | 300 | pdr->owner, pdr->state, pdr->flags); | 305 | pdr->name, pdr->owner, pdr->state, pdr->flags); |
147 | 301 | } | 306 | } |
148 | 302 | } | 307 | } |
149 | 303 | } | 308 | } |
150 | @@ -436,7 +441,7 @@ | |||
151 | 436 | main_loop = g_main_loop_new (NULL, FALSE); | 441 | main_loop = g_main_loop_new (NULL, FALSE); |
152 | 437 | 442 | ||
153 | 438 | // Hold active state request as long we're running tests | 443 | // Hold active state request as long we're running tests |
155 | 439 | requestSysState(POWERD_SYS_STATE_ACTIVE, &main_cookie); | 444 | requestSysState("main-req", POWERD_SYS_STATE_ACTIVE, &main_cookie); |
156 | 440 | 445 | ||
157 | 441 | ret = g_spawn_async_with_pipes(NULL, argv, NULL, | 446 | ret = g_spawn_async_with_pipes(NULL, argv, NULL, |
158 | 442 | G_SPAWN_SEARCH_PATH|G_SPAWN_DO_NOT_REAP_CHILD, | 447 | G_SPAWN_SEARCH_PATH|G_SPAWN_DO_NOT_REAP_CHILD, |
159 | @@ -466,10 +471,13 @@ | |||
160 | 466 | silence_errors(TRUE); | 471 | silence_errors(TRUE); |
161 | 467 | 472 | ||
162 | 468 | // Hold active state request as long we're running tests | 473 | // Hold active state request as long we're running tests |
164 | 469 | requestSysState(POWERD_SYS_STATE_ACTIVE, &main_cookie); | 474 | requestSysState("main-req", POWERD_SYS_STATE_ACTIVE, &main_cookie); |
165 | 470 | 475 | ||
168 | 471 | for (i = 0; i < TEST_NUM_SYS_REQUESTS; i++) | 476 | for (i = 0; i < TEST_NUM_SYS_REQUESTS; i++) { |
169 | 472 | do_test(requestSysState(POWERD_SYS_STATE_ACTIVE, &cookies[i]) == TRUE); | 477 | char name[16]; |
170 | 478 | snprintf(name, sizeof(name), "test-cookie-%d", i); | ||
171 | 479 | do_test(requestSysState(name, POWERD_SYS_STATE_ACTIVE, &cookies[i]) == TRUE); | ||
172 | 480 | } | ||
173 | 473 | 481 | ||
174 | 474 | // Make sure we have at least NUM_REQUESTS + 1 | 482 | // Make sure we have at least NUM_REQUESTS + 1 |
175 | 475 | requests = listSysRequests(); | 483 | requests = listSysRequests(); |
176 | @@ -501,11 +509,11 @@ | |||
177 | 501 | g_array_free(requests, TRUE); | 509 | g_array_free(requests, TRUE); |
178 | 502 | 510 | ||
179 | 503 | //cannot request the suspend state, this will fail | 511 | //cannot request the suspend state, this will fail |
181 | 504 | do_test(requestSysState(POWERD_SYS_STATE_SUSPEND, &cookie) == FALSE); | 512 | do_test(requestSysState("test-cookie", POWERD_SYS_STATE_SUSPEND, &cookie) == FALSE); |
182 | 505 | //invalid values | 513 | //invalid values |
186 | 506 | do_test(requestSysState(-1, &cookie) == FALSE); | 514 | do_test(requestSysState("test-cookie", -1, &cookie) == FALSE); |
187 | 507 | do_test(requestSysState(POWERD_NUM_POWER_STATES, &cookie) == FALSE); | 515 | do_test(requestSysState("test-cookie", POWERD_NUM_POWER_STATES, &cookie) == FALSE); |
188 | 508 | do_test(requestSysState(POWERD_NUM_POWER_STATES+1, &cookie) == FALSE); | 516 | do_test(requestSysState("test-cookie", POWERD_NUM_POWER_STATES+1, &cookie) == FALSE); |
189 | 509 | 517 | ||
190 | 510 | //cleanup | 518 | //cleanup |
191 | 511 | do_test(clearSysState(main_cookie) == TRUE); | 519 | do_test(clearSysState(main_cookie) == TRUE); |
192 | @@ -527,15 +535,17 @@ | |||
193 | 527 | silence_errors(TRUE); | 535 | silence_errors(TRUE); |
194 | 528 | 536 | ||
195 | 529 | // Hold active state request as long we're running tests | 537 | // Hold active state request as long we're running tests |
197 | 530 | requestSysState(POWERD_SYS_STATE_ACTIVE, &main_cookie); | 538 | requestSysState("main-req", POWERD_SYS_STATE_ACTIVE, &main_cookie); |
198 | 531 | 539 | ||
199 | 532 | for (i = 0; i < TEST_NUM_DISP_REQUESTS; i++) { | 540 | for (i = 0; i < TEST_NUM_DISP_REQUESTS; i++) { |
200 | 541 | char name[16]; | ||
201 | 542 | snprintf(name, sizeof(name), "disp-test-%d", i); | ||
202 | 533 | pdr.state = state++; | 543 | pdr.state = state++; |
203 | 534 | pdr.flags = 0; | 544 | pdr.flags = 0; |
204 | 535 | if (bright) { | 545 | if (bright) { |
205 | 536 | pdr.flags |= POWERD_DISPLAY_FLAG_BRIGHT; | 546 | pdr.flags |= POWERD_DISPLAY_FLAG_BRIGHT; |
206 | 537 | } | 547 | } |
208 | 538 | do_test(requestDisplayState(pdr, &cookies[i]) == TRUE); | 548 | do_test(requestDisplayState(pdr, name, &cookies[i]) == TRUE); |
209 | 539 | if (state >= POWERD_NUM_DISPLAY_STATES) { | 549 | if (state >= POWERD_NUM_DISPLAY_STATES) { |
210 | 540 | state = 0; | 550 | state = 0; |
211 | 541 | } | 551 | } |
212 | @@ -567,19 +577,19 @@ | |||
213 | 567 | 577 | ||
214 | 568 | //invalid values | 578 | //invalid values |
215 | 569 | pdr.state = -1; | 579 | pdr.state = -1; |
217 | 570 | do_test(requestDisplayState(pdr, &cookie) == FALSE); | 580 | do_test(requestDisplayState(pdr, "disp-test", &cookie) == FALSE); |
218 | 571 | 581 | ||
219 | 572 | pdr.state = POWERD_NUM_DISPLAY_STATES; | 582 | pdr.state = POWERD_NUM_DISPLAY_STATES; |
221 | 573 | do_test(requestDisplayState(pdr, &cookie) == FALSE); | 583 | do_test(requestDisplayState(pdr, "disp-test", &cookie) == FALSE); |
222 | 574 | 584 | ||
223 | 575 | pdr.state = POWERD_DISPLAY_STATE_ON; | 585 | pdr.state = POWERD_DISPLAY_STATE_ON; |
224 | 576 | pdr.flags = 0xdeadbeef; | 586 | pdr.flags = 0xdeadbeef; |
226 | 577 | do_test(requestDisplayState(pdr, &cookie) == FALSE); | 587 | do_test(requestDisplayState(pdr, "disp-test", &cookie) == FALSE); |
227 | 578 | 588 | ||
228 | 579 | // updateDisplayState tests | 589 | // updateDisplayState tests |
229 | 580 | pdr.state = POWERD_DISPLAY_STATE_ON; | 590 | pdr.state = POWERD_DISPLAY_STATE_ON; |
230 | 581 | pdr.flags = 0; | 591 | pdr.flags = 0; |
232 | 582 | do_test(requestDisplayState(pdr, &cookie) == TRUE); | 592 | do_test(requestDisplayState(pdr, "disp-test", &cookie) == TRUE); |
233 | 583 | 593 | ||
234 | 584 | // update with same state should be okay | 594 | // update with same state should be okay |
235 | 585 | do_test(updateDisplayState(pdr, cookie) == TRUE); | 595 | do_test(updateDisplayState(pdr, cookie) == TRUE); |
236 | @@ -798,12 +808,12 @@ | |||
237 | 798 | g_array_free(requests, TRUE); | 808 | g_array_free(requests, TRUE); |
238 | 799 | } | 809 | } |
239 | 800 | else if (!strcmp(argv[1],"active-nc")) { | 810 | else if (!strcmp(argv[1],"active-nc")) { |
241 | 801 | requestSysState(POWERD_SYS_STATE_ACTIVE,&cookie); | 811 | requestSysState("active-nc", POWERD_SYS_STATE_ACTIVE,&cookie); |
242 | 802 | printf("Power State requested, cookie is %s\n", cookie); | 812 | printf("Power State requested, cookie is %s\n", cookie); |
243 | 803 | return 0; | 813 | return 0; |
244 | 804 | } | 814 | } |
245 | 805 | else if (!strcmp(argv[1],"active")) { | 815 | else if (!strcmp(argv[1],"active")) { |
247 | 806 | requestSysState(POWERD_SYS_STATE_ACTIVE,&cookie); | 816 | requestSysState("active", POWERD_SYS_STATE_ACTIVE,&cookie); |
248 | 807 | printf("Power State requested, cookie is %s.\nPress ctrl-c to exit.\n", | 817 | printf("Power State requested, cookie is %s.\nPress ctrl-c to exit.\n", |
249 | 808 | cookie); | 818 | cookie); |
250 | 809 | pause(); /* wait for SIGINT */ | 819 | pause(); /* wait for SIGINT */ |
251 | @@ -820,7 +830,7 @@ | |||
252 | 820 | usage(argv[0]); | 830 | usage(argv[0]); |
253 | 821 | return -1; | 831 | return -1; |
254 | 822 | } | 832 | } |
256 | 823 | requestDisplayState(pdr,&cookie); | 833 | requestDisplayState(pdr, "disp-test", &cookie); |
257 | 824 | printf("Display State requested, cookie is %s.\nPress ctrl-c to exit.\n", | 834 | printf("Display State requested, cookie is %s.\nPress ctrl-c to exit.\n", |
258 | 825 | cookie); | 835 | cookie); |
259 | 826 | pause(); /* wait for SIGINT */ | 836 | pause(); /* wait for SIGINT */ |
260 | @@ -885,14 +895,14 @@ | |||
261 | 885 | // This printf is read by the parent | 895 | // This printf is read by the parent |
262 | 886 | printf("DBUSNAME: %s\n", bus_name); | 896 | printf("DBUSNAME: %s\n", bus_name); |
263 | 887 | // Grab some requests so we can see that they get cleared later | 897 | // Grab some requests so we can see that they get cleared later |
267 | 888 | requestSysState(POWERD_SYS_STATE_ACTIVE,&cookie); | 898 | requestSysState("dbusnametest1", POWERD_SYS_STATE_ACTIVE,&cookie); |
268 | 889 | requestSysState(POWERD_SYS_STATE_ACTIVE,&cookie); | 899 | requestSysState("dbusnametest2", POWERD_SYS_STATE_ACTIVE,&cookie); |
269 | 890 | requestSysState(POWERD_SYS_STATE_ACTIVE,&cookie); | 900 | requestSysState("dbusnametest3", POWERD_SYS_STATE_ACTIVE,&cookie); |
270 | 891 | pdr.state = POWERD_DISPLAY_STATE_DONT_CARE; | 901 | pdr.state = POWERD_DISPLAY_STATE_DONT_CARE; |
271 | 892 | pdr.flags = 0; | 902 | pdr.flags = 0; |
275 | 893 | requestDisplayState(pdr, &cookie); | 903 | requestDisplayState(pdr, "dbusnametest1", &cookie); |
276 | 894 | requestDisplayState(pdr, &cookie); | 904 | requestDisplayState(pdr, "dbusnametest2", &cookie); |
277 | 895 | requestDisplayState(pdr, &cookie); | 905 | requestDisplayState(pdr, "dbusnametest3", &cookie); |
278 | 896 | g_object_unref(bus); | 906 | g_object_unref(bus); |
279 | 897 | // Exit here without cleanup | 907 | // Exit here without cleanup |
280 | 898 | return 0; | 908 | return 0; |
281 | 899 | 909 | ||
282 | === modified file 'cli/powerd-cli.h' | |||
283 | --- cli/powerd-cli.h 2013-07-23 20:43:37 +0000 | |||
284 | +++ cli/powerd-cli.h 2013-07-29 16:08:44 +0000 | |||
285 | @@ -35,7 +35,7 @@ | |||
286 | 35 | #define cli_warn(f, a...) do { if (!silent_errors) g_warning(f, ##a); } while (0) | 35 | #define cli_warn(f, a...) do { if (!silent_errors) g_warning(f, ##a); } while (0) |
287 | 36 | #define cli_debug(f, a...) g_debug(f, ##a) | 36 | #define cli_debug(f, a...) g_debug(f, ##a) |
288 | 37 | 37 | ||
290 | 38 | gboolean requestSysState(int state, powerd_cookie_t *cookie); | 38 | gboolean requestSysState(const char *name, int state, powerd_cookie_t *cookie); |
291 | 39 | gboolean clearSysState(powerd_cookie_t cookie); | 39 | gboolean clearSysState(powerd_cookie_t cookie); |
292 | 40 | void powerd_cli_client_test(GDBusProxy *proxy); | 40 | void powerd_cli_client_test(GDBusProxy *proxy); |
293 | 41 | 41 | ||
294 | 42 | 42 | ||
295 | === modified file 'data/com.canonical.powerd.xml' | |||
296 | --- data/com.canonical.powerd.xml 2013-07-24 14:39:08 +0000 | |||
297 | +++ data/com.canonical.powerd.xml 2013-07-29 16:08:44 +0000 | |||
298 | @@ -5,6 +5,7 @@ | |||
299 | 5 | 5 | ||
300 | 6 | <!-- Functions --> | 6 | <!-- Functions --> |
301 | 7 | <method name="requestSysState"> | 7 | <method name="requestSysState"> |
302 | 8 | <arg type="s" name="name" direction="in" /> | ||
303 | 8 | <arg type="i" name="state" direction="in" /> | 9 | <arg type="i" name="state" direction="in" /> |
304 | 9 | <arg type="s" name="cookie" direction="out" /> | 10 | <arg type="s" name="cookie" direction="out" /> |
305 | 10 | </method> | 11 | </method> |
306 | @@ -14,6 +15,7 @@ | |||
307 | 14 | </method> | 15 | </method> |
308 | 15 | 16 | ||
309 | 16 | <method name="requestDisplayState"> | 17 | <method name="requestDisplayState"> |
310 | 18 | <arg type="s" name="name" direction="in" /> | ||
311 | 17 | <arg type="i" name="state" direction="in" /> | 19 | <arg type="i" name="state" direction="in" /> |
312 | 18 | <arg type="u" name="flags" direction="in" /> | 20 | <arg type="u" name="flags" direction="in" /> |
313 | 19 | <arg type="s" name="cookie" direction="out" /> | 21 | <arg type="s" name="cookie" direction="out" /> |
314 | @@ -43,11 +45,11 @@ | |||
315 | 43 | 45 | ||
316 | 44 | <!-- for debug/testing --> | 46 | <!-- for debug/testing --> |
317 | 45 | <method name="listSysRequests"> | 47 | <method name="listSysRequests"> |
319 | 46 | <arg type="a(si)" name="requestList" direction="out" /> | 48 | <arg type="a(ssi)" name="requestList" direction="out" /> |
320 | 47 | </method> | 49 | </method> |
321 | 48 | 50 | ||
322 | 49 | <method name="listDisplayRequests"> | 51 | <method name="listDisplayRequests"> |
324 | 50 | <arg type="a(siu)" name="requestList" direction="out" /> | 52 | <arg type="a(ssiu)" name="requestList" direction="out" /> |
325 | 51 | </method> | 53 | </method> |
326 | 52 | 54 | ||
327 | 53 | <!-- Signals --> | 55 | <!-- Signals --> |
328 | 54 | 56 | ||
329 | === modified file 'src/display-request.c' | |||
330 | --- src/display-request.c 2013-07-19 23:09:47 +0000 | |||
331 | +++ src/display-request.c 2013-07-29 16:08:44 +0000 | |||
332 | @@ -35,6 +35,7 @@ | |||
333 | 35 | 35 | ||
334 | 36 | struct display_request_internal { | 36 | struct display_request_internal { |
335 | 37 | struct powerd_display_request req; | 37 | struct powerd_display_request req; |
336 | 38 | const char *name; | ||
337 | 38 | const char *owner; | 39 | const char *owner; |
338 | 39 | }; | 40 | }; |
339 | 40 | 41 | ||
340 | @@ -183,7 +184,7 @@ | |||
341 | 183 | * the struct will be copied into internally-managed storage. | 184 | * the struct will be copied into internally-managed storage. |
342 | 184 | */ | 185 | */ |
343 | 185 | static int __powerd_add_display_request(struct powerd_display_request *request, | 186 | static int __powerd_add_display_request(struct powerd_display_request *request, |
345 | 186 | const char *owner) | 187 | const char *name, const char *owner) |
346 | 187 | { | 188 | { |
347 | 188 | struct display_request_internal *hash_req; | 189 | struct display_request_internal *hash_req; |
348 | 189 | 190 | ||
349 | @@ -204,6 +205,7 @@ | |||
350 | 204 | uuid_generate(request->cookie); | 205 | uuid_generate(request->cookie); |
351 | 205 | hash_req = g_new(struct display_request_internal, 1); | 206 | hash_req = g_new(struct display_request_internal, 1); |
352 | 206 | hash_req->req = *request; | 207 | hash_req->req = *request; |
353 | 208 | hash_req->name = g_strdup(name); | ||
354 | 207 | hash_req->owner = g_strdup(owner); | 209 | hash_req->owner = g_strdup(owner); |
355 | 208 | powerd_run_mainloop_sync(add_request_worker, hash_req); | 210 | powerd_run_mainloop_sync(add_request_worker, hash_req); |
356 | 209 | return 0; | 211 | return 0; |
357 | @@ -213,14 +215,14 @@ | |||
358 | 213 | * @request need not refer to persistent memory, as the data from | 215 | * @request need not refer to persistent memory, as the data from |
359 | 214 | * the struct will be copied into internally-managed storage. | 216 | * the struct will be copied into internally-managed storage. |
360 | 215 | */ | 217 | */ |
362 | 216 | int powerd_add_display_request(struct powerd_display_request *request) | 218 | int powerd_add_display_request(struct powerd_display_request *request, |
363 | 219 | const char *name) | ||
364 | 217 | { | 220 | { |
367 | 218 | if (!request) { | 221 | if (!request || !name) { |
368 | 219 | powerd_warn("powerd_add_display_request() called with request == NULL"); | 222 | powerd_warn("powerd_add_display_request() called with invalid args"); |
369 | 220 | return -EINVAL; | 223 | return -EINVAL; |
370 | 221 | } | 224 | } |
373 | 222 | 225 | return __powerd_add_display_request(request, name, "internal"); | |
372 | 223 | return __powerd_add_display_request(request, "internal"); | ||
374 | 224 | } | 226 | } |
375 | 225 | 227 | ||
376 | 226 | static int update_request_worker(gpointer data) | 228 | static int update_request_worker(gpointer data) |
377 | @@ -255,7 +257,7 @@ | |||
378 | 255 | 257 | ||
379 | 256 | gboolean handle_add_display_request(PowerdSource *obj, | 258 | gboolean handle_add_display_request(PowerdSource *obj, |
380 | 257 | GDBusMethodInvocation *invocation, | 259 | GDBusMethodInvocation *invocation, |
382 | 258 | int state, guint32 flags) | 260 | const char *name, int state, guint32 flags) |
383 | 259 | { | 261 | { |
384 | 260 | struct powerd_display_request req; | 262 | struct powerd_display_request req; |
385 | 261 | const char *owner; | 263 | const char *owner; |
386 | @@ -271,7 +273,7 @@ | |||
387 | 271 | req.state = state; | 273 | req.state = state; |
388 | 272 | req.flags = flags; | 274 | req.flags = flags; |
389 | 273 | 275 | ||
391 | 274 | ret = __powerd_add_display_request(&req, owner); | 276 | ret = __powerd_add_display_request(&req, name, owner); |
392 | 275 | if (ret) { | 277 | if (ret) { |
393 | 276 | g_dbus_method_invocation_return_error(invocation, G_DBUS_ERROR, | 278 | g_dbus_method_invocation_return_error(invocation, G_DBUS_ERROR, |
394 | 277 | G_DBUS_ERROR_INVALID_ARGS, | 279 | G_DBUS_ERROR_INVALID_ARGS, |
395 | @@ -363,16 +365,11 @@ | |||
396 | 363 | int count = 0; | 365 | int count = 0; |
397 | 364 | 366 | ||
398 | 365 | g_hash_table_iter_init(&iter, display_request_hash); | 367 | g_hash_table_iter_init(&iter, display_request_hash); |
399 | 366 | powerd_debug("Display state requests:"); | ||
400 | 367 | while (g_hash_table_iter_next(&iter, &key, &value)) { | 368 | while (g_hash_table_iter_next(&iter, &key, &value)) { |
401 | 368 | unsigned char *uuid = key; | ||
402 | 369 | struct display_request_internal *ireq = value; | 369 | struct display_request_internal *ireq = value; |
403 | 370 | struct powerd_display_request *req = &ireq->req; | 370 | struct powerd_display_request *req = &ireq->req; |
409 | 371 | char cookie_str[UUID_STR_LEN]; | 371 | g_variant_builder_add(builder, "(ssiu)", ireq->name, ireq->owner, |
410 | 372 | uuid_unparse(uuid, cookie_str); | 372 | req->state, req->flags); |
406 | 373 | powerd_debug(" owner: %s, cookie: %s, state: %d, flags: %#08x", | ||
407 | 374 | ireq->owner, cookie_str, req->state, req->flags); | ||
408 | 375 | g_variant_builder_add(builder, "(siu)", ireq->owner, req->state, req->flags); | ||
411 | 376 | count++; | 373 | count++; |
412 | 377 | } | 374 | } |
413 | 378 | return count; | 375 | return count; |
414 | @@ -385,13 +382,13 @@ | |||
415 | 385 | GVariantBuilder *builder; | 382 | GVariantBuilder *builder; |
416 | 386 | int count; | 383 | int count; |
417 | 387 | 384 | ||
419 | 388 | builder = g_variant_builder_new(G_VARIANT_TYPE("a(siu)")); | 385 | builder = g_variant_builder_new(G_VARIANT_TYPE("a(ssiu)")); |
420 | 389 | count = build_display_request_list(builder); | 386 | count = build_display_request_list(builder); |
421 | 390 | if (count > 0) { | 387 | if (count > 0) { |
422 | 391 | list = g_variant_builder_end(builder); | 388 | list = g_variant_builder_end(builder); |
423 | 392 | } else { | 389 | } else { |
424 | 393 | g_variant_builder_clear(builder); | 390 | g_variant_builder_clear(builder); |
426 | 394 | list = g_variant_new_array(G_VARIANT_TYPE("(siu)"), NULL, 0); | 391 | list = g_variant_new_array(G_VARIANT_TYPE("(ssiu)"), NULL, 0); |
427 | 395 | } | 392 | } |
428 | 396 | 393 | ||
429 | 397 | tuple = g_variant_new_tuple(&list, 1); | 394 | tuple = g_variant_new_tuple(&list, 1); |
430 | @@ -406,8 +403,8 @@ | |||
431 | 406 | { | 403 | { |
432 | 407 | struct display_request_internal *req = data; | 404 | struct display_request_internal *req = data; |
433 | 408 | 405 | ||
436 | 409 | if (req->owner) | 406 | g_free((gpointer)req->name); |
437 | 410 | g_free((gpointer)req->owner); | 407 | g_free((gpointer)req->owner); |
438 | 411 | g_free(req); | 408 | g_free(req); |
439 | 412 | } | 409 | } |
440 | 413 | 410 | ||
441 | 414 | 411 | ||
442 | === modified file 'src/display.c' | |||
443 | --- src/display.c 2013-07-18 20:58:16 +0000 | |||
444 | +++ src/display.c 2013-07-29 16:08:44 +0000 | |||
445 | @@ -166,7 +166,8 @@ | |||
446 | 166 | case POWERD_DISPLAY_STATE_ON: | 166 | case POWERD_DISPLAY_STATE_ON: |
447 | 167 | if (actual_screen_state != POWERD_DISPLAY_STATE_ON) { | 167 | if (actual_screen_state != POWERD_DISPLAY_STATE_ON) { |
448 | 168 | powerd_debug("Requesting active state internally"); | 168 | powerd_debug("Requesting active state internally"); |
450 | 169 | ret = request_sys_state_internal(POWERD_SYS_STATE_ACTIVE, | 169 | ret = request_sys_state_internal("display-request", |
451 | 170 | POWERD_SYS_STATE_ACTIVE, | ||
452 | 170 | &internal_request_cookie, NULL); | 171 | &internal_request_cookie, NULL); |
453 | 171 | if (!ret) | 172 | if (!ret) |
454 | 172 | powerd_warn("Request for active state failed"); | 173 | powerd_warn("Request for active state failed"); |
455 | 173 | 174 | ||
456 | === modified file 'src/power-request.c' | |||
457 | --- src/power-request.c 2013-07-24 14:39:08 +0000 | |||
458 | +++ src/power-request.c 2013-07-29 16:08:44 +0000 | |||
459 | @@ -39,7 +39,8 @@ | |||
460 | 39 | #define NOTIFICATION_TIMEOUT_MSECS 2000 | 39 | #define NOTIFICATION_TIMEOUT_MSECS 2000 |
461 | 40 | 40 | ||
462 | 41 | struct SysStateRequest { | 41 | struct SysStateRequest { |
464 | 42 | gchar *owner; | 42 | const char *name; |
465 | 43 | const char *owner; | ||
466 | 43 | uuid_t cookie; | 44 | uuid_t cookie; |
467 | 44 | enum SysPowerStates state; | 45 | enum SysPowerStates state; |
468 | 45 | }; | 46 | }; |
469 | @@ -170,16 +171,10 @@ | |||
470 | 170 | guint count = 0; | 171 | guint count = 0; |
471 | 171 | 172 | ||
472 | 172 | g_hash_table_iter_init(&iter, state_request_hash); | 173 | g_hash_table_iter_init(&iter, state_request_hash); |
473 | 173 | powerd_debug("System state requests:"); | ||
474 | 174 | while (g_hash_table_iter_next(&iter, &key, &value)) { | 174 | while (g_hash_table_iter_next(&iter, &key, &value)) { |
475 | 175 | unsigned char *uuid = key; | ||
476 | 176 | struct SysStateRequest *req = value; | 175 | struct SysStateRequest *req = value; |
483 | 177 | char cookie_str[UUID_STR_LEN]; | 176 | g_variant_builder_add(builder, "(ssi)", req->name, req->owner, |
484 | 178 | uuid_unparse(uuid, cookie_str); | 177 | req->state); |
479 | 179 | powerd_debug(" Owner: %s, Cookie: %s, State: %s (%d)", | ||
480 | 180 | req->owner, cookie_str, state_to_string(req->state), | ||
481 | 181 | req->state); | ||
482 | 182 | g_variant_builder_add(builder, "(si)", req->owner, req->state); | ||
485 | 183 | count++; | 178 | count++; |
486 | 184 | } | 179 | } |
487 | 185 | return count; | 180 | return count; |
488 | @@ -193,14 +188,14 @@ | |||
489 | 193 | GVariantBuilder *builder; | 188 | GVariantBuilder *builder; |
490 | 194 | guint count = 0; | 189 | guint count = 0; |
491 | 195 | 190 | ||
493 | 196 | builder = g_variant_builder_new(G_VARIANT_TYPE("a(si)")); | 191 | builder = g_variant_builder_new(G_VARIANT_TYPE("a(ssi)")); |
494 | 197 | count = list_sys_requests_internal(builder); | 192 | count = list_sys_requests_internal(builder); |
495 | 198 | if (count>0) { | 193 | if (count>0) { |
496 | 199 | list = g_variant_builder_end(builder); | 194 | list = g_variant_builder_end(builder); |
497 | 200 | } | 195 | } |
498 | 201 | else { | 196 | else { |
499 | 202 | g_variant_builder_clear(builder); | 197 | g_variant_builder_clear(builder); |
501 | 203 | list = g_variant_new_array(G_VARIANT_TYPE("(si)"), NULL, 0); | 198 | list = g_variant_new_array(G_VARIANT_TYPE("(ssi)"), NULL, 0); |
502 | 204 | } | 199 | } |
503 | 205 | tuple = g_variant_new_tuple(&list,1); | 200 | tuple = g_variant_new_tuple(&list,1); |
504 | 206 | g_dbus_method_invocation_return_value(invocation, tuple); | 201 | g_dbus_method_invocation_return_value(invocation, tuple); |
505 | @@ -220,7 +215,8 @@ | |||
506 | 220 | 215 | ||
507 | 221 | /* Note: owner is NULL for internal usage */ | 216 | /* Note: owner is NULL for internal usage */ |
508 | 222 | gboolean | 217 | gboolean |
510 | 223 | request_sys_state_internal(int state, uuid_t *cookie, const gchar *owner) | 218 | request_sys_state_internal(const char *name, int state, uuid_t *cookie, |
511 | 219 | const gchar *owner) | ||
512 | 224 | { | 220 | { |
513 | 225 | struct SysStateRequest *sr = NULL; | 221 | struct SysStateRequest *sr = NULL; |
514 | 226 | 222 | ||
515 | @@ -236,6 +232,7 @@ | |||
516 | 236 | } | 232 | } |
517 | 237 | 233 | ||
518 | 238 | sr = g_new(struct SysStateRequest, 1); | 234 | sr = g_new(struct SysStateRequest, 1); |
519 | 235 | sr->name = g_strdup(name); | ||
520 | 239 | sr->state = (enum SysPowerStates)state; | 236 | sr->state = (enum SysPowerStates)state; |
521 | 240 | if (owner) { | 237 | if (owner) { |
522 | 241 | sr->owner = g_strdup(owner); | 238 | sr->owner = g_strdup(owner); |
523 | @@ -252,7 +249,8 @@ | |||
524 | 252 | } | 249 | } |
525 | 253 | 250 | ||
526 | 254 | gboolean | 251 | gboolean |
528 | 255 | handle_request_sys_state (PowerdSource *obj, GDBusMethodInvocation *invocation, int state) | 252 | handle_request_sys_state(PowerdSource *obj, GDBusMethodInvocation *invocation, |
529 | 253 | const char *name, int state) | ||
530 | 256 | { | 254 | { |
531 | 257 | gboolean retval; | 255 | gboolean retval; |
532 | 258 | const char *owner; | 256 | const char *owner; |
533 | @@ -263,7 +261,7 @@ | |||
534 | 263 | powerd_debug("handle_requestSysState from %s - %s (%d)", owner, | 261 | powerd_debug("handle_requestSysState from %s - %s (%d)", owner, |
535 | 264 | state_to_string(state), state); | 262 | state_to_string(state), state); |
536 | 265 | 263 | ||
538 | 266 | retval = request_sys_state_internal(state, &cookie, owner); | 264 | retval = request_sys_state_internal(name, state, &cookie, owner); |
539 | 267 | if (retval == TRUE) { | 265 | if (retval == TRUE) { |
540 | 268 | powerd_debug("handle_requestSysState - SUCCESS"); | 266 | powerd_debug("handle_requestSysState - SUCCESS"); |
541 | 269 | uuid_unparse(cookie, ext_cookie); | 267 | uuid_unparse(cookie, ext_cookie); |
542 | @@ -620,10 +618,8 @@ | |||
543 | 620 | static void sys_state_request_destroy(gpointer data) | 618 | static void sys_state_request_destroy(gpointer data) |
544 | 621 | { | 619 | { |
545 | 622 | struct SysStateRequest *sr = (struct SysStateRequest *)data; | 620 | struct SysStateRequest *sr = (struct SysStateRequest *)data; |
550 | 623 | if (sr->owner) { | 621 | g_free((gpointer)sr->name); |
551 | 624 | g_free(sr->owner); | 622 | g_free((gpointer)sr->owner); |
548 | 625 | sr->owner = NULL; | ||
549 | 626 | } | ||
552 | 627 | g_free(sr); | 623 | g_free(sr); |
553 | 628 | } | 624 | } |
554 | 629 | 625 | ||
555 | 630 | 626 | ||
556 | === modified file 'src/powerd-internal.h' | |||
557 | --- src/powerd-internal.h 2013-07-24 14:39:08 +0000 | |||
558 | +++ src/powerd-internal.h 2013-07-29 16:08:44 +0000 | |||
559 | @@ -74,14 +74,15 @@ | |||
560 | 74 | void powerd_display_clear_override(enum powerd_override_reason reason); | 74 | void powerd_display_clear_override(enum powerd_override_reason reason); |
561 | 75 | 75 | ||
562 | 76 | /* Display request functions */ | 76 | /* Display request functions */ |
564 | 77 | int powerd_add_display_request(struct powerd_display_request *request); | 77 | int powerd_add_display_request(struct powerd_display_request *request, |
565 | 78 | const char *name); | ||
566 | 78 | int powerd_update_display_request(struct powerd_display_request *request); | 79 | int powerd_update_display_request(struct powerd_display_request *request); |
567 | 79 | int powerd_remove_display_request(uuid_t cookie); | 80 | int powerd_remove_display_request(uuid_t cookie); |
568 | 80 | void display_request_init(void); | 81 | void display_request_init(void); |
569 | 81 | void display_request_deinit(void); | 82 | void display_request_deinit(void); |
570 | 82 | gboolean handle_add_display_request(PowerdSource *obj, | 83 | gboolean handle_add_display_request(PowerdSource *obj, |
571 | 83 | GDBusMethodInvocation *invocation, | 84 | GDBusMethodInvocation *invocation, |
573 | 84 | int state, guint32 flags); | 85 | const char *name, int state, guint32 flags); |
574 | 85 | gboolean handle_update_display_request(PowerdSource *obj, | 86 | gboolean handle_update_display_request(PowerdSource *obj, |
575 | 86 | GDBusMethodInvocation *invocation, | 87 | GDBusMethodInvocation *invocation, |
576 | 87 | const gchar *ext_cookie, int state, | 88 | const gchar *ext_cookie, int state, |
577 | @@ -97,12 +98,13 @@ | |||
578 | 97 | gboolean handle_list_sys_requests(PowerdSource *obj, | 98 | gboolean handle_list_sys_requests(PowerdSource *obj, |
579 | 98 | GDBusMethodInvocation *invocation); | 99 | GDBusMethodInvocation *invocation); |
580 | 99 | gboolean handle_request_sys_state(PowerdSource *obj, | 100 | gboolean handle_request_sys_state(PowerdSource *obj, |
582 | 100 | GDBusMethodInvocation *invocation, int state); | 101 | GDBusMethodInvocation *invocation, |
583 | 102 | const char *name, int state); | ||
584 | 101 | gboolean handle_clear_sys_state(PowerdSource *obj, | 103 | gboolean handle_clear_sys_state(PowerdSource *obj, |
585 | 102 | GDBusMethodInvocation *invocation, | 104 | GDBusMethodInvocation *invocation, |
586 | 103 | gchar *cookie); | 105 | gchar *cookie); |
589 | 104 | gboolean request_sys_state_internal(int state, uuid_t *cookie, | 106 | gboolean request_sys_state_internal(const char *name, int state, |
590 | 105 | const gchar *owner); | 107 | uuid_t *cookie, const char *owner); |
591 | 106 | gboolean clear_sys_state_internal(uuid_t cookie); | 108 | gboolean clear_sys_state_internal(uuid_t cookie); |
592 | 107 | void power_request_transition_acked(void); | 109 | void power_request_transition_acked(void); |
593 | 108 | void update_system_state(void); | 110 | void update_system_state(void); |
594 | 109 | 111 | ||
595 | === modified file 'src/powerd.cpp' | |||
596 | --- src/powerd.cpp 2013-07-23 14:42:07 +0000 | |||
597 | +++ src/powerd.cpp 2013-07-29 16:08:44 +0000 | |||
598 | @@ -217,7 +217,8 @@ | |||
599 | 217 | activity_timer_req.flags |= POWERD_DISPLAY_FLAG_BRIGHT; | 217 | activity_timer_req.flags |= POWERD_DISPLAY_FLAG_BRIGHT; |
600 | 218 | 218 | ||
601 | 219 | if (activity_timer_screen_state == SCREEN_STATE_OFF) | 219 | if (activity_timer_screen_state == SCREEN_STATE_OFF) |
603 | 220 | ret = powerd_add_display_request(&activity_timer_req); | 220 | ret = powerd_add_display_request(&activity_timer_req, |
604 | 221 | "activity-timer"); | ||
605 | 221 | else | 222 | else |
606 | 222 | ret = powerd_update_display_request(&activity_timer_req); | 223 | ret = powerd_update_display_request(&activity_timer_req); |
607 | 223 | 224 | ||
608 | @@ -347,14 +348,14 @@ | |||
609 | 347 | if (!strcmp(prop_value,"active")) { | 348 | if (!strcmp(prop_value,"active")) { |
610 | 348 | if (!alerted) { | 349 | if (!alerted) { |
611 | 349 | //call is active, enable sensor | 350 | //call is active, enable sensor |
613 | 350 | if (powerd_add_display_request(&prox_sensor_req)) | 351 | if (powerd_add_display_request(&prox_sensor_req, "prox-sensor")) |
614 | 351 | powerd_warn("Request to use proximity sensor failed"); | 352 | powerd_warn("Request to use proximity sensor failed"); |
615 | 352 | } | 353 | } |
616 | 353 | } | 354 | } |
617 | 354 | if (!strcmp(prop_value,"alerting")) { | 355 | if (!strcmp(prop_value,"alerting")) { |
618 | 355 | alerted = TRUE; | 356 | alerted = TRUE; |
619 | 356 | //call is altering, enable sensor | 357 | //call is altering, enable sensor |
621 | 357 | if (powerd_add_display_request(&prox_sensor_req)) | 358 | if (powerd_add_display_request(&prox_sensor_req, "prox-sensor")) |
622 | 358 | powerd_warn("Request to use proximity sensor failed"); | 359 | powerd_warn("Request to use proximity sensor failed"); |
623 | 359 | } | 360 | } |
624 | 360 | else if (!strcmp(prop_value,"disconnected")) { | 361 | else if (!strcmp(prop_value,"disconnected")) { |
PASSED: Continuous integration, rev:77 jenkins. qa.ubuntu. com/job/ powerd- ci/100/ jenkins. qa.ubuntu. com/job/ powerd- saucy-armhf- ci/54 jenkins. qa.ubuntu. com/job/ powerd- saucy-armhf- ci/54/artifact/ work/output/ *zip*/output. zip
http://
Executed test runs:
SUCCESS: http://
deb: http://
Click here to trigger a rebuild: s-jenkins: 8080/job/ powerd- ci/100/ rebuild
http://