Codebase list upower / cadd721
Merge commit 'upstream/013' Michael Biebl 14 years ago
30 changed file(s) with 1177 addition(s) and 669 deletion(s). Raw diff Collapse all Expand all
11 Author: Richard Hughes <richard@hughsie.com>
22 Date: Wed Aug 6 06:58:45 2008 +0100
33
4 make some stuff non-global in devkit-power
5
6 tools/dkp-tool.c | 7 +++----
4 make some stuff non-global in upower
5
6 tools/up-tool.c | 7 +++----
77 1 files changed, 3 insertions(+), 4 deletions(-)
88
99 commit b242cbd9a617b4cf1d62cb22e3680167683577fd
1212
1313 trivial: remove some un-needed defines
1414
15 tools/dkp-tool.c | 18 ------------------
15 tools/up-tool.c | 18 ------------------
1616 1 files changed, 0 insertions(+), 18 deletions(-)
1717
1818 commit 5b6bae572f39a05e78f6c0c35018725f05c97a4d
1919 Author: Richard Hughes <richard@hughsie.com>
2020 Date: Tue Aug 5 17:26:35 2008 +0100
2121
22 abstract out the client and client device parts of the devkit-power
22 abstract out the client and client device parts of the upower
2323 tool
2424
2525 tools/Makefile.am | 4 +
26 tools/dkp-device.c | 384
26 tools/up-device.c | 384
2727 +++++++++++++++++++++++++++++++++++++++++++++
28 tools/dkp-device.h | 72 +++++++++
29 tools/dkp-client.c | 269 +++++++++++++++++++++++++++++++
30 tools/dkp-client.h | 66 ++++++++
31 tools/dkp-tool.c | 248 ++++-------------------------
28 tools/up-device.h | 72 +++++++++
29 tools/up-client.c | 269 +++++++++++++++++++++++++++++++
30 tools/up-client.h | 66 ++++++++
31 tools/up-tool.c | 248 ++++-------------------------
3232 6 files changed, 829 insertions(+), 214 deletions(-)
3333
3434 commit da8ec3f3b12f9869f2d7b0c93169d3c68e434ef2
3737
3838 move the enumeration into it's own function ready for tidyup
3939
40 tools/dkp-tool.c | 46 +++++++++++++++++++++++++++++++++++-----------
40 tools/up-tool.c | 46 +++++++++++++++++++++++++++++++++++-----------
4141 1 files changed, 35 insertions(+), 11 deletions(-)
4242
4343 commit 12c592ddeedc4bb0892234e449db8bd3e97c5d61
4646
4747 make the LowBatteryChanged and OnBatteryChanged signals work
4848
49 src/dkp-daemon.c | 88
49 src/up-daemon.c | 88
5050 ++++++++++++++++++++++++++++++++++++++++++++++++-----
51 src/dkp-source.c | 55 +++++++++++++++++++++------------
52 src/dkp-source.h | 7 ++--
51 src/up-source.c | 55 +++++++++++++++++++++------------
52 src/up-source.h | 7 ++--
5353 3 files changed, 118 insertions(+), 32 deletions(-)
5454
5555 commit 16f2c597aa03d1405c04b14595690f9717a801c8
5858
5959 don't segfault when a history file is present but empty
6060
61 devkit-power-gobject/dkp-history-obj.c | 2 +-
62 src/dkp-history.c | 10 ++++++++--
61 upower-gobject/up-history-obj.c | 2 +-
62 src/up-history.c | 10 ++++++++--
6363 2 files changed, 9 insertions(+), 3 deletions(-)
6464
6565 commit 38f86d7dae9f190f6e33c1940452a880bf96e396
6969 add some GObject checks in a couple of modules to try to debug a
7070 problem I'm seeing
7171
72 src/dkp-device-list.c | 17 ++++-
73 src/dkp-device-list.h | 12 ++--
74 src/dkp-history.c | 182
72 src/up-device-list.c | 17 ++++-
73 src/up-device-list.h | 12 ++--
74 src/up-history.c | 182
7575 +++++++++++++++++++++++++++----------------------
76 src/dkp-history.h | 24 +++---
76 src/up-history.h | 24 +++---
7777 4 files changed, 133 insertions(+), 102 deletions(-)
7878
7979 commit 22dfd9e7db9e58584e9f00359528c379f0a98cea
8282
8383 don't get the ID in DkpDevice, we already set it in DkpSource
8484
85 src/dkp-device.c | 5 -----
85 src/up-device.c | 5 -----
8686 1 files changed, 0 insertions(+), 5 deletions(-)
8787
8888 commit eed12da295df1209496ac029f07fbc376afdfb3f
9393 easily get the device list for the power queries
9494
9595 src/Makefile.am | 1 +
96 src/dkp-daemon.c | 88 ++++++++++---------------
97 src/dkp-device-list.c | 173
96 src/up-daemon.c | 88 ++++++++++---------------
97 src/up-device-list.c | 173
9898 +++++++++++++++++++++++++++++++++++++++++++++++++
99 src/dkp-device-list.h | 68 +++++++++++++++++++
99 src/up-device-list.h | 68 +++++++++++++++++++
100100 4 files changed, 277 insertions(+), 53 deletions(-)
101101
102102 commit 4e4859c9cba1dfb16a0299bf6328aa58cf001818
106106 add some helpers in DkpSource to get the binary states of primary
107107 batteries
108108
109 src/dkp-daemon.c | 2 ++
110 src/dkp-source.c | 28 ++++++++++++++++++++++++++++
111 src/dkp-source.h | 4 ++++
109 src/up-daemon.c | 2 ++
110 src/up-source.c | 28 ++++++++++++++++++++++++++++
111 src/up-source.h | 4 ++++
112112 3 files changed, 34 insertions(+), 0 deletions(-)
113113
114114 commit 9dca67f115ff8a71c1f633356918a9e056d24cac
117117
118118 add a new ninary to get the battery power state
119119
120 src/dkp-history.c | 3 +-
120 src/up-history.c | 3 +-
121121 tools/Makefile.am | 19 +++++++++++--
122 tools/dkp-battery-power.c | 67
122 tools/up-battery-power.c | 67
123123 +++++++++++++++++++++++++++++++++++++++++++++
124124 3 files changed, 84 insertions(+), 5 deletions(-)
125125
130130 treat the timespan like a range, and search backwards so we aways
131131 get some data
132132
133 src/dkp-history.c | 21 ++++++++++++++-------
133 src/up-history.c | 21 ++++++++++++++-------
134134 1 files changed, 14 insertions(+), 7 deletions(-)
135135
136136 commit 50cadd86229fb5cbd681d259b9b6e5323b251337
139139
140140 correct the signature of GetOnBattery and GetLowbattery
141141
142 src/org.freedesktop.DeviceKit.Power.xml | 4 ++--
142 src/org.freedesktop.UPower.xml | 4 ++--
143143 1 files changed, 2 insertions(+), 2 deletions(-)
144144
145145 commit 9f171a14ef6b27fe1a458ded143684dc6e988886
146146 Author: Richard Hughes <richard@hughsie.com>
147147 Date: Mon Aug 4 16:41:58 2008 +0100
148148
149 make devkit-power --dump work
150
151 tools/dkp-tool.c | 11 +++++++----
149 make upower --dump work
150
151 tools/up-tool.c | 11 +++++++----
152152 1 files changed, 7 insertions(+), 4 deletions(-)
153153
154154 commit 8c4efc79f33511eafa06074357fffc2c16e8e284
155155 Author: Richard Hughes <richard@hughsie.com>
156156 Date: Mon Aug 4 16:25:25 2008 +0100
157157
158 use DkpHistoryObj in devkit-power
159
160 devkit-power-gobject/Makefile.am | 2 +
161 devkit-power-gobject/dkp-history-obj.c | 173
158 use DkpHistoryObj in upower
159
160 upower-gobject/Makefile.am | 2 +
161 upower-gobject/up-history-obj.c | 173
162162 +++++++++++++++++++++++++++++++++++++
163 devkit-power-gobject/dkp-history-obj.h | 51 +++++++++++
163 upower-gobject/up-history-obj.h | 51 +++++++++++
164164 src/Makefile.am | 1 -
165 src/dkp-history-obj.c | 173
165 src/up-history-obj.c | 173
166166 -------------------------------------
167 src/dkp-history-obj.h | 51 -----------
168 tools/dkp-tool.c | 29 ++++--
167 src/up-history-obj.h | 51 -----------
168 tools/up-tool.c | 29 ++++--
169169 7 files changed, 245 insertions(+), 235 deletions(-)
170170
171171 commit 3e8ab9514a4524d33128295e65b32fc42411b523
174174
175175 get the device stats in the helper tool
176176
177 tools/dkp-tool.c | 82
177 tools/up-tool.c | 82
178178 +++++++++++++++++++++++++++++++++++++++++++++++++++--
179179 1 files changed, 78 insertions(+), 4 deletions(-)
180180
184184
185185 don't crash if we do GetStatistics on a device without history
186186
187 src/dkp-source.c | 7 +++++++
187 src/up-source.c | 7 +++++++
188188 1 files changed, 7 insertions(+), 0 deletions(-)
189189
190190 commit 0e617b862c8e427cfbcaaeb5f47b7f19979479b5
191191 Author: Richard Hughes <richard@hughsie.com>
192192 Date: Mon Aug 4 15:36:47 2008 +0100
193193
194 Add a GetStatistics() method on org.freedesktop.DeviceKit.Power.Source
194 Add a GetStatistics() method on org.freedesktop.UPower.Source
195195 so we can print some funky graphs
196196
197 src/dkp-source.c | 96
197 src/up-source.c | 96
198198 ++++++++++++++++++++++-
199 src/dkp-source.h | 20 +++++-
200 src/org.freedesktop.DeviceKit.Power.Source.xml | 23 ++++++
199 src/up-source.h | 20 +++++-
200 src/org.freedesktop.UPower.Source.xml | 23 ++++++
201201 3 files changed, 132 insertions(+), 7 deletions(-)
202202
203203 commit dfd11030674b9e52ada85c62a3a0860d14c4ac95
206206
207207 the power_supply class gives a very clear status enum, just use it
208208
209 src/dkp-source.c | 36 +++++++++++++++---------------------
209 src/up-source.c | 36 +++++++++++++++---------------------
210210 1 files changed, 15 insertions(+), 21 deletions(-)
211211
212212 commit a562159bc73920fd913a859bf5c822a31d14ef1e
216216 add simple history data to be saved and retrieved
217217
218218 src/Makefile.am | 4 +
219 src/dkp-history.c | 495
219 src/up-history.c | 495
220220 +++++++++++++++++++++++++++++++++++++++++++++++++++++
221 src/dkp-history.h | 71 ++++++++
222 src/dkp-source.c | 43 +++++-
221 src/up-history.h | 71 ++++++++
222 src/up-source.c | 43 +++++-
223223 4 files changed, 612 insertions(+), 1 deletions(-)
224224
225225 commit 1d7655c14fe6b622e6d01269e11c1c193e1a63ce
229229 add some helpers to manipulate DkpHistoryObj objects for the future
230230 history and profiling code
231231
232 src/dkp-history-obj.c | 173
232 src/up-history-obj.c | 173
233233 +++++++++++++++++++++++++++++++++++++++++++++++++
234 src/dkp-history-obj.h | 51 ++++++++++++++
234 src/up-history-obj.h | 51 ++++++++++++++
235235 2 files changed, 224 insertions(+), 0 deletions(-)
236236
237237 commit 3f606443b59c0f2c5eac3573855080edf1a28468
238238 Author: Richard Hughes <richard@hughsie.com>
239239 Date: Mon Aug 4 14:30:34 2008 +0100
240240
241 add a function dkp_object_diff() to pretty print the differences
241 add a function up_object_diff() to pretty print the differences
242242 between two DkpObject's
243243
244 devkit-power-gobject/dkp-object.c | 162
244 upower-gobject/up-object.c | 162
245245 ++++++++++++++++++++++++++++++++++++-----
246 devkit-power-gobject/dkp-object.h | 2 +
246 upower-gobject/up-object.h | 2 +
247247 2 files changed, 144 insertions(+), 20 deletions(-)
248248
249249 commit 66b6a807227036a256634cfc42f0ecc4ce51d83d
252252
253253 print a better seconds/minutes/hours text -- needs localising properly
254254
255 devkit-power-gobject/dkp-object.c | 36 ++++++++++++++++++++++++++++++------
255 upower-gobject/up-object.c | 36 ++++++++++++++++++++++++++++++------
256256 1 files changed, 30 insertions(+), 6 deletions(-)
257257
258258 commit b5b5b6824bece0dd9a49f9e219dcf743e0b22a81
270270
271271 remove some trivial whitespace and an invalid comment
272272
273 src/org.freedesktop.DeviceKit.Power.Source.xml | 7 -------
273 src/org.freedesktop.UPower.Source.xml | 7 -------
274274 1 files changed, 0 insertions(+), 7 deletions(-)
275275
276276 commit 0cd1a18a20a2de890704a69d813969442899adf7
279279
280280 add the skeleton --dump option for debugging -- more to come
281281
282 tools/dkp-tool.c | 6 +++++-
282 tools/up-tool.c | 6 +++++-
283283 1 files changed, 5 insertions(+), 1 deletions(-)
284284
285285 commit 117720b03de371e7d4194a8556c3eb413f7c43d1
298298 only poll when we have no updates when charging or discharging. if
299299 we are empty or full, there's no point
300300
301 src/dkp-source.c | 12 ++++++------
301 src/up-source.c | 12 ++++++------
302302 1 files changed, 6 insertions(+), 6 deletions(-)
303303
304304 commit b626fcd195908e07b3c9581183bc6c6d11479e2a
326326
327327 Makefile.am | 2 +-
328328 configure.in | 1 +
329 devkit-power-gobject/.gitignore | 11 ++
330 devkit-power-gobject/Makefile.am | 25 +++
331 devkit-power-gobject/egg-debug.c | 240 ++++++++++++++++++++++++++++
332 devkit-power-gobject/egg-debug.h | 80 +++++++++
333 devkit-power-gobject/dkp-enum.c | 229 ++++++++++++++++++++++++++
334 devkit-power-gobject/dkp-enum.h | 69 ++++++++
335 devkit-power-gobject/dkp-object.c | 361
329 upower-gobject/.gitignore | 11 ++
330 upower-gobject/Makefile.am | 25 +++
331 upower-gobject/egg-debug.c | 240 ++++++++++++++++++++++++++++
332 upower-gobject/egg-debug.h | 80 +++++++++
333 upower-gobject/up-enum.c | 229 ++++++++++++++++++++++++++
334 upower-gobject/up-enum.h | 69 ++++++++
335 upower-gobject/up-object.c | 361
336336 ++++++++++++++++++++++++++++++++++++++++++
337 devkit-power-gobject/dkp-object.h | 67 ++++++++
337 upower-gobject/up-object.h | 67 ++++++++
338338 src/Makefile.am | 7 +-
339339 src/egg-debug.c | 240 ----------------------------
340340 src/egg-debug.h | 80 ---------
341 src/dkp-enum.c | 229 --------------------------
342 src/dkp-enum.h | 69 --------
343 src/dkp-object.c | 361
341 src/up-enum.c | 229 --------------------------
342 src/up-enum.h | 69 --------
343 src/up-object.c | 361
344344 ------------------------------------------
345 src/dkp-object.h | 67 --------
345 src/up-object.h | 67 --------
346346 tools/Makefile.am | 7 +-
347 tools/dkp-tool.c | 4 +-
347 tools/up-tool.c | 4 +-
348348 19 files changed, 1094 insertions(+), 1055 deletions(-)
349349
350350 commit d06a9707c5e2ab366325e5e8e77207dcc1885c56
353353
354354 trivial line fixes :-)
355355
356 src/dkp-daemon.c | 7 -------
357 src/dkp-source.c | 2 --
356 src/up-daemon.c | 7 -------
357 src/up-source.c | 2 --
358358 2 files changed, 0 insertions(+), 9 deletions(-)
359359
360360 commit d9a0190fe2d3f277750ace2e71ae25aa0ead7cef
361361 Author: Richard Hughes <richard@hughsie.com>
362362 Date: Fri Aug 1 16:55:50 2008 +0100
363363
364 don't print blank lines in dkp_object_print
365
366 src/dkp-object.c | 32 +++++++++++++++++++++++++++++---
367 src/dkp-source.c | 5 +++++
364 don't print blank lines in up_object_print
365
366 src/up-object.c | 32 +++++++++++++++++++++++++++++---
367 src/up-source.c | 5 +++++
368368 2 files changed, 34 insertions(+), 3 deletions(-)
369369
370370 commit dee758ac78df79e5378efddd493e6e870c75f3d6
371371 Author: Richard Hughes <richard@hughsie.com>
372372 Date: Fri Aug 1 16:48:33 2008 +0100
373373
374 use DkpObject in devkit-power command line tool
375
376 tools/dkp-tool.c | 209
374 use DkpObject in upower command line tool
375
376 tools/up-tool.c | 209
377377 ++++++++++++------------------------------------------
378378 1 files changed, 46 insertions(+), 163 deletions(-)
379379
385385 it, check for changes and print it
386386
387387 src/Makefile.am | 1 +
388 src/dkp-object.c | 335
388 src/up-object.c | 335
389389 +++++++++++++++++++++++++++++++++++++++++++++++++++
390 src/dkp-object.h | 67 +++++++++++
391 src/dkp-source.c | 344
390 src/up-object.h | 67 +++++++++++
391 src/up-source.c | 344
392392 +++++++++++++++++++++--------------------------------
393393 tools/Makefile.am | 2 +
394394 5 files changed, 542 insertions(+), 207 deletions(-)
397397 Author: Richard Hughes <richard@hughsie.com>
398398 Date: Fri Aug 1 16:36:12 2008 +0100
399399
400 remove energy-empty-design from devkit-power tool
401
402 tools/dkp-tool.c | 4 ----
400 remove energy-empty-design from upower tool
401
402 tools/up-tool.c | 4 ----
403403 1 files changed, 0 insertions(+), 4 deletions(-)
404404
405405 commit 9cc2a944cb50c29cf0dc1b95f436a1e88cda38dd
408408
409409 add the abilty to turn the text enum forms back into enumerated types
410410
411 src/dkp-enum.c | 77
411 src/up-enum.c | 77
412412 ++++++++++++++++++++++++++++++++++++++++++++++++++++---
413 src/dkp-enum.h | 9 ++++--
413 src/up-enum.h | 9 ++++--
414414 2 files changed, 78 insertions(+), 8 deletions(-)
415415
416416 commit 9db5f0d3dcb665c7fad558da547c9648ef6ba647
419419
420420 fix the type and state enums when getting unknown
421421
422 src/dkp-enum.c | 6 ++++++
422 src/up-enum.c | 6 ++++++
423423 1 files changed, 6 insertions(+), 0 deletions(-)
424424
425425 commit 27cde0b6e03adc2db73413e4b4df09e00e86c337
426426 Author: Richard Hughes <richard@hughsie.com>
427427 Date: Fri Aug 1 13:15:40 2008 +0100
428428
429 rework devkit-power tool, more work to come
429 rework upower tool, more work to come
430430
431431 po/POTFILES.in | 3 +
432432 tools/Makefile.am | 19 ++--
433 tools/devkit-power.c | 376
433 tools/upower.c | 376
434434 --------------------------------------------------
435 tools/dkp-tool.c | 371
435 tools/up-tool.c | 371
436436 +++++++++++++++++++++++++++++++++++++++++++++++++
437437 4 files changed, 384 insertions(+), 385 deletions(-)
438438
443443 add some debugging infrastructure
444444
445445 src/Makefile.am | 1 +
446 src/dkp-daemon.c | 49 ++++++------
446 src/up-daemon.c | 49 ++++++------
447447 src/egg-debug.c | 240
448448 +++++++++++++++++++++++++++++++++++++++++++++++++++++
449449 src/egg-debug.h | 80 ++++++++++++++++++
450 src/dkp-device.c | 12 ++-
451 src/dkp-enum.c | 7 +-
452 src/dkp-source.c | 23 +++---
450 src/up-device.c | 12 ++-
451 src/up-enum.c | 7 +-
452 src/up-source.c | 23 +++---
453453 src/main.c | 44 +++++-----
454454 src/sysfs-utils.c | 10 +-
455455 9 files changed, 396 insertions(+), 70 deletions(-)
460460
461461 convert spaces to tabs, and make sure functions have sensible names
462462
463 src/dkp-daemon.c | 1095 +++++++++++++++++++++++++-----------------------
464 src/dkp-daemon.h | 63 ++--
465 src/dkp-device.c | 49 ++-
466 src/dkp-device.h | 43 +-
467 src/dkp-enum.c | 164 ++++----
468 src/dkp-enum.h | 50 ++--
469 src/dkp-source.c | 1213
463 src/up-daemon.c | 1095 +++++++++++++++++++++++++-----------------------
464 src/up-daemon.h | 63 ++--
465 src/up-device.c | 49 ++-
466 src/up-device.h | 43 +-
467 src/up-enum.c | 164 ++++----
468 src/up-enum.h | 50 ++--
469 src/up-source.c | 1213
470470 +++++++++++++++++++++++++++--------------------------
471 src/dkp-source.h | 29 +-
471 src/up-source.h | 29 +-
472472 src/main.c | 176 ++++----
473473 src/sysfs-utils.c | 244 ++++++------
474474 10 files changed, 1624 insertions(+), 1502 deletions(-)
480480 change the GObject prefix from DevkitPower to Dkp
481481
482482 src/Makefile.am | 8 ++--
483 src/dkp-daemon.c | 152
483 src/up-daemon.c | 152
484484 +++++++++++++++++++++++++++---------------------------
485 src/dkp-daemon.h | 62 +++++++++++-----------
486 src/dkp-device.c | 32 ++++++------
487 src/dkp-device.h | 38 +++++++-------
488 src/dkp-enum.c | 60 +++++++++++-----------
489 src/dkp-enum.h | 60 +++++++++++-----------
490 src/dkp-source.c | 138 ++++++++++++++++++++++++------------------------
491 src/dkp-source.h | 38 +++++++-------
485 src/up-daemon.h | 62 +++++++++++-----------
486 src/up-device.c | 32 ++++++------
487 src/up-device.h | 38 +++++++-------
488 src/up-enum.c | 60 +++++++++++-----------
489 src/up-enum.h | 60 +++++++++++-----------
490 src/up-source.c | 138 ++++++++++++++++++++++++------------------------
491 src/up-source.h | 38 +++++++-------
492492 src/main.c | 4 +-
493493 10 files changed, 296 insertions(+), 296 deletions(-)
494494
500500
501501 src/Makefile.am | 53
502502 +++++++++++++++++++++++++++--------------------------
503 src/dkp-daemon.c | 8 ++++----
504 src/dkp-device.c | 4 ++--
505 src/dkp-device.h | 2 +-
506 src/dkp-enum.c | 3 ++-
507 src/dkp-source.c | 8 ++++----
508 src/dkp-source.h | 4 ++--
503 src/up-daemon.c | 8 ++++----
504 src/up-device.c | 4 ++--
505 src/up-device.h | 2 +-
506 src/up-enum.c | 3 ++-
507 src/up-source.c | 8 ++++----
508 src/up-source.h | 4 ++--
509509 src/main.c | 2 +-
510510 8 files changed, 43 insertions(+), 41 deletions(-)
511511
516516 add some more GCC warnings
517517
518518 configure.in | 9 +
519 src/devkit-power-daemon.c | 755
519 src/upower-daemon.c | 755
520520 -------------------------------------
521 src/devkit-power-daemon.h | 92 -----
522 src/devkit-power-device.c | 92 -----
523 src/devkit-power-device.h | 68 ----
524 src/devkit-power-enum.c | 142 -------
525 src/devkit-power-enum.h | 66 ----
526 src/devkit-power-marshal.list | 2 -
527 src/devkit-power-source.c | 838
521 src/upower-daemon.h | 92 -----
522 src/upower-device.c | 92 -----
523 src/upower-device.h | 68 ----
524 src/upower-enum.c | 142 -------
525 src/upower-enum.h | 66 ----
526 src/upower-marshal.list | 2 -
527 src/upower-source.c | 838
528528 -----------------------------------------
529 src/devkit-power-source.h | 65 ----
530 src/dkp-daemon.c | 755
529 src/upower-source.h | 65 ----
530 src/up-daemon.c | 755
531531 +++++++++++++++++++++++++++++++++++++
532 src/dkp-daemon.h | 92 +++++
533 src/dkp-device.c | 92 +++++
534 src/dkp-device.h | 68 ++++
535 src/dkp-enum.c | 142 +++++++
536 src/dkp-enum.h | 66 ++++
537 src/dkp-marshal.list | 2 +
538 src/dkp-source.c | 838
532 src/up-daemon.h | 92 +++++
533 src/up-device.c | 92 +++++
534 src/up-device.h | 68 ++++
535 src/up-enum.c | 142 +++++++
536 src/up-enum.h | 66 ++++
537 src/up-marshal.list | 2 +
538 src/up-source.c | 838
539539 +++++++++++++++++++++++++++++++++++++++++
540 src/dkp-source.h | 65 ++++
540 src/up-source.h | 65 ++++
541541 19 files changed, 2129 insertions(+), 2120 deletions(-)
542542
543543 commit 1023e581335f5a078319b86794c24dd92f9b69f2
546546
547547 when we haven't got a rate value, try to calculate this
548548
549 src/devkit-power-source.c | 75
549 src/upower-source.c | 75
550550 ++++++++++++++++++++++++++++++++++++--------
551551 1 files changed, 61 insertions(+), 14 deletions(-)
552552
556556
557557 don't return an ID if we are not present
558558
559 src/devkit-power-source.c | 4 ++++
559 src/upower-source.c | 4 ++++
560560 1 files changed, 4 insertions(+), 0 deletions(-)
561561
562562 commit d85c4956741a3c02a7ae03cd2b429f0035080992
565565
566566 add some more logic into the power supply class
567567
568 src/devkit-power-source.c | 23 ++++++++++++++++-------
568 src/upower-source.c | 23 ++++++++++++++++-------
569569 1 files changed, 16 insertions(+), 7 deletions(-)
570570
571571 commit fccd159c739a71e8863c96ee6b9037ba8f3ae83e
574574
575575 calculate a quick and dirty time remaining value
576576
577 src/devkit-power-source.c | 30 ++++++++++++++++++++++++++++++
577 src/upower-source.c | 30 ++++++++++++++++++++++++++++++
578578 1 files changed, 30 insertions(+), 0 deletions(-)
579579
580580 commit d7447437dd1d2bc722a2bc746d9af2fb8b9a1a28
583583
584584 only suppy an id for devices supplying the system
585585
586 src/devkit-power-source.c | 4 ++++
586 src/upower-source.c | 4 ++++
587587 1 files changed, 4 insertions(+), 0 deletions(-)
588588
589589 commit 4a15e42c41415a8c9cc59e23c51092e097dfe7d4
593593 add a power-supply bool property so we can tell if the device is a
594594 supplier or consumer
595595
596 src/devkit-power-source.c | 14 ++++++++++++++
597 src/org.freedesktop.DeviceKit.Power.Source.xml | 8 ++++++++
596 src/upower-source.c | 14 ++++++++++++++
597 src/org.freedesktop.UPower.Source.xml | 8 ++++++++
598598 2 files changed, 22 insertions(+), 0 deletions(-)
599599
600600 commit 36bf97d9133f4bfd1f134da6c3052785701be65d
603603
604604 provide a function for getting a unique ID for the battery
605605
606 src/devkit-power-source.c | 42
606 src/upower-source.c | 42
607607 ++++++++++++++++++++++++++++++++++++++++++
608 src/devkit-power-source.h | 1 +
608 src/upower-source.h | 1 +
609609 2 files changed, 43 insertions(+), 0 deletions(-)
610610
611611 commit 2ed6ed80190a746f30c8b3fa08d3462b02669c5a
614614
615615 add a couple of sanity checks for the battery values
616616
617 src/devkit-power-source.c | 10 ++++++++++
617 src/upower-source.c | 10 ++++++++++
618618 1 files changed, 10 insertions(+), 0 deletions(-)
619619
620620 commit 32df1e0cc1ae92503902a1e329ed56952a942841
624624 add two bits of data that session applications really want --
625625 battery mode and low battery mode
626626
627 src/devkit-power-daemon.c | 46 ++++++++++++++++++++++
628 src/devkit-power-daemon.h | 4 ++
629 src/org.freedesktop.DeviceKit.Power.xml | 63
627 src/upower-daemon.c | 46 ++++++++++++++++++++++
628 src/upower-daemon.h | 4 ++
629 src/org.freedesktop.UPower.xml | 63
630630 +++++++++++++++++++++++++++++++
631631 3 files changed, 113 insertions(+), 0 deletions(-)
632632
636636
637637 add the Suspend() and Hibernate() stub methods
638638
639 src/devkit-power-daemon.c | 78
639 src/upower-daemon.c | 78
640640 +++++++++++++++++++++++++++++++
641 src/devkit-power-daemon.h | 4 ++
642 src/org.freedesktop.DeviceKit.Power.xml | 28 +++++++++++
641 src/upower-daemon.h | 4 ++
642 src/org.freedesktop.UPower.xml | 28 +++++++++++
643643 3 files changed, 110 insertions(+), 0 deletions(-)
644644
645645 commit 9ce7f3665be06b34e6a4cb9199050b98c731b0fc
648648
649649 if the battery goes away, properly clean up the cached values
650650
651 src/devkit-power-source.c | 7 +++++++
651 src/upower-source.c | 7 +++++++
652652 1 files changed, 7 insertions(+), 0 deletions(-)
653653
654654 commit a6f9b0fcb6043b0ad778f88e660694fbadefd81b
658658 using the technology as the coldplug indicator is a bad idea,
659659 properly flag this
660660
661 src/devkit-power-source.c | 86
661 src/upower-source.c | 86
662662 ++++++++++++++++++++++++++++++++------------
663663 1 files changed, 62 insertions(+), 24 deletions(-)
664664
669669 export battery-is-present as some batteries in laptops and UPSs can
670670 be removed
671671
672 src/devkit-power-source.c | 13 +++++++++++++
673 src/org.freedesktop.DeviceKit.Power.Source.xml | 12 ++++++++++++
672 src/upower-source.c | 13 +++++++++++++
673 src/org.freedesktop.UPower.Source.xml | 12 ++++++++++++
674674 2 files changed, 25 insertions(+), 0 deletions(-)
675675
676676 commit a1f9c0528097593c62822329ba1e66bf3a3f8d16
680680 export battery-is-rechargeable so we can export if we think it can
681681 be recharged
682682
683 src/devkit-power-source.c | 12 ++++++++++++
684 src/org.freedesktop.DeviceKit.Power.Source.xml | 10 ++++++++++
683 src/upower-source.c | 12 ++++++++++++
684 src/org.freedesktop.UPower.Source.xml | 10 ++++++++++
685685 2 files changed, 22 insertions(+), 0 deletions(-)
686686
687687 commit 4433bd3379bd4aa675ad2542bd64bbef2c5dc253
690690
691691 export battery-capacity as it's a useful property of a battery
692692
693 src/devkit-power-source.c | 9 +++++++++
694 src/org.freedesktop.DeviceKit.Power.Source.xml | 17 +++++++++++++++++
693 src/upower-source.c | 9 +++++++++
694 src/org.freedesktop.UPower.Source.xml | 17 +++++++++++++++++
695695 2 files changed, 26 insertions(+), 0 deletions(-)
696696
697697 commit ec658f5d29fef7ba592450703766b9f374dbe79f
700700
701701 battery-technology should be an enumerated type
702702
703 src/devkit-power-enum.c | 62
703 src/upower-enum.c | 62
704704 ++++++++++++++++++++++++
705 src/devkit-power-enum.h | 12 +++++
706 src/devkit-power-source.c | 10 ++--
707 src/org.freedesktop.DeviceKit.Power.Source.xml | 3 +-
705 src/upower-enum.h | 12 +++++
706 src/upower-source.c | 10 ++--
707 src/org.freedesktop.UPower.Source.xml | 3 +-
708708 4 files changed, 80 insertions(+), 7 deletions(-)
709709
710710 commit 2da987f9bca5479e352ac98bc73d5ebfe2c0e43d
713713
714714 add the battery state enumerated type property
715715
716 src/devkit-power-enum.c | 24
716 src/upower-enum.c | 24
717717 ++++++++++++++++++++++++
718 src/devkit-power-enum.h | 9 +++++++++
719 src/devkit-power-source.c | 23
718 src/upower-enum.h | 9 +++++++++
719 src/upower-source.c | 23
720720 ++++++++++++++++++++++-
721 src/org.freedesktop.DeviceKit.Power.Source.xml | 12 ++++++++++++
721 src/org.freedesktop.UPower.Source.xml | 12 ++++++++++++
722722 4 files changed, 67 insertions(+), 1 deletions(-)
723723
724724 commit f1c5630274195d4c613b95a49200ac48c3130f11
725725 Author: Richard Hughes <richard@hughsie.com>
726726 Date: Thu Jul 24 17:52:51 2008 +0100
727727
728 split out the enumerated stuff into devkit-power-enum.[c|h] as
728 split out the enumerated stuff into upower-enum.[c|h] as
729729 they'll be more soon
730730
731731 src/Makefile.am | 1 +
732 src/devkit-power-enum.c | 56
732 src/upower-enum.c | 56
733733 +++++++++++++++++++++++++++++++++++++++++++++
734 src/devkit-power-enum.h | 45 ++++++++++++++++++++++++++++++++++++
735 src/devkit-power-source.c | 24 ++++++++-----------
734 src/upower-enum.h | 45 ++++++++++++++++++++++++++++++++++++
735 src/upower-source.c | 24 ++++++++-----------
736736 4 files changed, 112 insertions(+), 14 deletions(-)
737737
738738 commit 8a04a2c3eda34f049a0d2190070c9c9e19ee46ec
742742 remove the battery-energy-empty-design parameter, it's never going
743743 to be anything other than zero
744744
745 src/devkit-power-source.c | 9 ---------
746 src/org.freedesktop.DeviceKit.Power.Source.xml | 11 -----------
745 src/upower-source.c | 9 ---------
746 src/org.freedesktop.UPower.Source.xml | 11 -----------
747747 2 files changed, 0 insertions(+), 20 deletions(-)
748748
749749 commit 4398839de1ecf4e88f425703c182444540a488c2
750750 Author: Richard Hughes <richard@hughsie.com>
751751 Date: Thu Jul 24 17:41:14 2008 +0100
752752
753 add the PolicyKit action org.freedesktop.devicekit.power.hibernate
754
755 policy/org.freedesktop.devicekit.power.policy.in | 14 ++++++++++++--
753 add the PolicyKit action org.freedesktop.upower.hibernate
754
755 policy/org.freedesktop.upower.policy.in | 14 ++++++++++++--
756756 1 files changed, 12 insertions(+), 2 deletions(-)
757757
758758 commit 058834be91645d445c1c785e3339fc383efba301
772772 fixup a few places where we mention a disk daemon to a power daemon
773773
774774 HACKING | 4 ++--
775 src/org.freedesktop.DeviceKit.Power.Source.xml | 2 +-
776 src/org.freedesktop.DeviceKit.Power.xml | 2 +-
777 tools/devkit-power.c | 2 +-
775 src/org.freedesktop.UPower.Source.xml | 2 +-
776 src/org.freedesktop.UPower.xml | 2 +-
777 tools/upower.c | 2 +-
778778 4 files changed, 5 insertions(+), 5 deletions(-)
779779
780780 commit 2a09a8062afc2a5947cb9ef5b0b1c2a57d1efdbb
792792
793793 forgot to add files
794794
795 src/org.freedesktop.DeviceKit.Power.conf.in | 11 +++++++++++
796 src/org.freedesktop.DeviceKit.Power.service.in | 5 +++++
795 src/org.freedesktop.UPower.conf.in | 11 +++++++++++
796 src/org.freedesktop.UPower.service.in | 5 +++++
797797 2 files changed, 16 insertions(+), 0 deletions(-)
798798
799799 commit 44d53913068e11cd3da871f4dc5285f6149b5b4f
827827 doc/dbus/dbus-introspect-docs.dtd | 32 ++
828828 doc/dbus/spec-to-docbook.xsl | 543
829829 +++++++++++++++++++
830 doc/devkit-power-docs.xml | 94 ++++
831 doc/man/DeviceKit-power.xml | 64 +++
830 doc/upower-docs.xml | 94 ++++
831 doc/man/UPower.xml | 64 +++
832832 doc/man/Makefile.am | 24 +
833 doc/man/devkit-power-daemon.xml | 84 +++
834 doc/man/devkit-power.xml | 99 ++++
833 doc/man/upower-daemon.xml | 84 +++
834 doc/man/upower.xml | 99 ++++
835835 doc/version.xml | 1 +
836836 gtk-doc.make | 159 ++++++
837837 mkinstalldirs | 111 ++++
838838 po/LINGUAS | 4 +
839839 po/POTFILES.in | 4 +
840840 policy/Makefile.am | 17 +
841 policy/org.freedesktop.devicekit.power.policy.in | 32 ++
841 policy/org.freedesktop.upower.policy.in | 32 ++
842842 src/Makefile.am | 82 +++
843 src/devkit-power-daemon.c | 631
843 src/upower-daemon.c | 631
844844 ++++++++++++++++++++++
845 src/devkit-power-daemon.h | 84 +++
846 src/devkit-power-device.c | 92 ++++
847 src/devkit-power-device.h | 68 +++
848 src/devkit-power-marshal.list | 2 +
849 src/devkit-power-source.c | 593
845 src/upower-daemon.h | 84 +++
846 src/upower-device.c | 92 ++++
847 src/upower-device.h | 68 +++
848 src/upower-marshal.list | 2 +
849 src/upower-source.c | 593
850850 ++++++++++++++++++++
851 src/devkit-power-source.h | 64 +++
851 src/upower-source.h | 64 +++
852852 src/main.c | 157 ++++++
853 src/org.freedesktop.DeviceKit.Power.Source.xml | 228 ++++++++
854 src/org.freedesktop.DeviceKit.Power.xml | 77 +++
853 src/org.freedesktop.UPower.Source.xml | 228 ++++++++
854 src/org.freedesktop.UPower.xml | 77 +++
855855 src/sysfs-utils.c | 203 +++++++
856856 src/sysfs-utils.h | 36 ++
857857 tools/Makefile.am | 49 ++
858 tools/devkit-power.c | 376 +++++++++++++
858 tools/upower.c | 376 +++++++++++++
859859 41 files changed, 4941 insertions(+), 0 deletions(-)
0 Version 013
1 ~~~~~~~~~~~
2 Released: 2009-12-07
3
4 Note:
5 - The DBus interface of DeviceKit-power may be subject to change in future
6 versions of this daemon.
7 - This will probably be the last release of DeviceKit-power as the project has
8 been renamed to upower.
9
10 New Features:
11 - When using devkit-power --monitor, print a timestamp before each message for
12 debugging. Fixes fd#24666 (Richard Hughes)
13
14 Bugfixes:
15 - Update the list of HID UPS (Arnaud Quette)
16 - Use a gdouble for percentage to fix on-battery reporting (Byron Clark)
17 - Bug 24262 – incorrect battery recall warning for Lenovo T61 (Martin Pitt)
18 - Fix the toshiba battery recal notices by matching up the double quotes (Richard Hughes)
19 - Avoid going from discharging to pending-discharge when the expansion battery
20 is very low (Richard Hughes)
21 - Some vendors fill the NVRAM full of junk. Don't crash the daemon if the
22 battery is broken. Fixes rh#533654 (Richard Hughes)
23 - When the internal battery is in the unknown state, we can't make a decision
24 whether the system is on battery power (Richard Hughes)
25 - Some batteries give out massive rate values when nearly empty (Richard Hughes)
26
027 Version 012
128 ~~~~~~~~~~~
229 Released: 2009-10-19
00 #! /bin/sh
11 # Guess values for system-dependent variables and create Makefiles.
2 # Generated by GNU Autoconf 2.63 for DeviceKit-power 012.
2 # Generated by GNU Autoconf 2.63 for DeviceKit-power 013.
33 #
44 # Report bugs to <http://lists.freedesktop.org/mailman/listinfo/devkit-devel>.
55 #
744744 # Identity of this package.
745745 PACKAGE_NAME='DeviceKit-power'
746746 PACKAGE_TARNAME='devicekit-power'
747 PACKAGE_VERSION='012'
748 PACKAGE_STRING='DeviceKit-power 012'
747 PACKAGE_VERSION='013'
748 PACKAGE_STRING='DeviceKit-power 013'
749749 PACKAGE_BUGREPORT='http://lists.freedesktop.org/mailman/listinfo/devkit-devel'
750750
751751 # Factoring default headers for most tests.
15691569 # Omit some internal or obsolete options to make the list less imposing.
15701570 # This message is too long to be a string in the A/UX 3.1 sh.
15711571 cat <<_ACEOF
1572 \`configure' configures DeviceKit-power 012 to adapt to many kinds of systems.
1572 \`configure' configures DeviceKit-power 013 to adapt to many kinds of systems.
15731573
15741574 Usage: $0 [OPTION]... [VAR=VALUE]...
15751575
16391639
16401640 if test -n "$ac_init_help"; then
16411641 case $ac_init_help in
1642 short | recursive ) echo "Configuration of DeviceKit-power 012:";;
1642 short | recursive ) echo "Configuration of DeviceKit-power 013:";;
16431643 esac
16441644 cat <<\_ACEOF
16451645
17691769 test -n "$ac_init_help" && exit $ac_status
17701770 if $ac_init_version; then
17711771 cat <<\_ACEOF
1772 DeviceKit-power configure 012
1772 DeviceKit-power configure 013
17731773 generated by GNU Autoconf 2.63
17741774
17751775 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
17831783 This file contains any messages produced by compilers while
17841784 running configure, to aid debugging if configure makes a mistake.
17851785
1786 It was created by DeviceKit-power $as_me 012, which was
1786 It was created by DeviceKit-power $as_me 013, which was
17871787 generated by GNU Autoconf 2.63. Invocation command line was
17881788
17891789 $ $0 $@
26322632
26332633 # Define the identity of the package.
26342634 PACKAGE=DeviceKit-power
2635 VERSION=012
2635 VERSION=013
26362636
26372637
26382638 cat >>confdefs.h <<_ACEOF
1762717627 # report actual input values of CONFIG_FILES etc. instead of their
1762817628 # values after options handling.
1762917629 ac_log="
17630 This file was extended by DeviceKit-power $as_me 012, which was
17630 This file was extended by DeviceKit-power $as_me 013, which was
1763117631 generated by GNU Autoconf 2.63. Invocation command line was
1763217632
1763317633 CONFIG_FILES = $CONFIG_FILES
1769017690 _ACEOF
1769117691 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
1769217692 ac_cs_version="\\
17693 DeviceKit-power config.status 012
17693 DeviceKit-power config.status 013
1769417694 configured by $0, generated by GNU Autoconf 2.63,
1769517695 with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
1769617696
00 dnl Process this file with autoconf to produce a configure script.
11
22 AC_PREREQ(2.59c)
3 AC_INIT(DeviceKit-power, 012, http://lists.freedesktop.org/mailman/listinfo/devkit-devel)
4 AM_INIT_AUTOMAKE(DeviceKit-power, 012)
3 AC_INIT(DeviceKit-power, 013, http://lists.freedesktop.org/mailman/listinfo/devkit-devel)
4 AM_INIT_AUTOMAKE(DeviceKit-power, 013)
55 AM_CONFIG_HEADER(config.h)
66 AM_MAINTAINER_MODE
77
2727
2828 /* compile time version
2929 */
30 #define DKP_COMPILE_VERSION (0x012)
30 #define DKP_COMPILE_VERSION (0x013)
3131
3232 /* check whether a the version is above the compile time version.
3333 */
5656 </pre>
5757 </div>
5858 <div class="refsect1" title="Signals">
59 <a name="id2923551"></a><h2>Signals</h2>
59 <a name="id2853086"></a><h2>Signals</h2>
6060 <pre class="synopsis"><a class="link" href="Device.html#Device::Changed">Changed</a> ()
6161 </pre>
6262 </div>
6363 <div class="refsect1" title="Implemented Interfaces">
64 <a name="id2935406"></a><h2>Implemented Interfaces</h2>
64 <a name="id2825516"></a><h2>Implemented Interfaces</h2>
6565 <p>
6666 Objects implementing org.freedesktop.DeviceKit.Power.Device also implements
6767 org.freedesktop.DBus.Introspectable,
6969 </p>
7070 </div>
7171 <div class="refsect1" title="Properties">
72 <a name="id2934950"></a><h2>Properties</h2>
72 <a name="id2852823"></a><h2>Properties</h2>
7373 <pre class="synopsis"><a class="link" href="Device.html#Device:NativePath">'NativePath'</a> read 's'
7474 <a class="link" href="Device.html#Device:Vendor">'Vendor'</a> read 's'
7575 <a class="link" href="Device.html#Device:Model">'Model'</a> read 's'
100100 </pre>
101101 </div>
102102 <div class="refsect1" title="Description">
103 <a name="id2863647"></a><h2>Description</h2>
103 <a name="id2769235"></a><h2>Description</h2>
104104 <p>
105105
106106 </p>
239239 </p>
240240 </div>
241241 <div class="refsect1" title="Details">
242 <a name="id2863764"></a><h2>Details</h2>
242 <a name="id2769349"></a><h2>Details</h2>
243243 <div class="refsect2" title="Refresh ()">
244 <a name="id2863772"></a><h3>
244 <a name="id2769357"></a><h3>
245245 <a name="Device.Refresh"></a>Refresh ()</h3>
246246 <pre class="programlisting">Refresh ()</pre>
247247 </div>
253253 <tbody></tbody>
254254 </table></div>
255255 <div class="refsect3" title="Errors">
256 <a name="id2939450"></a><h4>Errors</h4>
256 <a name="id2845028"></a><h4>Errors</h4>
257257 <div class="variablelist"><table border="0">
258258 <col align="left" valign="top">
259259 <tbody><tr>
263263 </table></div>
264264 </div>
265265 <div class="refsect3" title="Permissions">
266 <a name="id2939468"></a><h4>Permissions</h4>
266 <a name="id2845047"></a><h4>Permissions</h4>
267267 <p class="permission">Callers need the org.freedesktop.devicekit.power.refresh-power-source authorization</p>
268268 </div>
269269 <hr>
270270 <div class="refsect2" title="GetHistory ()">
271 <a name="id2939478"></a><h3>
271 <a name="id2845057"></a><h3>
272272 <a name="Device.GetHistory"></a>GetHistory ()</h3>
273273 <pre class="programlisting">GetHistory (in 's' type,
274274 in 'u' timespan,
324324 </table></div>
325325 <hr>
326326 <div class="refsect2" title="GetStatistics ()">
327 <a name="id2939624"></a><h3>
327 <a name="id2845203"></a><h3>
328328 <a name="Device.GetStatistics"></a>GetStatistics ()</h3>
329329 <pre class="programlisting">GetStatistics (in 's' type,
330330 out 'a(dd)' data)</pre>
362362 </table></div>
363363 </div>
364364 <div class="refsect1" title="Signal Details">
365 <a name="id2928909"></a><h2>Signal Details</h2>
365 <a name="id2853884"></a><h2>Signal Details</h2>
366366 <div class="refsect2" title="The Changed signal">
367 <a name="id2928917"></a><h3>
367 <a name="id2853893"></a><h3>
368368 <a name="Device::Changed"></a>The Changed signal</h3>
369369 <pre class="programlisting">Changed ()</pre>
370370 </div>
377377 </table></div>
378378 </div>
379379 <div class="refsect1" title="Property Details">
380 <a name="id2928950"></a><h2>Property Details</h2>
380 <a name="id2853926"></a><h2>Property Details</h2>
381381 <div class="refsect2" title='The "NativePath" property'>
382 <a name="id2928958"></a><h3>
382 <a name="id2853934"></a><h3>
383383 <a name="Device:NativePath"></a>The "NativePath" property</h3>
384384 <pre class="programlisting">'NativePath' read 's'
385385 </pre>
397397 </table></div>
398398 <hr>
399399 <div class="refsect2" title='The "Vendor" property'>
400 <a name="id2929000"></a><h3>
400 <a name="id2853976"></a><h3>
401401 <a name="Device:Vendor"></a>The "Vendor" property</h3>
402402 <pre class="programlisting">'Vendor' read 's'
403403 </pre>
411411 </table></div>
412412 <hr>
413413 <div class="refsect2" title='The "Model" property'>
414 <a name="id2929031"></a><h3>
414 <a name="id2854007"></a><h3>
415415 <a name="Device:Model"></a>The "Model" property</h3>
416416 <pre class="programlisting">'Model' read 's'
417417 </pre>
425425 </table></div>
426426 <hr>
427427 <div class="refsect2" title='The "Serial" property'>
428 <a name="id2929062"></a><h3>
428 <a name="id2854038"></a><h3>
429429 <a name="Device:Serial"></a>The "Serial" property</h3>
430430 <pre class="programlisting">'Serial' read 's'
431431 </pre>
439439 </table></div>
440440 <hr>
441441 <div class="refsect2" title='The "UpdateTime" property'>
442 <a name="id2929093"></a><h3>
442 <a name="id2854069"></a><h3>
443443 <a name="Device:UpdateTime"></a>The "UpdateTime" property</h3>
444444 <pre class="programlisting">'UpdateTime' read 't'
445445 </pre>
454454 </table></div>
455455 <hr>
456456 <div class="refsect2" title='The "Type" property'>
457 <a name="id2929127"></a><h3>
457 <a name="id2854103"></a><h3>
458458 <a name="Device:Type"></a>The "Type" property</h3>
459459 <pre class="programlisting">'Type' read 'u'
460460 </pre>
488488 </table></div>
489489 <hr>
490490 <div class="refsect2" title='The "PowerSupply" property'>
491 <a name="id2929225"></a><h3>
491 <a name="id2854201"></a><h3>
492492 <a name="Device:PowerSupply"></a>The "PowerSupply" property</h3>
493493 <pre class="programlisting">'PowerSupply' read 'b'
494494 </pre>
504504 </table></div>
505505 <hr>
506506 <div class="refsect2" title='The "HasHistory" property'>
507 <a name="id2929259"></a><h3>
507 <a name="id2854235"></a><h3>
508508 <a name="Device:HasHistory"></a>The "HasHistory" property</h3>
509509 <pre class="programlisting">'HasHistory' read 'b'
510510 </pre>
518518 </table></div>
519519 <hr>
520520 <div class="refsect2" title='The "HasStatistics" property'>
521 <a name="id2929291"></a><h3>
521 <a name="id2854267"></a><h3>
522522 <a name="Device:HasStatistics"></a>The "HasStatistics" property</h3>
523523 <pre class="programlisting">'HasStatistics' read 'b'
524524 </pre>
532532 </table></div>
533533 <hr>
534534 <div class="refsect2" title='The "Online" property'>
535 <a name="id2929323"></a><h3>
535 <a name="id2854299"></a><h3>
536536 <a name="Device:Online"></a>The "Online" property</h3>
537537 <pre class="programlisting">'Online' read 'b'
538538 </pre>
549549 </table></div>
550550 <hr>
551551 <div class="refsect2" title='The "Energy" property'>
552 <a name="id2929366"></a><h3>
552 <a name="id2854342"></a><h3>
553553 <a name="Device:Energy"></a>The "Energy" property</h3>
554554 <pre class="programlisting">'Energy' read 'd'
555555 </pre>
569569 </table></div>
570570 <hr>
571571 <div class="refsect2" title='The "EnergyEmpty" property'>
572 <a name="id2929411"></a><h3>
572 <a name="id2854387"></a><h3>
573573 <a name="Device:EnergyEmpty"></a>The "EnergyEmpty" property</h3>
574574 <pre class="programlisting">'EnergyEmpty' read 'd'
575575 </pre>
589589 </table></div>
590590 <hr>
591591 <div class="refsect2" title='The "EnergyFull" property'>
592 <a name="id2929458"></a><h3>
592 <a name="id2854434"></a><h3>
593593 <a name="Device:EnergyFull"></a>The "EnergyFull" property</h3>
594594 <pre class="programlisting">'EnergyFull' read 'd'
595595 </pre>
609609 </table></div>
610610 <hr>
611611 <div class="refsect2" title='The "EnergyFullDesign" property'>
612 <a name="id2929504"></a><h3>
612 <a name="id2854480"></a><h3>
613613 <a name="Device:EnergyFullDesign"></a>The "EnergyFullDesign" property</h3>
614614 <pre class="programlisting">'EnergyFullDesign' read 'd'
615615 </pre>
629629 </table></div>
630630 <hr>
631631 <div class="refsect2" title='The "EnergyRate" property'>
632 <a name="id2929551"></a><h3>
632 <a name="id2854527"></a><h3>
633633 <a name="Device:EnergyRate"></a>The "EnergyRate" property</h3>
634634 <pre class="programlisting">'EnergyRate' read 'd'
635635 </pre>
650650 </table></div>
651651 <hr>
652652 <div class="refsect2" title='The "Voltage" property'>
653 <a name="id2929598"></a><h3>
653 <a name="id2854574"></a><h3>
654654 <a name="Device:Voltage"></a>The "Voltage" property</h3>
655655 <pre class="programlisting">'Voltage' read 'd'
656656 </pre>
664664 </table></div>
665665 <hr>
666666 <div class="refsect2" title='The "TimeToEmpty" property'>
667 <a name="id2929630"></a><h3>
667 <a name="id2854606"></a><h3>
668668 <a name="Device:TimeToEmpty"></a>The "TimeToEmpty" property</h3>
669669 <pre class="programlisting">'TimeToEmpty' read 'x'
670670 </pre>
684684 </table></div>
685685 <hr>
686686 <div class="refsect2" title='The "TimeToFull" property'>
687 <a name="id2929676"></a><h3>
687 <a name="id2854652"></a><h3>
688688 <a name="Device:TimeToFull"></a>The "TimeToFull" property</h3>
689689 <pre class="programlisting">'TimeToFull' read 'x'
690690 </pre>
704704 </table></div>
705705 <hr>
706706 <div class="refsect2" title='The "Percentage" property'>
707 <a name="id2929722"></a><h3>
707 <a name="id2854698"></a><h3>
708708 <a name="Device:Percentage"></a>The "Percentage" property</h3>
709709 <pre class="programlisting">'Percentage' read 'd'
710710 </pre>
731731 </table></div>
732732 <hr>
733733 <div class="refsect2" title='The "IsPresent" property'>
734 <a name="id2929812"></a><h3>
734 <a name="id2854787"></a><h3>
735735 <a name="Device:IsPresent"></a>The "IsPresent" property</h3>
736736 <pre class="programlisting">'IsPresent' read 'b'
737737 </pre>
752752 </table></div>
753753 <hr>
754754 <div class="refsect2" title='The "State" property'>
755 <a name="id2929859"></a><h3>
755 <a name="id2854834"></a><h3>
756756 <a name="Device:State"></a>The "State" property</h3>
757757 <pre class="programlisting">'State' read 'u'
758758 </pre>
787787 </table></div>
788788 <hr>
789789 <div class="refsect2" title='The "IsRechargeable" property'>
790 <a name="id2929958"></a><h3>
790 <a name="id2854934"></a><h3>
791791 <a name="Device:IsRechargeable"></a>The "IsRechargeable" property</h3>
792792 <pre class="programlisting">'IsRechargeable' read 'b'
793793 </pre>
806806 </table></div>
807807 <hr>
808808 <div class="refsect2" title='The "Capacity" property'>
809 <a name="id2930003"></a><h3>
809 <a name="id2854979"></a><h3>
810810 <a name="Device:Capacity"></a>The "Capacity" property</h3>
811811 <pre class="programlisting">'Capacity' read 'd'
812812 </pre>
832832 </table></div>
833833 <hr>
834834 <div class="refsect2" title='The "Technology" property'>
835 <a name="id2930074"></a><h3>
835 <a name="id2855050"></a><h3>
836836 <a name="Device:Technology"></a>The "Technology" property</h3>
837837 <pre class="programlisting">'Technology' read 'u'
838838 </pre>
867867 </table></div>
868868 <hr>
869869 <div class="refsect2" title='The "RecallNotice" property'>
870 <a name="id2930173"></a><h3>
870 <a name="id2855149"></a><h3>
871871 <a name="Device:RecallNotice"></a>The "RecallNotice" property</h3>
872872 <pre class="programlisting">'RecallNotice' read 'b'
873873 </pre>
884884 </table></div>
885885 <hr>
886886 <div class="refsect2" title='The "RecallVendor" property'>
887 <a name="id2930209"></a><h3>
887 <a name="id2855185"></a><h3>
888888 <a name="Device:RecallVendor"></a>The "RecallVendor" property</h3>
889889 <pre class="programlisting">'RecallVendor' read 's'
890890 </pre>
901901 </table></div>
902902 <hr>
903903 <div class="refsect2" title='The "RecallUrl" property'>
904 <a name="id2930246"></a><h3>
904 <a name="id2855222"></a><h3>
905905 <a name="Device:RecallUrl"></a>The "RecallUrl" property</h3>
906906 <pre class="programlisting">'RecallUrl' read 's'
907907 </pre>
3232 <td valign="top" align="right"></td>
3333 </tr></table></div>
3434 <div class="refsect1" title="DESCRIPTION">
35 <a name="id2919916"></a><h2>DESCRIPTION</h2>
35 <a name="id2848292"></a><h2>DESCRIPTION</h2>
3636 <p>
3737 DeviceKit-power provides an interface to enumerate power sources
3838 on the system and control system-wide power management. Any
4343 </p>
4444 </div>
4545 <div class="refsect1" title="AUTHOR">
46 <a name="id2943831"></a><h2>AUTHOR</h2>
46 <a name="id2823404"></a><h2>AUTHOR</h2>
4747 <p>
4848 Written by David Zeuthen <code class="email">&lt;<a class="email" href="mailto:davidz@redhat.com">davidz@redhat.com</a>&gt;</code> with
4949 a lot of help from many others.
5050 </p>
5151 </div>
5252 <div class="refsect1" title="BUGS">
53 <a name="id2934622"></a><h2>BUGS</h2>
53 <a name="id2848309"></a><h2>BUGS</h2>
5454 <p>
5555 Please send bug reports to either the distribution or the
5656 DeviceKit mailing list,
5959 </p>
6060 </div>
6161 <div class="refsect1" title="SEE ALSO">
62 <a name="id2943821"></a><h2>SEE ALSO</h2>
62 <a name="id2843549"></a><h2>SEE ALSO</h2>
6363 <p>
6464 <span class="citerefentry"><span class="refentrytitle">DeviceKit</span>(7)</span>,
6565 <span class="citerefentry"><span class="refentrytitle">PolicyKit</span>(8)</span>,
5252 </pre>
5353 </div>
5454 <div class="refsect1" title="Signals">
55 <a name="id2939896"></a><h2>Signals</h2>
55 <a name="id2849482"></a><h2>Signals</h2>
5656 <pre class="synopsis"><a class="link" href="Power.html#Power::DeviceAdded">DeviceAdded</a> ('o' device)
5757 <a class="link" href="Power.html#Power::DeviceRemoved">DeviceRemoved</a> ('o' device)
5858 <a class="link" href="Power.html#Power::DeviceChanged">DeviceChanged</a> ('o' device)
6060 </pre>
6161 </div>
6262 <div class="refsect1" title="Implemented Interfaces">
63 <a name="id2925535"></a><h2>Implemented Interfaces</h2>
63 <a name="id2831112"></a><h2>Implemented Interfaces</h2>
6464 <p>
6565 Objects implementing org.freedesktop.DeviceKit.Power also implements
6666 org.freedesktop.DBus.Introspectable,
6868 </p>
6969 </div>
7070 <div class="refsect1" title="Properties">
71 <a name="id2862784"></a><h2>Properties</h2>
71 <a name="id2768495"></a><h2>Properties</h2>
7272 <pre class="synopsis"><a class="link" href="Power.html#Power:DaemonVersion">'DaemonVersion'</a> read 's'
7373 <a class="link" href="Power.html#Power:CanSuspend">'CanSuspend'</a> read 'b'
7474 <a class="link" href="Power.html#Power:CanHibernate">'CanHibernate'</a> read 'b'
7979 </pre>
8080 </div>
8181 <div class="refsect1" title="Description">
82 <a name="id2864618"></a><h2>Description</h2>
82 <a name="id2770204"></a><h2>Description</h2>
8383 <p>
8484
8585 </p>
115115 </p>
116116 </div>
117117 <div class="refsect1" title="Details">
118 <a name="id2864680"></a><h2>Details</h2>
118 <a name="id2770268"></a><h2>Details</h2>
119119 <div class="refsect2" title="EnumerateDevices ()">
120 <a name="id2864688"></a><h3>
120 <a name="id2770276"></a><h3>
121121 <a name="Power.EnumerateDevices"></a>EnumerateDevices ()</h3>
122122 <pre class="programlisting">EnumerateDevices (out 'ao' devices)</pre>
123123 </div>
133133 </table></div>
134134 <hr>
135135 <div class="refsect2" title="Suspend ()">
136 <a name="id2863516"></a><h3>
136 <a name="id2769095"></a><h3>
137137 <a name="Power.Suspend"></a>Suspend ()</h3>
138138 <pre class="programlisting">Suspend ()</pre>
139139 </div>
147147 </table></div>
148148 <hr>
149149 <div class="refsect2" title="Hibernate ()">
150 <a name="id2863549"></a><h3>
150 <a name="id2769128"></a><h3>
151151 <a name="Power.Hibernate"></a>Hibernate ()</h3>
152152 <pre class="programlisting">Hibernate ()</pre>
153153 </div>
161161 </table></div>
162162 </div>
163163 <div class="refsect1" title="Signal Details">
164 <a name="id2863584"></a><h2>Signal Details</h2>
164 <a name="id2769163"></a><h2>Signal Details</h2>
165165 <div class="refsect2" title="The DeviceAdded signal">
166 <a name="id2863592"></a><h3>
166 <a name="id2769171"></a><h3>
167167 <a name="Power::DeviceAdded"></a>The DeviceAdded signal</h3>
168168 <pre class="programlisting">DeviceAdded ('o' device)</pre>
169169 </div>
179179 </table></div>
180180 <hr>
181181 <div class="refsect2" title="The DeviceRemoved signal">
182 <a name="id2863634"></a><h3>
182 <a name="id2769214"></a><h3>
183183 <a name="Power::DeviceRemoved"></a>The DeviceRemoved signal</h3>
184184 <pre class="programlisting">DeviceRemoved ('o' device)</pre>
185185 </div>
195195 </table></div>
196196 <hr>
197197 <div class="refsect2" title="The DeviceChanged signal">
198 <a name="id2864314"></a><h3>
198 <a name="id2769892"></a><h3>
199199 <a name="Power::DeviceChanged"></a>The DeviceChanged signal</h3>
200200 <pre class="programlisting">DeviceChanged ('o' device)</pre>
201201 </div>
211211 </table></div>
212212 <hr>
213213 <div class="refsect2" title="The Changed signal">
214 <a name="id2864356"></a><h3>
214 <a name="id2769934"></a><h3>
215215 <a name="Power::Changed"></a>The Changed signal</h3>
216216 <pre class="programlisting">Changed ()</pre>
217217 </div>
224224 </table></div>
225225 </div>
226226 <div class="refsect1" title="Property Details">
227 <a name="id2864389"></a><h2>Property Details</h2>
227 <a name="id2769967"></a><h2>Property Details</h2>
228228 <div class="refsect2" title='The "DaemonVersion" property'>
229 <a name="id2864397"></a><h3>
229 <a name="id2769975"></a><h3>
230230 <a name="Power:DaemonVersion"></a>The "DaemonVersion" property</h3>
231231 <pre class="programlisting">'DaemonVersion' read 's'
232232 </pre>
240240 </table></div>
241241 <hr>
242242 <div class="refsect2" title='The "CanSuspend" property'>
243 <a name="id2868893"></a><h3>
243 <a name="id2770010"></a><h3>
244244 <a name="Power:CanSuspend"></a>The "CanSuspend" property</h3>
245245 <pre class="programlisting">'CanSuspend' read 'b'
246246 </pre>
254254 </table></div>
255255 <hr>
256256 <div class="refsect2" title='The "CanHibernate" property'>
257 <a name="id2868922"></a><h3>
257 <a name="id2774498"></a><h3>
258258 <a name="Power:CanHibernate"></a>The "CanHibernate" property</h3>
259259 <pre class="programlisting">'CanHibernate' read 'b'
260260 </pre>
268268 </table></div>
269269 <hr>
270270 <div class="refsect2" title='The "OnBattery" property'>
271 <a name="id2868952"></a><h3>
271 <a name="id2774528"></a><h3>
272272 <a name="Power:OnBattery"></a>The "OnBattery" property</h3>
273273 <pre class="programlisting">'OnBattery' read 'b'
274274 </pre>
283283 </table></div>
284284 <hr>
285285 <div class="refsect2" title='The "OnLowBattery" property'>
286 <a name="id2868982"></a><h3>
286 <a name="id2774558"></a><h3>
287287 <a name="Power:OnLowBattery"></a>The "OnLowBattery" property</h3>
288288 <pre class="programlisting">'OnLowBattery' read 'b'
289289 </pre>
298298 </table></div>
299299 <hr>
300300 <div class="refsect2" title='The "LidIsClosed" property'>
301 <a name="id2869013"></a><h3>
301 <a name="id2774589"></a><h3>
302302 <a name="Power:LidIsClosed"></a>The "LidIsClosed" property</h3>
303303 <pre class="programlisting">'LidIsClosed' read 'b'
304304 </pre>
312312 </table></div>
313313 <hr>
314314 <div class="refsect2" title='The "LidIsPresent" property'>
315 <a name="id2869045"></a><h3>
315 <a name="id2774622"></a><h3>
316316 <a name="Power:LidIsPresent"></a>The "LidIsPresent" property</h3>
317317 <pre class="programlisting">'LidIsPresent' read 'b'
318318 </pre>
5858 </pre>
5959 </div>
6060 <div class="refsect1" title="Signals">
61 <a name="id2889113"></a><h2>Signals</h2>
61 <a name="id2844816"></a><h2>Signals</h2>
6262 <pre class="synopsis"><a class="link" href="QoS.html#QoS::LatencyChanged">LatencyChanged</a> ('s' type,
6363 'i' value)
6464 <a class="link" href="QoS.html#QoS::RequestsChanged">RequestsChanged</a> ()
6565 </pre>
6666 </div>
6767 <div class="refsect1" title="Implemented Interfaces">
68 <a name="id2926826"></a><h2>Implemented Interfaces</h2>
68 <a name="id2857025"></a><h2>Implemented Interfaces</h2>
6969 <p>
7070 Objects implementing org.freedesktop.DeviceKit.Power.QoS also implements
7171 org.freedesktop.DBus.Introspectable,
7373 </p>
7474 </div>
7575 <div class="refsect1" title="Description">
76 <a name="id2936335"></a><h2>Description</h2>
76 <a name="id2834519"></a><h2>Description</h2>
7777 <p>
7878
7979 </p>
160160 </p>
161161 </div>
162162 <div class="refsect1" title="Details">
163 <a name="id2952378"></a><h2>Details</h2>
163 <a name="id2825222"></a><h2>Details</h2>
164164 <div class="refsect2" title="SetMinimumLatency ()">
165 <a name="id2952386"></a><h3>
165 <a name="id2825230"></a><h3>
166166 <a name="QoS.SetMinimumLatency"></a>SetMinimumLatency ()</h3>
167167 <pre class="programlisting">SetMinimumLatency (in 's' type,
168168 in 'i' value)</pre>
196196 </tbody>
197197 </table></div>
198198 <div class="refsect3" title="Errors">
199 <a name="id2925026"></a><h4>Errors</h4>
199 <a name="id2839689"></a><h4>Errors</h4>
200200 <div class="variablelist"><table border="0">
201201 <col align="left" valign="top">
202202 <tbody><tr>
206206 </table></div>
207207 </div>
208208 <div class="refsect3" title="Permissions">
209 <a name="id2925046"></a><h4>Permissions</h4>
209 <a name="id2839708"></a><h4>Permissions</h4>
210210 <p class="permission">Callers need the <code class="literal">org.freedesktop.devicekit.power.qos.set-minimum-latency</code> authorization</p>
211211 </div>
212212 <hr>
213213 <div class="refsect2" title="RequestLatency ()">
214 <a name="id2925061"></a><h3>
214 <a name="id2839724"></a><h3>
215215 <a name="QoS.RequestLatency"></a>RequestLatency ()</h3>
216216 <pre class="programlisting">RequestLatency (in 's' type,
217217 in 'i' value,
259259 </tbody>
260260 </table></div>
261261 <div class="refsect3" title="Errors">
262 <a name="id2922914"></a><h4>Errors</h4>
262 <a name="id2821004"></a><h4>Errors</h4>
263263 <div class="variablelist"><table border="0">
264264 <col align="left" valign="top">
265265 <tbody><tr>
269269 </table></div>
270270 </div>
271271 <div class="refsect3" title="Permissions">
272 <a name="id2922933"></a><h4>Permissions</h4>
272 <a name="id2821023"></a><h4>Permissions</h4>
273273 <p class="permission">
274274 Callers need the
275275 <code class="literal">org.freedesktop.devicekit.power.qos.request-latency-persistent</code>
279279 </div>
280280 <hr>
281281 <div class="refsect2" title="CancelRequest ()">
282 <a name="id2922961"></a><h3>
282 <a name="id2821050"></a><h3>
283283 <a name="QoS.CancelRequest"></a>CancelRequest ()</h3>
284284 <pre class="programlisting">CancelRequest (in 's' type,
285285 in 'u' cookie)</pre>
307307 </tbody>
308308 </table></div>
309309 <div class="refsect3" title="Errors">
310 <a name="id2923033"></a><h4>Errors</h4>
310 <a name="id2821122"></a><h4>Errors</h4>
311311 <div class="variablelist"><table border="0">
312312 <col align="left" valign="top">
313313 <tbody><tr>
317317 </table></div>
318318 </div>
319319 <div class="refsect3" title="Permissions">
320 <a name="id2923052"></a><h4>Permissions</h4>
320 <a name="id2821142"></a><h4>Permissions</h4>
321321 <p class="permission">
322322 Callers need the
323323 <code class="literal">org.freedesktop.devicekit.power.qos.cancel-request</code>
326326 </div>
327327 <hr>
328328 <div class="refsect2" title="GetLatency ()">
329 <a name="id2923068"></a><h3>
329 <a name="id2821157"></a><h3>
330330 <a name="QoS.GetLatency"></a>GetLatency ()</h3>
331331 <pre class="programlisting">GetLatency (in 's' type,
332332 out 'i' value)</pre>
354354 </tbody>
355355 </table></div>
356356 <div class="refsect3" title="Errors">
357 <a name="id2923145"></a><h4>Errors</h4>
357 <a name="id2821234"></a><h4>Errors</h4>
358358 <div class="variablelist"><table border="0">
359359 <col align="left" valign="top">
360360 <tbody><tr>
365365 </div>
366366 <hr>
367367 <div class="refsect2" title="GetLatencyRequests ()">
368 <a name="id2954417"></a><h3>
368 <a name="id2859593"></a><h3>
369369 <a name="QoS.GetLatencyRequests"></a>GetLatencyRequests ()</h3>
370370 <pre class="programlisting">GetLatencyRequests (out 'a(uuusxbssi)' requests)</pre>
371371 </div>
419419 </table></div>
420420 </div>
421421 <div class="refsect1" title="Signal Details">
422 <a name="id2954545"></a><h2>Signal Details</h2>
422 <a name="id2859721"></a><h2>Signal Details</h2>
423423 <div class="refsect2" title="The LatencyChanged signal">
424 <a name="id2954553"></a><h3>
424 <a name="id2859729"></a><h3>
425425 <a name="QoS::LatencyChanged"></a>The LatencyChanged signal</h3>
426426 <pre class="programlisting">LatencyChanged ('s' type,
427427 'i' value)</pre>
450450 </table></div>
451451 <hr>
452452 <div class="refsect2" title="The RequestsChanged signal">
453 <a name="id2954612"></a><h3>
453 <a name="id2859788"></a><h3>
454454 <a name="QoS::RequestsChanged"></a>The RequestsChanged signal</h3>
455455 <pre class="programlisting">RequestsChanged ()</pre>
456456 </div>
3636 <div class="cmdsynopsis"><p><code class="command">devkit-power-daemon</code> [<code class="option">--help</code>]</p></div>
3737 </div>
3838 <div class="refsect1" title="DESCRIPTION">
39 <a name="id2862842"></a><h2>DESCRIPTION</h2>
39 <a name="id2827438"></a><h2>DESCRIPTION</h2>
4040 <p>
4141 <span class="emphasis"><em><span class="refentrytitle">devkit-power-daemon</span></em></span> provides
4242 the <span class="emphasis"><em>org.freedesktop.DeviceKit.Power</em></span> service on the
4848 </p>
4949 </div>
5050 <div class="refsect1" title="OPTIONS">
51 <a name="id2918802"></a><h2>OPTIONS</h2>
51 <a name="id2839175"></a><h2>OPTIONS</h2>
5252 <div class="variablelist"><table border="0">
5353 <col align="left" valign="top">
5454 <tbody><tr>
6060 </table></div>
6161 </div>
6262 <div class="refsect1" title="AUTHOR">
63 <a name="id2936214"></a><h2>AUTHOR</h2>
63 <a name="id2827104"></a><h2>AUTHOR</h2>
6464 <p>
6565 Written by David Zeuthen <code class="email">&lt;<a class="email" href="mailto:davidz@redhat.com">davidz@redhat.com</a>&gt;</code> with
6666 a lot of help from many others.
6767 </p>
6868 </div>
6969 <div class="refsect1" title="BUGS">
70 <a name="id2932822"></a><h2>BUGS</h2>
70 <a name="id2842988"></a><h2>BUGS</h2>
7171 <p>
7272 Please send bug reports to either the distribution or the
7373 DeviceKit mailing list,
7676 </p>
7777 </div>
7878 <div class="refsect1" title="SEE ALSO">
79 <a name="id2944274"></a><h2>SEE ALSO</h2>
79 <a name="id2824365"></a><h2>SEE ALSO</h2>
8080 <p>
8181 <span class="citerefentry"><span class="refentrytitle">DeviceKit-power</span>(7)</span>,
8282 <span class="citerefentry"><span class="refentrytitle">devkit-power</span>(1)</span>,
3636 <div class="cmdsynopsis"><p><code class="command">devkit-power</code> [<code class="option">--enumerate</code>] [<code class="option">--monitor</code>] [<code class="option">--monitor-detail</code>] [<code class="option">--help</code>]</p></div>
3737 </div>
3838 <div class="refsect1" title="DESCRIPTION">
39 <a name="id2942485"></a><h2>DESCRIPTION</h2>
39 <a name="id2851374"></a><h2>DESCRIPTION</h2>
4040 <p>
4141 <span class="emphasis"><em><span class="refentrytitle">devkit-power</span></em></span> is a
4242 simple command line client for the
4545 </p>
4646 </div>
4747 <div class="refsect1" title="OPTIONS">
48 <a name="id2943809"></a><h2>OPTIONS</h2>
48 <a name="id2842965"></a><h2>OPTIONS</h2>
4949 <div class="variablelist"><table border="0">
5050 <col align="left" valign="top">
5151 <tbody>
7373 </table></div>
7474 </div>
7575 <div class="refsect1" title="AUTHOR">
76 <a name="id2937429"></a><h2>AUTHOR</h2>
76 <a name="id2843456"></a><h2>AUTHOR</h2>
7777 <p>
7878 Written by David Zeuthen <code class="email">&lt;<a class="email" href="mailto:davidz@redhat.com">davidz@redhat.com</a>&gt;</code> with
7979 a lot of help from many others.
8080 </p>
8181 </div>
8282 <div class="refsect1" title="BUGS">
83 <a name="id2937883"></a><h2>BUGS</h2>
83 <a name="id2833801"></a><h2>BUGS</h2>
8484 <p>
8585 Please send bug reports to either the distribution or the
8686 DeviceKit mailing list,
8989 </p>
9090 </div>
9191 <div class="refsect1" title="SEE ALSO">
92 <a name="id2928232"></a><h2>SEE ALSO</h2>
92 <a name="id2825523"></a><h2>SEE ALSO</h2>
9393 <p>
9494 <span class="citerefentry"><span class="refentrytitle">devkit-power-daemon</span>(8)</span>,
9595 <span class="citerefentry"><span class="refentrytitle">DeviceKit-power</span>(7)</span>,
2525     <code class="email">&lt;<a class="email" href="mailto:davidz@redhat.com">davidz@redhat.com</a>&gt;</code><br>
2626   </p></div></div>
2727 </div></div></div>
28 <div><p class="releaseinfo">Version 012
28 <div><p class="releaseinfo">Version 013
2929 </p></div>
3030 <div><p class="copyright">Copyright © 2008 The DeviceKit-power Authors</p></div>
3131 <div><div class="legalnotice" title="Legal Notice">
32 <a name="id2903519"></a><p>
32 <a name="id2809093"></a><p>
3333 Permission is granted to copy, distribute and/or modify this
3434 document under the terms of the <em class="citetitle">GNU Free
3535 Documentation License</em>, Version 1.1 or any later
2424 </tr></table>
2525 <div class="index" title="Index">
2626 <div class="titlepage"><div><div><h2 class="title">
27 <a name="id2864240"></a>Index</h2></div></div></div>
27 <a name="id2769821"></a>Index</h2></div></div></div>
2828 <div class="index">
2929 <div class="indexdiv">
3030 <h3>C</h3>
3131 <dl>
3232 <dt>CancelRequest</dt>
33 <dd><dl><dt>QoS, <a class="indexterm" href="QoS.html#id2922961">CancelRequest ()</a>
33 <dd><dl><dt>QoS, <a class="indexterm" href="QoS.html#id2821050">CancelRequest ()</a>
3434 </dt></dl></dd>
3535 <dt>CanHibernate</dt>
36 <dd><dl><dt>Power, <a class="indexterm" href="Power.html#id2868922">The "CanHibernate" property</a>
36 <dd><dl><dt>Power, <a class="indexterm" href="Power.html#id2774498">The "CanHibernate" property</a>
3737 </dt></dl></dd>
3838 <dt>CanSuspend</dt>
39 <dd><dl><dt>Power, <a class="indexterm" href="Power.html#id2868893">The "CanSuspend" property</a>
39 <dd><dl><dt>Power, <a class="indexterm" href="Power.html#id2770010">The "CanSuspend" property</a>
4040 </dt></dl></dd>
4141 <dt>Capacity</dt>
42 <dd><dl><dt>Device, <a class="indexterm" href="Device.html#id2930003">The "Capacity" property</a>
42 <dd><dl><dt>Device, <a class="indexterm" href="Device.html#id2854979">The "Capacity" property</a>
4343 </dt></dl></dd>
4444 <dt>Changed</dt>
4545 <dd><dl>
46 <dt>Device, <a class="indexterm" href="Device.html#id2928917">The Changed signal</a>
46 <dt>Device, <a class="indexterm" href="Device.html#id2853893">The Changed signal</a>
4747 </dt>
48 <dt>Power, <a class="indexterm" href="Power.html#id2864356">The Changed signal</a>
48 <dt>Power, <a class="indexterm" href="Power.html#id2769934">The Changed signal</a>
4949 </dt>
5050 </dl></dd>
5151 </dl>
5454 <h3>D</h3>
5555 <dl>
5656 <dt>DaemonVersion</dt>
57 <dd><dl><dt>Power, <a class="indexterm" href="Power.html#id2864397">The "DaemonVersion" property</a>
57 <dd><dl><dt>Power, <a class="indexterm" href="Power.html#id2769975">The "DaemonVersion" property</a>
5858 </dt></dl></dd>
5959 <dt>DeviceAdded</dt>
60 <dd><dl><dt>Power, <a class="indexterm" href="Power.html#id2863592">The DeviceAdded signal</a>
60 <dd><dl><dt>Power, <a class="indexterm" href="Power.html#id2769171">The DeviceAdded signal</a>
6161 </dt></dl></dd>
6262 <dt>DeviceChanged</dt>
63 <dd><dl><dt>Power, <a class="indexterm" href="Power.html#id2864314">The DeviceChanged signal</a>
63 <dd><dl><dt>Power, <a class="indexterm" href="Power.html#id2769892">The DeviceChanged signal</a>
6464 </dt></dl></dd>
6565 <dt>DeviceRemoved</dt>
66 <dd><dl><dt>Power, <a class="indexterm" href="Power.html#id2863634">The DeviceRemoved signal</a>
66 <dd><dl><dt>Power, <a class="indexterm" href="Power.html#id2769214">The DeviceRemoved signal</a>
6767 </dt></dl></dd>
6868 </dl>
6969 </div>
7171 <h3>E</h3>
7272 <dl>
7373 <dt>Energy</dt>
74 <dd><dl><dt>Device, <a class="indexterm" href="Device.html#id2929366">The "Energy" property</a>
74 <dd><dl><dt>Device, <a class="indexterm" href="Device.html#id2854342">The "Energy" property</a>
7575 </dt></dl></dd>
7676 <dt>EnergyEmpty</dt>
77 <dd><dl><dt>Device, <a class="indexterm" href="Device.html#id2929411">The "EnergyEmpty" property</a>
77 <dd><dl><dt>Device, <a class="indexterm" href="Device.html#id2854387">The "EnergyEmpty" property</a>
7878 </dt></dl></dd>
7979 <dt>EnergyFull</dt>
80 <dd><dl><dt>Device, <a class="indexterm" href="Device.html#id2929458">The "EnergyFull" property</a>
80 <dd><dl><dt>Device, <a class="indexterm" href="Device.html#id2854434">The "EnergyFull" property</a>
8181 </dt></dl></dd>
8282 <dt>EnergyFullDesign</dt>
83 <dd><dl><dt>Device, <a class="indexterm" href="Device.html#id2929504">The "EnergyFullDesign" property</a>
83 <dd><dl><dt>Device, <a class="indexterm" href="Device.html#id2854480">The "EnergyFullDesign" property</a>
8484 </dt></dl></dd>
8585 <dt>EnergyRate</dt>
86 <dd><dl><dt>Device, <a class="indexterm" href="Device.html#id2929551">The "EnergyRate" property</a>
86 <dd><dl><dt>Device, <a class="indexterm" href="Device.html#id2854527">The "EnergyRate" property</a>
8787 </dt></dl></dd>
8888 <dt>EnumerateDevices</dt>
89 <dd><dl><dt>Power, <a class="indexterm" href="Power.html#id2864688">EnumerateDevices ()</a>
89 <dd><dl><dt>Power, <a class="indexterm" href="Power.html#id2770276">EnumerateDevices ()</a>
9090 </dt></dl></dd>
9191 </dl>
9292 </div>
9494 <h3>G</h3>
9595 <dl>
9696 <dt>GetHistory</dt>
97 <dd><dl><dt>Device, <a class="indexterm" href="Device.html#id2939478">GetHistory ()</a>
97 <dd><dl><dt>Device, <a class="indexterm" href="Device.html#id2845057">GetHistory ()</a>
9898 </dt></dl></dd>
9999 <dt>GetLatency</dt>
100 <dd><dl><dt>QoS, <a class="indexterm" href="QoS.html#id2923068">GetLatency ()</a>
100 <dd><dl><dt>QoS, <a class="indexterm" href="QoS.html#id2821157">GetLatency ()</a>
101101 </dt></dl></dd>
102102 <dt>GetLatencyRequests</dt>
103 <dd><dl><dt>QoS, <a class="indexterm" href="QoS.html#id2954417">GetLatencyRequests ()</a>
103 <dd><dl><dt>QoS, <a class="indexterm" href="QoS.html#id2859593">GetLatencyRequests ()</a>
104104 </dt></dl></dd>
105105 <dt>GetStatistics</dt>
106 <dd><dl><dt>Device, <a class="indexterm" href="Device.html#id2939624">GetStatistics ()</a>
106 <dd><dl><dt>Device, <a class="indexterm" href="Device.html#id2845203">GetStatistics ()</a>
107107 </dt></dl></dd>
108108 </dl>
109109 </div>
111111 <h3>H</h3>
112112 <dl>
113113 <dt>HasHistory</dt>
114 <dd><dl><dt>Device, <a class="indexterm" href="Device.html#id2929259">The "HasHistory" property</a>
114 <dd><dl><dt>Device, <a class="indexterm" href="Device.html#id2854235">The "HasHistory" property</a>
115115 </dt></dl></dd>
116116 <dt>HasStatistics</dt>
117 <dd><dl><dt>Device, <a class="indexterm" href="Device.html#id2929291">The "HasStatistics" property</a>
117 <dd><dl><dt>Device, <a class="indexterm" href="Device.html#id2854267">The "HasStatistics" property</a>
118118 </dt></dl></dd>
119119 <dt>Hibernate</dt>
120 <dd><dl><dt>Power, <a class="indexterm" href="Power.html#id2863549">Hibernate ()</a>
120 <dd><dl><dt>Power, <a class="indexterm" href="Power.html#id2769128">Hibernate ()</a>
121121 </dt></dl></dd>
122122 </dl>
123123 </div>
125125 <h3>I</h3>
126126 <dl>
127127 <dt>IsPresent</dt>
128 <dd><dl><dt>Device, <a class="indexterm" href="Device.html#id2929812">The "IsPresent" property</a>
128 <dd><dl><dt>Device, <a class="indexterm" href="Device.html#id2854787">The "IsPresent" property</a>
129129 </dt></dl></dd>
130130 <dt>IsRechargeable</dt>
131 <dd><dl><dt>Device, <a class="indexterm" href="Device.html#id2929958">The "IsRechargeable" property</a>
131 <dd><dl><dt>Device, <a class="indexterm" href="Device.html#id2854934">The "IsRechargeable" property</a>
132132 </dt></dl></dd>
133133 </dl>
134134 </div>
136136 <h3>L</h3>
137137 <dl>
138138 <dt>LatencyChanged</dt>
139 <dd><dl><dt>QoS, <a class="indexterm" href="QoS.html#id2954553">The LatencyChanged signal</a>
139 <dd><dl><dt>QoS, <a class="indexterm" href="QoS.html#id2859729">The LatencyChanged signal</a>
140140 </dt></dl></dd>
141141 <dt>LidIsClosed</dt>
142 <dd><dl><dt>Power, <a class="indexterm" href="Power.html#id2869013">The "LidIsClosed" property</a>
142 <dd><dl><dt>Power, <a class="indexterm" href="Power.html#id2774589">The "LidIsClosed" property</a>
143143 </dt></dl></dd>
144144 <dt>LidIsPresent</dt>
145 <dd><dl><dt>Power, <a class="indexterm" href="Power.html#id2869045">The "LidIsPresent" property</a>
145 <dd><dl><dt>Power, <a class="indexterm" href="Power.html#id2774622">The "LidIsPresent" property</a>
146146 </dt></dl></dd>
147147 </dl>
148148 </div>
150150 <h3>M</h3>
151151 <dl>
152152 <dt>Model</dt>
153 <dd><dl><dt>Device, <a class="indexterm" href="Device.html#id2929031">The "Model" property</a>
153 <dd><dl><dt>Device, <a class="indexterm" href="Device.html#id2854007">The "Model" property</a>
154154 </dt></dl></dd>
155155 </dl>
156156 </div>
158158 <h3>N</h3>
159159 <dl>
160160 <dt>NativePath</dt>
161 <dd><dl><dt>Device, <a class="indexterm" href="Device.html#id2928958">The "NativePath" property</a>
161 <dd><dl><dt>Device, <a class="indexterm" href="Device.html#id2853934">The "NativePath" property</a>
162162 </dt></dl></dd>
163163 </dl>
164164 </div>
166166 <h3>O</h3>
167167 <dl>
168168 <dt>OnBattery</dt>
169 <dd><dl><dt>Power, <a class="indexterm" href="Power.html#id2868952">The "OnBattery" property</a>
169 <dd><dl><dt>Power, <a class="indexterm" href="Power.html#id2774528">The "OnBattery" property</a>
170170 </dt></dl></dd>
171171 <dt>Online</dt>
172 <dd><dl><dt>Device, <a class="indexterm" href="Device.html#id2929323">The "Online" property</a>
172 <dd><dl><dt>Device, <a class="indexterm" href="Device.html#id2854299">The "Online" property</a>
173173 </dt></dl></dd>
174174 <dt>OnLowBattery</dt>
175 <dd><dl><dt>Power, <a class="indexterm" href="Power.html#id2868982">The "OnLowBattery" property</a>
175 <dd><dl><dt>Power, <a class="indexterm" href="Power.html#id2774558">The "OnLowBattery" property</a>
176176 </dt></dl></dd>
177177 </dl>
178178 </div>
180180 <h3>P</h3>
181181 <dl>
182182 <dt>Percentage</dt>
183 <dd><dl><dt>Device, <a class="indexterm" href="Device.html#id2929722">The "Percentage" property</a>
183 <dd><dl><dt>Device, <a class="indexterm" href="Device.html#id2854698">The "Percentage" property</a>
184184 </dt></dl></dd>
185185 <dt>PowerSupply</dt>
186 <dd><dl><dt>Device, <a class="indexterm" href="Device.html#id2929225">The "PowerSupply" property</a>
186 <dd><dl><dt>Device, <a class="indexterm" href="Device.html#id2854201">The "PowerSupply" property</a>
187187 </dt></dl></dd>
188188 </dl>
189189 </div>
191191 <h3>R</h3>
192192 <dl>
193193 <dt>RecallNotice</dt>
194 <dd><dl><dt>Device, <a class="indexterm" href="Device.html#id2930173">The "RecallNotice" property</a>
194 <dd><dl><dt>Device, <a class="indexterm" href="Device.html#id2855149">The "RecallNotice" property</a>
195195 </dt></dl></dd>
196196 <dt>RecallUrl</dt>
197 <dd><dl><dt>Device, <a class="indexterm" href="Device.html#id2930246">The "RecallUrl" property</a>
197 <dd><dl><dt>Device, <a class="indexterm" href="Device.html#id2855222">The "RecallUrl" property</a>
198198 </dt></dl></dd>
199199 <dt>RecallVendor</dt>
200 <dd><dl><dt>Device, <a class="indexterm" href="Device.html#id2930209">The "RecallVendor" property</a>
200 <dd><dl><dt>Device, <a class="indexterm" href="Device.html#id2855185">The "RecallVendor" property</a>
201201 </dt></dl></dd>
202202 <dt>Refresh</dt>
203 <dd><dl><dt>Device, <a class="indexterm" href="Device.html#id2863772">Refresh ()</a>
203 <dd><dl><dt>Device, <a class="indexterm" href="Device.html#id2769357">Refresh ()</a>
204204 </dt></dl></dd>
205205 <dt>RequestLatency</dt>
206 <dd><dl><dt>QoS, <a class="indexterm" href="QoS.html#id2925061">RequestLatency ()</a>
206 <dd><dl><dt>QoS, <a class="indexterm" href="QoS.html#id2839724">RequestLatency ()</a>
207207 </dt></dl></dd>
208208 <dt>RequestsChanged</dt>
209 <dd><dl><dt>QoS, <a class="indexterm" href="QoS.html#id2954612">The RequestsChanged signal</a>
209 <dd><dl><dt>QoS, <a class="indexterm" href="QoS.html#id2859788">The RequestsChanged signal</a>
210210 </dt></dl></dd>
211211 </dl>
212212 </div>
214214 <h3>S</h3>
215215 <dl>
216216 <dt>Serial</dt>
217 <dd><dl><dt>Device, <a class="indexterm" href="Device.html#id2929062">The "Serial" property</a>
217 <dd><dl><dt>Device, <a class="indexterm" href="Device.html#id2854038">The "Serial" property</a>
218218 </dt></dl></dd>
219219 <dt>SetMinimumLatency</dt>
220 <dd><dl><dt>QoS, <a class="indexterm" href="QoS.html#id2952386">SetMinimumLatency ()</a>
220 <dd><dl><dt>QoS, <a class="indexterm" href="QoS.html#id2825230">SetMinimumLatency ()</a>
221221 </dt></dl></dd>
222222 <dt>State</dt>
223 <dd><dl><dt>Device, <a class="indexterm" href="Device.html#id2929859">The "State" property</a>
223 <dd><dl><dt>Device, <a class="indexterm" href="Device.html#id2854834">The "State" property</a>
224224 </dt></dl></dd>
225225 <dt>Suspend</dt>
226 <dd><dl><dt>Power, <a class="indexterm" href="Power.html#id2863516">Suspend ()</a>
226 <dd><dl><dt>Power, <a class="indexterm" href="Power.html#id2769095">Suspend ()</a>
227227 </dt></dl></dd>
228228 </dl>
229229 </div>
231231 <h3>T</h3>
232232 <dl>
233233 <dt>Technology</dt>
234 <dd><dl><dt>Device, <a class="indexterm" href="Device.html#id2930074">The "Technology" property</a>
234 <dd><dl><dt>Device, <a class="indexterm" href="Device.html#id2855050">The "Technology" property</a>
235235 </dt></dl></dd>
236236 <dt>TimeToEmpty</dt>
237 <dd><dl><dt>Device, <a class="indexterm" href="Device.html#id2929630">The "TimeToEmpty" property</a>
237 <dd><dl><dt>Device, <a class="indexterm" href="Device.html#id2854606">The "TimeToEmpty" property</a>
238238 </dt></dl></dd>
239239 <dt>TimeToFull</dt>
240 <dd><dl><dt>Device, <a class="indexterm" href="Device.html#id2929676">The "TimeToFull" property</a>
240 <dd><dl><dt>Device, <a class="indexterm" href="Device.html#id2854652">The "TimeToFull" property</a>
241241 </dt></dl></dd>
242242 <dt>Type</dt>
243 <dd><dl><dt>Device, <a class="indexterm" href="Device.html#id2929127">The "Type" property</a>
243 <dd><dl><dt>Device, <a class="indexterm" href="Device.html#id2854103">The "Type" property</a>
244244 </dt></dl></dd>
245245 </dl>
246246 </div>
248248 <h3>U</h3>
249249 <dl>
250250 <dt>UpdateTime</dt>
251 <dd><dl><dt>Device, <a class="indexterm" href="Device.html#id2929093">The "UpdateTime" property</a>
251 <dd><dl><dt>Device, <a class="indexterm" href="Device.html#id2854069">The "UpdateTime" property</a>
252252 </dt></dl></dd>
253253 </dl>
254254 </div>
256256 <h3>V</h3>
257257 <dl>
258258 <dt>Vendor</dt>
259 <dd><dl><dt>Device, <a class="indexterm" href="Device.html#id2929000">The "Vendor" property</a>
259 <dd><dl><dt>Device, <a class="indexterm" href="Device.html#id2853976">The "Vendor" property</a>
260260 </dt></dl></dd>
261261 <dt>Voltage</dt>
262 <dd><dl><dt>Device, <a class="indexterm" href="Device.html#id2929598">The "Voltage" property</a>
262 <dd><dl><dt>Device, <a class="indexterm" href="Device.html#id2854574">The "Voltage" property</a>
263263 </dt></dl></dd>
264264 </dl>
265265 </div>
+0
-2
doc/html/upload.sh less more
0 scp * hughsient@people.freedesktop.org:/home/hughsient/public_html/DeviceKit-power
1
0 012
0 013
44 policy/org.freedesktop.devicekit.power.qos.policy.in
55 src/dkp-main.c
66 tools/dkp-tool.c
7 src/egg-debug.c
78
0 tools/egg-debug.c
1
1515 # only match correct manufacturer
1616 ATTR{manufacturer}!="SONY", GOTO="dkp_battery_recall_ibm_end"
1717
18 # only recalled on some particular models
19 ATTR{[dmi/id]product_version}!="*R60*|*T60*|*Z60m*|*Z61e*|*Z61m*|*Z61p*", GOTO="dkp_battery_recall_ibm_end"
20
1821 ATTR{model_name}=="92P1072", ENV{DKP_RECALL_NOTICE}="1"
1922 ATTR{model_name}=="92P1073", ENV{DKP_RECALL_NOTICE}="1"
2023 ATTR{model_name}=="92P1088", ENV{DKP_RECALL_NOTICE}="1"
1515 # only match correct manufacturer
1616 ATTR{manufacturer}!="TOSHIBA", GOTO="dkp_battery_recall_toshiba_end"
1717
18 ATTR{model_name}=="PA3465U, ENV{DKP_RECALL_NOTICE}="1"
19 ATTR{model_name}=="PA3399U, ENV{DKP_RECALL_NOTICE}="1"
20 ATTR{model_name}=="PA3400U, ENV{DKP_RECALL_NOTICE}="1"
21 ATTR{model_name}=="PA3465U, ENV{DKP_RECALL_NOTICE}="1"
22 ATTR{model_name}=="PA3399U, ENV{DKP_RECALL_NOTICE}="1"
23 ATTR{model_name}=="PA3400U, ENV{DKP_RECALL_NOTICE}="1"
18 ATTR{model_name}=="PA3465U", ENV{DKP_RECALL_NOTICE}="1"
19 ATTR{model_name}=="PA3399U", ENV{DKP_RECALL_NOTICE}="1"
20 ATTR{model_name}=="PA3400U", ENV{DKP_RECALL_NOTICE}="1"
21 ATTR{model_name}=="PA3465U", ENV{DKP_RECALL_NOTICE}="1"
22 ATTR{model_name}=="PA3399U", ENV{DKP_RECALL_NOTICE}="1"
23 ATTR{model_name}=="PA3400U", ENV{DKP_RECALL_NOTICE}="1"
2424
2525 ENV{DKP_RECALL_NOTICE}=="1", ENV{DKP_RECALL_VENDOR}="Toshiba", ENV{DKP_RECALL_URL}="http://bxinfo.toshiba.com/"
2626
1313
1414 ATTRS{idVendor}=="03f0", ENV{DKP_VENDOR}="Hewlett Packard"
1515 ATTRS{idVendor}=="0463", ENV{DKP_VENDOR}="Eaton"
16 ATTRS{idVendor}=="047c", ENV{DKP_VENDOR}="Dell"
1617 ATTRS{idVendor}=="050d", ENV{DKP_VENDOR}="Belkin"
1718 ATTRS{idVendor}=="051d", ENV{DKP_VENDOR}="APC"
1819 ATTRS{idVendor}=="06da", ENV{DKP_VENDOR}="Liebert"
1920 ATTRS{idVendor}=="0764", ENV{DKP_VENDOR}="Cyber Power Systems"
2021 ATTRS{idVendor}=="09ae", ENV{DKP_VENDOR}="TrippLite"
22 ATTRS{idVendor}=="0d9f", ENV{DKP_VENDOR}="PowerCOM"
23 ATTRS{idVendor}=="10af", ENV{DKP_VENDOR}="Liebert"
2124
2225 # Hewlett Packard
2326 ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="1f06", ENV{DKP_BATTERY_TYPE}="ups"
2629 # Eaton
2730 ATTRS{idVendor}=="0463", ATTRS{idProduct}=="0001", ENV{DKP_BATTERY_TYPE}="ups"
2831 ATTRS{idVendor}=="0463", ATTRS{idProduct}=="ffff", ENV{DKP_BATTERY_TYPE}="ups"
32
33 # Dell
34 ATTRS{idVendor}=="047c", ATTRS{idProduct}=="ffff", ENV{DKP_BATTERY_TYPE}="ups"
2935
3036 # Belkin
3137 ATTRS{idVendor}=="050d", ATTRS{idProduct}=="0375", ENV{DKP_BATTERY_TYPE}="ups"
4753 # Cyber Power Systems
4854 ATTRS{idVendor}=="0764", ATTRS{idProduct}=="0005", ENV{DKP_BATTERY_TYPE}="ups"
4955 ATTRS{idVendor}=="0764", ATTRS{idProduct}=="0501", ENV{DKP_BATTERY_TYPE}="ups"
56 ATTRS{idVendor}=="0764", ATTRS{idProduct}=="0601", ENV{DKP_BATTERY_TYPE}="ups"
5057
5158 # TrippLite
5259 ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="1003", ENV{DKP_BATTERY_TYPE}="ups"
5360 ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="1007", ENV{DKP_BATTERY_TYPE}="ups"
61 ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="1008", ENV{DKP_BATTERY_TYPE}="ups"
5462 ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="2005", ENV{DKP_BATTERY_TYPE}="ups"
5563 ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="2007", ENV{DKP_BATTERY_TYPE}="ups"
5664 ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="3012", ENV{DKP_BATTERY_TYPE}="ups"
5967 ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="4002", ENV{DKP_BATTERY_TYPE}="ups"
6068 ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="4003", ENV{DKP_BATTERY_TYPE}="ups"
6169
70 # PowerCOM
71 ATTRS{idVendor}=="0d9f", ATTRS{idProduct}=="00a2", ENV{DKP_BATTERY_TYPE}="ups"
72 ATTRS{idVendor}=="0d9f", ATTRS{idProduct}=="00a3", ENV{DKP_BATTERY_TYPE}="ups"
73 ATTRS{idVendor}=="0d9f", ATTRS{idProduct}=="00a4", ENV{DKP_BATTERY_TYPE}="ups"
74 ATTRS{idVendor}=="0d9f", ATTRS{idProduct}=="00a5", ENV{DKP_BATTERY_TYPE}="ups"
75 ATTRS{idVendor}=="0d9f", ATTRS{idProduct}=="00a6", ENV{DKP_BATTERY_TYPE}="ups"
76
77 # Liebert
78 ATTRS{idVendor}=="10af", ATTRS{idProduct}=="0001", ENV{DKP_BATTERY_TYPE}="ups"
79
6280 LABEL="dkp_hid_end"
81
562562 }
563563
564564 /* encrypted swap? */
565 if (!daemon->priv->hibernate_has_encrypted_swap) {
565 if (daemon->priv->hibernate_has_encrypted_swap) {
566566 error = g_error_new (DKP_DAEMON_ERROR,
567567 DKP_DAEMON_ERROR_GENERAL,
568568 "Swap space is encrypted");
8484
8585 static gboolean dkp_device_register_device (DkpDevice *device);
8686
87 enum
88 {
87 enum {
8988 PROP_0,
9089 PROP_NATIVE_PATH,
9190 PROP_VENDOR,
117116 PROP_LAST
118117 };
119118
120 enum
121 {
119 enum {
122120 SIGNAL_CHANGED,
123121 SIGNAL_LAST,
124122 };
531529 gboolean ret;
532530 const gchar *native_path;
533531 DkpDeviceClass *klass = DKP_DEVICE_GET_CLASS (device);
534 gchar *id;
532 gchar *id = NULL;
535533
536534 g_return_val_if_fail (DKP_IS_DEVICE (device), FALSE);
537535
578576 id = dkp_device_get_id (device);
579577 if (id != NULL)
580578 dkp_history_set_id (device->priv->history, id);
581 g_free (id);
582579
583580 out:
584581 /* start signals and callbacks */
585582 g_object_thaw_notify (G_OBJECT(device));
586583 device->priv->during_coldplug = FALSE;
587584 egg_debug ("device now not coldplug");
585 g_free (id);
588586 return ret;
589587 }
590588
104104 }
105105
106106 /**
107 * dkp_main_timed_exit_cb:
108 *
109 * Exits the main loop, which is helpful for valgrinding.
110 **/
111 static gboolean
112 dkp_main_timed_exit_cb (GMainLoop *loop)
113 {
114 g_main_loop_quit (loop);
115 return FALSE;
116 }
117
118 /**
107119 * main:
108120 **/
109121 gint
110122 main (gint argc, gchar **argv)
111123 {
112124 GError *error = NULL;
113 DkpDaemon *daemon;
114 DkpQos *qos;
115 DkpWakeups *wakeups;
125 DkpDaemon *daemon = NULL;
126 DkpQos *qos = NULL;
127 DkpWakeups *wakeups = NULL;
116128 GOptionContext *context;
117129 DBusGProxy *bus_proxy;
118130 DBusGConnection *bus;
119 gboolean verbose = FALSE;
120131 gboolean ret;
121132 gint retval = 1;
122
123 const GOptionEntry entries[] = {
124 { "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose,
125 _("Show extra debugging information"), NULL },
126 { NULL }
133 gboolean timed_exit = FALSE;
134 gboolean immediate_exit = FALSE;
135
136 const GOptionEntry options[] = {
137 { "timed-exit", '\0', 0, G_OPTION_ARG_NONE, &timed_exit,
138 /* TRANSLATORS: exit after we've started up, used for user profiling */
139 _("Exit after a small delay"), NULL },
140 { "immediate-exit", '\0', 0, G_OPTION_ARG_NONE, &immediate_exit,
141 /* TRANSLATORS: exit straight away, used for automatic profiling */
142 _("Exit after the engine has loaded"), NULL },
143 { NULL}
127144 };
128145
129146 g_type_init ();
130147
131148 context = g_option_context_new ("DeviceKit Power Daemon");
132 g_option_context_add_main_entries (context, entries, NULL);
149 g_option_context_add_main_entries (context, options, NULL);
150 g_option_context_add_group (context, egg_debug_get_option_group ());
133151 g_option_context_parse (context, &argc, &argv, NULL);
134152 g_option_context_free (context);
135 egg_debug_init (verbose);
136153
137154 /* get bus connection */
138155 bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);
165182 qos = dkp_qos_new ();
166183 wakeups = dkp_wakeups_new ();
167184 daemon = dkp_daemon_new ();
185 loop = g_main_loop_new (NULL, FALSE);
168186 ret = dkp_daemon_startup (daemon);
169187 if (!ret) {
170188 egg_warning ("Could not startup; bailing out");
171189 goto out;
172190 }
173191
174 loop = g_main_loop_new (NULL, FALSE);
192 /* only timeout and close the mainloop if we have specified it on the command line */
193 if (timed_exit)
194 g_timeout_add_seconds (30, (GSourceFunc) dkp_main_timed_exit_cb, loop);
195
196 /* immediatly exit */
197 if (immediate_exit)
198 g_timeout_add (50, (GSourceFunc) dkp_main_timed_exit_cb, loop);
199
200 /* wait for input or timeout */
175201 g_main_loop_run (loop);
176
177 g_object_unref (qos);
178 g_object_unref (wakeups);
179 g_object_unref (daemon);
180 g_main_loop_unref (loop);
181202 retval = 0;
182203 out:
204 if (qos != NULL)
205 g_object_unref (qos);
206 if (wakeups != NULL)
207 g_object_unref (wakeups);
208 if (daemon != NULL)
209 g_object_unref (daemon);
210 if (loop != NULL)
211 g_main_loop_unref (loop);
183212 return retval;
184213 }
185214
4141
4242 g_type_init ();
4343 test = egg_test_init ();
44 egg_debug_init (TRUE);
44 egg_debug_init (&argc, &argv);
4545
4646 /* tests go here */
4747 dkp_backend_test (test);
00 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
11 *
2 * Copyright (C) 2007-2008 Richard Hughes <richard@hughsie.com>
2 * Copyright (C) 2007-2009 Richard Hughes <richard@hughsie.com>
33 *
44 * Licensed under the GNU General Public License Version 2
55 *
2424 *
2525 * This file contains functions that can be used for debugging.
2626 */
27
28 #include "config.h"
2729
2830 #include <glib.h>
2931 #include <glib/gi18n.h>
3840 #include <sys/stat.h>
3941 #include <fcntl.h>
4042 #include <time.h>
43
44 #ifdef HAVE_EXECINFO_H
4145 #include <execinfo.h>
46 #endif
4247
4348 #include "egg-debug.h"
4449
5257 #define CONSOLE_CYAN 36
5358 #define CONSOLE_WHITE 37
5459
55 static gint fd = -1;
56
57 /**
58 * pk_set_console_mode:
60 static gint _fd = -1;
61 static gboolean _verbose = FALSE;
62 static gboolean _console = FALSE;
63 static gchar *_log_filename = NULL;
64 static gboolean _initialized = FALSE;
65 static GPtrArray *_modules_array = NULL;
66 static GPtrArray *_functions_array = NULL;
67 static gchar **_modules = NULL;
68 static gchar **_functions = NULL;
69
70 /**
71 * egg_debug_filter_module:
72 **/
73 static gboolean
74 egg_debug_filter_module (const gchar *filename)
75 {
76 gchar *module;
77 const gchar *module_tmp;
78 guint i;
79 gboolean ret = FALSE;
80
81 /* nothing filtering */
82 if (_modules_array == NULL)
83 return FALSE;
84
85 /* are we in the filter list */
86 module = g_strdup (filename);
87 g_strdelimit (module, ".", '\0');
88 for (i=0; i<_modules_array->len; i++) {
89 module_tmp = g_ptr_array_index (_modules_array, i);
90 if (g_strcmp0 (module_tmp, module) == 0) {
91 ret = TRUE;
92 break;
93 }
94 }
95 return ret;
96 }
97
98 /**
99 * egg_debug_filter_function:
100 **/
101 static gboolean
102 egg_debug_filter_function (const gchar *function)
103 {
104 guint i;
105 const gchar *function_tmp;
106 gboolean ret = FALSE;
107
108 /* nothing filtering */
109 if (_functions_array == NULL)
110 return FALSE;
111
112 /* are we in the filter list */
113 for (i=0; i<_functions_array->len; i++) {
114 function_tmp = g_ptr_array_index (_functions_array, i);
115 if (g_str_has_prefix (function, function_tmp)) {
116 ret = TRUE;
117 break;
118 }
119 }
120 return ret;
121 }
122
123 /**
124 * egg_debug_set_console_mode:
59125 **/
60126 static void
61 pk_set_console_mode (guint console_code)
127 egg_debug_set_console_mode (guint console_code)
62128 {
63129 gchar command[13];
64130
65131 /* don't put extra commands into logs */
66 if (!egg_debug_is_console ())
132 if (!_console)
67133 return;
68134
69135 /* Command is the control command to the terminal */
77143 void
78144 egg_debug_backtrace (void)
79145 {
146 #ifdef HAVE_EXECINFO_H
80147 void *call_stack[512];
81148 int call_stack_size;
82149 char **symbols;
85152 call_stack_size = backtrace (call_stack, G_N_ELEMENTS (call_stack));
86153 symbols = backtrace_symbols (call_stack, call_stack_size);
87154 if (symbols != NULL) {
88 pk_set_console_mode (CONSOLE_RED);
155 egg_debug_set_console_mode (CONSOLE_RED);
89156 g_print ("Traceback:\n");
90157 while (i < call_stack_size) {
91158 g_print ("\t%s\n", symbols[i]);
92159 i++;
93160 }
94 pk_set_console_mode (CONSOLE_RESET);
161 egg_debug_set_console_mode (CONSOLE_RESET);
95162 free (symbols);
96163 }
97 }
98
99 /**
100 * pk_log_line:
164 #endif
165 }
166
167 /**
168 * egg_debug_log_line:
101169 **/
102170 static void
103 pk_log_line (const gchar *buffer)
171 egg_debug_log_line (const gchar *buffer)
104172 {
105173 ssize_t count;
174
106175 /* open a file */
107 if (fd == -1) {
176 if (_fd == -1) {
108177 /* ITS4: ignore, /var/log/foo is owned by root, and this is just debug text */
109 fd = open (EGG_LOG_FILE, O_WRONLY|O_APPEND|O_CREAT, 0777);
110 if (fd == -1)
111 g_error ("could not open log: '%s'", EGG_LOG_FILE);
178 _fd = open (_log_filename, O_WRONLY|O_APPEND|O_CREAT, 0777);
179 if (_fd == -1)
180 g_error ("could not open log: '%s'", _log_filename);
112181 }
113182
114183 /* ITS4: ignore, debug text always NULL terminated */
115 count = write (fd, buffer, strlen (buffer));
184 count = write (_fd, buffer, strlen (buffer));
116185 if (count == -1)
117186 g_warning ("could not write %s", buffer);
187
118188 /* newline */
119 count = write (fd, "\n", 1);
189 count = write (_fd, "\n", 1);
120190 if (count == -1)
121191 g_warning ("could not write newline");
122192 }
123193
124194 /**
125 * pk_print_line:
195 * egg_debug_print_line:
126196 **/
127197 static void
128 pk_print_line (const gchar *func, const gchar *file, const int line, const gchar *buffer, guint color)
198 egg_debug_print_line (const gchar *func, const gchar *file, const int line, const gchar *buffer, guint color)
129199 {
130200 gchar *str_time;
131201 gchar *header;
132202 time_t the_time;
133 GThread *thread;
134203
135204 time (&the_time);
136205 str_time = g_new0 (gchar, 255);
137206 strftime (str_time, 254, "%H:%M:%S", localtime (&the_time));
138 thread = g_thread_self ();
139207
140208 /* generate header text */
141 header = g_strdup_printf ("TI:%s\tTH:%p\tFI:%s\tFN:%s,%d", str_time, thread, file, func, line);
209 header = g_strdup_printf ("TI:%s\tFI:%s\tFN:%s,%d", str_time, file, func, line);
142210 g_free (str_time);
143211
144212 /* always in light green */
145 pk_set_console_mode (CONSOLE_GREEN);
213 egg_debug_set_console_mode (CONSOLE_GREEN);
146214 printf ("%s\n", header);
147215
148216 /* different colors according to the severity */
149 pk_set_console_mode (color);
217 egg_debug_set_console_mode (color);
150218 printf (" - %s\n", buffer);
151 pk_set_console_mode (CONSOLE_RESET);
219 egg_debug_set_console_mode (CONSOLE_RESET);
152220
153221 /* log to a file */
154 if (egg_debug_is_logging ()) {
155 pk_log_line (header);
156 pk_log_line (buffer);
222 if (_log_filename != NULL) {
223 egg_debug_log_line (header);
224 egg_debug_log_line (buffer);
157225 }
158226
159227 /* flush this output, as we need to debug */
171239 va_list args;
172240 gchar *buffer = NULL;
173241
174 if (!egg_debug_enabled ())
242 if (!_verbose && !egg_debug_filter_module (file) && !egg_debug_filter_function (func))
175243 return;
176244
177245 va_start (args, format);
178246 g_vasprintf (&buffer, format, args);
179247 va_end (args);
180248
181 pk_print_line (func, file, line, buffer, CONSOLE_BLUE);
182
183 g_free(buffer);
249 egg_debug_print_line (func, file, line, buffer, CONSOLE_BLUE);
250
251 g_free (buffer);
184252 }
185253
186254 /**
192260 va_list args;
193261 gchar *buffer = NULL;
194262
195 if (!egg_debug_enabled ())
263 if (!_verbose && !egg_debug_filter_module (file) && !egg_debug_filter_function (func))
196264 return;
197265
198266 va_start (args, format);
200268 va_end (args);
201269
202270 /* do extra stuff for a warning */
203 if (!egg_debug_is_console ())
271 if (!_console)
204272 printf ("*** WARNING ***\n");
205 pk_print_line (func, file, line, buffer, CONSOLE_RED);
206
207 g_free(buffer);
273 egg_debug_print_line (func, file, line, buffer, CONSOLE_RED);
274
275 g_free (buffer);
208276 }
209277
210278 /**
221289 va_end (args);
222290
223291 /* do extra stuff for a warning */
224 if (!egg_debug_is_console ())
292 if (!_console)
225293 printf ("*** ERROR ***\n");
226 pk_print_line (func, file, line, buffer, CONSOLE_RED);
227 g_free(buffer);
294 egg_debug_print_line (func, file, line, buffer, CONSOLE_RED);
295 g_free (buffer);
228296
229297 /* we want to fix this! */
230298 egg_debug_backtrace ();
233301 }
234302
235303 /**
236 * egg_debug_enabled:
304 * egg_debug_is_verbose:
237305 *
238306 * Returns: TRUE if we have debugging enabled
239307 **/
240308 gboolean
241 egg_debug_enabled (void)
242 {
243 const gchar *env;
244 env = g_getenv (EGG_VERBOSE);
245 return (g_strcmp0 (env, "1") == 0);
246 }
247
248 /**
249 * egg_debug_is_logging:
250 *
251 * Returns: TRUE if we have logging enabled
309 egg_debug_is_verbose (void)
310 {
311 return _verbose;
312 }
313
314 /**
315 * egg_debug_set_log_filename:
316 **/
317 void
318 egg_debug_set_log_filename (const gchar *filename)
319 {
320 g_free (_log_filename);
321 _log_filename = g_strdup (filename);
322 }
323
324 /**
325 * egg_debug_strv_split_to_ptr_array:
326 **/
327 static GPtrArray *
328 egg_debug_strv_split_to_ptr_array (gchar **modules)
329 {
330 GPtrArray *array = NULL;
331 guint i, j;
332 gchar **split;
333
334 /* nothing */
335 if (modules == NULL)
336 goto out;
337
338 /* create array of strings */
339 array = g_ptr_array_new_with_free_func (g_free);
340
341 /* parse each --debug-foo option */
342 for (i=0; modules[i] != NULL; i++) {
343 /* use a comma to delimit multiple entries */
344 split = g_strsplit (modules[i], ",", -1);
345 for (j=0; split[j] != NULL; j++)
346 g_ptr_array_add (array, g_strdup (split[j]));
347 g_strfreev (split);
348 }
349 out:
350 return array;
351 }
352
353 /**
354 * egg_debug_pre_parse_hook:
355 */
356 static gboolean
357 egg_debug_pre_parse_hook (GOptionContext *context, GOptionGroup *group, gpointer data, GError **error)
358 {
359 const gchar *env_string;
360 const GOptionEntry main_entries[] = {
361 { "verbose", 'v', 0, G_OPTION_ARG_NONE, &_verbose,
362 /* TRANSLATORS: turn on all debugging */
363 N_("Show debugging information for all files"), NULL },
364 { NULL}
365 };
366
367 /* global variable */
368 env_string = g_getenv ("VERBOSE");
369 if (env_string != NULL)
370 _verbose = TRUE;
371
372 /* add main entry */
373 g_option_context_add_main_entries (context, main_entries, NULL);
374
375 return TRUE;
376 }
377
378 /**
379 * egg_debug_free:
380 **/
381 static void
382 egg_debug_free (void)
383 {
384 if (!_initialized)
385 return;
386
387 /* close file */
388 if (_fd != -1)
389 close (_fd);
390
391 /* free memory */
392 g_free (_log_filename);
393 if (_modules_array != NULL)
394 g_ptr_array_unref (_modules_array);
395 if (_functions_array != NULL)
396 g_ptr_array_unref (_functions_array);
397 g_strfreev (_modules);
398 g_strfreev (_functions);
399
400 /* can not re-init */
401 _initialized = FALSE;
402 }
403
404 /**
405 * egg_debug_post_parse_hook:
406 */
407 static gboolean
408 egg_debug_post_parse_hook (GOptionContext *context, GOptionGroup *group, gpointer data, GError **error)
409 {
410 _initialized = TRUE;
411 _modules_array = egg_debug_strv_split_to_ptr_array (_modules);
412 _functions_array = egg_debug_strv_split_to_ptr_array (_functions);
413 _console = (isatty (fileno (stdout)) == 1);
414 egg_debug ("Verbose debugging %i (on console %i)", _verbose, _console);
415
416 /* run this function on cleanup */
417 atexit (egg_debug_free);
418
419 return TRUE;
420 }
421
422 /**
423 * egg_debug_get_option_group:
424 *
425 * Returns a #GOptionGroup for the commandline arguments recognized
426 * by debugging. You should add this group to your #GOptionContext
427 * with g_option_context_add_group(), if you are using
428 * g_option_context_parse() to parse your commandline arguments.
429 *
430 * Returns: a #GOptionGroup for the commandline arguments
431 */
432 GOptionGroup *
433 egg_debug_get_option_group (void)
434 {
435 GOptionGroup *group;
436 const GOptionEntry debug_entries[] = {
437 { "debug-modules", '\0', 0, G_OPTION_ARG_STRING_ARRAY, &_modules,
438 /* TRANSLATORS: a list of modules to debug */
439 N_("Debug these specific modules"), NULL },
440 { "debug-functions", '\0', 0, G_OPTION_ARG_STRING_ARRAY, &_functions,
441 /* TRANSLATORS: a list of functions to debug */
442 N_("Debug these specific functions"), NULL },
443 { "debug-log-filename", '\0', 0, G_OPTION_ARG_STRING, &_log_filename,
444 /* TRANSLATORS: save to a log */
445 N_("Log debugging data to a file"), NULL },
446 { NULL}
447 };
448
449 group = g_option_group_new ("debug", _("Debugging Options"), _("Show debugging options"), NULL, NULL);
450 g_option_group_set_parse_hooks (group, egg_debug_pre_parse_hook, egg_debug_post_parse_hook);
451 g_option_group_add_entries (group, debug_entries);
452 return group;
453 }
454
455 /**
456 * egg_debug_init:
457 * @argc: a pointer to the number of command line arguments.
458 * @argv: a pointer to the array of command line arguments.
459 *
460 * Parses command line arguments.
461 *
462 * Return value: %TRUE if initialization succeeded, otherwise %FALSE.
252463 **/
253464 gboolean
254 egg_debug_is_logging (void)
255 {
256 const gchar *env;
257 env = g_getenv (EGG_LOGGING);
258 return (g_strcmp0 (env, "1") == 0);
259 }
260
261 /**
262 * egg_debug_is_console:
263 *
264 * Returns: TRUE if we have debugging enabled
265 **/
266 gboolean
267 egg_debug_is_console (void)
268 {
269 const gchar *env;
270 env = g_getenv (EGG_CONSOLE);
271 return (g_strcmp0 (env, "1") == 0);
272 }
273
274 /**
275 * egg_debug_set_logging:
276 **/
277 void
278 egg_debug_set_logging (gboolean enabled)
279 {
280 if (enabled)
281 g_setenv (EGG_LOGGING, "1", TRUE);
282 else
283 g_setenv (EGG_LOGGING, "0", TRUE);
284
285 if (egg_debug_is_logging ())
286 egg_debug ("logging to %s", EGG_LOG_FILE);
287 }
288
289 /**
290 * egg_debug_init:
291 * @debug: If we should print out verbose logging
292 **/
293 void
294 egg_debug_init (gboolean debug)
295 {
296 /* check if we are on console */
297 if (isatty (fileno (stdout)) == 1)
298 g_setenv (EGG_CONSOLE, "1", FALSE);
299 else
300 g_setenv (EGG_CONSOLE, "0", FALSE);
301 if (debug)
302 g_setenv (EGG_VERBOSE, "1", FALSE);
303 else
304 g_setenv (EGG_VERBOSE, "0", FALSE);
305 egg_debug ("Verbose debugging %i (on console %i)%s", egg_debug_enabled (), egg_debug_is_console (), EGG_VERBOSE);
306 }
307
465 egg_debug_init (gint *argc, gchar ***argv)
466 {
467 GOptionContext *context;
468
469 /* already initialized */
470 if (_initialized)
471 return TRUE;
472
473 context = g_option_context_new (NULL);
474 g_option_context_set_ignore_unknown_options (context, TRUE);
475 g_option_context_add_group (context, egg_debug_get_option_group ());
476 g_option_context_parse (context, argc, argv, NULL);
477 g_option_context_free (context);
478
479 return TRUE;
480 }
481
00 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
11 *
2 * Copyright (C) 2007-2008 Richard Hughes <richard@hughsie.com>
2 * Copyright (C) 2007-2009 Richard Hughes <richard@hughsie.com>
33 *
44 * Licensed under the GNU General Public License Version 2
55 *
5858 #define egg_error(...)
5959 #endif
6060
61 void egg_debug_init (gboolean debug);
62 void egg_debug_set_logging (gboolean enabled);
63 gboolean egg_debug_enabled (void);
64 gboolean egg_debug_is_logging (void);
65 gboolean egg_debug_is_console (void);
66 void egg_debug_backtrace (void);
67 void egg_debug_real (const gchar *func,
61 gboolean egg_debug_init (gint *argc,
62 gchar ***argv);
63 GOptionGroup *egg_debug_get_option_group (void);
64 gboolean egg_debug_is_verbose (void);
65 void egg_debug_backtrace (void);
66 void egg_debug_set_log_filename (const gchar *filename);
67 void egg_debug_real (const gchar *func,
6868 const gchar *file,
69 int line,
69 gint line,
7070 const gchar *format, ...) __attribute__((format (printf,4,5)));
71 void egg_warning_real (const gchar *func,
71 void egg_warning_real (const gchar *func,
7272 const gchar *file,
73 int line,
73 gint line,
7474 const gchar *format, ...) __attribute__((format (printf,4,5)));
75 void egg_error_real (const gchar *func,
75 void egg_error_real (const gchar *func,
7676 const gchar *file,
77 int line,
77 gint line,
7878 const gchar *format, ...) G_GNUC_NORETURN __attribute__((format (printf,4,5)));
7979
8080 G_END_DECLS
142142
143143 if (type != DKP_DEVICE_TYPE_BATTERY)
144144 return FALSE;
145 if (state == DKP_DEVICE_STATE_UNKNOWN)
146 return FALSE;
145147 if (!is_present)
146148 return FALSE;
147149
158160 gboolean ret;
159161 gboolean on_battery;
160162 DkpDeviceSupply *supply = DKP_DEVICE_SUPPLY (device);
161 guint percentage;
163 gdouble percentage;
162164
163165 g_return_val_if_fail (DKP_IS_SUPPLY (supply), FALSE);
164166 g_return_val_if_fail (low_battery != NULL, FALSE);
175177 }
176178
177179 g_object_get (device, "percentage", &percentage, NULL);
178 *low_battery = (percentage < 10);
180 *low_battery = (percentage < 10.0f);
179181 return TRUE;
180182 }
181183
219221
220222 g_object_get (device, "energy", &energy, NULL);
221223
222 if (energy < 0)
224 if (energy < 0.1f)
223225 return;
224226
225 if (supply->priv->energy_old < 0)
227 if (supply->priv->energy_old < 0.1f)
226228 return;
227229
228230 if (supply->priv->energy_old == energy)
237239
238240 /* get the difference in charge */
239241 energy = supply->priv->energy_old - energy;
240 if (energy < 0.1)
242 if (energy < 0.1f)
241243 return;
242244
243245 /* probably okay */
340342 }
341343
342344 /**
345 * dkp_device_supply_make_safe_string:
346 **/
347 static void
348 dkp_device_supply_make_safe_string (gchar *text)
349 {
350 guint i;
351 guint idx = 0;
352
353 /* no point checking */
354 if (text == NULL)
355 return;
356
357 /* shunt up only safe chars */
358 for (i=0; text[i] != '\0'; i++) {
359 if (g_ascii_isprint (text[i])) {
360 /* only copy if the address is going to change */
361 if (idx != i)
362 text[idx] = text[i];
363 idx++;
364 } else {
365 egg_debug ("invalid char '%c'", text[i]);
366 }
367 }
368
369 /* ensure null terminated */
370 text[idx] = '\0';
371 }
372
373 /**
343374 * dkp_device_supply_refresh_battery:
344375 *
345376 * Return %TRUE on success, %FALSE if we failed to refresh or no data
348379 dkp_device_supply_refresh_battery (DkpDeviceSupply *supply)
349380 {
350381 gchar *status = NULL;
351 gchar *technology_native;
382 gchar *technology_native = NULL;
352383 gboolean ret = TRUE;
353384 gdouble voltage_design;
354385 DkpDeviceState old_state;
366397 gdouble voltage;
367398 guint64 time_to_empty;
368399 guint64 time_to_full;
369 gchar *manufacturer;
370 gchar *model_name;
371 gchar *serial_number;
400 gchar *manufacturer = NULL;
401 gchar *model_name = NULL;
402 gchar *serial_number = NULL;
372403 gboolean recall_notice;
373404 const gchar *recall_vendor = NULL;
374405 const gchar *recall_url = NULL;
404435 /* the ACPI spec is bad at defining battery type constants */
405436 technology_native = dkp_device_supply_get_string (native_path, "technology");
406437 g_object_set (device, "technology", dkp_device_supply_convert_device_technology (technology_native), NULL);
407 g_free (technology_native);
408438
409439 /* get values which may be blank */
410440 manufacturer = dkp_device_supply_get_string (native_path, "manufacturer");
411441 model_name = dkp_device_supply_get_string (native_path, "model_name");
412442 serial_number = dkp_device_supply_get_string (native_path, "serial_number");
443
444 /* some vendors fill this with binary garbage */
445 dkp_device_supply_make_safe_string (manufacturer);
446 dkp_device_supply_make_safe_string (model_name);
447 dkp_device_supply_make_safe_string (serial_number);
413448
414449 /* are we possibly recalled by the vendor? */
415450 recall_notice = g_udev_device_has_property (native, "DKP_RECALL_NOTICE");
429464 "recall-vendor", recall_vendor,
430465 "recall-url", recall_url,
431466 NULL);
432
433 g_free (manufacturer);
434 g_free (model_name);
435 g_free (serial_number);
436467
437468 /* these don't change at runtime */
438469 energy_full = sysfs_get_double (native_path, "energy_full") / 1000000.0;
571602 battery_count = dkp_daemon_get_number_devices_of_type (daemon, DKP_DEVICE_TYPE_BATTERY);
572603
573604 /* try to find a suitable icon depending on AC state */
574 if (on_battery && battery_count > 1)
575 state = DKP_DEVICE_STATE_PENDING_DISCHARGE;
576 else if (battery_count > 1)
577 state = DKP_DEVICE_STATE_PENDING_CHARGE;
578 else if (on_battery)
579 state = DKP_DEVICE_STATE_DISCHARGING;
580 else
581 state = DKP_DEVICE_STATE_FULLY_CHARGED;
605 if (battery_count > 1) {
606 if (on_battery && percentage < 1.0f) {
607 /* battery is low */
608 state = DKP_DEVICE_STATE_EMPTY;
609 } else if (on_battery) {
610 /* battery is waiting */
611 state = DKP_DEVICE_STATE_PENDING_DISCHARGE;
612 } else {
613 /* battery is waiting */
614 state = DKP_DEVICE_STATE_PENDING_CHARGE;
615 }
616 } else {
617 if (on_battery) {
618 /* battery is assumed discharging */
619 state = DKP_DEVICE_STATE_DISCHARGING;
620 } else {
621 /* battery is waiting */
622 state = DKP_DEVICE_STATE_FULLY_CHARGED;
623 }
624 }
582625
583626 /* print what we did */
584627 egg_debug ("guessing battery state '%s' using global on-battery:%i",
592635 egg_warning ("Setting %s state empty as unknown and very low", native_path);
593636 state = DKP_DEVICE_STATE_EMPTY;
594637 }
638
639 /* some batteries give out massive rate values when nearly empty */
640 if (energy < 0.1f)
641 energy_rate = 0.0f;
595642
596643 /* calculate a quick and dirty time remaining value */
597644 time_to_empty = 0;
633680 NULL);
634681
635682 out:
683 g_free (technology_native);
684 g_free (manufacturer);
685 g_free (model_name);
686 g_free (serial_number);
636687 g_free (status);
637688 return ret;
638689 }
4040 static gboolean opt_monitor_detail = FALSE;
4141
4242 /**
43 * dkp_tool_get_timestamp:
44 **/
45 static gchar *
46 dkp_tool_get_timestamp (void)
47 {
48 gchar *str_time;
49 gchar *timestamp;
50 time_t the_time;
51 struct timeval time_val;
52
53 time (&the_time);
54 gettimeofday (&time_val, NULL);
55 str_time = g_new0 (gchar, 255);
56 strftime (str_time, 254, "%H:%M:%S", localtime (&the_time));
57
58 /* generate header text */
59 timestamp = g_strdup_printf ("%s.%03i", str_time, (gint) time_val.tv_usec / 1000);
60 g_free (str_time);
61 return timestamp;
62 }
63
64 /**
4365 * dkp_tool_device_added_cb:
4466 **/
4567 static void
4668 dkp_tool_device_added_cb (DkpClient *client, const DkpDevice *device, gpointer user_data)
4769 {
48 g_print ("device added: %s\n", dkp_device_get_object_path (device));
70 gchar *timestamp;
71 timestamp = dkp_tool_get_timestamp ();
72 g_print ("[%s]\tdevice added: %s\n", timestamp, dkp_device_get_object_path (device));
4973 if (opt_monitor_detail) {
5074 dkp_device_print (device);
5175 g_print ("\n");
5276 }
77 g_free (timestamp);
5378 }
5479
5580 /**
5883 static void
5984 dkp_tool_device_changed_cb (DkpClient *client, const DkpDevice *device, gpointer user_data)
6085 {
61 g_print ("device changed: %s\n", dkp_device_get_object_path (device));
86 gchar *timestamp;
87 timestamp = dkp_tool_get_timestamp ();
88 g_print ("[%s]\tdevice changed: %s\n", timestamp, dkp_device_get_object_path (device));
6289 if (opt_monitor_detail) {
6390 /* TODO: would be nice to just show the diff */
6491 dkp_device_print (device);
6592 g_print ("\n");
6693 }
94 g_free (timestamp);
6795 }
6896
6997 /**
72100 static void
73101 dkp_tool_device_removed_cb (DkpClient *client, const DkpDevice *device, gpointer user_data)
74102 {
75 g_print ("device removed: %s\n", dkp_device_get_object_path (device));
103 gchar *timestamp;
104 timestamp = dkp_tool_get_timestamp ();
105 g_print ("[%s]\tdevice removed: %s\n", timestamp, dkp_device_get_object_path (device));
76106 if (opt_monitor_detail)
77107 g_print ("\n");
108 g_free (timestamp);
78109 }
79110
80111 /**
118149 static void
119150 dkp_tool_changed_cb (DkpClient *client, gpointer user_data)
120151 {
121 g_print ("daemon changed:\n");
152 gchar *timestamp;
153 timestamp = dkp_tool_get_timestamp ();
154 g_print ("[%s]\tdaemon changed:\n", timestamp);
122155 if (opt_monitor_detail) {
123156 dkp_client_print (client);
124157 g_print ("\n");
125158 }
159 g_free (timestamp);
126160 }
127161
128162 /**
195229 gint retval = EXIT_FAILURE;
196230 guint i;
197231 GOptionContext *context;
198 gboolean verbose = FALSE;
199232 gboolean opt_dump = FALSE;
200233 gboolean opt_wakeups = FALSE;
201234 gboolean opt_enumerate = FALSE;
209242 DkpDevice *device;
210243
211244 const GOptionEntry entries[] = {
212 { "verbose", '\0', 0, G_OPTION_ARG_NONE, &verbose, _("Show extra debugging information"), NULL },
213245 { "enumerate", 'e', 0, G_OPTION_ARG_NONE, &opt_enumerate, _("Enumerate objects paths for devices"), NULL },
214246 { "dump", 'd', 0, G_OPTION_ARG_NONE, &opt_dump, _("Dump all parameters for all objects"), NULL },
215247 { "wakeups", 'w', 0, G_OPTION_ARG_NONE, &opt_wakeups, _("Get the wakeup data"), NULL },
224256
225257 context = g_option_context_new ("DeviceKit-power tool");
226258 g_option_context_add_main_entries (context, entries, NULL);
259 g_option_context_add_group (context, egg_debug_get_option_group ());
227260 g_option_context_parse (context, &argc, &argv, NULL);
228261 g_option_context_free (context);
229 egg_debug_init (verbose);
230262
231263 loop = g_main_loop_new (NULL, FALSE);
232264 client = dkp_client_new ();
00 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
11 *
2 * Copyright (C) 2007-2008 Richard Hughes <richard@hughsie.com>
2 * Copyright (C) 2007-2009 Richard Hughes <richard@hughsie.com>
33 *
44 * Licensed under the GNU General Public License Version 2
55 *
2424 *
2525 * This file contains functions that can be used for debugging.
2626 */
27
28 #include "config.h"
2729
2830 #include <glib.h>
2931 #include <glib/gi18n.h>
3840 #include <sys/stat.h>
3941 #include <fcntl.h>
4042 #include <time.h>
43
44 #ifdef HAVE_EXECINFO_H
4145 #include <execinfo.h>
46 #endif
4247
4348 #include "egg-debug.h"
4449
5257 #define CONSOLE_CYAN 36
5358 #define CONSOLE_WHITE 37
5459
55 static gint fd = -1;
56
57 /**
58 * pk_set_console_mode:
60 static gint _fd = -1;
61 static gboolean _verbose = FALSE;
62 static gboolean _console = FALSE;
63 static gchar *_log_filename = NULL;
64 static gboolean _initialized = FALSE;
65 static GPtrArray *_modules_array = NULL;
66 static GPtrArray *_functions_array = NULL;
67 static gchar **_modules = NULL;
68 static gchar **_functions = NULL;
69
70 /**
71 * egg_debug_filter_module:
72 **/
73 static gboolean
74 egg_debug_filter_module (const gchar *filename)
75 {
76 gchar *module;
77 const gchar *module_tmp;
78 guint i;
79 gboolean ret = FALSE;
80
81 /* nothing filtering */
82 if (_modules_array == NULL)
83 return FALSE;
84
85 /* are we in the filter list */
86 module = g_strdup (filename);
87 g_strdelimit (module, ".", '\0');
88 for (i=0; i<_modules_array->len; i++) {
89 module_tmp = g_ptr_array_index (_modules_array, i);
90 if (g_strcmp0 (module_tmp, module) == 0) {
91 ret = TRUE;
92 break;
93 }
94 }
95 return ret;
96 }
97
98 /**
99 * egg_debug_filter_function:
100 **/
101 static gboolean
102 egg_debug_filter_function (const gchar *function)
103 {
104 guint i;
105 const gchar *function_tmp;
106 gboolean ret = FALSE;
107
108 /* nothing filtering */
109 if (_functions_array == NULL)
110 return FALSE;
111
112 /* are we in the filter list */
113 for (i=0; i<_functions_array->len; i++) {
114 function_tmp = g_ptr_array_index (_functions_array, i);
115 if (g_str_has_prefix (function, function_tmp)) {
116 ret = TRUE;
117 break;
118 }
119 }
120 return ret;
121 }
122
123 /**
124 * egg_debug_set_console_mode:
59125 **/
60126 static void
61 pk_set_console_mode (guint console_code)
127 egg_debug_set_console_mode (guint console_code)
62128 {
63129 gchar command[13];
64130
65131 /* don't put extra commands into logs */
66 if (!egg_debug_is_console ())
132 if (!_console)
67133 return;
68134
69135 /* Command is the control command to the terminal */
77143 void
78144 egg_debug_backtrace (void)
79145 {
146 #ifdef HAVE_EXECINFO_H
80147 void *call_stack[512];
81148 int call_stack_size;
82149 char **symbols;
85152 call_stack_size = backtrace (call_stack, G_N_ELEMENTS (call_stack));
86153 symbols = backtrace_symbols (call_stack, call_stack_size);
87154 if (symbols != NULL) {
88 pk_set_console_mode (CONSOLE_RED);
155 egg_debug_set_console_mode (CONSOLE_RED);
89156 g_print ("Traceback:\n");
90157 while (i < call_stack_size) {
91158 g_print ("\t%s\n", symbols[i]);
92159 i++;
93160 }
94 pk_set_console_mode (CONSOLE_RESET);
161 egg_debug_set_console_mode (CONSOLE_RESET);
95162 free (symbols);
96163 }
97 }
98
99 /**
100 * pk_log_line:
164 #endif
165 }
166
167 /**
168 * egg_debug_log_line:
101169 **/
102170 static void
103 pk_log_line (const gchar *buffer)
171 egg_debug_log_line (const gchar *buffer)
104172 {
105173 ssize_t count;
174
106175 /* open a file */
107 if (fd == -1) {
176 if (_fd == -1) {
108177 /* ITS4: ignore, /var/log/foo is owned by root, and this is just debug text */
109 fd = open (EGG_LOG_FILE, O_WRONLY|O_APPEND|O_CREAT, 0777);
110 if (fd == -1)
111 g_error ("could not open log: '%s'", EGG_LOG_FILE);
178 _fd = open (_log_filename, O_WRONLY|O_APPEND|O_CREAT, 0777);
179 if (_fd == -1)
180 g_error ("could not open log: '%s'", _log_filename);
112181 }
113182
114183 /* ITS4: ignore, debug text always NULL terminated */
115 count = write (fd, buffer, strlen (buffer));
184 count = write (_fd, buffer, strlen (buffer));
116185 if (count == -1)
117186 g_warning ("could not write %s", buffer);
187
118188 /* newline */
119 count = write (fd, "\n", 1);
189 count = write (_fd, "\n", 1);
120190 if (count == -1)
121191 g_warning ("could not write newline");
122192 }
123193
124194 /**
125 * pk_print_line:
195 * egg_debug_print_line:
126196 **/
127197 static void
128 pk_print_line (const gchar *func, const gchar *file, const int line, const gchar *buffer, guint color)
198 egg_debug_print_line (const gchar *func, const gchar *file, const int line, const gchar *buffer, guint color)
129199 {
130200 gchar *str_time;
131201 gchar *header;
132202 time_t the_time;
133 GThread *thread;
134203
135204 time (&the_time);
136205 str_time = g_new0 (gchar, 255);
137206 strftime (str_time, 254, "%H:%M:%S", localtime (&the_time));
138 thread = g_thread_self ();
139207
140208 /* generate header text */
141 header = g_strdup_printf ("TI:%s\tTH:%p\tFI:%s\tFN:%s,%d", str_time, thread, file, func, line);
209 header = g_strdup_printf ("TI:%s\tFI:%s\tFN:%s,%d", str_time, file, func, line);
142210 g_free (str_time);
143211
144212 /* always in light green */
145 pk_set_console_mode (CONSOLE_GREEN);
213 egg_debug_set_console_mode (CONSOLE_GREEN);
146214 printf ("%s\n", header);
147215
148216 /* different colors according to the severity */
149 pk_set_console_mode (color);
217 egg_debug_set_console_mode (color);
150218 printf (" - %s\n", buffer);
151 pk_set_console_mode (CONSOLE_RESET);
219 egg_debug_set_console_mode (CONSOLE_RESET);
152220
153221 /* log to a file */
154 if (egg_debug_is_logging ()) {
155 pk_log_line (header);
156 pk_log_line (buffer);
222 if (_log_filename != NULL) {
223 egg_debug_log_line (header);
224 egg_debug_log_line (buffer);
157225 }
158226
159227 /* flush this output, as we need to debug */
171239 va_list args;
172240 gchar *buffer = NULL;
173241
174 if (!egg_debug_enabled ())
242 if (!_verbose && !egg_debug_filter_module (file) && !egg_debug_filter_function (func))
175243 return;
176244
177245 va_start (args, format);
178246 g_vasprintf (&buffer, format, args);
179247 va_end (args);
180248
181 pk_print_line (func, file, line, buffer, CONSOLE_BLUE);
182
183 g_free(buffer);
249 egg_debug_print_line (func, file, line, buffer, CONSOLE_BLUE);
250
251 g_free (buffer);
184252 }
185253
186254 /**
192260 va_list args;
193261 gchar *buffer = NULL;
194262
195 if (!egg_debug_enabled ())
263 if (!_verbose && !egg_debug_filter_module (file) && !egg_debug_filter_function (func))
196264 return;
197265
198266 va_start (args, format);
200268 va_end (args);
201269
202270 /* do extra stuff for a warning */
203 if (!egg_debug_is_console ())
271 if (!_console)
204272 printf ("*** WARNING ***\n");
205 pk_print_line (func, file, line, buffer, CONSOLE_RED);
206
207 g_free(buffer);
273 egg_debug_print_line (func, file, line, buffer, CONSOLE_RED);
274
275 g_free (buffer);
208276 }
209277
210278 /**
221289 va_end (args);
222290
223291 /* do extra stuff for a warning */
224 if (!egg_debug_is_console ())
292 if (!_console)
225293 printf ("*** ERROR ***\n");
226 pk_print_line (func, file, line, buffer, CONSOLE_RED);
227 g_free(buffer);
294 egg_debug_print_line (func, file, line, buffer, CONSOLE_RED);
295 g_free (buffer);
228296
229297 /* we want to fix this! */
230298 egg_debug_backtrace ();
233301 }
234302
235303 /**
236 * egg_debug_enabled:
304 * egg_debug_is_verbose:
237305 *
238306 * Returns: TRUE if we have debugging enabled
239307 **/
240308 gboolean
241 egg_debug_enabled (void)
242 {
243 const gchar *env;
244 env = g_getenv (EGG_VERBOSE);
245 return (g_strcmp0 (env, "1") == 0);
246 }
247
248 /**
249 * egg_debug_is_logging:
250 *
251 * Returns: TRUE if we have logging enabled
309 egg_debug_is_verbose (void)
310 {
311 return _verbose;
312 }
313
314 /**
315 * egg_debug_set_log_filename:
316 **/
317 void
318 egg_debug_set_log_filename (const gchar *filename)
319 {
320 g_free (_log_filename);
321 _log_filename = g_strdup (filename);
322 }
323
324 /**
325 * egg_debug_strv_split_to_ptr_array:
326 **/
327 static GPtrArray *
328 egg_debug_strv_split_to_ptr_array (gchar **modules)
329 {
330 GPtrArray *array = NULL;
331 guint i, j;
332 gchar **split;
333
334 /* nothing */
335 if (modules == NULL)
336 goto out;
337
338 /* create array of strings */
339 array = g_ptr_array_new_with_free_func (g_free);
340
341 /* parse each --debug-foo option */
342 for (i=0; modules[i] != NULL; i++) {
343 /* use a comma to delimit multiple entries */
344 split = g_strsplit (modules[i], ",", -1);
345 for (j=0; split[j] != NULL; j++)
346 g_ptr_array_add (array, g_strdup (split[j]));
347 g_strfreev (split);
348 }
349 out:
350 return array;
351 }
352
353 /**
354 * egg_debug_pre_parse_hook:
355 */
356 static gboolean
357 egg_debug_pre_parse_hook (GOptionContext *context, GOptionGroup *group, gpointer data, GError **error)
358 {
359 const gchar *env_string;
360 const GOptionEntry main_entries[] = {
361 { "verbose", 'v', 0, G_OPTION_ARG_NONE, &_verbose,
362 /* TRANSLATORS: turn on all debugging */
363 N_("Show debugging information for all files"), NULL },
364 { NULL}
365 };
366
367 /* global variable */
368 env_string = g_getenv ("VERBOSE");
369 if (env_string != NULL)
370 _verbose = TRUE;
371
372 /* add main entry */
373 g_option_context_add_main_entries (context, main_entries, NULL);
374
375 return TRUE;
376 }
377
378 /**
379 * egg_debug_free:
380 **/
381 static void
382 egg_debug_free (void)
383 {
384 if (!_initialized)
385 return;
386
387 /* close file */
388 if (_fd != -1)
389 close (_fd);
390
391 /* free memory */
392 g_free (_log_filename);
393 if (_modules_array != NULL)
394 g_ptr_array_unref (_modules_array);
395 if (_functions_array != NULL)
396 g_ptr_array_unref (_functions_array);
397 g_strfreev (_modules);
398 g_strfreev (_functions);
399
400 /* can not re-init */
401 _initialized = FALSE;
402 }
403
404 /**
405 * egg_debug_post_parse_hook:
406 */
407 static gboolean
408 egg_debug_post_parse_hook (GOptionContext *context, GOptionGroup *group, gpointer data, GError **error)
409 {
410 _initialized = TRUE;
411 _modules_array = egg_debug_strv_split_to_ptr_array (_modules);
412 _functions_array = egg_debug_strv_split_to_ptr_array (_functions);
413 _console = (isatty (fileno (stdout)) == 1);
414 egg_debug ("Verbose debugging %i (on console %i)", _verbose, _console);
415
416 /* run this function on cleanup */
417 atexit (egg_debug_free);
418
419 return TRUE;
420 }
421
422 /**
423 * egg_debug_get_option_group:
424 *
425 * Returns a #GOptionGroup for the commandline arguments recognized
426 * by debugging. You should add this group to your #GOptionContext
427 * with g_option_context_add_group(), if you are using
428 * g_option_context_parse() to parse your commandline arguments.
429 *
430 * Returns: a #GOptionGroup for the commandline arguments
431 */
432 GOptionGroup *
433 egg_debug_get_option_group (void)
434 {
435 GOptionGroup *group;
436 const GOptionEntry debug_entries[] = {
437 { "debug-modules", '\0', 0, G_OPTION_ARG_STRING_ARRAY, &_modules,
438 /* TRANSLATORS: a list of modules to debug */
439 N_("Debug these specific modules"), NULL },
440 { "debug-functions", '\0', 0, G_OPTION_ARG_STRING_ARRAY, &_functions,
441 /* TRANSLATORS: a list of functions to debug */
442 N_("Debug these specific functions"), NULL },
443 { "debug-log-filename", '\0', 0, G_OPTION_ARG_STRING, &_log_filename,
444 /* TRANSLATORS: save to a log */
445 N_("Log debugging data to a file"), NULL },
446 { NULL}
447 };
448
449 group = g_option_group_new ("debug", _("Debugging Options"), _("Show debugging options"), NULL, NULL);
450 g_option_group_set_parse_hooks (group, egg_debug_pre_parse_hook, egg_debug_post_parse_hook);
451 g_option_group_add_entries (group, debug_entries);
452 return group;
453 }
454
455 /**
456 * egg_debug_init:
457 * @argc: a pointer to the number of command line arguments.
458 * @argv: a pointer to the array of command line arguments.
459 *
460 * Parses command line arguments.
461 *
462 * Return value: %TRUE if initialization succeeded, otherwise %FALSE.
252463 **/
253464 gboolean
254 egg_debug_is_logging (void)
255 {
256 const gchar *env;
257 env = g_getenv (EGG_LOGGING);
258 return (g_strcmp0 (env, "1") == 0);
259 }
260
261 /**
262 * egg_debug_is_console:
263 *
264 * Returns: TRUE if we have debugging enabled
265 **/
266 gboolean
267 egg_debug_is_console (void)
268 {
269 const gchar *env;
270 env = g_getenv (EGG_CONSOLE);
271 return (g_strcmp0 (env, "1") == 0);
272 }
273
274 /**
275 * egg_debug_set_logging:
276 **/
277 void
278 egg_debug_set_logging (gboolean enabled)
279 {
280 if (enabled)
281 g_setenv (EGG_LOGGING, "1", TRUE);
282 else
283 g_setenv (EGG_LOGGING, "0", TRUE);
284
285 if (egg_debug_is_logging ())
286 egg_debug ("logging to %s", EGG_LOG_FILE);
287 }
288
289 /**
290 * egg_debug_init:
291 * @debug: If we should print out verbose logging
292 **/
293 void
294 egg_debug_init (gboolean debug)
295 {
296 /* check if we are on console */
297 if (isatty (fileno (stdout)) == 1)
298 g_setenv (EGG_CONSOLE, "1", FALSE);
299 else
300 g_setenv (EGG_CONSOLE, "0", FALSE);
301 if (debug)
302 g_setenv (EGG_VERBOSE, "1", FALSE);
303 else
304 g_setenv (EGG_VERBOSE, "0", FALSE);
305 egg_debug ("Verbose debugging %i (on console %i)%s", egg_debug_enabled (), egg_debug_is_console (), EGG_VERBOSE);
306 }
307
465 egg_debug_init (gint *argc, gchar ***argv)
466 {
467 GOptionContext *context;
468
469 /* already initialized */
470 if (_initialized)
471 return TRUE;
472
473 context = g_option_context_new (NULL);
474 g_option_context_set_ignore_unknown_options (context, TRUE);
475 g_option_context_add_group (context, egg_debug_get_option_group ());
476 g_option_context_parse (context, argc, argv, NULL);
477 g_option_context_free (context);
478
479 return TRUE;
480 }
481
00 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
11 *
2 * Copyright (C) 2007-2008 Richard Hughes <richard@hughsie.com>
2 * Copyright (C) 2007-2009 Richard Hughes <richard@hughsie.com>
33 *
44 * Licensed under the GNU General Public License Version 2
55 *
5858 #define egg_error(...)
5959 #endif
6060
61 void egg_debug_init (gboolean debug);
62 void egg_debug_set_logging (gboolean enabled);
63 gboolean egg_debug_enabled (void);
64 gboolean egg_debug_is_logging (void);
65 gboolean egg_debug_is_console (void);
66 void egg_debug_backtrace (void);
67 void egg_debug_real (const gchar *func,
61 gboolean egg_debug_init (gint *argc,
62 gchar ***argv);
63 GOptionGroup *egg_debug_get_option_group (void);
64 gboolean egg_debug_is_verbose (void);
65 void egg_debug_backtrace (void);
66 void egg_debug_set_log_filename (const gchar *filename);
67 void egg_debug_real (const gchar *func,
6868 const gchar *file,
69 int line,
69 gint line,
7070 const gchar *format, ...) __attribute__((format (printf,4,5)));
71 void egg_warning_real (const gchar *func,
71 void egg_warning_real (const gchar *func,
7272 const gchar *file,
73 int line,
73 gint line,
7474 const gchar *format, ...) __attribute__((format (printf,4,5)));
75 void egg_error_real (const gchar *func,
75 void egg_error_real (const gchar *func,
7676 const gchar *file,
77 int line,
77 gint line,
7878 const gchar *format, ...) G_GNUC_NORETURN __attribute__((format (printf,4,5)));
7979
8080 G_END_DECLS