CVS commit: src/usr.bin/make

2016-03-19 Thread Matthias Pfaller
Module Name:src
Committed By:   matthias
Date:   Wed Mar 16 16:04:44 UTC 2016

Modified Files:
src/usr.bin/make: main.c

Log Message:
honor setting .MAKE.JOBS from the makefile. That way one can e.g. do:

CPUS!=sysctl -n hw.ncpuonline
.MAKE.JOBS?=$(CPUS)


To generate a diff of this commit:
cvs rdiff -u -r1.242 -r1.243 src/usr.bin/make/main.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/main.c
diff -u src/usr.bin/make/main.c:1.242 src/usr.bin/make/main.c:1.243
--- src/usr.bin/make/main.c:1.242	Mon Mar  7 21:45:43 2016
+++ src/usr.bin/make/main.c	Wed Mar 16 16:04:44 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.242 2016/03/07 21:45:43 christos Exp $	*/
+/*	$NetBSD: main.c,v 1.243 2016/03/16 16:04:44 matthias Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,7 +69,7 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: main.c,v 1.242 2016/03/07 21:45:43 christos Exp $";
+static char rcsid[] = "$NetBSD: main.c,v 1.243 2016/03/16 16:04:44 matthias Exp $";
 #else
 #include 
 #ifndef lint
@@ -81,7 +81,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19
 #if 0
 static char sccsid[] = "@(#)main.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: main.c,v 1.242 2016/03/07 21:45:43 christos Exp $");
+__RCSID("$NetBSD: main.c,v 1.243 2016/03/16 16:04:44 matthias Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -1117,14 +1117,6 @@ main(int argc, char **argv)
 	}
 
 	/*
-	 * Be compatible if user did not specify -j and did not explicitly
-	 * turned compatibility on
-	 */
-	if (!compatMake && !forceJobs) {
-		compatMake = TRUE;
-	}
-	
-	/*
 	 * Initialize archive, target and suffix modules in preparation for
 	 * parsing the makefile(s)
 	 */
@@ -1240,6 +1232,35 @@ main(int argc, char **argv)
 	Var_Append("MFLAGS", Var_Value(MAKEFLAGS, VAR_GLOBAL, ), VAR_GLOBAL);
 	free(p1);
 
+	if (Var_Exists(".MAKE.JOBS", VAR_GLOBAL)) {
+	char *value;
+	int n;
+
+	value = Var_Subst(NULL, "${.MAKE.JOBS}", VAR_GLOBAL, VARF_WANTRES);
+	n = strtol(value, NULL, 0);
+	if (n < 1) {
+		(void)fprintf(stderr, "%s: illegal value for .MAKE.JOBS -- must be positive integer!\n",
+		progname);
+		exit(1);
+	}
+	if (n != maxJobs) {
+		Var_Append(MAKEFLAGS, "-j", VAR_GLOBAL);
+		Var_Append(MAKEFLAGS, value, VAR_GLOBAL);
+	}
+	maxJobs = n;
+	maxJobTokens = maxJobs;
+	forceJobs = TRUE;
+	free(value);
+	}
+
+	/*
+	 * Be compatible if user did not specify -j and did not explicitly
+	 * turned compatibility on
+	 */
+	if (!compatMake && !forceJobs) {
+	compatMake = TRUE;
+	}
+
 	if (!compatMake)
 	Job_ServerStart(maxJobTokens, jp_0, jp_1);
 	if (DEBUG(JOB))



CVS commit: src/usr.bin/make

2016-03-15 Thread Matthias Pfaller
Module Name:src
Committed By:   matthias
Date:   Tue Mar 15 18:30:14 UTC 2016

Modified Files:
src/usr.bin/make: suff.c

Log Message:
Another small change to make archive member rules work. With this change
archive member rules seem to work as expected again.


