Subject: kern/12779: wiconfig doesn't print vendor and firmware id/version
To: None <gnats-bugs@gnats.netbsd.org>
From: None <lha@stacken.kth.se>
List: netbsd-bugs
Date: 04/28/2001 21:52:01
>Number:         12779
>Category:       kern
>Synopsis:       wiconfig doesn't print vendor and firmware id/version
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Apr 28 12:53:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Love
>Release:        1.5U
>Organization:
	Stacken Computer Club
>Environment:
	
System: NetBSD nutcracker.dynarc.se 1.5U NetBSD 1.5U (NUTCRACKER) #3: Mon Apr 9 16:12:48 CEST 2001 lha@nutcracker.dynarc.se:/usr/src/sys/arch/i386/compile/NUTCRACKER i386
Architecture: i386
Machine: i386
>Description:

	Insert your Orinoco card, try to figure out what fireware
	version you are running, look at the wi driver and then the
	linux driver and the realize that its almost there.

>How-To-Repeat:
	See above	
>Fix:

	Dunno where to define WI_RID_STA_IDENEITY_*, and there are several
	vendors that share id.

	Also there is a question how this is supported by other vendors, I
	have obly tried it on a Orinoco (silver) card. Linux driver
	hints that it should work for more cardtype.

Index: wiconfig.c
===================================================================
RCS file: /cvsroot/basesrc/usr.sbin/wiconfig/wiconfig.c,v
retrieving revision 1.11
diff -u -w -r1.11 wiconfig.c
--- wiconfig.c	2001/02/19 23:22:49	1.11
+++ wiconfig.c	2001/04/28 19:45:49
@@ -81,6 +81,7 @@
 #define	WI_WORDS		0x03
 #define	WI_HEXBYTES		0x04
 #define	WI_KEYSTRUCT		0x05
+#define WI_VENDOR		0x06
 	char *wi_label;			/* label used to print info */
 	int wi_opt;			/* option character to set this */
 	char *wi_desc;
@@ -100,6 +101,7 @@
 static void wi_dumpinfo		__P((char *));
 static void wi_setkeys		__P((char *, char *, int));
 static void wi_printkeys	__P((struct wi_req *));
+static void wi_printvendor	__P((struct wi_req *));
 static void wi_dumpstats	__P((char *));
 static void usage		__P((void));
 static struct wi_table *
@@ -379,6 +381,43 @@
         return;
 };
 
+void wi_printvendor(wreq)
+	struct wi_req		*wreq;
+{
+	/* id
+	 * vendor
+	 * firmware major
+	 *          minor
+	 */
+#define WI_RID_STA_IDENEITY_LUCENT	0x1
+#define WI_RID_STA_IDENEITY_PRISMII	0x2
+#define WI_RID_STA_IDENEITY_SAMSUNG	0x3
+#define WI_RID_STA_IDENEITY_DLINK	0x6
+	
+	const char *vendor = "Unknown";
+
+	if (wreq->wi_len < 4)
+		return;
+
+	switch (wreq->wi_val[1]) {
+	case WI_RID_STA_IDENEITY_LUCENT:
+		vendor = "Lucent";
+		break;
+	case WI_RID_STA_IDENEITY_PRISMII:
+		vendor = "generic PRISM II";
+		break;
+	case WI_RID_STA_IDENEITY_SAMSUNG:
+		vendor = "Samsung";
+		break;
+	case WI_RID_STA_IDENEITY_DLINK:
+		vendor = "D-Link";
+		break;
+	}
+	printf("[ %s ID: %d version: %d.%d ]", vendor,
+	       wreq->wi_val[0], wreq->wi_val[2], wreq->wi_val[3]);
+	return;
+}	
+
 void wi_printwords(wreq)
 	struct wi_req		*wreq;
 {
@@ -459,6 +498,7 @@
 	    'S', "max sleep duration" },
 	{ WI_RID_MICROWAVE_OVEN, WI_WORDS, "Microwave oven robustness:\t\t",
 	  'M', "microwave oven robustness enabled" },
+	{ WI_RID_STA_IDENEITY, WI_VENDOR, "Vendor info:\t\t\t\t" },
 	{ 0, WI_NONE }
 };
 
@@ -526,6 +566,9 @@
 			break;
 		case WI_HEXBYTES:
 			wi_printhex(&wreq);
+			break;
+		case WI_VENDOR:
+			wi_printvendor(&wreq);
 			break;
 		default:
 			break;
>Release-Note:
>Audit-Trail:
>Unformatted: