~ubuntu-branches/ubuntu/karmic/devicekit-power/karmic-proposed

« back to all changes in this revision

Viewing changes to src/dkp-hid.c

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2009-01-08 11:43:09 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20090108114309-sz25jx234bgww096
Tags: 003-0ubuntu1
* New upstream version 003.
* debian/control: Bump libdevkit-gobject-dev build dependency.
* debian/contro: Replace Debian's Vcs-Svn: with our Vcs-Bzr: branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
#include <glib/gstdio.h>
33
33
#include <glib/gi18n-lib.h>
34
34
#include <glib-object.h>
35
 
#include <devkit-gobject.h>
 
35
#include <devkit-gobject/devkit-gobject.h>
36
36
 
37
37
/* asm/types.h required for __s32 in linux/hiddev.h */
38
38
#include <asm/types.h>
169
169
}
170
170
 
171
171
/**
 
172
 * dkp_hid_convert_device_technology:
 
173
 **/
 
174
static DkpDeviceTechnology
 
175
dkp_hid_convert_device_technology (const gchar *type)
 
176
{
 
177
        if (type == NULL)
 
178
                return DKP_DEVICE_TECHNOLGY_UNKNOWN;
 
179
        if (strcasecmp (type, "pb") == 0 ||
 
180
            strcasecmp (type, "pbac") == 0)
 
181
                return DKP_DEVICE_TECHNOLGY_LEAD_ACID;
 
182
        return DKP_DEVICE_TECHNOLGY_UNKNOWN;
 
183
}
 
184
 
 
185
/**
172
186
 * dkp_hid_set_obj:
173
187
 **/
174
188
static gboolean
202
216
                break;
203
217
        case DKP_HID_CHEMISTRY:
204
218
                type = dkp_hid_get_string (hid, value);
205
 
                obj->technology = dkp_acpi_to_device_technology (type);
 
219
                obj->technology = dkp_hid_convert_device_technology (type);
206
220
                break;
207
221
        case DKP_HID_RECHARGEABLE:
208
222
                obj->is_rechargeable = (value != 0);
289
303
 
290
304
        /* get the type */
291
305
        type = devkit_device_get_property (d, "DKP_BATTERY_TYPE");
292
 
        if (type == NULL || !egg_strequal (type, "ups")) {
293
 
                egg_debug ("not a UPS device");
 
306
        if (type == NULL || !egg_strequal (type, "ups"))
294
307
                goto out;
295
 
        }
296
308
 
297
309
        /* get the device file */
298
310
        device_file = devkit_device_get_device_file (d);
320
332
        obj->is_rechargeable = TRUE;
321
333
        obj->power_supply = TRUE;
322
334
        obj->is_present = TRUE;
 
335
        obj->has_history = TRUE;
 
336
        obj->has_statistics = TRUE;
323
337
 
324
338
        /* try and get from udev if UPS is being difficult */
325
339
        if (obj->vendor == NULL)