To generate a diff of this commit:
cvs rdiff -u -r1.80 -r1.81 src/usr.bin/make/suff.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/suff.c
diff -u src/usr.bin/make/suff.c:1.80 src/usr.bin/make/suff.c:1.81
--- src/usr.bin/make/suff.c:1.80	Tue Mar 15 06:25:14 2016
+++ src/usr.bin/make/suff.c	Tue Mar 15 18:30:14 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: suff.c,v 1.80 2016/03/15 06:25:14 matthias Exp $	*/
+/*	$NetBSD: suff.c,v 1.81 2016/03/15 18:30:14 matthias Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: suff.c,v 1.80 2016/03/15 06:25:14 matthias Exp $";
+static char rcsid[] = "$NetBSD: suff.c,v 1.81 2016/03/15 18:30:14 matthias Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)suff.c	8.4 (Berkeley) 3/21/94";
 #else
-__RCSID("$NetBSD: suff.c,v 1.80 2016/03/15 06:25:14 matthias Exp $");
+__RCSID("$NetBSD: suff.c,v 1.81 2016/03/15 18:30:14 matthias Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -2016,9 +2016,10 @@ SuffFindArchiveDeps(GNode *gn, Lst slst)
 
 /*
  * Flag the member as such so we remember to look in the archive for
- * its modification time.
+ * its modification time. The OP_JOIN | OP_MADE is needed because this
+ * target should never get made.
  */
-mem->type |= OP_MEMBER;
+mem->type |= OP_MEMBER | OP_JOIN | OP_MADE;
 }
 
 /*-



CVS commit: src/usr.bin/make

2016-03-15 Thread Matthias Pfaller
Module Name:src
Committed By:   matthias
Date:   Tue Mar 15 06:25:14 UTC 2016

Modified Files:
src/usr.bin/make: suff.c

Log Message:
dynamic dependencies for library member targets are working again.


To generate a diff of this commit:
cvs rdiff -u -r1.79 -r1.80 src/usr.bin/make/suff.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/suff.c
diff -u src/usr.bin/make/suff.c:1.79 src/usr.bin/make/suff.c:1.80
--- src/usr.bin/make/suff.c:1.79	Mon Mar 14 07:42:15 2016
+++ src/usr.bin/make/suff.c	Tue Mar 15 06:25:14 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: suff.c,v 1.79 2016/03/14 07:42:15 matthias Exp $	*/
+/*	$NetBSD: suff.c,v 1.80 2016/03/15 06:25:14 matthias Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: suff.c,v 1.79 2016/03/14 07:42:15 matthias Exp $";
+static char rcsid[] = "$NetBSD: suff.c,v 1.80 2016/03/15 06:25:14 matthias Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)suff.c	8.4 (Berkeley) 3/21/94";
 #else
-__RCSID("$NetBSD: suff.c,v 1.79 2016/03/14 07:42:15 matthias Exp $");
+__RCSID("$NetBSD: suff.c,v 1.80 2016/03/15 06:25:14 matthias Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -1894,6 +1894,7 @@ SuffFindArchiveDeps(GNode *gn, Lst slst)
 	TARGET,		/* Must be first */
 	PREFIX,		/* Must be second */
 };
+LstNode 	ln, nln;/* Next suffix node to check */
 int		i;  	/* Index into copy and vals */
 Suff	*ms;	/* Suffix descriptor for member */
 char	*name;	/* Start of member's name */
@@ -1959,7 +1960,16 @@ SuffFindArchiveDeps(GNode *gn, Lst slst)
  * Set $@ for compatibility with other makes
  */
 Var_Set(TARGET, gn->name, gn, 0);
-
+
+/*
+ * Now we've got the important local variables set, expand any sources
+ * that still contain variables or wildcards in their names.
+ */
+for (ln = Lst_First(gn->children); ln != NULL; ln = nln) {
+	nln = Lst_Succ(ln);
+	SuffExpandChildren(ln, gn);
+}
+
 if (ms != NULL) {
 	/*
 	 * Member has a known suffix, so look for a transformation rule from
@@ -1967,7 +1977,6 @@ SuffFindArchiveDeps(GNode *gn, Lst slst)
 	 * through the entire list, we just look at suffixes to which the
 	 * member's suffix may be transformed...
 	 */
-	LstNode		ln;
 	SuffixCmpData	sd;		/* Search string data */
 
 	/*



CVS commit: src/usr.bin/make

2016-03-14 Thread Matthias Pfaller
Module Name:src
Committed By:   matthias
Date:   Mon Mar 14 07:42:16 UTC 2016

Modified Files:
src/usr.bin/make: make.1 suff.c

Log Message:
make $@ an alias for $! in archive member rules (compatibility with
other makes).


To generate a diff of this commit:
cvs rdiff -u -r1.254 -r1.255 src/usr.bin/make/make.1
cvs rdiff -u -r1.78 -r1.79 src/usr.bin/make/suff.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/make.1
diff -u src/usr.bin/make/make.1:1.254 src/usr.bin/make/make.1:1.255
--- src/usr.bin/make/make.1:1.254	Sat Feb 20 01:43:28 2016
+++ src/usr.bin/make/make.1	Mon Mar 14 07:42:15 2016
@@ -1,4 +1,4 @@
-.\"	$NetBSD: make.1,v 1.254 2016/02/20 01:43:28 wiz Exp $
+.\"	$NetBSD: make.1,v 1.255 2016/03/14 07:42:15 matthias Exp $
 .\"
 .\" Copyright (c) 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -685,6 +685,9 @@ or it will not be recognized.
 .It Va .TARGET
 The name of the target; also known as
 .Ql Va @ .
+For compatibility with other makes this is an alias for
+.Ic Va .ARCHIVE
+in archive member rules.
 .El
 .Pp
 The shorter forms

Index: src/usr.bin/make/suff.c
diff -u src/usr.bin/make/suff.c:1.78 src/usr.bin/make/suff.c:1.79
--- src/usr.bin/make/suff.c:1.78	Thu Feb 18 18:29:14 2016
+++ src/usr.bin/make/suff.c	Mon Mar 14 07:42:15 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: suff.c,v 1.78 2016/02/18 18:29:14 christos Exp $	*/
+/*	$NetBSD: suff.c,v 1.79 2016/03/14 07:42:15 matthias Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: suff.c,v 1.78 2016/02/18 18:29:14 christos Exp $";
+static char rcsid[] = "$NetBSD: suff.c,v 1.79 2016/03/14 07:42:15 matthias Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)suff.c	8.4 (Berkeley) 3/21/94";
 #else
-__RCSID("$NetBSD: suff.c,v 1.78 2016/02/18 18:29:14 christos Exp $");
+__RCSID("$NetBSD: suff.c,v 1.79 2016/03/14 07:42:15 matthias Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -1955,6 +1955,11 @@ SuffFindArchiveDeps(GNode *gn, Lst slst)
 Var_Set(MEMBER, name, gn, 0);
 Var_Set(ARCHIVE, gn->name, gn, 0);
 
+/*
+ * Set $@ for compatibility with other makes
+ */
+Var_Set(TARGET, gn->name, gn, 0);
+
 if (ms != NULL) {
 	/*
 	 * Member has a known suffix, so look for a transformation rule from



CVS commit: src/usr.bin/make

2016-03-11 Thread Matthias Pfaller
Module Name:src
Committed By:   matthias
Date:   Fri Mar 11 15:12:39 UTC 2016

Modified Files:
src/usr.bin/make: var.c

Log Message:
$% is $(.MEMBER) and not $(.ARCHIVE), $! is $(.ARCHIVE) and not $(.MEMBER)


To generate a diff of this commit:
cvs rdiff -u -r1.206 -r1.207 src/usr.bin/make/var.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/var.c
diff -u src/usr.bin/make/var.c:1.206 src/usr.bin/make/var.c:1.207
--- src/usr.bin/make/var.c:1.206	Mon Mar  7 20:20:35 2016
+++ src/usr.bin/make/var.c	Fri Mar 11 15:12:39 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.206 2016/03/07 20:20:35 sjg Exp $	*/
+/*	$NetBSD: var.c,v 1.207 2016/03/11 15:12:39 matthias Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.206 2016/03/07 20:20:35 sjg Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.207 2016/03/11 15:12:39 matthias Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.206 2016/03/07 20:20:35 sjg Exp $");
+__RCSID("$NetBSD: var.c,v 1.207 2016/03/11 15:12:39 matthias Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -3700,11 +3700,11 @@ Var_Parse(const char *str, GNode *ctxt, 
 		case '@':
 			return UNCONST("$(.TARGET)");
 		case '%':
-			return UNCONST("$(.ARCHIVE)");
+			return UNCONST("$(.MEMBER)");
 		case '*':
 			return UNCONST("$(.PREFIX)");
 		case '!':
-			return UNCONST("$(.MEMBER)");
+			return UNCONST("$(.ARCHIVE)");
 		}
 	}
 	/*



CVS commit: src/usr.bin/make

2016-03-11 Thread Matthias Pfaller
Module Name:src
Committed By:   matthias
Date:   Fri Mar 11 13:54:47 UTC 2016

Modified Files:
src/usr.bin/make: parse.c

Log Message:
make parsing of library member targets work. So

lib.a(member.o): something
cp something member.o
ar r lib.a member.o
rm member.o

will work now.


To generate a diff of this commit:
cvs rdiff -u -r1.212 -r1.213 src/usr.bin/make/parse.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/parse.c
diff -u src/usr.bin/make/parse.c:1.212 src/usr.bin/make/parse.c:1.213
--- src/usr.bin/make/parse.c:1.212	Fri Feb 19 06:19:06 2016
+++ src/usr.bin/make/parse.c	Fri Mar 11 13:54:47 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.212 2016/02/19 06:19:06 sjg Exp $	*/
+/*	$NetBSD: parse.c,v 1.213 2016/03/11 13:54:47 matthias Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: parse.c,v 1.212 2016/02/19 06:19:06 sjg Exp $";
+static char rcsid[] = "$NetBSD: parse.c,v 1.213 2016/03/11 13:54:47 matthias Exp $";
 #else
 #include 
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)parse.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: parse.c,v 1.212 2016/02/19 06:19:06 sjg Exp $");
+__RCSID("$NetBSD: parse.c,v 1.213 2016/03/11 13:54:47 matthias Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -1247,6 +1247,7 @@ ParseDoDependency(char *line)
 		goto out;
 	} else {
 		/* Done with this word; on to the next. */
+		cp = line;
 		continue;
 	}
 	}



CVS commit: src/usr.bin/calendar

2012-04-03 Thread Matthias Pfaller
Module Name:src
Committed By:   matthias
Date:   Tue Apr  3 12:03:05 UTC 2012

Modified Files:
src/usr.bin/calendar: calendar.c

Log Message:
Stop playing games with stdin and stdout file descriptors.
calendar did not work with nss_ldap installed. Typical symptoms were
  cc1: error: stdout: Bad file descriptor
in daily.out.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/usr.bin/calendar/calendar.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/calendar/calendar.c
diff -u src/usr.bin/calendar/calendar.c:1.48 src/usr.bin/calendar/calendar.c:1.49
--- src/usr.bin/calendar/calendar.c:1.48	Tue Dec  8 13:49:08 2009
+++ src/usr.bin/calendar/calendar.c	Tue Apr  3 12:03:04 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: calendar.c,v 1.48 2009/12/08 13:49:08 wiz Exp $	*/
+/*	$NetBSD: calendar.c,v 1.49 2012/04/03 12:03:04 matthias Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993, 1994
@@ -39,7 +39,7 @@ __COPYRIGHT(@(#) Copyright (c) 1989, 19
 #if 0
 static char sccsid[] = @(#)calendar.c	8.4 (Berkeley) 1/7/95;
 #endif
-__RCSID($NetBSD: calendar.c,v 1.48 2009/12/08 13:49:08 wiz Exp $);
+__RCSID($NetBSD: calendar.c,v 1.49 2012/04/03 12:03:04 matthias Exp $);
 #endif /* not lint */
 
 #include sys/param.h
