Merge lp:~rsalveti/powerd/powerd-better_log into lp:powerd

Proposed by Ricardo Salveti
Status: Merged
Approved by: Ricardo Salveti
Approved revision: 140
Merged at revision: 137
Proposed branch: lp:~rsalveti/powerd/powerd-better_log
Merge into: lp:powerd
Diff against target: 201 lines (+31/-4)
10 files modified
libsuspend/autosleep.c (+2/-0)
libsuspend/common.h (+1/-0)
libsuspend/earlysuspend.c (+2/-0)
libsuspend/legacy.c (+2/-0)
libsuspend/libsuspend.c (+8/-0)
libsuspend/libsuspend.h (+1/-0)
libsuspend/mocksuspend.c (+3/-0)
src/backlight.c (+6/-1)
src/power-request.c (+5/-3)
src/powerd.cpp (+1/-0)
To merge this branch: bzr merge lp:~rsalveti/powerd/powerd-better_log
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Ricardo Salveti Pending
Review via email: mp+231210@code.launchpad.net

This proposal supersedes a proposal from 2014-08-15.

Commit message

Better log for powerd when suspending, to make debug easier.

Description of the change

Better log for 1. show suspend module used, 2. use libsuspend function name as call it to make debug easier.

To post a comment you must log in.
Revision history for this message
Ricardo Salveti (rsalveti) wrote : Posted in a previous version of this proposal

Looks good, thanks.

