Commit 2a9dff08 authored by Richard Hughes's avatar Richard Hughes

trivial: convert freebsd private object to using upower prefix (no ABI or API changes)

parent 8d4ec582
/* dkp-acpi-native.c generated by valac, the Vala compiler
* generated from dkp-acpi-native.vala, do not modify */
/* up-acpi-native.c generated by valac, the Vala compiler
* generated from up-acpi-native.vala, do not modify */
#include <glib.h>
......@@ -8,69 +8,69 @@
#include <string.h>
#define TYPE_DKP_ACPI_NATIVE (dkp_acpi_native_get_type ())
#define DKP_ACPI_NATIVE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DKP_ACPI_NATIVE, DkpAcpiNative))
#define DKP_ACPI_NATIVE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DKP_ACPI_NATIVE, DkpAcpiNativeClass))
#define IS_DKP_ACPI_NATIVE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DKP_ACPI_NATIVE))
#define IS_DKP_ACPI_NATIVE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DKP_ACPI_NATIVE))
#define DKP_ACPI_NATIVE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DKP_ACPI_NATIVE, DkpAcpiNativeClass))
#define TYPE_UP_ACPI_NATIVE (up_acpi_native_get_type ())
#define UP_ACPI_NATIVE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_UP_ACPI_NATIVE, UpAcpiNative))
#define UP_ACPI_NATIVE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_UP_ACPI_NATIVE, UpAcpiNativeClass))
#define IS_UP_ACPI_NATIVE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_UP_ACPI_NATIVE))
#define IS_UP_ACPI_NATIVE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_UP_ACPI_NATIVE))
#define UP_ACPI_NATIVE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_UP_ACPI_NATIVE, UpAcpiNativeClass))
typedef struct _DkpAcpiNative DkpAcpiNative;
typedef struct _DkpAcpiNativeClass DkpAcpiNativeClass;
typedef struct _DkpAcpiNativePrivate DkpAcpiNativePrivate;
typedef struct _UpAcpiNative UpAcpiNative;
typedef struct _UpAcpiNativeClass UpAcpiNativeClass;
typedef struct _UpAcpiNativePrivate UpAcpiNativePrivate;
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))
#define _g_match_info_free0(var) ((var == NULL) ? NULL : (var = (g_match_info_free (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
struct _DkpAcpiNative {
struct _UpAcpiNative {
GObject parent_instance;
DkpAcpiNativePrivate * priv;
UpAcpiNativePrivate * priv;
};
struct _DkpAcpiNativeClass {
struct _UpAcpiNativeClass {
GObjectClass parent_class;
};
struct _DkpAcpiNativePrivate {
struct _UpAcpiNativePrivate {
gchar *_driver;
gint _unit;
gchar *_path;
};
static gpointer dkp_acpi_native_parent_class = NULL;
static gpointer up_acpi_native_parent_class = NULL;
GType dkp_acpi_native_get_type (void);
#define DKP_ACPI_NATIVE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_DKP_ACPI_NATIVE, DkpAcpiNativePrivate))
GType up_acpi_native_get_type (void);
#define UP_ACPI_NATIVE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_UP_ACPI_NATIVE, UpAcpiNativePrivate))
enum {
DKP_ACPI_NATIVE_DUMMY_PROPERTY,
DKP_ACPI_NATIVE_DRIVER,
DKP_ACPI_NATIVE_UNIT,
DKP_ACPI_NATIVE_PATH
UP_ACPI_NATIVE_DUMMY_PROPERTY,
UP_ACPI_NATIVE_DRIVER,
UP_ACPI_NATIVE_UNIT,
UP_ACPI_NATIVE_PATH
};
DkpAcpiNative* dkp_acpi_native_new (const char* path);
DkpAcpiNative* dkp_acpi_native_construct (GType object_type, const char* path);
DkpAcpiNative* dkp_acpi_native_new_driver_unit (const char* driver, gint unit);
DkpAcpiNative* dkp_acpi_native_construct_driver_unit (GType object_type, const char* driver, gint unit);
const char* dkp_acpi_native_get_driver (DkpAcpiNative* self);
gint dkp_acpi_native_get_unit (DkpAcpiNative* self);
const char* dkp_acpi_native_get_path (DkpAcpiNative* self);
static void dkp_acpi_native_finalize (GObject* obj);
static void dkp_acpi_native_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
UpAcpiNative* up_acpi_native_new (const char* path);
UpAcpiNative* up_acpi_native_construct (GType object_type, const char* path);
UpAcpiNative* up_acpi_native_new_driver_unit (const char* driver, gint unit);
UpAcpiNative* up_acpi_native_construct_driver_unit (GType object_type, const char* driver, gint unit);
const char* up_acpi_native_get_driver (UpAcpiNative* self);
gint up_acpi_native_get_unit (UpAcpiNative* self);
const char* up_acpi_native_get_path (UpAcpiNative* self);
static void up_acpi_native_finalize (GObject* obj);
static void up_acpi_native_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
DkpAcpiNative* dkp_acpi_native_construct (GType object_type, const char* path) {
UpAcpiNative* up_acpi_native_construct (GType object_type, const char* path) {
GError * _inner_error_;
DkpAcpiNative * self;
UpAcpiNative * self;
GRegex* r;
GMatchInfo* mi;
gboolean ret = FALSE;
char* _tmp9_;
g_return_val_if_fail (path != NULL, NULL);
_inner_error_ = NULL;
self = (DkpAcpiNative*) g_object_new (object_type, NULL);
self = (UpAcpiNative*) g_object_new (object_type, NULL);
r = NULL;
mi = NULL;
{
......@@ -128,17 +128,17 @@ DkpAcpiNative* dkp_acpi_native_construct (GType object_type, const char* path) {
}
DkpAcpiNative* dkp_acpi_native_new (const char* path) {
return dkp_acpi_native_construct (TYPE_DKP_ACPI_NATIVE, path);
UpAcpiNative* up_acpi_native_new (const char* path) {
return up_acpi_native_construct (TYPE_UP_ACPI_NATIVE, path);
}
DkpAcpiNative* dkp_acpi_native_construct_driver_unit (GType object_type, const char* driver, gint unit) {
DkpAcpiNative * self;
UpAcpiNative* up_acpi_native_construct_driver_unit (GType object_type, const char* driver, gint unit) {
UpAcpiNative * self;
char* _tmp0_;
char* _tmp1_;
g_return_val_if_fail (driver != NULL, NULL);
self = (DkpAcpiNative*) g_object_new (object_type, NULL);
self = (UpAcpiNative*) g_object_new (object_type, NULL);
self->priv->_driver = (_tmp0_ = g_strdup (driver), _g_free0 (self->priv->_driver), _tmp0_);
self->priv->_unit = unit;
self->priv->_path = (_tmp1_ = g_strdup_printf ("dev.%s.%i", self->priv->_driver, self->priv->_unit), _g_free0 (self->priv->_path), _tmp1_);
......@@ -146,12 +146,12 @@ DkpAcpiNative* dkp_acpi_native_construct_driver_unit (GType object_type, const c
}
DkpAcpiNative* dkp_acpi_native_new_driver_unit (const char* driver, gint unit) {
return dkp_acpi_native_construct_driver_unit (TYPE_DKP_ACPI_NATIVE, driver, unit);
UpAcpiNative* up_acpi_native_new_driver_unit (const char* driver, gint unit) {
return up_acpi_native_construct_driver_unit (TYPE_UP_ACPI_NATIVE, driver, unit);
}
const char* dkp_acpi_native_get_driver (DkpAcpiNative* self) {
const char* up_acpi_native_get_driver (UpAcpiNative* self) {
const char* result;
g_return_val_if_fail (self != NULL, NULL);
result = self->priv->_driver;
......@@ -159,7 +159,7 @@ const char* dkp_acpi_native_get_driver (DkpAcpiNative* self) {
}
gint dkp_acpi_native_get_unit (DkpAcpiNative* self) {
gint up_acpi_native_get_unit (UpAcpiNative* self) {
gint result;
g_return_val_if_fail (self != NULL, 0);
result = self->priv->_unit;
......@@ -167,7 +167,7 @@ gint dkp_acpi_native_get_unit (DkpAcpiNative* self) {
}
const char* dkp_acpi_native_get_path (DkpAcpiNative* self) {
const char* up_acpi_native_get_path (UpAcpiNative* self) {
const char* result;
g_return_val_if_fail (self != NULL, NULL);
result = self->priv->_path;
......@@ -175,53 +175,53 @@ const char* dkp_acpi_native_get_path (DkpAcpiNative* self) {
}
static void dkp_acpi_native_class_init (DkpAcpiNativeClass * klass) {
dkp_acpi_native_parent_class = g_type_class_peek_parent (klass);
g_type_class_add_private (klass, sizeof (DkpAcpiNativePrivate));
G_OBJECT_CLASS (klass)->get_property = dkp_acpi_native_get_property;
G_OBJECT_CLASS (klass)->finalize = dkp_acpi_native_finalize;
g_object_class_install_property (G_OBJECT_CLASS (klass), DKP_ACPI_NATIVE_DRIVER, g_param_spec_string ("driver", "driver", "driver", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
g_object_class_install_property (G_OBJECT_CLASS (klass), DKP_ACPI_NATIVE_UNIT, g_param_spec_int ("unit", "unit", "unit", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
g_object_class_install_property (G_OBJECT_CLASS (klass), DKP_ACPI_NATIVE_PATH, g_param_spec_string ("path", "path", "path", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
static void up_acpi_native_class_init (UpAcpiNativeClass * klass) {
up_acpi_native_parent_class = g_type_class_peek_parent (klass);
g_type_class_add_private (klass, sizeof (UpAcpiNativePrivate));
G_OBJECT_CLASS (klass)->get_property = up_acpi_native_get_property;
G_OBJECT_CLASS (klass)->finalize = up_acpi_native_finalize;
g_object_class_install_property (G_OBJECT_CLASS (klass), UP_ACPI_NATIVE_DRIVER, g_param_spec_string ("driver", "driver", "driver", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
g_object_class_install_property (G_OBJECT_CLASS (klass), UP_ACPI_NATIVE_UNIT, g_param_spec_int ("unit", "unit", "unit", G_MININT, G_MAXINT, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
g_object_class_install_property (G_OBJECT_CLASS (klass), UP_ACPI_NATIVE_PATH, g_param_spec_string ("path", "path", "path", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
}
static void dkp_acpi_native_instance_init (DkpAcpiNative * self) {
self->priv = DKP_ACPI_NATIVE_GET_PRIVATE (self);
static void up_acpi_native_instance_init (UpAcpiNative * self) {
self->priv = UP_ACPI_NATIVE_GET_PRIVATE (self);
}
static void dkp_acpi_native_finalize (GObject* obj) {
DkpAcpiNative * self;
self = DKP_ACPI_NATIVE (obj);
static void up_acpi_native_finalize (GObject* obj) {
UpAcpiNative * self;
self = UP_ACPI_NATIVE (obj);
_g_free0 (self->priv->_driver);
_g_free0 (self->priv->_path);
G_OBJECT_CLASS (dkp_acpi_native_parent_class)->finalize (obj);
G_OBJECT_CLASS (up_acpi_native_parent_class)->finalize (obj);
}
GType dkp_acpi_native_get_type (void) {
static GType dkp_acpi_native_type_id = 0;
if (dkp_acpi_native_type_id == 0) {
static const GTypeInfo g_define_type_info = { sizeof (DkpAcpiNativeClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dkp_acpi_native_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DkpAcpiNative), 0, (GInstanceInitFunc) dkp_acpi_native_instance_init, NULL };
dkp_acpi_native_type_id = g_type_register_static (G_TYPE_OBJECT, "DkpAcpiNative", &g_define_type_info, 0);
GType up_acpi_native_get_type (void) {
static GType up_acpi_native_type_id = 0;
if (up_acpi_native_type_id == 0) {
static const GTypeInfo g_define_type_info = { sizeof (UpAcpiNativeClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) up_acpi_native_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (UpAcpiNative), 0, (GInstanceInitFunc) up_acpi_native_instance_init, NULL };
up_acpi_native_type_id = g_type_register_static (G_TYPE_OBJECT, "UpAcpiNative", &g_define_type_info, 0);
}
return dkp_acpi_native_type_id;
return up_acpi_native_type_id;
}
static void dkp_acpi_native_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
DkpAcpiNative * self;
self = DKP_ACPI_NATIVE (object);
static void up_acpi_native_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
UpAcpiNative * self;
self = UP_ACPI_NATIVE (object);
switch (property_id) {
case DKP_ACPI_NATIVE_DRIVER:
g_value_set_string (value, dkp_acpi_native_get_driver (self));
case UP_ACPI_NATIVE_DRIVER:
g_value_set_string (value, up_acpi_native_get_driver (self));
break;
case DKP_ACPI_NATIVE_UNIT:
g_value_set_int (value, dkp_acpi_native_get_unit (self));
case UP_ACPI_NATIVE_UNIT:
g_value_set_int (value, up_acpi_native_get_unit (self));
break;
case DKP_ACPI_NATIVE_PATH:
g_value_set_string (value, dkp_acpi_native_get_path (self));
case UP_ACPI_NATIVE_PATH:
g_value_set_string (value, up_acpi_native_get_path (self));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
......
/* dkp-acpi-native.h generated by valac, the Vala compiler, do not modify */
/* up-acpi-native.h generated by valac, the Vala compiler, do not modify */
#ifndef __DKP_ACPI_NATIVE_H__
#define __DKP_ACPI_NATIVE_H__
#ifndef __UP_ACPI_NATIVE_H__
#define __UP_ACPI_NATIVE_H__
#include <glib.h>
#include <glib-object.h>
......@@ -12,35 +12,35 @@
G_BEGIN_DECLS
#define TYPE_DKP_ACPI_NATIVE (dkp_acpi_native_get_type ())
#define DKP_ACPI_NATIVE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DKP_ACPI_NATIVE, DkpAcpiNative))
#define DKP_ACPI_NATIVE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DKP_ACPI_NATIVE, DkpAcpiNativeClass))
#define IS_DKP_ACPI_NATIVE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DKP_ACPI_NATIVE))
#define IS_DKP_ACPI_NATIVE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DKP_ACPI_NATIVE))
#define DKP_ACPI_NATIVE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DKP_ACPI_NATIVE, DkpAcpiNativeClass))
#define TYPE_UP_ACPI_NATIVE (up_acpi_native_get_type ())
#define UP_ACPI_NATIVE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_UP_ACPI_NATIVE, UpAcpiNative))
#define UP_ACPI_NATIVE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_UP_ACPI_NATIVE, UpAcpiNativeClass))
#define IS_UP_ACPI_NATIVE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_UP_ACPI_NATIVE))
#define IS_UP_ACPI_NATIVE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_UP_ACPI_NATIVE))
#define UP_ACPI_NATIVE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_UP_ACPI_NATIVE, UpAcpiNativeClass))
typedef struct _DkpAcpiNative DkpAcpiNative;
typedef struct _DkpAcpiNativeClass DkpAcpiNativeClass;
typedef struct _DkpAcpiNativePrivate DkpAcpiNativePrivate;
typedef struct _UpAcpiNative UpAcpiNative;
typedef struct _UpAcpiNativeClass UpAcpiNativeClass;
typedef struct _UpAcpiNativePrivate UpAcpiNativePrivate;
struct _DkpAcpiNative {
struct _UpAcpiNative {
GObject parent_instance;
DkpAcpiNativePrivate * priv;
UpAcpiNativePrivate * priv;
};
struct _DkpAcpiNativeClass {
struct _UpAcpiNativeClass {
GObjectClass parent_class;
};
GType dkp_acpi_native_get_type (void);
DkpAcpiNative* dkp_acpi_native_new (const char* path);
DkpAcpiNative* dkp_acpi_native_construct (GType object_type, const char* path);
DkpAcpiNative* dkp_acpi_native_new_driver_unit (const char* driver, gint unit);
DkpAcpiNative* dkp_acpi_native_construct_driver_unit (GType object_type, const char* driver, gint unit);
const char* dkp_acpi_native_get_driver (DkpAcpiNative* self);
gint dkp_acpi_native_get_unit (DkpAcpiNative* self);
const char* dkp_acpi_native_get_path (DkpAcpiNative* self);
GType up_acpi_native_get_type (void);
UpAcpiNative* up_acpi_native_new (const char* path);
UpAcpiNative* up_acpi_native_construct (GType object_type, const char* path);
UpAcpiNative* up_acpi_native_new_driver_unit (const char* driver, gint unit);
UpAcpiNative* up_acpi_native_construct_driver_unit (GType object_type, const char* driver, gint unit);
const char* up_acpi_native_get_driver (UpAcpiNative* self);
gint up_acpi_native_get_unit (UpAcpiNative* self);
const char* up_acpi_native_get_path (UpAcpiNative* self);
G_END_DECLS
......
public class DkpAcpiNative : Object {
public class UpAcpiNative : Object {
private string? _driver;
private int _unit;
private string _path;
......@@ -15,7 +15,7 @@ public class DkpAcpiNative : Object {
get { return _path; }
}
public DkpAcpiNative (string path) {
public UpAcpiNative (string path) {
Regex r;
MatchInfo mi;
bool ret;
......@@ -38,7 +38,7 @@ public class DkpAcpiNative : Object {
_path = path;
}
public DkpAcpiNative.driver_unit (string driver, int unit) {
public UpAcpiNative.driver_unit (string driver, int unit) {
_driver = driver;
_unit = unit;
_path = "dev.%s.%i".printf (_driver, _unit);
......
/***************************************************************************
*
* dkp-backend-acpi.h : define some backend objects
* up-backend-acpi.h : define some backend objects
*
* Copyright (C) 2006, 2009 Joe Marcus Clarke <marcus@FreeBSD.org>
*
......@@ -27,6 +27,6 @@
#include "up-devd.h"
extern DkpDevdHandler up_backend_acpi_devd_handler;
extern UpDevdHandler up_backend_acpi_devd_handler;
#endif /* _UP_BACKEND_ACPI_H */
......@@ -55,7 +55,7 @@ static void up_backend_finalize (GObject *object);
static gboolean up_backend_refresh_devices (gpointer user_data);
static gboolean up_backend_acpi_devd_notify (UpBackend *backend, const gchar *system, const gchar *subsystem, const gchar *type, const gchar *data);
static gboolean up_backend_create_new_device (UpBackend *backend, DkpAcpiNative *native);
static gboolean up_backend_create_new_device (UpBackend *backend, UpAcpiNative *native);
static void up_backend_lid_coldplug (UpBackend *backend);
static gboolean up_backend_supports_sleep_state (const gchar *state);
......@@ -83,7 +83,7 @@ static const gchar *handlers[] = {
"battery",
};
DkpDevdHandler up_backend_acpi_devd_handler = {
UpDevdHandler up_backend_acpi_devd_handler = {
.notify = up_backend_acpi_devd_notify
};
......@@ -118,13 +118,13 @@ static gboolean
up_backend_acpi_devd_notify (UpBackend *backend, const gchar *system, const gchar *subsystem, const gchar *type, const gchar *data)
{
GObject *object = NULL;
DkpAcpiNative *native = NULL;
UpAcpiNative *native = NULL;
if (strcmp (system, "ACPI"))
return FALSE;
if (!strcmp (subsystem, "ACAD")) {
native = dkp_acpi_native_new ("hw.acpi.acline");
native = up_acpi_native_new ("hw.acpi.acline");
object = up_device_list_lookup (backend->priv->device_list, G_OBJECT (native));
} else if (!strcmp (subsystem, "CMBAT")) {
gchar *ptr;
......@@ -133,7 +133,7 @@ up_backend_acpi_devd_notify (UpBackend *backend, const gchar *system, const gcha
ptr = strstr (type, ".BAT");
if (ptr != NULL && sscanf (ptr, ".BAT%i", &unit)) {
native = dkp_acpi_native_new_driver_unit ("battery", unit);
native = up_acpi_native_new_driver_unit ("battery", unit);
object = up_device_list_lookup (backend->priv->device_list, G_OBJECT (native));
if (object == NULL) {
gpointer hptr;
......@@ -186,7 +186,7 @@ out:
* up_backend_create_new_device:
**/
static gboolean
up_backend_create_new_device (UpBackend *backend, DkpAcpiNative *native)
up_backend_create_new_device (UpBackend *backend, UpAcpiNative *native)
{
UpDevice *device;
gboolean ret;
......@@ -196,14 +196,14 @@ up_backend_create_new_device (UpBackend *backend, DkpAcpiNative *native)
if (!ret)
g_object_unref (device);
else {
if (!strncmp (dkp_acpi_native_get_path (native), "dev.", strlen ("dev."))) {
if (!strncmp (up_acpi_native_get_path (native), "dev.", strlen ("dev."))) {
const gchar *path;
path = dkp_acpi_native_get_path (native);
if (dkp_has_sysctl ("%s.%%location", path)) {
path = up_acpi_native_get_path (native);
if (up_has_sysctl ("%s.%%location", path)) {
gchar *location;
location = dkp_get_string_sysctl (NULL, "%s.%%location", path);
location = up_get_string_sysctl (NULL, "%s.%%location", path);
if (location != NULL && strstr (location, "handle=") != NULL) {
gchar *handle;
......@@ -229,7 +229,7 @@ up_backend_lid_coldplug (UpBackend *backend)
{
gchar *lid_state;
lid_state = dkp_get_string_sysctl (NULL, "hw.acpi.lid_switch_state");
lid_state = up_get_string_sysctl (NULL, "hw.acpi.lid_switch_state");
if (lid_state && strcmp (lid_state, "NONE")) {
g_object_set (backend->priv->daemon, "lid-is-present", TRUE, NULL);
}
......@@ -249,7 +249,7 @@ up_backend_lid_coldplug (UpBackend *backend)
gboolean
up_backend_coldplug (UpBackend *backend, UpDaemon *daemon)
{
DkpAcpiNative *acnative;
UpAcpiNative *acnative;
int i;
backend->priv->daemon = g_object_ref (daemon);
......@@ -258,12 +258,12 @@ up_backend_coldplug (UpBackend *backend, UpDaemon *daemon)
for (i = 0; i < (int) G_N_ELEMENTS (handlers); i++) {
int j;
for (j = 0; dkp_has_sysctl ("dev.%s.%i.%%driver", handlers[i], j); j++) {
DkpAcpiNative *native;
for (j = 0; up_has_sysctl ("dev.%s.%i.%%driver", handlers[i], j); j++) {
UpAcpiNative *native;
UpDevice *device;
GObject *object;
native = dkp_acpi_native_new_driver_unit (handlers[i], j);
native = up_acpi_native_new_driver_unit (handlers[i], j);
object = up_device_list_lookup (backend->priv->device_list, G_OBJECT (native));
if (object != NULL) {
device = UP_DEVICE (object);
......@@ -284,11 +284,11 @@ up_backend_coldplug (UpBackend *backend, UpDaemon *daemon)
up_backend_lid_coldplug (backend);
acnative = dkp_acpi_native_new ("hw.acpi.acline");
acnative = up_acpi_native_new ("hw.acpi.acline");
up_backend_create_new_device (backend, acnative);
g_object_unref (acnative);
dkp_devd_init (backend);
up_devd_init (backend);
backend->priv->poll_timer_id =
g_timeout_add_seconds (UP_BACKEND_REFRESH_TIMEOUT,
......@@ -394,7 +394,7 @@ up_backend_supports_sleep_state (const gchar *state)
gchar *sleep_states;
gboolean ret = FALSE;
sleep_states = dkp_get_string_sysctl (NULL, "hw.acpi.supported_sleep_state");
sleep_states = up_get_string_sysctl (NULL, "hw.acpi.supported_sleep_state");
if (sleep_states != NULL) {
if (strstr (sleep_states, state) != NULL)
ret = TRUE;
......
/***************************************************************************
*
* dkp-devd.c : process devd events
* up-devd.c : process devd events
*
* Copyright (C) 2006, 2007 Joe Marcus Clarke <marcus@FreeBSD.org>
*
......@@ -36,22 +36,22 @@
#include "up-backend-acpi.h"
#include "up-devd.h"
#define DKP_DEVD_SOCK_PATH "/var/run/devd.pipe"
#define UP_DEVD_SOCK_PATH "/var/run/devd.pipe"
#define DKP_DEVD_EVENT_NOTIFY '!'
#define DKP_DEVD_EVENT_ADD '+'
#define DKP_DEVD_EVENT_REMOVE '-'
#define DKP_DEVD_EVENT_NOMATCH '?'
#define UP_DEVD_EVENT_NOTIFY '!'
#define UP_DEVD_EVENT_ADD '+'
#define UP_DEVD_EVENT_REMOVE '-'
#define UP_DEVD_EVENT_NOMATCH '?'
static DkpDevdHandler *handlers[] = {
static UpDevdHandler *handlers[] = {
&up_backend_acpi_devd_handler,
};
static gboolean dkp_devd_inited = FALSE;
static gboolean up_devd_inited = FALSE;
#if 0
static GHashTable *
dkp_devd_parse_params (const gchar *str)
up_devd_parse_params (const gchar *str)
{
GHashTable *params;
gchar **pairs;
......@@ -77,7 +77,7 @@ dkp_devd_parse_params (const gchar *str)
#endif
static gboolean
dkp_devd_parse_notify (const gchar *event,
up_devd_parse_notify (const gchar *event,
gchar **system,
gchar **subsystem,
gchar **type,
......@@ -118,7 +118,7 @@ end:
}
static void
dkp_devd_process_notify_event (UpBackend *backend,
up_devd_process_notify_event (UpBackend *backend,
const gchar *system,
const gchar *subsystem,
const gchar *type,
......@@ -140,7 +140,7 @@ dkp_devd_process_notify_event (UpBackend *backend,
}
static void
dkp_devd_process_event (const gchar *event, gpointer user_data)
up_devd_process_event (const gchar *event, gpointer user_data)
{
UpBackend *backend;
......@@ -151,21 +151,21 @@ dkp_devd_process_event (const gchar *event, gpointer user_data)
egg_debug("received devd event: '%s'", event);
switch (event[0]) {
case DKP_DEVD_EVENT_ADD:
case DKP_DEVD_EVENT_REMOVE:
case UP_DEVD_EVENT_ADD:
case UP_DEVD_EVENT_REMOVE:
/* Do nothing as we don't currently hotplug ACPI devices. */
return;
case DKP_DEVD_EVENT_NOTIFY: {
case UP_DEVD_EVENT_NOTIFY: {
gchar *system;
gchar *subsystem;
gchar *type;
gchar *data;
if (!dkp_devd_parse_notify (event + 1, &system, &subsystem, &type, &data))
if (!up_devd_parse_notify (event + 1, &system, &subsystem, &type, &data))
goto malformed;
dkp_devd_process_notify_event (backend, system, subsystem, type, data);
up_devd_process_notify_event (backend, system, subsystem, type, data);
g_free (system);
g_free (subsystem);
......@@ -174,7 +174,7 @@ dkp_devd_process_event (const gchar *event, gpointer user_data)
}
return;
case DKP_DEVD_EVENT_NOMATCH:
case UP_DEVD_EVENT_NOMATCH:
/* Do nothing. */
return;
}
......@@ -184,7 +184,7 @@ malformed:
}
static gboolean
dkp_devd_event_cb (GIOChannel *source, GIOCondition condition,
up_devd_event_cb (GIOChannel *source, GIOCondition condition,
gpointer user_data)
{
gchar *event;
......@@ -195,11 +195,11 @@ dkp_devd_event_cb (GIOChannel *source, GIOCondition condition,
if (status == G_IO_STATUS_NORMAL) {
event[terminator] = 0;
dkp_devd_process_event(event, user_data);
up_devd_process_event(event, user_data);
g_free(event);
} else if (status == G_IO_STATUS_AGAIN) {
dkp_devd_init (UP_BACKEND(user_data));
if (dkp_devd_inited) {
up_devd_init (UP_BACKEND(user_data));
if (up_devd_inited) {
int fd;
fd = g_io_channel_unix_get_fd (source);
......@@ -214,7 +214,7 @@ dkp_devd_event_cb (GIOChannel *source, GIOCondition condition,
}
void
dkp_devd_init (UpBackend *backend)
up_devd_init (UpBackend *backend)
{
int event_fd;
struct sockaddr_un addr;
......@@ -222,23 +222,23 @@ dkp_devd_init (UpBackend *backend)
event_fd = socket(PF_UNIX, SOCK_STREAM, 0);
if (event_fd < 0) {
egg_warning("failed to create event socket: '%s'", g_strerror(errno));
dkp_devd_inited = FALSE;
up_devd_inited = FALSE;
return;
}
addr.sun_family = AF_UNIX;
strncpy (addr.sun_path, DKP_DEVD_SOCK_PATH, sizeof(addr.sun_path));
strncpy (addr.sun_path, UP_DEVD_SOCK_PATH, sizeof(addr.sun_path));
if (connect (event_fd, (struct sockaddr *)&addr, sizeof(addr)) == 0) {
GIOChannel *channel;
channel = g_io_channel_unix_new (event_fd);
g_io_add_watch (channel, G_IO_IN, dkp_devd_event_cb, backend);
g_io_add_watch (channel, G_IO_IN, up_devd_event_cb, backend);
g_io_channel_unref (channel);
dkp_devd_inited = TRUE;
up_devd_inited = TRUE;
} else {
egg_warning ("failed to connect to %s: '%s'"