1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or http://www.opensolaris.org/os/licensing. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22 /* 23 * Copyright 2003 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 #pragma ident "%Z%%M% %I% %E% SMI" 28 29 /* 30 * Console and mouse configuration 31 */ 32 33 #include <sys/types.h> 34 #include <sys/param.h> 35 #include <sys/cmn_err.h> 36 #include <sys/user.h> 37 #include <sys/vfs.h> 38 #include <sys/vnode.h> 39 #include <sys/systm.h> 40 #include <sys/file.h> 41 #include <sys/klwp.h> 42 #include <sys/stropts.h> 43 #include <sys/stream.h> 44 #include <sys/strsubr.h> 45 46 #include <sys/consdev.h> 47 #include <sys/kbio.h> 48 #include <sys/debug.h> 49 #include <sys/reboot.h> 50 #include <sys/termios.h> 51 52 #include <sys/ddi.h> 53 #include <sys/sunddi.h> 54 #include <sys/modctl.h> 55 #include <sys/ddi_impldefs.h> 56 57 #include <sys/strsubr.h> 58 #include <sys/errno.h> 59 #include <sys/devops.h> 60 #include <sys/note.h> 61 62 63 /* 64 * On supported configurations, the firmware defines the keyboard and mouse 65 * paths. However, during USB development, it is useful to be able to use 66 * the USB keyboard and mouse on machines without full USB firmware support. 67 * These variables may be set in /etc/system according to a machine's 68 * USB configuration. This module will override the firmware's values 69 * with these. 70 */ 71 static char *usb_kb_path = NULL; 72 static char *usb_ms_path = NULL; 73 74 /* 75 * This is the loadable module wrapper. 76 */ 77 extern struct mod_ops mod_miscops; 78 79 /* 80 * Module linkage information for the kernel. 81 */ 82 static struct modlmisc modlmisc = { 83 &mod_miscops, "console configuration %I%" 84 }; 85 86 static struct modlinkage modlinkage = { 87 MODREV_1, (void *)&modlmisc, NULL 88 }; 89 90 int 91 _init(void) 92 { 93 return (mod_install(&modlinkage)); 94 } 95 96 int 97 _fini(void) 98 { 99 return (mod_remove(&modlinkage)); 100 } 101 102 int 103 _info(struct modinfo *modinfop) 104 { 105 return (mod_info(&modlinkage, modinfop)); 106 } 107 108 extern void dynamic_console_config(void); 109 110 /* 111 * Configure keyboard and mouse. Main entry here. 112 */ 113 void 114 consconfig(void) 115 { 116 dynamic_console_config(); 117 } 118 119 extern char * 120 consconfig_get_usb_kb_path(void) { 121 if (usb_kb_path) 122 return (i_ddi_strdup(usb_kb_path, KM_SLEEP)); 123 return (NULL); 124 } 125 126 extern char * 127 consconfig_get_usb_ms_path(void) { 128 if (usb_ms_path) 129 return (i_ddi_strdup(usb_ms_path, KM_SLEEP)); 130 return (NULL); 131 } 132