/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <devfsadm.h>
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <string.h>
#include <unistd.h>
#include <strings.h>
extern char *devfsadm_get_devices_dir();
/* Rules for creating links */
ILEVEL_0, usb_process },
ILEVEL_0, usb_process },
ILEVEL_0, usb_process },
ILEVEL_0, usb_process },
ILEVEL_0, usb_process },
ILEVEL_0, usb_process },
ILEVEL_0, usb_process },
ILEVEL_0, usb_process },
ILEVEL_0, usb_process },
ILEVEL_0, usb_process },
ILEVEL_0, usb_process },
ILEVEL_0, usb_process },
ILEVEL_0, usb_process },
ILEVEL_0, usb_process },
ILEVEL_0, usb_process },
ILEVEL_0, usb_process },
ILEVEL_0, usb_process },
ILEVEL_0, usb_process },
ILEVEL_0, usb_process },
};
/* For debug printing (-V filter) */
/* USB device links */
/* Rules for removing links */
};
/*
* Rules for different USB devices except ugen which is dynamically
* created
*/
int
minor_init(void)
{
return (DEVFSADM_SUCCESS);
}
int
minor_fini(void)
{
return (DEVFSADM_SUCCESS);
}
typedef enum {
DRIVER_HUBD = 0,
typedef struct {
char *driver_name;
int index;
{ "hubd", DRIVER_HUBD },
{ "ohci", DRIVER_OHCI },
{ "ehci", DRIVER_EHCI },
{ "uhci", DRIVER_UHCI },
{ "usb_ac", DRIVER_USB_AC },
{ "usb_as", DRIVER_USB_AS },
{ "hid", DRIVER_HID },
{ "usb_mid", DRIVER_USB_MID },
{ "ddivs_usbc", DRIVER_DDIVS_USBC },
{ "scsa2usb", DRIVER_SCSA2USB },
{ "usbprn", DRIVER_USBPRN },
{ "ugen", DRIVER_UGEN },
{ "usbvc", DRIVER_VIDEO },
{ "hwahc", DRIVER_HWAHC },
{ "hwarc", DRIVER_HWARC },
{ "wusb_ca", DRIVER_WUSB_CA },
{ NULL, DRIVER_UNKNOWN }
};
/*
* This function is called for every usb minor node.
* Calls enumerate to assign a logical usb id, and then
* devfsadm_mklink to make the link.
*/
static int
{
int i, index;
int flags = 0;
int create_secondary_link = 0;
return (DEVFSADM_CONTINUE);
}
"USB_process: devfspath is NULL\n");
return (DEVFSADM_CONTINUE);
}
return (DEVFSADM_CONTINUE);
}
return (DEVFSADM_CONTINUE);
}
for (i = 0; ; i++) {
break;
}
}
return (DEVFSADM_CONTINUE);
}
/* Figure out which rules to apply */
switch (index) {
case DRIVER_HUBD:
case DRIVER_OHCI:
case DRIVER_EHCI:
case DRIVER_UHCI:
name = "hub";
break;
case DRIVER_USB_AC:
rules[0] = audio_rules[0];
rules[0] = audio_control_rules[0];
rules[0] = audio_mux_rules[0];
} else {
return (DEVFSADM_CONTINUE);
}
break;
case DRIVER_USB_AS:
rules[0] = audio_stream_rules[0];
break;
case DRIVER_VIDEO:
rules[0] = video_rules[0];
break;
case DRIVER_HID:
break;
case DRIVER_USB_MID:
rules[0] = device_rules[0];
break;
case DRIVER_DDIVS_USBC:
rules[0] = ddivs_usbc_rules[0];
break;
case DRIVER_SCSA2USB:
rules[0] = mass_storage_rules[0];
break;
case DRIVER_USBPRN:
rules[0] = usbprn_rules[0];
name = "printer";
break;
case DRIVER_HWAHC:
rules[0] = whost_rules[0];
} else {
return (DEVFSADM_CONTINUE);
}
break;
case DRIVER_HWARC:
rules[0] = hwarc_rules[0];
break;
case DRIVER_WUSB_CA:
rules[0] = wusb_ca_rules[0];
break;
default:
drvr_nm);
return (DEVFSADM_CONTINUE);
}
/*
* build the physical path from the components.
* find the logical usb id, and stuff it in buf
*/
return (DEVFSADM_CONTINUE);
}
if (create_secondary_link) {
/*
* Create secondary links to make newly hotplugged
* usb audio device the primary device.
*/
}
}
return (DEVFSADM_CONTINUE);
}
static void
{
char *lasts = s;
char *minor_name;
int flags = 0;
/* get vid, pid and minor name strings */
minor_name = lasts;
return;
}
/* create regular expression contain vid and pid */
"ugen_create_link: ugen_RE=%s minor_name=%s\n",
/*
* build the physical path from the components.
* find the logical usb id, and stuff it in buf
*/
return;
}
}