Merge lp:~ycheng-twn/powerd/powerd_lp1323286 into lp:powerd

Proposed by Yuan-Chen Cheng
Status: Merged
Approved by: Ricardo Salveti
Approved revision: 141
Merged at revision: 141
Proposed branch: lp:~ycheng-twn/powerd/powerd_lp1323286
Merge into: lp:powerd
Diff against target: 53 lines (+13/-7)
2 files modified
libsuspend/earlysuspend.c (+9/-3)
libsuspend/libsuspend.c (+4/-4)
To merge this branch: bzr merge lp:~ycheng-twn/powerd/powerd_lp1323286
Reviewer Review Type Date Requested Status
Ricardo Salveti (community) Approve
Review via email: mp+232997@code.launchpad.net

Commit message

Use android standard way on libsuspend detection.

Description of the change

use android standard way on libsuspend detection.

tested on n4, n10.

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

Looks good, works as expected.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libsuspend/earlysuspend.c'
2--- libsuspend/earlysuspend.c 2014-08-11 12:31:24 +0000
3+++ libsuspend/earlysuspend.c 2014-09-02 08:02:10 +0000
4@@ -50,7 +50,6 @@
5 static const char state_path[] = "/sys/power/state";
6 static const char wakelock_path[] = "/sys/power/wake_lock";
7 static const char wakeunlock_path[] = "/sys/power/wake_unlock";
8-static const char autosleep_path[] = "/sys/power/autosleep";
9
10 static const char mem_str[] = "mem";
11 static const char on_str[] = "on";
12@@ -157,9 +156,16 @@
13
14 const struct suspend_handler *earlysuspend_detect(void)
15 {
16- if (!sysfs_file_exists(autosleep_path) &&
17- sysfs_file_exists(wakelock_path) &&
18+ int len, ret;
19+ if (sysfs_file_exists(wakelock_path) &&
20 sysfs_file_exists(state_path)) {
21+
22+ len = ARRAY_SIZE(on_str) - 1;
23+ ret = sysfs_write(state_path, on_str, len);
24+ if (ret != len) {
25+ return NULL;
26+ }
27+
28 wait_for_fb = start_fb_monitor_thread();
29 return &earlysuspend_handler;
30 }
31
32=== modified file 'libsuspend/libsuspend.c'
33--- libsuspend/libsuspend.c 2014-08-11 12:31:24 +0000
34+++ libsuspend/libsuspend.c 2014-09-02 08:02:10 +0000
35@@ -26,14 +26,14 @@
36 void libsuspend_init(int force_mock)
37 {
38 if (!force_mock) {
39+ handler = earlysuspend_detect();
40+ if (handler)
41+ return;
42+
43 handler = autosleep_detect();
44 if (handler)
45 return;
46
47- handler = earlysuspend_detect();
48- if (handler)
49- return;
50-
51 handler = legacy_detect();
52 if (handler)
53 return;

Subscribers

People subscribed via source and target branches