diff -Nru battery-stats-0.3.5/debian/battery-stats.desktop battery-stats-0.3.6/debian/battery-stats.desktop --- battery-stats-0.3.5/debian/battery-stats.desktop 2010-05-31 04:36:14.000000000 +0100 +++ battery-stats-0.3.6/debian/battery-stats.desktop 2010-05-31 04:36:14.000000000 +0100 @@ -1,6 +1,7 @@ [Desktop Entry] Name=Battery Charge Graph Type=Application +Comment=Battery Charge Graph Exec=/usr/bin/battery-graph Icon=/usr/share/battery-graph/pixmaps/battery-stats.xpm Terminal=false diff -Nru battery-stats-0.3.5/debian/changelog battery-stats-0.3.6/debian/changelog --- battery-stats-0.3.5/debian/changelog 2010-05-31 04:36:14.000000000 +0100 +++ battery-stats-0.3.6/debian/changelog 2010-05-31 04:36:14.000000000 +0100 @@ -1,9 +1,13 @@ -battery-stats (0.3.5-1ubuntu1) karmic; urgency=low +battery-stats (0.3.6-1) unstable; urgency=low - * debian/battery-stats.desktop: - - fix bug in desktop file (Comment line wrong) + * New upstream release that integrates a patch to specify the battery + number (Closes: 535815) + * debian/control: + + Standars-Version bumped to 3.8.3 + + Architecture modified so it builds only where libacpi is present + * debian/battery-stats.desktop: added a Comment (Closes: 537946) - -- Michael Vogt Fri, 04 Sep 2009 09:44:37 +0200 + -- Antonio Radici Sat, 19 Sep 2009 22:28:40 +0100 battery-stats (0.3.5-1) unstable; urgency=low diff -Nru battery-stats-0.3.5/debian/control battery-stats-0.3.6/debian/control --- battery-stats-0.3.5/debian/control 2010-05-31 04:36:14.000000000 +0100 +++ battery-stats-0.3.6/debian/control 2010-05-31 04:36:14.000000000 +0100 @@ -1,15 +1,14 @@ Source: battery-stats Section: admin Priority: extra -Maintainer: Ubuntu Developers -XSBC-Original-Maintainer: Antonio Radici +Maintainer: Antonio Radici Build-Depends: debhelper (>= 7), libapm-dev, libacpi-dev [i386 amd64 ia64], cdbs, autotools-dev, gnuplot-nox (>= 4), imagemagick -Standards-Version: 3.8.1 +Standards-Version: 3.8.3 DM-Upload-Allowed: yes Homepage: http://theforest.dyne.org/battery-stats/ Package: battery-stats -Architecture: any +Architecture: sparc ia64 amd64 i386 Depends: logrotate, gnuplot (>= 4.0.0), gzip (>= 1.3.2), ${shlibs:Depends}, ${misc:Depends} Description: collects statistics about charge of laptop batteries This package provides battery-stats-collector, a daemon which will periodically diff -Nru battery-stats-0.3.5/debian/init.d battery-stats-0.3.6/debian/init.d --- battery-stats-0.3.5/debian/init.d 2010-05-31 04:36:14.000000000 +0100 +++ battery-stats-0.3.6/debian/init.d 2010-05-31 04:36:14.000000000 +0100 @@ -10,7 +10,7 @@ # # Based on skeleton written by Miquel van Smoorenburg . # Modified for Debian GNU/Linux by Ian Murdock . -# Modified for battery-stats by Karl E. Jørgensen +# Modified for battery-stats by Karl E. Jørgensen PATH=/sbin:/bin:/usr/sbin:/usr/bin DAEMON=/usr/sbin/battery-stats-collector diff -Nru battery-stats-0.3.5/src/battery-stats-collector.c battery-stats-0.3.6/src/battery-stats-collector.c --- battery-stats-0.3.5/src/battery-stats-collector.c 2009-06-13 20:54:14.000000000 +0100 +++ battery-stats-0.3.6/src/battery-stats-collector.c 2009-09-19 22:21:46.000000000 +0100 @@ -42,6 +42,7 @@ { "syslog", no_argument, NULL, 's' }, { "flush", required_argument, NULL, 'F' }, { "ignore-missing-battery", no_argument, NULL, 'I' }, + { "battery-num", required_argument, NULL, 'b' }, { NULL, 0, NULL, 0 } }; @@ -58,6 +59,8 @@ static char *myname = "battery-stats-collector"; static char *myversion = "0.3.3"; +static int battery_num = 0; + static int do_syslog = 0; #define COMPLAIN(loglevel, args...) if (do_syslog) syslog(loglevel, ## args); \ else { fprintf(stderr,"%s: ", myname); fprintf(stderr, ##args); } @@ -77,7 +80,7 @@ int c; char *end; - c = getopt_long(argc, argv, "o:i:Vh1sF:", long_options, &option_index); + c = getopt_long(argc, argv, "o:i:Vh1sF:b:", long_options, &option_index); if (c == -1) break; @@ -143,6 +146,21 @@ } break; + case 'b': + battery_num = strtol(optarg, &end, 10); + if (*end != 0) + { + fprintf(stderr, "%s: Invalid battery number '%s'\n", myname, optarg); + exit(2); + } + + if (battery_num < 0) + { + fprintf(stderr, "%s: Invalid negative battery number '%s'\n", myname, optarg); + exit(2); + } + break; + default: /* getopt_long will already have complained on stderr ... */ fprintf(stderr,"%s: Try %s --help for options\n", myname, myname); @@ -180,10 +198,12 @@ switch(retval) { case SUCCESS: - COMPLAIN(LOG_INFO, "Number of batteries: %i.%s\n", - libacpi_global->batt_count, - libacpi_global->batt_count > 1 ? - " Reading info from first battery only. " : ""); + COMPLAIN(LOG_INFO, "Number of batteries: %i.\n", + libacpi_global->batt_count); + if (libacpi_global->batt_count > 1) { + COMPLAIN(LOG_INFO, + "Reading info from battery %d only.\n", battery_num); + } break; case NOT_SUPPORTED: COMPLAIN(LOG_WARNING, "You have more than %i batteries. " @@ -371,16 +391,22 @@ static void acpidump(FILE *output, const int ignore_missing_battery, global_t *libacpi_global) { - int rc = read_acpi_batt(0); + int rc; + + if (battery_num >= libacpi_global->batt_count) { + COMPLAIN(LOG_ERR,"Battery %d doesn't exist. The number of batteries is: %d.\n", battery_num, libacpi_global->batt_count); + return; + } + rc = read_acpi_batt(battery_num); if (rc != SUCCESS) { - COMPLAIN(LOG_ERR,"read_acpi_batt(0) failed with error code %d\n", rc); + COMPLAIN(LOG_ERR,"read_acpi_batt(%d) failed with error code %d\n", battery_num, rc); return; } - if (!batteries[0].present) + if (!batteries[battery_num].present) { if (!ignore_missing_battery) { - COMPLAIN(LOG_WARNING, "Battery 0 absent\n"); + COMPLAIN(LOG_WARNING, "Battery %d absent\n", battery_num); } return; } @@ -392,10 +418,10 @@ return; } - check_and_write_log_line(output, batteries[0].percentage, + check_and_write_log_line(output, batteries[battery_num].percentage, (libacpi_global->adapt.ac_state == P_BATT) ? 2 : ((libacpi_global->adapt.ac_state == P_AC) ? 1 : 0), - batteries[0].remaining_time); + batteries[battery_num].remaining_time); } #endif