Subject: port-sparc64/18450: USB related charactor devices are missing on sparc64
To: None <gnats-bugs@gnats.netbsd.org>
From: None <t-nkyma@tcp-ip.or.jp>
List: netbsd-bugs
Date: 09/29/2002 03:00:40
>Number:         18450
>Category:       port-sparc64
>Synopsis:       USB related charactor devices are missing on sparc64
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-sparc64-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Sep 28 11:01:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Takeshi Nakayama
>Release:        NetBSD 1.6
>Organization:
Private
>Environment:
System: NetBSD nyx 1.6 NetBSD 1.6 (NYX32) #39: Fri Sep 27 18:42:10 JST 2002
 takeshi@nyx:/usr/src/sys/arch/sparc64/compile/NYX32 sparc64
Architecture: sparc
Machine: sparc64
>Description:
	Recent models of sparc64 have USB and we support it. But
	charactor devices are missing.
>How-To-Repeat:
	use usbdevs(8) on sparc64
>Fix:
	Add the charactor devices, like the following patch.

Index: etc/etc.sparc64/MAKEDEV
===================================================================
RCS file: /cvsroot/basesrc/etc/etc.sparc64/MAKEDEV,v
retrieving revision 1.39
diff -u -d -u -r1.39 MAKEDEV
--- etc/etc.sparc64/MAKEDEV	2002/08/16 17:56:56	1.39
+++ etc/etc.sparc64/MAKEDEV	2002/09/10 03:12:36
@@ -46,6 +46,7 @@
 #	std	standard devices
 #	local	configuration specific devices
 #	isdns	make ISDN devices
+#	usbs	make USB devices
 # Tapes:
 #	st*	SCSI tape
 # Disks:
@@ -65,6 +66,14 @@
 # Pseudo terminals:
 #	pty*	set of 62 master and slave pseudo terminals
 #	opty	first 16 ptys, to save inodes on install media
+# USB devices:
+#	usb*	Bus control devices used by usbd for attach/detach
+#	uhid*	Generic HID devices
+#	ulpt*	Printer devices
+#	ugen*	Generic device
+#	urio*	Diamond Rio 500
+#	uscanner*	Scanners
+#	ttyU*	Modem
 # ISDN devices:
 #	isdn	communication between userland isdnd and kernel
 #	isdnctl	control device
@@ -98,6 +107,7 @@
 
 dialin=0
 dialout=524288		# high bit of the minor number
+callunit=262144
 
 PATH=/sbin:/bin/:/usr/bin:/usr/sbin:/usr/etc
 umask 77
@@ -133,6 +143,7 @@
 	sh -$- $0 cgeight0 tcx0
 	sh -$- $0 scsibus0 scsibus1 scsibus2 scsibus3
 	sh -$- $0 ipl lkm random local
+	sh -$- $0 usbs
 	sh -$- $0 isdns
 	sh -$- $0 pci0 pci1 pci2 pci3 pci4 pci5 pci6 pci7
 	sh -$- $0 clockctl
@@ -522,6 +533,94 @@
 	rm -f isdntrc$unit
 	mknod isdntrc$unit c 75 $unit
 	chmod 600 isdntrc$unit
+	;;
+
+usbs)
+	makedev usb usb0 usb1 usb2 usb3 usb4 usb5 usb6 usb7
+	makedev uhid0 uhid1 uhid2 uhid3
+	makedev ulpt0 ulpt1
+	makedev ttyU0 ttyU1
+	makedev urio0
+	makedev uscanner0 uscanner1
+	;;
+
+usb*)
+	unit=${i#usb}
+	if [ "$unit" = "" ]; then
+	    unit=255
+	    usb=usb
+	else
+	    usb=usb$unit
+	fi
+	major=78
+	rm -f $usb
+	mknod $usb c $major $unit
+	chmod 600 $usb
+	;;
+
+uhid*)
+	unit=${i#uhid}
+	uhid=uhid$unit
+	major=79
+	rm -f $uhid
+	mknod $uhid c $major $unit
+	chmod 666 $uhid
+	;;
+
+ulpt*)
+	unit=${i#ulpt}
+	ulpt=ulpt$unit
+	ulpn=ulpn$unit
+	major=80
+	rm -f $ulpt $ulpn
+	mknod $ulpt c $major $unit
+	mknod $ulpn c $major $(($unit + 64))
+	chmod 600 $ulpt $ulpn
+	;;
+
+ugen*)
+	unit=${i#ugen}
+	ugen=ugen$unit
+	major=81
+	for j in 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15
+	do
+		ugenj=$ugen.$j
+		rm -f $ugenj
+		mknod $ugenj c $major $(($unit * 16 + $j))
+		chmod 600 $ugenj
+	done
+	;;
+
+ttyU*)
+	unit=${i#ttyU}
+	ttyU=ttyU$unit
+	dtyU=dtyU$unit
+	ctyU=ctyU$unit
+	major=82
+	rm -f $ttyU $dtyU $ctyU
+	mknod $ttyU c $major $(($unit + $dialin  ))
+	mknod $dtyU c $major $(($unit + $dialout ))
+	mknod $ctyU c $major $(($unit + $callunit))
+	chown uucp $ttyU $dtyU $ctyU
+	chmod 600 $ttyU $dtyU $ctyU
+	;;
+
+urio*)
+	unit=${i#urio}
+	urio=urio$unit
+	major=83
+	rm -f $urio
+	mknod $urio c $major $unit
+	chmod 600 $urio
+	;;
+
+uscanner*)
+	unit=${i#uscanner}
+	uscanner=uscanner$unit
+	major=84
+	rm -f $uscanner
+	mknod $uscanner c $major $unit
+	chmod 600 $uscanner
 	;;
 
 pci*)
Index: sys/arch/sparc64/conf/majors.sparc64
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/sparc64/conf/majors.sparc64,v
retrieving revision 1.2
diff -u -d -u -r1.2 majors.sparc64
--- sys/arch/sparc64/conf/majors.sparc64	2002/09/06 13:22:12	1.2
+++ sys/arch/sparc64/conf/majors.sparc64	2002/09/10 03:12:43
@@ -56,6 +56,13 @@
 device-major	isdntrc		char 75			isdntrc
 device-major	isdntel		char 76			isdntel
 device-major	sabtty		char 77			sabtty
+device-major	usb		char 78			usb
+device-major	uhid		char 79			uhid
+device-major	ulpt		char 80			ulpt
+device-major	ugen		char 81			ugen
+device-major	ucom		char 82			ucom
+device-major	urio		char 83			urio
+device-major	uscanner	char 84			uscanner
 
 device-major	cgfourteen	char 99			cgfourteen
 
>Release-Note:
>Audit-Trail:
>Unformatted: