~ubuntu-branches/ubuntu/natty/upower/natty

« back to all changes in this revision

Viewing changes to src/linux/up-device-supply.c

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2010-07-12 14:43:12 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20100712144312-mk9w8zlsw2cztdb7
Tags: 0.9.5-1
* New upstream release:
  - Dynamic testing for enough hibernate swap. (LP: #599352)
  - Port UPower to libusb1 to avoid unfixable crashes. (LP: #522827)
* debian/rules: Build a PO template during package build, for translation
  systems. (LP: #538321)
* debian/control: Switch libusb-dev build dependency to libusb-1.0-0-dev,
  and add libimobiledevice-dev to support the new backend.
* debian/control: Bump Standards-Version to 3.9.0; no changes necessary.
* Drop transitional devicekit-power-doc package. It's been in testing long
  enough, and we do not want to carry it into the squeeze release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
104
104
                      "vendor", NULL,
105
105
                      "model", NULL,
106
106
                      "serial", NULL,
107
 
                      "update-time", 0,
 
107
                      "update-time", (guint64) 0,
108
108
                      "power-supply", FALSE,
109
109
                      "online", FALSE,
110
 
                      "energy", 0.0,
 
110
                      "energy", (gdouble) 0.0,
111
111
                      "is-present", FALSE,
112
112
                      "is-rechargeable", FALSE,
113
113
                      "has-history", FALSE,
114
114
                      "has-statistics", FALSE,
115
 
                      "state", NULL,
116
 
                      "capacity", 0.0,
117
 
                      "energy-empty", 0.0,
118
 
                      "energy-full", 0.0,
119
 
                      "energy-full-design", 0.0,
120
 
                      "energy-rate", 0.0,
121
 
                      "voltage", 0.0,
122
 
                      "time-to-empty", 0,
123
 
                      "time-to-full", 0,
124
 
                      "percentage", 0,
125
 
                      "technology", NULL,
 
115
                      "state", UP_DEVICE_STATE_UNKNOWN,
 
116
                      "capacity", (gdouble) 0.0,
 
117
                      "energy-empty", (gdouble) 0.0,
 
118
                      "energy-full", (gdouble) 0.0,
 
119
                      "energy-full-design", (gdouble) 0.0,
 
120
                      "energy-rate", (gdouble) 0.0,
 
121
                      "voltage", (gdouble) 0.0,
 
122
                      "time-to-empty", (gint64) 0,
 
123
                      "time-to-full", (gint64) 0,
 
124
                      "percentage", (gdouble) 0.0,
 
125
                      "technology", UP_DEVICE_TECHNOLOGY_UNKNOWN,
126
126
                      NULL);
127
127
}
128
128
 
412
412
        gdouble energy_full;
413
413
        gdouble energy_full_design;
414
414
        gdouble energy_rate;
415
 
        gdouble capacity;
 
415
        gdouble capacity = 100.0f;
416
416
        gdouble percentage = 0.0f;
417
417
        gdouble voltage;
418
 
        guint64 time_to_empty;
419
 
        guint64 time_to_full;
 
418
        gint64 time_to_empty;
 
419
        gint64 time_to_full;
420
420
        gchar *manufacturer = NULL;
421
421
        gchar *model_name = NULL;
422
422
        gchar *serial_number = NULL;
804
804
                supply->priv->poll_timer_id =
805
805
                        g_timeout_add_seconds (UP_DEVICE_SUPPLY_UNKNOWN_TIMEOUT,
806
806
                                               (GSourceFunc) up_device_supply_poll_battery, supply);
 
807
#if GLIB_CHECK_VERSION(2,25,8)
 
808
                g_source_set_name_by_id (supply->priv->poll_timer_id, "[UpDeviceSupply] unknown poll");
 
809
#endif
807
810
                /* increase count, we don't want to poll at 0.5Hz forever */
808
811
                supply->priv->unknown_retries++;
809
812
                goto out;
813
816
        supply->priv->poll_timer_id =
814
817
                g_timeout_add_seconds (UP_DEVICE_SUPPLY_REFRESH_TIMEOUT,
815
818
                                       (GSourceFunc) up_device_supply_poll_battery, supply);
 
819
#if GLIB_CHECK_VERSION(2,25,8)
 
820
        g_source_set_name_by_id (supply->priv->poll_timer_id, "[UpDeviceSupply] normal poll");
 
821
#endif
816
822
out:
817
823
        return (supply->priv->poll_timer_id != 0);
818
824
}