devinfo_usb.c revision 3fb52c733c5435ce279a4641b57941b1befa5c9f
/***************************************************************************
*
* devinfo_usb.h : USB devices
*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
* Licensed under the Academic Free License version 2.1
*
**************************************************************************/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <stdio.h>
#include <string.h>
#include <libdevinfo.h>
#include <unistd.h>
#include <dirent.h>
#include "../osspec.h"
#include "../logger.h"
#include "../hald.h"
#include "../hald_dbus.h"
#include "../device_info.h"
#include "../util.h"
#include "../ids.h"
#include "hotplug.h"
#include "devinfo.h"
#include "devinfo_usb.h"
NULL,
NULL,
NULL,
NULL,
};
NULL,
NULL,
NULL,
NULL,
};
NULL,
NULL,
NULL,
NULL,
};
static gboolean
{
int rc;
char *s;
/*
* USB device nodes will have "compatible" propety values that
* begins with "usb".
*/
while (rc-- > 0) {
return (TRUE);
}
s += (strlen(s) + 1);
}
return (FALSE);
}
static char *
{
break;
}
}
}
return (result);
}
{
char *s;
int *i;
char *driver_name, *binding_name;
char if_devfs_path[HAL_PATH_MAX];
double k;
return (NULL);
}
/* It is a USB device node. */
d = hal_device_new ();
k = (double)bcd(*i);
}
k = 1.5;
k = 480.0;
} else {
/* It is the full speed device. */
k = 12.0;
}
hal_device_property_set_double (d, "usb_device.speed", k);
/* wait for the ugen node's creation */
di_devlink_fini (&hdl);
}
}
/* add to TDL so preprobing callouts and prober can access it */
hal_device_store_add (hald_get_tdl (), d);
devfs_path, 0);
if_devfs_path, 0)) != NULL) {
d = nd;
}
}
} else {
/* It is a USB interface node or IA node. */
int *j;
/*
* The USB IA node properties are not defined in
* HAL spec so far. So IA node udi has "ia" sign
* now, different from the IF node udi with "if".
*/
"%s:ia%d", devfs_path, *i);
} else {
"%s:if%d", devfs_path, *i);
}
}
/* driver specific */
if (driver_name != NULL) {
}
}
}
}
out:
return (nd);
} else {
return (d);
}
}
static void
{
char *p;
int i = 0;
hal_device_property_set_int (d, "usb_device.port_number",
&rdata) > 0) {
if (dev_descrp != NULL) {
hal_device_property_set_int (d, "usb_device.device_class",
hal_device_property_set_int (d, "usb_device.device_subclass",
hal_device_property_set_int (d, "usb_device.device_protocol",
}
}
&rdata) > 0) {
if (cfg_descrp != NULL) {
hal_device_property_set_int (d, "usb_device.configuration_value",
hal_device_property_set_int (d, "usb_device.max_power",
hal_device_property_set_int (d, "usb_device.num_interfaces",
hal_device_property_set_bool (d, "usb_device.can_wake_up",
hal_device_property_set_bool (d, "usb_device.is_self_powered",
}
}
/* get the node's usb tree level by counting hub numbers */
do {
i ++;
}
} while (p != NULL);
i --;
hal_device_property_set_int (d, "usb_device.level_number", i);
}
static usb_if_descr_t *
{
int rlen;
"usb-raw-cfg-descriptors", &rdata)) < 0) {
char *p;
int i;
goto out;
/* Look up its parent that may be a USB IA or USB mid. */
for (i = 0; i < 2; i++) {
if (p == NULL)
goto out;
*p = '\0';
goto out;
"usb-raw-cfg-descriptors", &rdata)) > 0)
break;
}
}
goto out;
do {
if (type == USB_DESCR_TYPE_IF) {
break;
}
}
out:
if (tmp_node != DI_NODE_NIL)
return (if_descrp);
}
static HalDevice *
{
char udi[HAL_PATH_MAX];
const char *parent_info;
d = hal_device_new ();
/* Set the existed physical device path. */
/* Set usb interface properties to interface node. */
hal_device_property_set_int (d, "usb.interface.class",
hal_device_property_set_int (d, "usb.interface.subclass",
hal_device_property_set_int (d, "usb.interface.protocol",
hal_device_property_set_int (d, "usb.interface.number",
}
}
/* copy parent's usb_device.* properties */
if (parent_info != NULL) {
/* for the case that the parent is IA node */
}
}
/* add to TDL so preprobing callouts and prober can access it */
hal_device_store_add (hald_get_tdl (), d);
return (d);
}
static void
get_dev_link_path(di_node_t node, char *nodetype, char *re, char **devlink, char **minor_path, char **minor_name)
{
int major;
*minor_path = NULL;
*minor_name = NULL;
return;
}
continue;
}
continue;
}
continue;
}
/*
* During hotplugging, devlink could be NULL for usb
* devices due to devlink database has not yet been
* updated when hal try to read from it although the
* actually dev link path has been created. In such a
* situation, we will read the devlink name from
*/
}
break;
}
}
*minor_path = NULL;
}
}
static HalDevice *
{
int major;
char *dev_videolink = NULL;
char *minor_path = NULL;
char *minor_name = NULL;
char udi[HAL_PATH_MAX];
char *s;
goto out;
}
goto out;
}
d = hal_device_new();
hal_device_add_capability(d, "video4linux");
hal_device_set_udi(d, udi);
out:
if (devlink) {
}
if (minor_path) {
}
return (d);
}
static HalDevice *
{
int major;
char *minor_path = NULL;
char *minor_name = NULL;
char udi[HAL_PATH_MAX];
goto out;
}
goto out;
}
d = hal_device_new();
hal_device_add_capability(d, "input");
hal_device_add_capability(d, "input.keyboard");
hal_device_add_capability(d, "input.keys");
hal_device_add_capability(d, "button");
hal_device_add_capability (d, "input.mouse");
}
hal_device_property_set_string(d, "input.originating_device",
hal_device_set_udi(d, udi);
} else {
}
/* add to TDL so preprobing callouts and prober can access it */
hal_device_store_add(hald_get_tdl(), d);
out:
if (devlink) {
}
if (minor_path) {
}
return (d);
}
static HalDevice *
{
int major;
char *minor_path = NULL;
char *minor_name = NULL;
char udi[HAL_PATH_MAX];
goto out;
}
d = hal_device_new ();
hal_device_property_set_int (d, "scsi_host.host", 0);
hal_device_property_get_int (d, "scsi_host.host"));
hal_device_set_udi (d, udi);
out:
if (devlink) {
}
if (minor_path) {
}
return (d);
}
static HalDevice *
{
int i;
char udi[HAL_PATH_MAX];
char *s;
const char *subsystem;
goto out;
}
d = hal_device_new ();
hal_device_add_capability (d, "printer");
/* add printer properties */
/* copy parent's selected usb* properties to printer properties */
for (i = 0; properties[i] != NULL; i++) {
}
out:
if (devlink) {
}
if (minor_path) {
}
return (d);
}
const gchar *
{
return ("hald-probe-printer");
}
const gchar *
{
return ("hald-probe-xkb");
}