18c2aff776a775d34a4c9893a4c72e0434d68e36artem/***************************************************************************
18c2aff776a775d34a4c9893a4c72e0434d68e36artem * devinfo_usb.h : USB devices
d5c32991787e092564403b5c520497689dba69a6Norm Jacobs * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
18c2aff776a775d34a4c9893a4c72e0434d68e36artem * Use is subject to license terms.
18c2aff776a775d34a4c9893a4c72e0434d68e36artem * Licensed under the Academic Free License version 2.1
18c2aff776a775d34a4c9893a4c72e0434d68e36artem **************************************************************************/
18c2aff776a775d34a4c9893a4c72e0434d68e36artem#include "../osspec.h"
18c2aff776a775d34a4c9893a4c72e0434d68e36artem#include "../logger.h"
18c2aff776a775d34a4c9893a4c72e0434d68e36artem#include "../hald.h"
18c2aff776a775d34a4c9893a4c72e0434d68e36artem#include "../hald_dbus.h"
18c2aff776a775d34a4c9893a4c72e0434d68e36artem#include "../util.h"
18c2aff776a775d34a4c9893a4c72e0434d68e36artem#include "../ids.h"
112cd14a18db3bd3fac4ff92c4117b51ddd339abqzstatic HalDevice *devinfo_usb_if_add(HalDevice *d, di_node_t node, gchar *devfs_path,
112cd14a18db3bd3fac4ff92c4117b51ddd339abqzstatic HalDevice *devinfo_usb_scsa2usb_add(HalDevice *d, di_node_t node);
112cd14a18db3bd3fac4ff92c4117b51ddd339abqzstatic HalDevice *devinfo_usb_printer_add(HalDevice *usbd, di_node_t node);
b453864f3587ccc3324d7a3b0438a1e542dcfde7Lin Guo - Sun Microsystemsstatic HalDevice *devinfo_usb_input_add(HalDevice *usbd, di_node_t node);
3622ad5add770690d66e34e2176b6441269ffa35Lin Guo - Sun Microsystemsstatic HalDevice *devinfo_usb_video4linux_add(HalDevice *usbd, di_node_t node);
b453864f3587ccc3324d7a3b0438a1e542dcfde7Lin Guo - Sun Microsystemsconst gchar *devinfo_printer_prnio_get_prober(HalDevice *d, int *timeout);
b453864f3587ccc3324d7a3b0438a1e542dcfde7Lin Guo - Sun Microsystemsconst gchar *devinfo_keyboard_get_prober(HalDevice *d, int *timeout);
112cd14a18db3bd3fac4ff92c4117b51ddd339abqzstatic void set_usb_properties(HalDevice *d, di_node_t node, gchar *devfs_path, char *driver_name);
b453864f3587ccc3324d7a3b0438a1e542dcfde7Lin Guo - Sun MicrosystemsDevinfoDevHandler devinfo_usb_keyboard_handler = {
c74d5d46b91a456f2ccf1a2416478fad8d1b3b11jacobs * USB device nodes will have "compatible" propety values that
c74d5d46b91a456f2ccf1a2416478fad8d1b3b11jacobs * begins with "usb".
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz rc = di_prop_lookup_strings(DDI_DEV_T_ANY, node, "compatible", &s);
c74d5d46b91a456f2ccf1a2416478fad8d1b3b11jacobs while (rc-- > 0) {
3622ad5add770690d66e34e2176b6441269ffa35Lin Guo - Sun Microsystemsget_usb_devlink(char *devfs_path, const char *dir_name)
3622ad5add770690d66e34e2176b6441269ffa35Lin Guo - Sun Microsystems if ((dp = opendir(dir_name)) != NULL) {
b453864f3587ccc3324d7a3b0438a1e542dcfde7Lin Guo - Sun Microsystems while ((ep = readdir(dp)) != NULL) {
b453864f3587ccc3324d7a3b0438a1e542dcfde7Lin Guo - Sun Microsystems char path[MAXPATHLEN], lpath[MAXPATHLEN];
3622ad5add770690d66e34e2176b6441269ffa35Lin Guo - Sun Microsystems strncpy(path, dir_name, strlen(dir_name));
3622ad5add770690d66e34e2176b6441269ffa35Lin Guo - Sun Microsystems strncat(path, ep->d_name, strlen(ep->d_name));
b453864f3587ccc3324d7a3b0438a1e542dcfde7Lin Guo - Sun Microsystems memset(lpath, 0, sizeof (lpath));
b453864f3587ccc3324d7a3b0438a1e542dcfde7Lin Guo - Sun Microsystems if ((readlink(path, lpath, sizeof (lpath)) > 0) &&
b453864f3587ccc3324d7a3b0438a1e542dcfde7Lin Guo - Sun Microsystems (strstr(lpath, devfs_path) != NULL)) {
18c2aff776a775d34a4c9893a4c72e0434d68e36artemdevinfo_usb_add(HalDevice *parent, di_node_t node, char *devfs_path, char *device_type)
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz if (di_prop_lookup_ints (DDI_DEV_T_ANY, node, "interface", &i) < 0) {
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz /* It is a USB device node. */
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz devinfo_set_default_properties (d, parent, node, devfs_path);
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz hal_device_property_set_string (d, "info.subsystem", "usb_device");
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz PROP_STR(d, node, s, "usb-product-name", "info.product");
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz PROP_STR(d, node, s, "usb-product-name", "usb_device.product");
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz PROP_STR(d, node, s, "usb-vendor-name", "usb_device.vendor");
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz PROP_INT(d, node, i, "usb-vendor-id", "usb_device.vendor_id");
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz PROP_INT(d, node, i, "usb-product-id", "usb_device.product_id");
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz PROP_INT(d, node, i, "usb-revision-id", "usb_device.device_revision_bcd");
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz PROP_STR(d, node, s, "usb-serialno", "usb_device.serial");
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz PROP_INT(d, node, i, "usb-port-count", "usb_device.num_ports");
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz PROP_INT(d, node, i, "usb-num-configs", "usb_device.num_configurations");
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz PROP_INT(d, node, i, "assigned-address", "usb_device.bus_number");
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz if (di_prop_lookup_ints (DDI_DEV_T_ANY, node, "usb-release", &i) > 0) {
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz k = (double)bcd(*i);
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz hal_device_property_set_double (d, "usb_device.version", k / 100);
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz if (di_prop_lookup_ints (DDI_DEV_T_ANY, node, "low-speed", &i) >= 0) {
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz } else if (di_prop_lookup_ints (DDI_DEV_T_ANY, node, "high-speed", &i) >= 0) {
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz k = 480.0;
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz /* It is the full speed device. */
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz hal_device_property_set_double (d, "usb_device.speed", k);
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz /* wait for the ugen node's creation */
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz if ((driver_name != NULL) && (strcmp (driver_name, "usb_mid") == 0)) {
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz devinfo_add_enqueue (d, devfs_path, &devinfo_usb_handler);
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz /* add to TDL so preprobing callouts and prober can access it */
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz (strncmp (binding_name, "usbif,", sizeof ("usbif,") - 1) == 0)) {
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz snprintf (if_devfs_path, sizeof (if_devfs_path), "%s:if%d",
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz /* It is a USB interface node or IA node. */
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz if (di_prop_lookup_ints (DDI_DEV_T_ANY, node, "interface-count", &j) > 0) {
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz * The USB IA node properties are not defined in
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz * HAL spec so far. So IA node udi has "ia" sign
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz * now, different from the IF node udi with "if".
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz d = devinfo_usb_if_add (parent, node, devfs_path, if_devfs_path, *i);
18c2aff776a775d34a4c9893a4c72e0434d68e36artem /* driver specific */
b453864f3587ccc3324d7a3b0438a1e542dcfde7Lin Guo - Sun Microsystems if (strcmp (driver_name, "scsa2usb") == 0) {
b453864f3587ccc3324d7a3b0438a1e542dcfde7Lin Guo - Sun Microsystems nd = devinfo_usb_scsa2usb_add (d, node);
b453864f3587ccc3324d7a3b0438a1e542dcfde7Lin Guo - Sun Microsystems } else if (strcmp (driver_name, "usbprn") == 0) {
b453864f3587ccc3324d7a3b0438a1e542dcfde7Lin Guo - Sun Microsystems nd = devinfo_usb_printer_add (d, node);
b453864f3587ccc3324d7a3b0438a1e542dcfde7Lin Guo - Sun Microsystems } else if (strcmp(driver_name, "hid") == 0) {
b453864f3587ccc3324d7a3b0438a1e542dcfde7Lin Guo - Sun Microsystems if (hdl = di_devlink_init(devfs_path, DI_MAKE_LINK)) {
b453864f3587ccc3324d7a3b0438a1e542dcfde7Lin Guo - Sun Microsystems nd = devinfo_usb_input_add(d, node);
3622ad5add770690d66e34e2176b6441269ffa35Lin Guo - Sun Microsystems } else if (strcmp(driver_name, "usbvc") == 0) {
3622ad5add770690d66e34e2176b6441269ffa35Lin Guo - Sun Microsystems if (hdl = di_devlink_init(devfs_path, DI_MAKE_LINK)) {
3622ad5add770690d66e34e2176b6441269ffa35Lin Guo - Sun Microsystems nd = devinfo_usb_video4linux_add(d, node);
18c2aff776a775d34a4c9893a4c72e0434d68e36artem return (d);
112cd14a18db3bd3fac4ff92c4117b51ddd339abqzstatic void
112cd14a18db3bd3fac4ff92c4117b51ddd339abqzset_usb_properties(HalDevice *d, di_node_t node, gchar *devfs_path, char *driver_name)
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz usb_dev_descr_t *dev_descrp = NULL; /* device descriptor */
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz usb_cfg_descr_t *cfg_descrp = NULL; /* configuration descriptor */
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz int i = 0;
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz hal_device_property_set_int (d, "usb_device.port_number",
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz if (di_prop_lookup_bytes (DDI_DEV_T_ANY, node, "usb-dev-descriptor",
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz hal_device_property_set_int (d, "usb_device.device_class",
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz hal_device_property_set_int (d, "usb_device.device_subclass",
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz hal_device_property_set_int (d, "usb_device.device_protocol",
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz if (di_prop_lookup_bytes (DDI_DEV_T_ANY, node, "usb-raw-cfg-descriptors",
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz hal_device_property_set_int (d, "usb_device.configuration_value",
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz hal_device_property_set_int (d, "usb_device.num_interfaces",
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz hal_device_property_set_bool (d, "usb_device.can_wake_up",
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz hal_device_property_set_bool (d, "usb_device.is_self_powered",
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz /* get the node's usb tree level by counting hub numbers */
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz } while (p != NULL);
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz if ((driver_name != NULL) && (strcmp (driver_name, "hubd") == 0) && (i > 0))
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz hal_device_property_set_int (d, "usb_device.level_number", i);
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz usb_if_descr_t *if_descrp=NULL; /* interface descriptor */
b453864f3587ccc3324d7a3b0438a1e542dcfde7Lin Guo - Sun Microsystems di_node_t tmp_node = DI_NODE_NIL;
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz /* Look up its parent that may be a USB IA or USB mid. */
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz for (i = 0; i < 2; i++) {
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz *p = '\0';
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz if ((tmp_node = di_init (devpath, DINFOCPYALL)) == DI_NODE_NIL)
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz if ((rlen = di_prop_lookup_bytes (DDI_DEV_T_ANY, tmp_node,
112cd14a18db3bd3fac4ff92c4117b51ddd339abqzdevinfo_usb_if_add(HalDevice *parent, di_node_t node, gchar *devfs_path,
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz usb_if_descr_t *if_descrp=NULL; /* interface descriptor */
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz devinfo_set_default_properties (d, parent, node, if_devfs_path);
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz /* Set the existed physical device path. */
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz hal_device_property_set_string (d, "solaris.devfs_path", devfs_path);
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz hal_device_property_set_string (d, "info.subsystem", "usb");
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz hal_device_property_set_string (d, "info.product", "USB Device Interface");
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz /* Set usb interface properties to interface node. */
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz hal_device_property_set_int (d, "usb.interface.subclass",
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz hal_device_property_set_int (d, "usb.interface.protocol",
18c2aff776a775d34a4c9893a4c72e0434d68e36artem /* copy parent's usb_device.* properties */
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz parent_info = hal_device_property_get_string (parent, "info.subsystem");
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz hal_device_merge_with_rewrite (d, parent, "usb.", "usb_device.");
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz /* for the case that the parent is IA node */
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz hal_device_merge_with_rewrite (d, parent, "usb.", "usb.");
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz devinfo_add_enqueue (d, devfs_path, &devinfo_usb_handler);
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz /* add to TDL so preprobing callouts and prober can access it */
18c2aff776a775d34a4c9893a4c72e0434d68e36artem return (d);
b453864f3587ccc3324d7a3b0438a1e542dcfde7Lin Guo - Sun Microsystemsget_dev_link_path(di_node_t node, char *nodetype, char *re, char **devlink, char **minor_path, char **minor_name)
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz while ((minor = di_minor_next(node, minor)) != DI_MINOR_NIL) {
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz if ((*minor_path = di_devfs_minor_path(minor)) == NULL) {
b453864f3587ccc3324d7a3b0438a1e542dcfde7Lin Guo - Sun Microsystems if (strcmp(di_minor_nodetype(minor), nodetype) == 0) {
b453864f3587ccc3324d7a3b0438a1e542dcfde7Lin Guo - Sun Microsystems *devlink = get_devlink(devlink_hdl, re, *minor_path);
3622ad5add770690d66e34e2176b6441269ffa35Lin Guo - Sun Microsystems * During hotplugging, devlink could be NULL for usb
b453864f3587ccc3324d7a3b0438a1e542dcfde7Lin Guo - Sun Microsystems * devices due to devlink database has not yet been
b453864f3587ccc3324d7a3b0438a1e542dcfde7Lin Guo - Sun Microsystems * updated when hal try to read from it although the
b453864f3587ccc3324d7a3b0438a1e542dcfde7Lin Guo - Sun Microsystems * actually dev link path has been created. In such a
b453864f3587ccc3324d7a3b0438a1e542dcfde7Lin Guo - Sun Microsystems * situation, we will read the devlink name from
3622ad5add770690d66e34e2176b6441269ffa35Lin Guo - Sun Microsystems ((strstr(re, "hid") != NULL) || (strstr(re, "video") != NULL))) {
3622ad5add770690d66e34e2176b6441269ffa35Lin Guo - Sun Microsystems *devlink = get_usb_devlink(*minor_path, "/dev/usb/");
b453864f3587ccc3324d7a3b0438a1e542dcfde7Lin Guo - Sun Microsystems *minor_name = di_minor_name(minor);
3622ad5add770690d66e34e2176b6441269ffa35Lin Guo - Sun Microsystemsdevinfo_usb_video4linux_add(HalDevice *usbd, di_node_t node)
3622ad5add770690d66e34e2176b6441269ffa35Lin Guo - Sun Microsystems get_dev_link_path(node, "usb_video",
3fb52c733c5435ce279a4641b57941b1befa5c9fRaymond Chen "^usb/video[0-9]+", &devlink, &minor_path, &minor_name);
3622ad5add770690d66e34e2176b6441269ffa35Lin Guo - Sun Microsystems if ((minor_path == NULL) || (devlink == NULL)) {
3622ad5add770690d66e34e2176b6441269ffa35Lin Guo - Sun Microsystems HAL_DEBUG(("devlink %s, minor_name %s", devlink, minor_name));
3622ad5add770690d66e34e2176b6441269ffa35Lin Guo - Sun Microsystems if (strcmp(minor_name, "usbvc") != 0) {
3622ad5add770690d66e34e2176b6441269ffa35Lin Guo - Sun Microsystems devinfo_set_default_properties(d, usbd, node, minor_path);
3622ad5add770690d66e34e2176b6441269ffa35Lin Guo - Sun Microsystems hal_device_property_set_string(d, "info.subsystem", "video4linux");
3622ad5add770690d66e34e2176b6441269ffa35Lin Guo - Sun Microsystems hal_device_property_set_string(d, "info.category", "video4linux");
3622ad5add770690d66e34e2176b6441269ffa35Lin Guo - Sun Microsystems hal_device_add_capability(d, "video4linux");
3622ad5add770690d66e34e2176b6441269ffa35Lin Guo - Sun Microsystems /* Get logic link under /dev (/dev/video+) */
3622ad5add770690d66e34e2176b6441269ffa35Lin Guo - Sun Microsystems dev_videolink = get_usb_devlink(strstr(devlink, "usb"), "/dev/");
3622ad5add770690d66e34e2176b6441269ffa35Lin Guo - Sun Microsystems hal_device_property_set_string(d, "video4linux.device", dev_videolink);
3622ad5add770690d66e34e2176b6441269ffa35Lin Guo - Sun Microsystems hal_util_compute_udi(hald_get_gdl(), udi, sizeof (udi),
3622ad5add770690d66e34e2176b6441269ffa35Lin Guo - Sun Microsystems "%s_video4linux", hal_device_get_udi(usbd));
3622ad5add770690d66e34e2176b6441269ffa35Lin Guo - Sun Microsystems hal_device_property_set_string(d, "info.udi", udi);
3622ad5add770690d66e34e2176b6441269ffa35Lin Guo - Sun Microsystems PROP_STR(d, node, s, "usb-product-name", "info.product");
3622ad5add770690d66e34e2176b6441269ffa35Lin Guo - Sun Microsystems devinfo_add_enqueue(d, minor_path, &devinfo_usb_handler);
b453864f3587ccc3324d7a3b0438a1e542dcfde7Lin Guo - Sun Microsystemsdevinfo_usb_input_add(HalDevice *usbd, di_node_t node)
b453864f3587ccc3324d7a3b0438a1e542dcfde7Lin Guo - Sun Microsystems get_dev_link_path(node, "ddi_pseudo",
3fb52c733c5435ce279a4641b57941b1befa5c9fRaymond Chen "^usb/hid[0-9]+", &devlink, &minor_path, &minor_name);
b453864f3587ccc3324d7a3b0438a1e542dcfde7Lin Guo - Sun Microsystems if ((minor_path == NULL) || (devlink == NULL)) {
b453864f3587ccc3324d7a3b0438a1e542dcfde7Lin Guo - Sun Microsystems HAL_DEBUG(("devlink %s, minor_name %s", devlink, minor_name));
b453864f3587ccc3324d7a3b0438a1e542dcfde7Lin Guo - Sun Microsystems if ((strcmp(minor_name, "keyboard") != 0) &&
b453864f3587ccc3324d7a3b0438a1e542dcfde7Lin Guo - Sun Microsystems (strcmp(minor_name, "mouse") != 0)) {
b453864f3587ccc3324d7a3b0438a1e542dcfde7Lin Guo - Sun Microsystems devinfo_set_default_properties(d, usbd, node, minor_path);
b453864f3587ccc3324d7a3b0438a1e542dcfde7Lin Guo - Sun Microsystems hal_device_property_set_string(d, "info.subsystem", "input");
b453864f3587ccc3324d7a3b0438a1e542dcfde7Lin Guo - Sun Microsystems hal_device_property_set_string(d, "info.category", "input");
b453864f3587ccc3324d7a3b0438a1e542dcfde7Lin Guo - Sun Microsystems hal_device_add_capability(d, "input");
b453864f3587ccc3324d7a3b0438a1e542dcfde7Lin Guo - Sun Microsystems if (strcmp(minor_name, "keyboard") == 0) {
b453864f3587ccc3324d7a3b0438a1e542dcfde7Lin Guo - Sun Microsystems hal_device_add_capability(d, "input.keyboard");
b453864f3587ccc3324d7a3b0438a1e542dcfde7Lin Guo - Sun Microsystems hal_device_add_capability(d, "input.keys");
b453864f3587ccc3324d7a3b0438a1e542dcfde7Lin Guo - Sun Microsystems hal_device_add_capability(d, "button");
b453864f3587ccc3324d7a3b0438a1e542dcfde7Lin Guo - Sun Microsystems } else if (strcmp(minor_name, "mouse") == 0) {
b453864f3587ccc3324d7a3b0438a1e542dcfde7Lin Guo - Sun Microsystems hal_device_add_capability (d, "input.mouse");
b453864f3587ccc3324d7a3b0438a1e542dcfde7Lin Guo - Sun Microsystems hal_device_property_set_string(d, "input.device", devlink);
b453864f3587ccc3324d7a3b0438a1e542dcfde7Lin Guo - Sun Microsystems hal_device_property_set_string(d, "input.originating_device",
b453864f3587ccc3324d7a3b0438a1e542dcfde7Lin Guo - Sun Microsystems hal_util_compute_udi(hald_get_gdl(), udi, sizeof (udi),
b453864f3587ccc3324d7a3b0438a1e542dcfde7Lin Guo - Sun Microsystems "%s_logicaldev_input", hal_device_get_udi(usbd));
b453864f3587ccc3324d7a3b0438a1e542dcfde7Lin Guo - Sun Microsystems hal_device_property_set_string(d, "info.udi", udi);
b453864f3587ccc3324d7a3b0438a1e542dcfde7Lin Guo - Sun Microsystems if (strcmp(minor_name, "keyboard") == 0) {
b453864f3587ccc3324d7a3b0438a1e542dcfde7Lin Guo - Sun Microsystems devinfo_add_enqueue(d, minor_path, &devinfo_usb_keyboard_handler);
b453864f3587ccc3324d7a3b0438a1e542dcfde7Lin Guo - Sun Microsystems devinfo_add_enqueue(d, minor_path, &devinfo_usb_handler);
b453864f3587ccc3324d7a3b0438a1e542dcfde7Lin Guo - Sun Microsystems /* add to TDL so preprobing callouts and prober can access it */
b453864f3587ccc3324d7a3b0438a1e542dcfde7Lin Guo - Sun Microsystems hal_device_store_add(hald_get_tdl(), d);
3fb52c733c5435ce279a4641b57941b1befa5c9fRaymond Chen "^usb/mass-storage[0-9]+", &devlink, &minor_path, &minor_name);
18c2aff776a775d34a4c9893a4c72e0434d68e36artem devinfo_set_default_properties (d, usbd, node, minor_path);
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz hal_device_property_set_string (d, "scsi_host.solaris.device", devlink);
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz hal_device_property_set_string (d, "info.category", "scsi_host");
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz hal_util_compute_udi (hald_get_gdl (), udi, sizeof (udi),
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz hal_device_property_set_string (d, "info.product", "SCSI Host Adapter");
18c2aff776a775d34a4c9893a4c72e0434d68e36artem devinfo_add_enqueue (d, minor_path, &devinfo_usb_handler);
18c2aff776a775d34a4c9893a4c72e0434d68e36artem return (d);
112cd14a18db3bd3fac4ff92c4117b51ddd339abqzdevinfo_usb_printer_add(HalDevice *parent, di_node_t node)
d5c32991787e092564403b5c520497689dba69a6Norm Jacobs char *properties[] = { "vendor", "product", "serial", NULL };
b453864f3587ccc3324d7a3b0438a1e542dcfde7Lin Guo - Sun Microsystems char *devlink = NULL, *minor_path = NULL, *minor_name = NULL;
b453864f3587ccc3324d7a3b0438a1e542dcfde7Lin Guo - Sun Microsystems get_dev_link_path(node, "ddi_printer", "printers/.+", &devlink, &minor_path, &minor_name);
42a7bded1b1244af097afdc88654381a3d3879f9jacobs devinfo_set_default_properties (d, parent, node, minor_path);
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz hal_device_property_set_string (d, "info.category", "printer");
42a7bded1b1244af097afdc88654381a3d3879f9jacobs /* add printer properties */
112cd14a18db3bd3fac4ff92c4117b51ddd339abqz hal_device_property_set_string (d, "printer.device", devlink);
d5c32991787e092564403b5c520497689dba69a6Norm Jacobs /* copy parent's selected usb* properties to printer properties */
d5c32991787e092564403b5c520497689dba69a6Norm Jacobs subsystem = hal_device_property_get_string (parent, "info.subsystem");
d5c32991787e092564403b5c520497689dba69a6Norm Jacobs char src[32], dst[32]; /* "subsystem.property" names */
d5c32991787e092564403b5c520497689dba69a6Norm Jacobs snprintf(src, sizeof (src), "%s.%s", subsystem, properties[i]);
d5c32991787e092564403b5c520497689dba69a6Norm Jacobs snprintf(dst, sizeof (dst), "printer.%s", properties[i]);
42a7bded1b1244af097afdc88654381a3d3879f9jacobs devinfo_add_enqueue (d, minor_path, &devinfo_usb_printer_handler);
42a7bded1b1244af097afdc88654381a3d3879f9jacobs return (d);
42a7bded1b1244af097afdc88654381a3d3879f9jacobsdevinfo_printer_prnio_get_prober (HalDevice *d, int *timeout)
42a7bded1b1244af097afdc88654381a3d3879f9jacobs return ("hald-probe-printer");
b453864f3587ccc3324d7a3b0438a1e542dcfde7Lin Guo - Sun Microsystemsdevinfo_keyboard_get_prober(HalDevice *d, int *timeout)
b453864f3587ccc3324d7a3b0438a1e542dcfde7Lin Guo - Sun Microsystems *timeout = 5 * 1000; /* 5 second timeout */
b453864f3587ccc3324d7a3b0438a1e542dcfde7Lin Guo - Sun Microsystems return ("hald-probe-xkb");