Home | History | Annotate | Download | only in SUNWuprl
      1 #!/bin/sh
      2 #
      3 # CDDL HEADER START
      4 #
      5 # The contents of this file are subject to the terms of the
      6 # Common Development and Distribution License (the "License").
      7 # You may not use this file except in compliance 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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
     24 #
     25 # Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
     26 # Use is subject to license terms.
     27 #
     28  
     29 PATH="/usr/bin:/usr/sbin:${PATH}"
     30 export PATH
     31 
     32 if [ "${BASEDIR:=/}" != "/" ] 
     33 then
     34 	BASEDIR_OPT="-b $BASEDIR" 
     35 fi
     36 
     37 installed() {
     38 	driver=$1
     39 	grep "^${driver} " $BASEDIR/etc/name_to_major > /dev/null 2>&1
     40 
     41 	return $?
     42 }
     43 
     44 update_driver() {
     45 	driver=$1
     46 	aliases=$2
     47 	for alias in ${aliases}
     48 	do
     49 		egrep "^${driver}[ 	]+${alias}" ${BASEDIR}/etc/driver_aliases > /dev/null 2>&1
     50 		if [ $? -ne 0 ]
     51 		then
     52 			echo "${driver} ${alias}" >> ${BASEDIR}/etc/driver_aliases
     53 		fi
     54 	done
     55 }
     56 
     57 EXIT=0
     58 
     59 # "usb67b,2303" Most adapters based on pl2303 chip set have this ID
     60 # "usb67b,aaa2" IO DATA USB-RSAQ3 USB serial adapter
     61 # "usb56e,5004" ELECOM UC-SGT USB serial adapter
     62 # "usb557,2008" Aten UC-232A USB serial adapter
     63 # "usb6189,2068" Sitecom CN-104 USB serial adapter
     64 # "usb5ad,fba" Radio Shack 6-Ft USB serial adapter
     65 USBSPRL_ALIASES="\
     66 	\"usb67b,2303\" \
     67 	\"usb67b,aaa2\" \
     68 	\"usb56e,5004\" \
     69 	\"usb557,2008\" \
     70 	\"usb6189,2068\" \
     71 	\"usb5ad,fba\" \
     72 	"
     73 
     74 if installed usbsprl ; then
     75 	update_driver usbsprl "${USBSPRL_ALIASES}" || EXIT=1
     76 else
     77 	add_drv ${BASEDIR_OPT} -m '* 0666 root sys' \
     78 	    -i "${USBSPRL_ALIASES}" -n usbsprl || EXIT=1
     79 fi
     80 
     81 exit $EXIT
     82