Merge lp:~lihow731/ubuntu/saucy/cpufreqd/fix-for-1162160 into lp:ubuntu/trusty/cpufreqd
- Saucy (13.10)
- fix-for-1162160
- Merge into trusty
Proposed by
Leon Liao
Status: | Rejected |
---|---|
Rejected by: | Jamie Strandboge |
Proposed branch: | lp:~lihow731/ubuntu/saucy/cpufreqd/fix-for-1162160 |
Merge into: | lp:ubuntu/trusty/cpufreqd |
Diff against target: |
553 lines (+11/-481) 6 files modified
.pc/619913.patch/src/cpufreqd_acpi_battery.c (+0/-401) .pc/applied-patches (+0/-2) .pc/path_max.patch/src/cpufreqd.h (+0/-59) debian/changelog (+7/-0) src/cpufreqd.h (+1/-7) src/cpufreqd_acpi_battery.c (+3/-12) |
To merge this branch: | bzr merge lp:~lihow731/ubuntu/saucy/cpufreqd/fix-for-1162160 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jamie Strandboge | Disapprove | ||
Review via email: mp+202195@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === removed directory '.pc/619913.patch' |
2 | === removed directory '.pc/619913.patch/src' |
3 | === removed file '.pc/619913.patch/src/cpufreqd_acpi_battery.c' |
4 | --- .pc/619913.patch/src/cpufreqd_acpi_battery.c 2013-03-23 21:42:31 +0000 |
5 | +++ .pc/619913.patch/src/cpufreqd_acpi_battery.c 1970-01-01 00:00:00 +0000 |
6 | @@ -1,401 +0,0 @@ |
7 | -/* |
8 | - * Copyright (C) 2002-2006 Mattia Dongili <malattia@linux.it> |
9 | - * George Staikos <staikos@0wned.org> |
10 | - * |
11 | - * This program is free software; you can redistribute it and/or modify |
12 | - * it under the terms of the GNU General Public License as published by |
13 | - * the Free Software Foundation; either version 2 of the License, or |
14 | - * (at your option) any later version. |
15 | - * |
16 | - * This program is distributed in the hope that it will be useful, |
17 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
18 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
19 | - * GNU General Public License for more details. |
20 | - * |
21 | - * You should have received a copy of the GNU General Public License |
22 | - * along with this program; if not, write to the Free Software |
23 | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
24 | - */ |
25 | - |
26 | -#include <dirent.h> |
27 | -#include <errno.h> |
28 | -#include <stdio.h> |
29 | -#include <stdlib.h> |
30 | -#include <string.h> |
31 | -#include "cpufreqd_plugin.h" |
32 | -#include "cpufreqd_acpi.h" |
33 | -#include "cpufreqd_acpi_event.h" |
34 | -#include "cpufreqd_acpi_battery.h" |
35 | - |
36 | -#define POWER_SUPPLY "power_supply" |
37 | -#define BATTERY_TYPE "Battery" |
38 | -#define ENERGY_FULL "energy_full" |
39 | -#define ENERGY_NOW "energy_now" |
40 | -#define CHARGE_FULL "charge_full" |
41 | -#define CHARGE_NOW "charge_now" |
42 | -#define PRESENT "present" |
43 | -#define STATUS "status" |
44 | -#define CURRENT_NOW "current_now" |
45 | - |
46 | -struct battery_info { |
47 | - int capacity; |
48 | - int remaining; |
49 | - int present_rate; |
50 | - int level; /* computed percentage */ |
51 | - int is_present; |
52 | - |
53 | - struct sysfs_class_device *cdev; |
54 | - struct sysfs_attribute *energy_full; /* last full capacity */ |
55 | - struct sysfs_attribute *energy_now; /* remaining capacity */ |
56 | - struct sysfs_attribute *present; |
57 | - struct sysfs_attribute *status; |
58 | - struct sysfs_attribute *current_now; /* present rate */ |
59 | - |
60 | - int open; |
61 | -}; |
62 | - |
63 | -struct battery_interval { |
64 | - int min, max; |
65 | - struct battery_info *bat; |
66 | -}; |
67 | - |
68 | -/* don't want to handle more than 8 batteries... yet */ |
69 | -static struct battery_info info[8]; |
70 | -static int bat_dir_num; |
71 | -static int avg_battery_level; |
72 | -static double check_timeout; |
73 | -static double old_time; |
74 | -extern struct acpi_configuration acpi_config; |
75 | - |
76 | -/* validate if the requested battery exists */ |
77 | -static struct battery_info *get_battery_info(const char *name) |
78 | -{ |
79 | - int i; |
80 | - struct battery_info *ret = NULL; |
81 | - |
82 | - for (i = 0; i < bat_dir_num; i++) { |
83 | - if (strncmp(info[i].cdev->name, name, SYSFS_NAME_LEN) == 0) { |
84 | - ret = &info[i]; |
85 | - break; |
86 | - } |
87 | - } |
88 | - return ret; |
89 | -} |
90 | - |
91 | -/* close all the attributes and reset the open status */ |
92 | -static void close_battery(struct battery_info *binfo) { |
93 | - |
94 | - if (!binfo->open) return; |
95 | - |
96 | - if (binfo->energy_full) |
97 | - put_attribute(binfo->energy_full); |
98 | - if (binfo->energy_now) |
99 | - put_attribute(binfo->energy_now); |
100 | - if (binfo->present) |
101 | - put_attribute(binfo->present); |
102 | - if (binfo->status) |
103 | - put_attribute(binfo->status); |
104 | - if (binfo->current_now) |
105 | - put_attribute(binfo->current_now); |
106 | - |
107 | - binfo->open = 0; |
108 | -} |
109 | -/* read battery levels as reported by hw */ |
110 | -static int read_battery(struct battery_info *binfo) { |
111 | - clog(LOG_DEBUG, "%s - reading battery levels\n", binfo->cdev->name); |
112 | - |
113 | - if (read_int(binfo->current_now, &binfo->present_rate) != 0) { |
114 | - clog(LOG_ERR, "Skipping %s\n", binfo->cdev->name); |
115 | - return -1; |
116 | - } |
117 | - if (read_int(binfo->energy_now, &binfo->remaining) != 0) { |
118 | - clog(LOG_ERR, "Skipping %s\n", binfo->cdev->name); |
119 | - return -1; |
120 | - } |
121 | - if (read_value(binfo->status) != 0) { |
122 | - clog(LOG_ERR, "Skipping %s\n", binfo->cdev->name); |
123 | - return -1; |
124 | - } |
125 | - clog(LOG_DEBUG, "%s - remaining capacity: %d\n", |
126 | - binfo->cdev->name, binfo->remaining); |
127 | - return 0; |
128 | -} |
129 | -/* open all the required attributes and set the open status */ |
130 | -static int open_battery(struct battery_info *binfo) { |
131 | - binfo->open = 1; |
132 | - |
133 | - binfo->energy_full = get_class_device_attribute(binfo->cdev, ENERGY_FULL); |
134 | - if (!binfo->energy_full) { |
135 | - /* try the "charge_full" name */ |
136 | - binfo->energy_full = get_class_device_attribute(binfo->cdev, |
137 | - CHARGE_FULL); |
138 | - if (!binfo->energy_full) |
139 | - return -1; |
140 | - } |
141 | - binfo->energy_now = get_class_device_attribute(binfo->cdev, ENERGY_NOW); |
142 | - if (!binfo->energy_now) { |
143 | - /* try the "charge_now" name */ |
144 | - binfo->energy_now = get_class_device_attribute(binfo->cdev, CHARGE_NOW); |
145 | - if (!binfo->energy_now) |
146 | - return -1; |
147 | - } |
148 | - binfo->present = get_class_device_attribute(binfo->cdev, PRESENT); |
149 | - if (!binfo->present) |
150 | - return -1; |
151 | - binfo->status = get_class_device_attribute(binfo->cdev, STATUS); |
152 | - if (!binfo->status) |
153 | - return -1; |
154 | - binfo->current_now = get_class_device_attribute(binfo->cdev, CURRENT_NOW); |
155 | - if (!binfo->current_now) |
156 | - return -1; |
157 | - |
158 | - /* read the last full capacity, this is not going to change |
159 | - * very often, so no need to poke it later */ |
160 | - if (read_int(binfo->energy_full, &binfo->capacity) != 0) { |
161 | - clog(LOG_WARNING, "Couldn't read %s capacity (%s)\n", |
162 | - binfo->cdev->name, strerror(errno)); |
163 | - return -1; |
164 | - } |
165 | - return 0; |
166 | -} |
167 | - |
168 | -/* set the battery class device into the battery_info array */ |
169 | -static int clsdev_callback(struct sysfs_class_device *cdev) { |
170 | - clog(LOG_DEBUG, "Got device %s\n", cdev->name); |
171 | - info[bat_dir_num].cdev = cdev; |
172 | - bat_dir_num++; |
173 | - return 0; |
174 | -} |
175 | - |
176 | -/* int acpi_battery_init(void) |
177 | - * |
178 | - * this never fails since batteries are hotpluggable and |
179 | - * we can easily rescan for availability later (see acpi_battery_update |
180 | - * when an event is pending) |
181 | - */ |
182 | -short int acpi_battery_init(void) { |
183 | - int i; |
184 | - |
185 | - find_class_device(POWER_SUPPLY, BATTERY_TYPE, &clsdev_callback); |
186 | - if (bat_dir_num <= 0) { |
187 | - clog(LOG_INFO, "No Batteries found\n"); |
188 | - return 0; |
189 | - } |
190 | - /* open the required attributes */ |
191 | - for (i = 0; i < bat_dir_num; i++) { |
192 | - clog(LOG_DEBUG, "Opening %s attributes\n", info[i].cdev->name); |
193 | - if (open_battery(&info[i]) != 0) { |
194 | - clog(LOG_WARNING, "Couldn't open %s attributes\n", |
195 | - info[i].cdev->name); |
196 | - close_battery(&info[i]); |
197 | - } |
198 | - } |
199 | - clog(LOG_INFO, "found %d Batter%s\n", bat_dir_num, |
200 | - bat_dir_num > 1 ? "ies" : "y"); |
201 | - return 0; |
202 | -} |
203 | -short int acpi_battery_exit(void) { |
204 | - /* also reset values since this is called on pending |
205 | - * acpi events to rescan batteries |
206 | - */ |
207 | - while (--bat_dir_num >= 0) { |
208 | - close_battery(&info[bat_dir_num]); |
209 | - put_class_device(info[bat_dir_num].cdev); |
210 | - info[bat_dir_num].cdev = NULL; |
211 | - } |
212 | - bat_dir_num = 0; |
213 | - clog(LOG_INFO, "exited.\n"); |
214 | - return 0; |
215 | -} |
216 | -/* |
217 | - * Parses entries of the form %d-%d (min-max) |
218 | - */ |
219 | -int acpi_battery_parse(const char *ev, void **obj) { |
220 | - char battery_name[32]; |
221 | - struct battery_interval *ret = calloc(1, sizeof(struct battery_interval)); |
222 | - if (ret == NULL) { |
223 | - clog(LOG_ERR, "couldn't make enough room for battery_interval (%s)\n", |
224 | - strerror(errno)); |
225 | - return -1; |
226 | - } |
227 | - |
228 | - clog(LOG_DEBUG, "called with: %s\n", ev); |
229 | - |
230 | - /* try to parse the %[a-zA-Z0-9]:%d-%d format first */ |
231 | - if (sscanf(ev, "%32[a-zA-Z0-9]:%d-%d", battery_name, &(ret->min), &(ret->max)) == 3) { |
232 | - /* validate battery name and assign pointer to struct battery_info */ |
233 | - if ((ret->bat = get_battery_info(battery_name)) == NULL) { |
234 | - clog(LOG_ERR, "non existent battery %s!\n", |
235 | - battery_name); |
236 | - free(ret); |
237 | - return -1; |
238 | - } |
239 | - clog(LOG_INFO, "parsed %s %d-%d\n", ret->bat->cdev->name, ret->min, ret->max); |
240 | - |
241 | - } else if (sscanf(ev, "%32[a-zA-Z0-9]:%d", battery_name, &(ret->min)) == 2) { |
242 | - /* validate battery name and assign pointer to struct battery_info */ |
243 | - if ((ret->bat = get_battery_info(battery_name)) == NULL) { |
244 | - clog(LOG_ERR, "non existent battery %s!\n", |
245 | - battery_name); |
246 | - free(ret); |
247 | - return -1; |
248 | - } |
249 | - ret->max = ret->min; |
250 | - clog(LOG_INFO, "parsed %s %d\n", ret->bat->cdev->name, ret->min); |
251 | - |
252 | - } else if (sscanf(ev, "%d-%d", &(ret->min), &(ret->max)) == 2) { |
253 | - clog(LOG_INFO, "parsed %d-%d\n", ret->min, ret->max); |
254 | - |
255 | - } else if (sscanf(ev, "%d", &(ret->min)) == 1) { |
256 | - ret->max = ret->min; |
257 | - clog(LOG_INFO, "parsed %d\n", ret->min); |
258 | - |
259 | - } else { |
260 | - free(ret); |
261 | - return -1; |
262 | - } |
263 | - |
264 | - if (ret->min > ret->max) { |
265 | - clog(LOG_ERR, "Min higher than Max?\n"); |
266 | - free(ret); |
267 | - return -1; |
268 | - } |
269 | - |
270 | - *obj = ret; |
271 | - return 0; |
272 | -} |
273 | - |
274 | - |
275 | -int acpi_battery_evaluate(const void *s) { |
276 | - const struct battery_interval *bi = (const struct battery_interval *)s; |
277 | - int level = avg_battery_level; |
278 | - |
279 | - if (bi != NULL && bi->bat != NULL) { |
280 | - level = bi->bat->present->value ? bi->bat->level : -1; |
281 | - } |
282 | - |
283 | - clog(LOG_DEBUG, "called %d-%d [%s:%d]\n", bi->min, bi->max, |
284 | - bi != NULL && bi->bat != NULL ? bi->bat->cdev->name : "Avg", level); |
285 | - |
286 | - return (level >= bi->min && level <= bi->max) ? MATCH : DONT_MATCH; |
287 | -} |
288 | - |
289 | -/* static int acpi_battery_update(void) |
290 | - * |
291 | - * reads temperature valuse ant compute a medium value |
292 | - */ |
293 | -int acpi_battery_update(void) { |
294 | - int i = 0, total_capacity = 0, total_remaining = 0, n_read = 0; |
295 | - double elapsed_time = 0.0; |
296 | - double current_time = 0.0; |
297 | -#if 0 |
298 | - int remaining_hours=0, remaining_minutes=0; |
299 | - double remaining_secs = 0.0; |
300 | -#endif |
301 | - struct cpufreqd_info * cinfo = get_cpufreqd_info(); |
302 | - |
303 | - current_time = (double)cinfo->timestamp.tv_sec + (cinfo->timestamp.tv_usec/1000000.0); |
304 | - elapsed_time = current_time - old_time; |
305 | - old_time = current_time; |
306 | - /* decrement timeout */ |
307 | - check_timeout -= elapsed_time; |
308 | - |
309 | - /* if there is a pending event rescan batteries */ |
310 | - if (is_event_pending()) { |
311 | - clog(LOG_NOTICE, "Re-scanning available batteries\n"); |
312 | - acpi_battery_exit(); |
313 | - acpi_battery_init(); |
314 | - /* force timeout expiration */ |
315 | - check_timeout = -1; |
316 | - } |
317 | - |
318 | - /* Read battery informations */ |
319 | - for (i = 0; i < bat_dir_num; i++) { |
320 | - |
321 | - if (read_int(info[i].present, &info[i].is_present) != 0) { |
322 | - clog(LOG_INFO, "Skipping %s\n", info[i].cdev->name); |
323 | - continue; |
324 | - } |
325 | - |
326 | - /* if battery not open or not present skip to the next one */ |
327 | - if (!info[i].open || !info[i].is_present || info[i].capacity <= 0) { |
328 | - continue; |
329 | - } |
330 | - clog(LOG_INFO, "%s - present\n", info[i].cdev->name); |
331 | - |
332 | - /* if check_timeout is expired */ |
333 | - if (check_timeout <= 0) { |
334 | - if (read_battery(&info[i]) == 0) |
335 | - n_read++; |
336 | - else |
337 | - clog(LOG_INFO, "Unable to read battery %s\n", |
338 | - info[i].cdev->name); |
339 | - } else { |
340 | - /* estimate battery life */ |
341 | - clog(LOG_DEBUG, "%s - estimating battery life (timeout: %0.2f" |
342 | - " - status: %s)\n", |
343 | - info[i].cdev->name, check_timeout, |
344 | - info[i].status->value); |
345 | - |
346 | - if (strncmp(info[i].status->value, "Discharging", 11) == 0) |
347 | - info[i].remaining -= ((float)info[i].present_rate * elapsed_time) / 3600.0; |
348 | - |
349 | - else if (strncmp(info[i].status->value, "Full", 4) != 0 && |
350 | - (int)info[i].remaining < info[i].capacity) |
351 | - info[i].remaining += ((float)info[i].present_rate * elapsed_time) / 3600.0; |
352 | - |
353 | - clog(LOG_DEBUG, "%s - remaining capacity: %d\n", |
354 | - info[i].cdev->name, info[i].remaining); |
355 | - } |
356 | - n_read++; |
357 | - total_remaining += info[i].remaining; |
358 | - total_capacity += info[i].capacity; |
359 | - |
360 | - info[i].level = 100 * (info[i].remaining / (double)info[i].capacity); |
361 | - clog(LOG_INFO, "battery life for %s is %d%%\n", info[i].cdev->name, info[i].level); |
362 | -#if 0 |
363 | - if (info[i].present_rate > 0) { |
364 | - remaining_secs = 3600 * info[i].remaining / info[i].present_rate; |
365 | - remaining_hours = (int) remaining_secs / 3600; |
366 | - remaining_minutes = (remaining_secs - (remaining_hours * 3600)) / 60; |
367 | - clog(LOG_INFO, "battery time for %s is %d:%0.2d\n", |
368 | - info[i].cdev->name, remaining_hours, remaining_minutes); |
369 | - } |
370 | -#endif |
371 | - } /* end info loop */ |
372 | - |
373 | - /* check_timeout is global for all batteries, so update it after all batteries got updated */ |
374 | - if (check_timeout <= 0) { |
375 | - check_timeout = acpi_config.battery_update_interval; |
376 | - } |
377 | - |
378 | - /* calculates medium battery life between all batteries */ |
379 | - if (total_capacity > 0) |
380 | - avg_battery_level = 100 * (total_remaining / (double)total_capacity); |
381 | - else |
382 | - avg_battery_level = -1; |
383 | - |
384 | - clog(LOG_INFO, "average battery life %d%%\n", avg_battery_level); |
385 | - |
386 | - return 0; |
387 | -} |
388 | - |
389 | - |
390 | -#if 0 |
391 | -static struct cpufreqd_keyword kw[] = { |
392 | - { .word = "battery_interval", .parse = &acpi_battery_parse, .evaluate = &acpi_battery_evaluate }, |
393 | - { .word = NULL, .parse = NULL, .evaluate = NULL, .free = NULL } |
394 | -}; |
395 | - |
396 | -static struct cpufreqd_plugin acpi_battery = { |
397 | - .plugin_name = "acpi_battery_plugin", /* plugin_name */ |
398 | - .keywords = kw, /* config_keywords */ |
399 | - .plugin_init = &acpi_battery_init, /* plugin_init */ |
400 | - .plugin_exit = &acpi_battery_exit, /* plugin_exit */ |
401 | - .plugin_update = &acpi_battery_update, /* plugin_update */ |
402 | -}; |
403 | - |
404 | -struct cpufreqd_plugin *create_plugin (void) { |
405 | - return &acpi_battery; |
406 | -} |
407 | -#endif |
408 | |
409 | === removed file '.pc/applied-patches' |
410 | --- .pc/applied-patches 2014-01-04 03:51:23 +0000 |
411 | +++ .pc/applied-patches 1970-01-01 00:00:00 +0000 |
412 | @@ -1,2 +0,0 @@ |
413 | -619913.patch |
414 | -path_max.patch |
415 | |
416 | === removed directory '.pc/path_max.patch' |
417 | === removed directory '.pc/path_max.patch/src' |
418 | === removed file '.pc/path_max.patch/src/cpufreqd.h' |
419 | --- .pc/path_max.patch/src/cpufreqd.h 2014-01-04 03:51:23 +0000 |
420 | +++ .pc/path_max.patch/src/cpufreqd.h 1970-01-01 00:00:00 +0000 |
421 | @@ -1,59 +0,0 @@ |
422 | -/* |
423 | - * Copyright (C) 2002-2008 Mattia Dongili <malattia@linux.it> |
424 | - * George Staikos <staikos@0wned.org> |
425 | - * |
426 | - * This program is free software; you can redistribute it and/or modify |
427 | - * it under the terms of the GNU General Public License as published by |
428 | - * the Free Software Foundation; either version 2 of the License, or |
429 | - * (at your option) any later version. |
430 | - * |
431 | - * This program is distributed in the hope that it will be useful, |
432 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
433 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
434 | - * GNU General Public License for more details. |
435 | - * |
436 | - * You should have received a copy of the GNU General Public License |
437 | - * along with this program; if not, write to the Free Software |
438 | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
439 | - */ |
440 | - |
441 | -#ifdef HAVE_CONFIG_H |
442 | -#include "config.h" |
443 | -#endif |
444 | - |
445 | -#ifndef __CPUFREQD_H__ |
446 | -#define __CPUFREQD_H__ |
447 | - |
448 | -#define __CPUFREQD_VERSION__ VERSION |
449 | -#define __CPUFREQD_MAINTAINER__ "malattia@linux.it" |
450 | - |
451 | -#ifdef __GNUC__ |
452 | -# define __UNUSED__ __attribute__((unused)) |
453 | -#else |
454 | -# define __UNUSED__ |
455 | -#endif |
456 | - |
457 | -#ifndef CPUFREQD_CONFDIR |
458 | -# define CPUFREQD_CONFDIR "/etc/" |
459 | -#endif |
460 | - |
461 | -#ifndef CPUFREQD_LIBDIR |
462 | -# define CPUFREQD_LIBDIR "/usr/lib/cpufreqd/" |
463 | -#endif |
464 | - |
465 | -#ifndef CPUFREQD_STATEDIR |
466 | -# define CPUFREQD_STATEDIR "/var/" |
467 | -#endif |
468 | - |
469 | -#define CPUFREQD_CONFIG CPUFREQD_CONFDIR"cpufreqd.conf" |
470 | -# define CPUFREQD_PIDFILE CPUFREQD_STATEDIR"run/cpufreqd.pid" |
471 | -#define CPUFREQD_SOCKFILE "/tmp/cpufreqd.sock" |
472 | - |
473 | - |
474 | -#define DEFAULT_POLL 1 |
475 | -#define DEFAULT_VERBOSITY 3 |
476 | - |
477 | -#define MAX_STRING_LEN 255 |
478 | -#define MAX_PATH_LEN 512 |
479 | - |
480 | -#endif /* __CPUFREQD_H__ */ |
481 | |
482 | === modified file 'debian/changelog' |
483 | --- debian/changelog 2014-01-04 03:51:23 +0000 |
484 | +++ debian/changelog 2014-01-18 09:14:08 +0000 |
485 | @@ -1,3 +1,10 @@ |
486 | +cpufreqd (2.4.2-2ubuntu1ppa) saucy; urgency=low |
487 | + |
488 | + * Merge 2.4.2-2ubuntu1 from trusty for the buffer overflow bug. |
489 | + - fix bug LP: #1190389 , too. |
490 | + |
491 | + -- Li-Hao Liao (Leon Liao) <lihow731@gmail.com> Sat, 18 Jan 2014 15:16:52 +0800 |
492 | + |
493 | cpufreqd (2.4.2-2ubuntu1) trusty; urgency=medium |
494 | |
495 | * path_max.patch: Pull upstream patch to fix MAX_PATH_LEN (LP: #1162160) |
496 | |
497 | === modified file 'src/cpufreqd.h' |
498 | --- src/cpufreqd.h 2014-01-04 03:51:23 +0000 |
499 | +++ src/cpufreqd.h 2014-01-18 09:14:08 +0000 |
500 | @@ -54,12 +54,6 @@ |
501 | #define DEFAULT_VERBOSITY 3 |
502 | |
503 | #define MAX_STRING_LEN 255 |
504 | - |
505 | -#ifdef HAVE_LIMITS_H |
506 | -#include <limits.h> |
507 | -#define MAX_PATH_LEN PATH_MAX |
508 | -#else |
509 | -#define MAX_PATH_LEN 512 |
510 | -#endif |
511 | +#define MAX_PATH_LEN 512 |
512 | |
513 | #endif /* __CPUFREQD_H__ */ |
514 | |
515 | === modified file 'src/cpufreqd_acpi_battery.c' |
516 | --- src/cpufreqd_acpi_battery.c 2013-03-23 21:42:31 +0000 |
517 | +++ src/cpufreqd_acpi_battery.c 2014-01-18 09:14:08 +0000 |
518 | @@ -36,7 +36,6 @@ |
519 | #define PRESENT "present" |
520 | #define STATUS "status" |
521 | #define CURRENT_NOW "current_now" |
522 | -#define POWER_NOW "power_now" |
523 | |
524 | struct battery_info { |
525 | int capacity; |
526 | @@ -146,13 +145,9 @@ |
527 | binfo->status = get_class_device_attribute(binfo->cdev, STATUS); |
528 | if (!binfo->status) |
529 | return -1; |
530 | - binfo->current_now = get_class_device_attribute(binfo->cdev, POWER_NOW); |
531 | - if (!binfo->current_now) { |
532 | - /* try the "current_now" name */ |
533 | - binfo->current_now = get_class_device_attribute(binfo->cdev, CURRENT_NOW); |
534 | - if (!binfo->current_now) |
535 | - return -1; |
536 | - } |
537 | + binfo->current_now = get_class_device_attribute(binfo->cdev, CURRENT_NOW); |
538 | + if (!binfo->current_now) |
539 | + return -1; |
540 | |
541 | /* read the last full capacity, this is not going to change |
542 | * very often, so no need to poke it later */ |
543 | @@ -316,10 +311,6 @@ |
544 | |
545 | /* Read battery informations */ |
546 | for (i = 0; i < bat_dir_num; i++) { |
547 | - if (!info[i].open) { |
548 | - clog(LOG_INFO, "Skipping %s (closed)\n", info[i].cdev->name); |
549 | - continue; |
550 | - } |
551 | |
552 | if (read_int(info[i].present, &info[i].is_present) != 0) { |
553 | clog(LOG_INFO, "Skipping %s\n", info[i].cdev->name); |
Thanks for the patch! I am going to reject this for now because https:/ /launchpad. net/ubuntu/ +source/ cpufreqd/ 2.4.2-2ubuntu0. 1 was uploaded to saucy-proposed yesterday. Note, normally when preparing an SRU you will provide an isolated patch rather than do a merge like you.