4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
40 #include <libdevice.h>
41 #include <sys/varargs.h>
42 #include <sys/usb/usba.h>
43 #include <sys/usb/hubd/hub.h>
44 #include <sys/usb/hubd/hubd_impl.h>
45 #include <libdevinfo.h>
46 #include <libdevice.h>
52 #define CFGA_PLUGIN_LIB
53 #include <config_admin.h>
60 #define DPRINTF (void) printf
66 /* for walking links */
67 typedef struct walk_link
{
75 * Stuff carried over for the routines borrowed from cfgadm/SCSI.
82 /* Structures for tree walking code */
92 #define MATCH_MINOR_NAME 1
93 #define S_FREE(x) (free(x), (x) = NULL)
94 #define GET_DYN(a) (((a) != NULL) ? strstr((a), DYN_SEP) : NULL)
97 /* Location of USB configuration file */
98 #define USBCONF_FILE "/etc/usb/config_map.conf"
100 /* Hardware options */
101 #define OPT_DISABLE_RCM "disable_rcm"
102 #define FLAG_DISABLE_RCM 0x00000001 /* flags */
104 /* Return/error codes */
118 int intl
; /* Flag: if 1, internationalize */
119 cfga_err_t cfga_err
; /* Error code libcfgadm understands */
125 #define MSG_TBL_SZ(table) (sizeof ((table)) / sizeof (msgcvt_t))
128 /* Error message ids (and indices into usb_error_msgs) */
133 CFGA_USB_INTERNAL_ERROR
,
139 CFGA_USB_NOT_CONNECTED
,
140 CFGA_USB_NOT_CONFIGURED
,
141 CFGA_USB_ALREADY_CONNECTED
,
142 CFGA_USB_ALREADY_CONFIGURED
,
150 CFGA_USB_CONFIG_INVAL
,
154 CFGA_USB_CONFIG_FILE
,
156 CFGA_USB_UNLOCK_FILE
,
162 CFGA_USB_RCM_OFFLINE
,
169 * Given an error msg index, look up the associated string, and
170 * convert it to the current locale if required.
172 #define ERR_STR(msg_idx) \
173 (get_msg((msg_idx), usb_error_msgs, MSG_TBL_SZ(usb_error_msgs)))
176 /* Misc text strings */
177 #define CFGA_DEV_DIR "/dev/cfg"
179 #define MINOR_SEP ":"
181 #define PORT_SEPERATOR "."
183 #define USB_CFGADM_DEFAULT_AP_TYPE "unknown"
185 /* these set of defines are -lav listing */
186 #define USB_UNDEF_STR "<undef>"
187 #define USB_NO_CFG_STR "<no cfg str descr>"
190 #define RESET_DEVICE "usb_reset" /* with -x option */
191 #define USB_CONFIG "usb_config" /* with -x option */
192 #define SET_CONFIG "config=" /* with -o option */
193 #define SET_DRIVER "drv=" /* with -op option */
195 /* for confirm operation */
196 #define USB_CONFIRM_0 "the device: "
197 #define USB_CONFIRM_1 \
198 "This operation will suspend activity on the USB device\nContinue"
201 extern int add_entry(char *, int, int, int, char *, char *, char *,
203 extern cfga_usb_ret_t
do_control_ioctl(const char *, uint_t
, uint_t
,
211 #endif /* _CFGA_USB_H */