sysevent.c revision 7b840e52d558c34b70cbcde044d8d79852d169d2
/***************************************************************************
*
* sysevent.c : Solaris sysevents
*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
* Licensed under the Academic Free License version 2.1
*
**************************************************************************/
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
#include <libdevinfo.h>
#include <libsysevent.h>
#include <glib.h>
#include "../osspec.h"
#include "../logger.h"
#include "../hald.h"
#include "../hald_dbus.h"
#include "../device_info.h"
#include "../util.h"
#include "osspec_solaris.h"
#include "hotplug.h"
#include "devinfo.h"
#include "devinfo_storage.h"
#include "devinfo_acpi.h"
#include "sysevent.h"
#ifndef ESC_LOFI
#define ESC_LOFI "lofi"
#endif
static void sysevent_dev_handler(sysevent_t *);
static void sysevent_dev_branch(gchar *);
static sysevent_handle_t *shp;
static int sysevent_pipe_fds[2];
static GIOChannel *sysevent_iochannel;
static guint sysevent_source_id;
sysevent_init(void)
{
const char *subcl[3];
/*
* pipe used to serialize sysevents through the main loop
*/
if (pipe (sysevent_pipe_fds) != 0) {
return (FALSE);
}
if (sysevent_iochannel == NULL) {
HAL_INFO (("g_io_channel_unix_new failed"));
return (FALSE);
}
return (FALSE);
}
return (FALSE);
}
return (FALSE);
}
subcl[0] = ESC_DEV_BRANCH_REMOVE;
return (FALSE);
}
subcl[0] = ESC_ACPIEV_ADD;
return (FALSE);
}
return (B_TRUE);
}
void
sysevent_fini(void)
{
}
static void
{
char *class;
char *subclass;
char *phys_path;
char *dev_name;
char *dev_hid;
char *dev_uid;
char s[1024];
return;
return;
return;
&phys_path) != 0) {
goto out;
}
!= 0) {
goto out;
}
dev_name = "noname";
} else {
dev_name = "";
}
}
dev_hid = "";
}
dev_uid = "";
}
!= 0) {
dev_index = 0;
}
snprintf(s, sizeof (s), "%s %s %s %s %s %s %d\n",
out:
}
static gboolean
{
int matches;
HAL_INFO (("sysevent_iochannel_data"));
&err) == G_IO_STATUS_NORMAL) {
if (len == 0) {
break;
}
g_free (s);
s = NULL;
if (matches < 3) {
continue;
}
}
}
"/org/freedesktop/Hal/devices/pseudo/"
"battery_0_battery%d_0", dev_index);
"/org/freedesktop/Hal/devices/pseudo/"
"battery_0_ac%d_0", dev_index);
} else {
continue;
}
}
}
if (err) {
g_error_free (err);
}
return (TRUE);
}
static void
{
return;
}
}
static void
{
}
static void
{
}
static void
{
const char *parent_udi;
if ((d = hal_device_store_match_key_value_string (hald_get_gdl (),
return;
}
return;
}
return;
}
return;
}
}
static void
{
}