Just creating a new bzr branch because you don't need to change debian/changelog, that is done by our CI engine.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libsuspend/autosleep.c'
2--- libsuspend/autosleep.c 2013-05-23 14:45:14 +0000
3+++ libsuspend/autosleep.c 2014-08-18 15:14:31 +0000
4@@ -21,6 +21,7 @@
5 #include "common.h"
6 #include "sysfs.h"
7
8+static const char autosleep_name[] = "autosleep";
9 static const char autosleep_path[] = "/sys/power/autosleep";
10 static const char wakelock_path[] = "/sys/power/wake_lock";
11 static const char wakeunlock_path[] = "/sys/power/wake_unlock";
12@@ -52,6 +53,7 @@
13 }
14
15 static const struct suspend_handler autosleep_handler = {
16+ .name = autosleep_name,
17 .enter = autosleep_enter,
18 .exit = autosleep_exit,
19 .acquire_wake_lock = autosleep_acquire_wake_lock,
20
21=== modified file 'libsuspend/common.h'
22--- libsuspend/common.h 2013-05-23 14:45:14 +0000
23+++ libsuspend/common.h 2014-08-18 15:14:31 +0000
24@@ -22,6 +22,7 @@
25 #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
26
27 struct suspend_handler {
28+ const char *name;
29 int (*prepare)(void);
30 int (*enter)(void);
31 int (*exit)(void);
32
33=== modified file 'libsuspend/earlysuspend.c'
34--- libsuspend/earlysuspend.c 2014-01-06 16:12:54 +0000
35+++ libsuspend/earlysuspend.c 2014-08-18 15:14:31 +0000
36@@ -46,6 +46,7 @@
37 static pthread_cond_t fb_state_cond = PTHREAD_COND_INITIALIZER;
38 static int wait_for_fb = 0;
39
40+static const char earlysuspend_name[] = "earlysuspend";
41 static const char state_path[] = "/sys/power/state";
42 static const char wakelock_path[] = "/sys/power/wake_lock";
43 static const char wakeunlock_path[] = "/sys/power/wake_unlock";
44@@ -147,6 +148,7 @@
45 }
46
47 static const struct suspend_handler earlysuspend_handler = {
48+ .name = earlysuspend_name,
49 .enter = earlysuspend_enter,
50 .exit = earlysuspend_exit,
51 .acquire_wake_lock = earlysuspend_acquire_wake_lock,
52
53=== modified file 'libsuspend/legacy.c'
54--- libsuspend/legacy.c 2013-05-15 14:14:35 +0000
55+++ libsuspend/legacy.c 2014-08-18 15:14:31 +0000
56@@ -21,6 +21,7 @@
57 #include "common.h"
58 #include "sysfs.h"
59
60+static const char legacy_name[] = "legacy";
61 static const char state_path[] = "/sys/power/state";
62 static const char wakelock_path[] = "/sys/power/wake_lock";
63 static const char wakeup_count_path[] = "/sys/power/wakeup_count";
64@@ -67,6 +68,7 @@
65 }
66
67 static const struct suspend_handler legacy_handler = {
68+ .name = legacy_name,
69 .prepare = legacy_prepare,
70 .enter = legacy_enter,
71 };
72
73=== modified file 'libsuspend/libsuspend.c'
74--- libsuspend/libsuspend.c 2013-05-23 14:45:14 +0000
75+++ libsuspend/libsuspend.c 2014-08-18 15:14:31 +0000
76@@ -44,6 +44,14 @@
77 handler = mocksuspend_detect();
78 }
79
80+const char *libsuspend_getname(void)
81+{
82+ if (!handler)
83+ return "not-initialized yet";
84+
85+ return handler->name;
86+}
87+
88 int libsuspend_prepare_suspend(void)
89 {
90 if (!handler)
91
92=== modified file 'libsuspend/libsuspend.h'
93--- libsuspend/libsuspend.h 2013-05-23 14:45:14 +0000
94+++ libsuspend/libsuspend.h 2014-08-18 15:14:31 +0000
95@@ -24,6 +24,7 @@
96 #endif
97
98 void libsuspend_init(int force_mock);
99+const char *libsuspend_getname(void);
100 int libsuspend_prepare_suspend(void);
101 int libsuspend_enter_suspend(void);
102 int libsuspend_exit_suspend(void);
103
104=== modified file 'libsuspend/mocksuspend.c'
105--- libsuspend/mocksuspend.c 2013-05-23 14:45:14 +0000
106+++ libsuspend/mocksuspend.c 2014-08-18 15:14:31 +0000
107@@ -19,6 +19,8 @@
108 #include <stdio.h>
109 #include "common.h"
110
111+static const char mocksuspend_name[] = "mocksuspend";
112+
113 static int mocksuspend_prepare(void)
114 {
115 printf("mocksuspend prepare\n");
116@@ -50,6 +52,7 @@
117 }
118
119 static const struct suspend_handler mocksuspend_handler = {
120+ .name = mocksuspend_name,
121 .prepare = mocksuspend_prepare,
122 .enter = mocksuspend_enter,
123 .exit = mocksuspend_exit,
124
125=== modified file 'src/backlight.c'
126--- src/backlight.c 2014-05-13 22:05:20 +0000
127+++ src/backlight.c 2014-08-18 15:14:31 +0000
128@@ -90,8 +90,13 @@
129 (scaled_brightness << 8) | scaled_brightness);
130
131 ret = light_dev->set_light(light_dev, &state);
132- if (!ret)
133+ if (!ret) {
134+ powerd_debug("light_dev: set_light to brightness %i succ", brightness);
135 current_brightness = brightness;
136+ } else {
137+ powerd_debug("light_dev: set_light to brightness %i failed", brightness);
138+ }
139+
140 return ret;
141 }
142
143
144=== modified file 'src/power-request.c'
145--- src/power-request.c 2014-05-13 22:05:20 +0000
146+++ src/power-request.c 2014-08-18 15:14:31 +0000
147@@ -120,7 +120,7 @@
148 int ret;
149
150 if (g_atomic_int_add(&suspend_block_count, 1) == 0) {
151- powerd_debug("Blocking suspend");
152+ powerd_debug("libsuspend: acquire_wake_lock: %s", power_request_wakelock_name);
153 ret = libsuspend_acquire_wake_lock(power_request_wakelock_name);
154 if (ret)
155 powerd_warn("Could not acquire wake lock");
156@@ -142,7 +142,7 @@
157 retry = !g_atomic_int_compare_and_exchange(&suspend_block_count,
158 old_count, old_count - 1);
159 if (!retry && old_count == 1) {
160- powerd_debug("Unblocking suspend");
161+ powerd_debug("libsuspend: release_wake_lock: %s", power_request_wakelock_name);
162 ret = libsuspend_release_wake_lock(power_request_wakelock_name);
163 if (ret)
164 powerd_warn("Could not release wake lock");
165@@ -361,6 +361,7 @@
166
167 static int enter_suspend(void)
168 {
169+ powerd_debug("libsuspend: enter_suspend.");
170 int ret = libsuspend_enter_suspend();
171 if (!ret)
172 suspend_active = TRUE;
173@@ -369,6 +370,7 @@
174
175 static int exit_suspend(void)
176 {
177+ powerd_debug("libsuspend: exit_suspend.");
178 int ret = libsuspend_exit_suspend();
179 if (!ret) {
180 suspend_active = FALSE;
181@@ -431,7 +433,7 @@
182
183 /* Must call libsuspend_prepare_suspend() _before_ emitting signal */
184 if (pending_system_state == POWERD_SYS_STATE_SUSPEND) {
185- powerd_debug("preparing for suspend");
186+ powerd_debug("libsuspend: prepare_suspend.");
187 ret = libsuspend_prepare_suspend();
188 if (ret)
189 powerd_warn("Failed to prepare for suspend: %d", ret);
190
191=== modified file 'src/powerd.cpp'
192--- src/powerd.cpp 2014-07-02 16:24:51 +0000
193+++ src/powerd.cpp 2014-08-18 15:14:31 +0000
194@@ -568,6 +568,7 @@
195 device_config_init();
196
197 libsuspend_init(0);
198+ powerd_info("libsuspend: detect module: %s.", libsuspend_getname());
199 powerd_stats_init();
200 powerd_client_init();
201 power_request_init();

Subscribers

People subscribed via source and target branches