@@ -117,7 +117,7 @@ static int	 getfield(char *, char **, in
 static void	 getmmdd(struct tm *, char *);
 static int	 getmonth(char *);
 static bool	 isnow(char *);
-static FILE	*opencal(void);
+static FILE	*opencal(FILE **);
 static void	 settime(void);
 static void	 usage(void) __dead;
 
@@ -192,13 +192,13 @@ static void
 cal(void)
 {
 	bool printing;
-	FILE *fp;
+	FILE *fp, *in = NULL;
 	char *line;
 
-	if ((fp = opencal()) == NULL)
+	if ((fp = opencal(in)) == NULL || in == NULL)
 		return;
 	printing = false;
-	while ((line = fparseln(stdin,
+	while ((line = fparseln(in,
 		NULL, NULL, NULL, FPARSELN_UNESCCOMM)) != NULL) {
 		if (line[0] == '\0')
 			continue;
@@ -381,7 +381,7 @@ getfield(char *p, char **endp, int *flag
 }
 
 static FILE *
-opencal(void)
+opencal(FILE **in)
 {
 	int fd;
 	int pdes[2];
@@ -390,7 +390,7 @@ opencal(void)
 	/* open up calendar file as stdin */
 	if (fname == NULL) {
 		for (name = defaultnames; *name != NULL; name++) {
-			if (freopen(*name, rf, stdin) == NULL)
+			if ((fd = open(*name, O_RDONLY))  0)
 continue;
 			else
 break;
@@ -400,7 +400,7 @@ opencal(void)
 return NULL;
 			err(EXIT_FAILURE, Cannot open calendar file);
 		}
-	} else if (freopen(fname, rf, stdin) == NULL) {
+	} else if ((fd = open(fname, O_RDONLY))  0) {
 		if (doall)
 			return NULL;
 		err(EXIT_FAILURE, Cannot open `%s', fname);
@@ -418,7 +418,13 @@ opencal(void)
 		(void)close(pdes[1]);
 		return NULL;
 	case 0:
-		/* child -- stdin already setup, set stdout to pipe input */
+		/* child */
+		/* set stdin to calendar file */
+		if (fd != STDIN_FILENO) {
+			(void)dup2(fd, STDIN_FILENO);
+			(void)close(fd);
+		}
+		/* set stdout to pipe input */
 		if (pdes[1] != STDOUT_FILENO) {
 			(void)dup2(pdes[1], STDOUT_FILENO);
 			(void)close(pdes[1]);
@@ -434,11 +440,13 @@ opencal(void)
 		err(EXIT_FAILURE, Cannot exec `%s', _PATH_CPP);
 		/*NOTREACHED*/
 	default:
-		/* parent -- set stdin to pipe output */
-		(void)dup2(pdes[0], STDIN_FILENO);
-		(void)close(pdes[0]);
+		/* parent -- fdopen *in to pipe output */
+		*in = fdopen(pdes[0], r);
 		(void)close(pdes[1]);
 
+		/* close calendar file */
+		close(fd);
+
 		/* not reading all calendar files, just set output to stdout */
 		if (!doall)
 			return stdout;



CVS commit: src/sys/dev/usb

2010-04-25 Thread Matthias Pfaller
Module Name:src
Committed By:   matthias
Date:   Sun Apr 25 09:14:39 UTC 2010

Modified Files:
src/sys/dev/usb: usb_subr.c

Log Message:
Fix for PR#42572. I was running with this patch for several month without
any problems.


To generate a diff of this commit:
cvs rdiff -u -r1.167 -r1.168 src/sys/dev/usb/usb_subr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/usb/usb_subr.c
diff -u src/sys/dev/usb/usb_subr.c:1.167 src/sys/dev/usb/usb_subr.c:1.168
--- src/sys/dev/usb/usb_subr.c:1.167	Thu Nov 12 20:11:35 2009
+++ src/sys/dev/usb/usb_subr.c	Sun Apr 25 09:14:38 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: usb_subr.c,v 1.167 2009/11/12 20:11:35 dyoung Exp $	*/
+/*	$NetBSD: usb_subr.c,v 1.168 2010/04/25 09:14:38 matthias Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $	*/
 
 /*
@@ -32,7 +32,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: usb_subr.c,v 1.167 2009/11/12 20:11:35 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: usb_subr.c,v 1.168 2010/04/25 09:14:38 matthias Exp $);
 
 #include opt_compat_netbsd.h
 #include opt_usbverbose.h
@@ -1158,14 +1158,6 @@
 
 	USETW(dev-def_ep_desc.wMaxPacketSize, dd-bMaxPacketSize);
 
-	err = usbd_reload_device_desc(dev);
-	if (err) {
-		DPRINTFN(-1, (usbd_new_device: addr=%d, getting full desc 
-			  failed\n, addr));
-		usbd_remove_device(dev, up);
-		return (err);
-	}
-
 	/* Set the address */
 	DPRINTFN(5, (usbd_new_device: setting device address=%d\n, addr));
 	err = usbd_set_address(dev, addr);
@@ -1181,6 +1173,14 @@
 	dev-address = addr;	/* new device address now */
 	bus-devices[addr] = dev;
 
+	err = usbd_reload_device_desc(dev);
+	if (err) {
+		DPRINTFN(-1, (usbd_new_device: addr=%d, getting full desc 
+			  failed\n, addr));
+		usbd_remove_device(dev, up);
+		return (err);
+	}
+
 	/* Re-establish the default pipe with the new address. */
 	usbd_kill_pipe(dev-default_pipe);
 	err = usbd_setup_pipe(dev, 0, dev-def_ep, USBD_DEFAULT_INTERVAL,



CVS commit: src/sys/dev/usb

2010-01-14 Thread Matthias Pfaller
Module Name:src
Committed By:   matthias
Date:   Thu Jan 14 09:30:39 UTC 2010

Modified Files:
src/sys/dev/usb: ums.c usbdevs usbdevs.h usbdevs_data.h

Log Message:
Make ums.c work with a Microsoft Natural Ergonomic Desktop 7000 mouse.
XXX The tilt function still doesn't work for me.


To generate a diff of this commit:
cvs rdiff -u -r1.79 -r1.80 src/sys/dev/usb/ums.c
cvs rdiff -u -r1.539 -r1.540 src/sys/dev/usb/usbdevs
cvs rdiff -u -r1.534 -r1.535 src/sys/dev/usb/usbdevs.h
cvs rdiff -u -r1.535 -r1.536 src/sys/dev/usb/usbdevs_data.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/usb/ums.c
diff -u src/sys/dev/usb/ums.c:1.79 src/sys/dev/usb/ums.c:1.80
--- src/sys/dev/usb/ums.c:1.79	Tue Jan 12 16:18:58 2010
+++ src/sys/dev/usb/ums.c	Thu Jan 14 09:30:39 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: ums.c,v 1.79 2010/01/12 16:18:58 jakllsch Exp $	*/
+/*	$NetBSD: ums.c,v 1.80 2010/01/14 09:30:39 matthias Exp $	*/
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ums.c,v 1.79 2010/01/12 16:18:58 jakllsch Exp $);
+__KERNEL_RCSID(0, $NetBSD: ums.c,v 1.80 2010/01/14 09:30:39 matthias Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -287,7 +287,8 @@
 	 * in bytes 3  4 of the report.  Fix this if necessary.
 	 */
 	if (uha-uaa-vendor == USB_VENDOR_MICROSOFT 
-	uha-uaa-product == USB_PRODUCT_MICROSOFT_24GHZ_XCVR) {
+	(uha-uaa-product == USB_PRODUCT_MICROSOFT_24GHZ_XCVR10 ||
+	 uha-uaa-product == USB_PRODUCT_MICROSOFT_24GHZ_XCVR20)) {	
 		if ((sc-flags  UMS_Z)  sc-sc_loc_z.pos == 0)
 			sc-sc_loc_z.pos = 24;
 		if ((sc-flags  UMS_W)  sc-sc_loc_w.pos == 0)

Index: src/sys/dev/usb/usbdevs
diff -u src/sys/dev/usb/usbdevs:1.539 src/sys/dev/usb/usbdevs:1.540
--- src/sys/dev/usb/usbdevs:1.539	Tue Jan 12 14:50:38 2010
+++ src/sys/dev/usb/usbdevs	Thu Jan 14 09:30:39 2010
@@ -1,4 +1,4 @@
-$NetBSD: usbdevs,v 1.539 2010/01/12 14:50:38 jakllsch Exp $
+$NetBSD: usbdevs,v 1.540 2010/01/14 09:30:39 matthias Exp $
 
 /*
  * Copyright (c) 1998-2004 The NetBSD Foundation, Inc.
@@ -1601,7 +1601,8 @@
 product MICROSOFT XBOX_CONTROLLER_S10	0x0285	Xbox Controller S (1.0)
 product MICROSOFT XBOX_CONTROLLER_HUB	0x0288	Xbox Controller Hub
 product MICROSOFT XBOX_CONTROLLER_S12	0x0289	Xbox Controller S (1.2)
-product MICROSOFT 24GHZ_XCVR		0x071f  2.4GHz Transceiver V2.0
+product MICROSOFT 24GHZ_XCVR10		0x071d  2.4GHz Transceiver V1.0
+product MICROSOFT 24GHZ_XCVR20		0x071f  2.4GHz Transceiver V2.0
 
 /* Microtech products */
 product MICROTECH SCSIDB25	0x0004	USB-SCSI-DB25

Index: src/sys/dev/usb/usbdevs.h
diff -u src/sys/dev/usb/usbdevs.h:1.534 src/sys/dev/usb/usbdevs.h:1.535
--- src/sys/dev/usb/usbdevs.h:1.534	Tue Jan 12 14:51:43 2010
+++ src/sys/dev/usb/usbdevs.h	Thu Jan 14 09:30:39 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbdevs.h,v 1.534 2010/01/12 14:51:43 jakllsch Exp $	*/
+/*	$NetBSD: usbdevs.h,v 1.535 2010/01/14 09:30:39 matthias Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
@@ -1608,7 +1608,8 @@
 #define	USB_PRODUCT_MICROSOFT_XBOX_CONTROLLER_S10	0x0285		/* Xbox Controller S (1.0) */
 #define	USB_PRODUCT_MICROSOFT_XBOX_CONTROLLER_HUB	0x0288		/* Xbox Controller Hub */
 #define	USB_PRODUCT_MICROSOFT_XBOX_CONTROLLER_S12	0x0289		/* Xbox Controller S (1.2) */
-#define	USB_PRODUCT_MICROSOFT_24GHZ_XCVR	0x071f		/* 2.4GHz Transceiver V2.0 */
+#define	USB_PRODUCT_MICROSOFT_24GHZ_XCVR10	0x071d		/* 2.4GHz Transceiver V1.0 */
+#define	USB_PRODUCT_MICROSOFT_24GHZ_XCVR20	0x071f		/* 2.4GHz Transceiver V2.0 */
 
 /* Microtech products */
 #define	USB_PRODUCT_MICROTECH_SCSIDB25	0x0004		/* USB-SCSI-DB25 */

Index: src/sys/dev/usb/usbdevs_data.h
diff -u src/sys/dev/usb/usbdevs_data.h:1.535 src/sys/dev/usb/usbdevs_data.h:1.536
--- src/sys/dev/usb/usbdevs_data.h:1.535	Tue Jan 12 14:51:43 2010
+++ src/sys/dev/usb/usbdevs_data.h	Thu Jan 14 09:30:39 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbdevs_data.h,v 1.535 2010/01/12 14:51:43 jakllsch Exp $	*/
+/*	$NetBSD: usbdevs_data.h,v 1.536 2010/01/14 09:30:39 matthias Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
@@ -4743,7 +4743,11 @@
 	Xbox Controller S (1.2),
 	},
 	{
-	USB_VENDOR_MICROSOFT, USB_PRODUCT_MICROSOFT_24GHZ_XCVR,
+	USB_VENDOR_MICROSOFT, USB_PRODUCT_MICROSOFT_24GHZ_XCVR10,
+	2.4GHz Transceiver V1.0,
+	},
+	{
+	USB_VENDOR_MICROSOFT, USB_PRODUCT_MICROSOFT_24GHZ_XCVR20,
 	2.4GHz Transceiver V2.0,
 	},
 	{
@@ -7035,4 +7039,4 @@
 	Prestige,
 	},
 };
-const int usb_nproducts = 1285;
+const int usb_nproducts = 1286;