Re: CVS commit: [netbsd-7-nhusb] src/sys/dev/usb

2017-03-31 Thread Nick Hudson

On 03/31/17 11:30, Nick Hudson wrote:

Module Name:src
Committed By:   skrll
Date:   Fri Mar 31 10:30:58 UTC 2017

Modified Files:
src/sys/dev/usb [netbsd-7-nhusb]: uep.c


To generate a diff of this commit:
cvs rdiff -u -r1.19.10.1 -r1.19.10.2 src/sys/dev/usb/uep.c

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



Log message changed to read


revision 1.21
uep: allow (hard-coded) calibration.

From Nicolas Jouanne in PR kern/40105
ok skrll



CVS commit: [netbsd-7-nhusb] src/sys/dev/usb

2017-03-31 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Mar 31 10:30:58 UTC 2017

Modified Files:
src/sys/dev/usb [netbsd-7-nhusb]: uep.c


To generate a diff of this commit:
cvs rdiff -u -r1.19.10.1 -r1.19.10.2 src/sys/dev/usb/uep.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/uep.c
diff -u src/sys/dev/usb/uep.c:1.19.10.1 src/sys/dev/usb/uep.c:1.19.10.2
--- src/sys/dev/usb/uep.c:1.19.10.1	Tue Sep  6 20:33:09 2016
+++ src/sys/dev/usb/uep.c	Fri Mar 31 10:30:58 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: uep.c,v 1.19.10.1 2016/09/06 20:33:09 skrll Exp $	*/
+/*	$NetBSD: uep.c,v 1.19.10.2 2017/03/31 10:30:58 skrll Exp $	*/
 
 /*
  * Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
  *  eGalax USB touchpanel controller driver.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uep.c,v 1.19.10.1 2016/09/06 20:33:09 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uep.c,v 1.19.10.2 2017/03/31 10:30:58 skrll Exp $");
 
 #include 
 #include 
@@ -54,6 +54,14 @@ __KERNEL_RCSID(0, "$NetBSD: uep.c,v 1.19
 #include 
 
 #define UIDSTR	"eGalax USB SN00"
+/* calibration - integer values, perhaps sysctls?  */
+#define X_RATIO   293 
+#define X_OFFSET  -28
+#define Y_RATIO   -348
+#define Y_OFFSET  537
+/* an X_RATIO of ``312''  means : reduce by a factor 3.12 x axis amplitude */
+/* an Y_RATIO of ``-157'' means : reduce by a factor 1.57 y axis amplitude,
+ * and reverse y motion */
 
 struct uep_softc {
 	device_t sc_dev;
@@ -358,6 +366,17 @@ uep_ioctl(void *v, u_long cmd, void *dat
 	return EPASSTHROUGH;
 }
 
+static int
+uep_adjust(int v, int off, int rat)
+{
+	int num = 100 * v;
+	int quot = num / rat;
+	int rem = num % rat;
+	if (num >= 0 && rem < 0)
+		quot++;
+	return quot + off;
+}
+
 void
 uep_intr(struct usbd_xfer *xfer, void *addr, usbd_status status)
 {
@@ -429,8 +448,8 @@ uep_intr(struct usbd_xfer *xfer, void *a
 		default:
 			msk = 0x0f;	/* H=0, L=0 */
 		}
-		x = ((p[3] & msk) << 7) | p[4];
-		y = ((p[1] & msk) << 7) | p[2];
+		x = uep_adjust(((p[3] & msk) << 7) | p[4], X_OFFSET, X_RATIO);
+		y = uep_adjust(((p[1] & msk) << 7) | p[2], Y_OFFSET, Y_RATIO);
 
 		tpcalib_trans(>sc_tpcalib, x, y, , );
 



CVS commit: [netbsd-7-nhusb] src/sys/dev/usb

2017-03-31 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Mar 31 10:30:58 UTC 2017

Modified Files:
src/sys/dev/usb [netbsd-7-nhusb]: uep.c


To generate a diff of this commit:
cvs rdiff -u -r1.19.10.1 -r1.19.10.2 src/sys/dev/usb/uep.c

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



CVS commit: [netbsd-7-nhusb] src/sys/dev/usb

2017-03-31 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Mar 31 10:28:21 UTC 2017

Modified Files:
src/sys/dev/usb [netbsd-7-nhusb]: if_axe.c

Log Message:
Fix build


To generate a diff of this commit:
cvs rdiff -u -r1.67.8.2 -r1.67.8.3 src/sys/dev/usb/if_axe.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/if_axe.c
diff -u src/sys/dev/usb/if_axe.c:1.67.8.2 src/sys/dev/usb/if_axe.c:1.67.8.3
--- src/sys/dev/usb/if_axe.c:1.67.8.2	Thu Jan 26 21:54:24 2017
+++ src/sys/dev/usb/if_axe.c	Fri Mar 31 10:28:21 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_axe.c,v 1.67.8.2 2017/01/26 21:54:24 skrll Exp $	*/
+/*	$NetBSD: if_axe.c,v 1.67.8.3 2017/03/31 10:28:21 skrll Exp $	*/
 /*	$OpenBSD: if_axe.c,v 1.137 2016/04/13 11:03:37 mpi Exp $ */
 
 /*
@@ -87,7 +87,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_axe.c,v 1.67.8.2 2017/01/26 21:54:24 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_axe.c,v 1.67.8.3 2017/03/31 10:28:21 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -278,6 +278,8 @@ static void	axe_unlock_mii(struct axe_so
 
 static void	axe_ax88178_init(struct axe_softc *);
 static void	axe_ax88772_init(struct axe_softc *);
+static void	axe_ax88772a_init(struct axe_softc *);
+static void	axe_ax88772b_init(struct axe_softc *);
 
 /* Get exclusive access to the MII registers */
 static void



CVS commit: [netbsd-7-nhusb] src/sys/dev/usb

2017-03-31 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Mar 31 10:28:21 UTC 2017

Modified Files:
src/sys/dev/usb [netbsd-7-nhusb]: if_axe.c

Log Message:
Fix build


To generate a diff of this commit:
cvs rdiff -u -r1.67.8.2 -r1.67.8.3 src/sys/dev/usb/if_axe.c

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



CVS commit: [netbsd-7-nhusb] src/sys/dev/usb

2017-03-31 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Mar 31 10:25:55 UTC 2017

Modified Files:
src/sys/dev/usb [netbsd-7-nhusb]: uftdi.c

Log Message:
revision 1.64
allow suspend with uftdi(4). it works fine.


To generate a diff of this commit:
cvs rdiff -u -r1.59.4.1.4.2 -r1.59.4.1.4.3 src/sys/dev/usb/uftdi.c

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



CVS commit: [netbsd-7-nhusb] src/sys/dev/usb

2017-03-31 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Mar 31 10:25:55 UTC 2017

Modified Files:
src/sys/dev/usb [netbsd-7-nhusb]: uftdi.c

Log Message:
revision 1.64
allow suspend with uftdi(4). it works fine.


To generate a diff of this commit:
cvs rdiff -u -r1.59.4.1.4.2 -r1.59.4.1.4.3 src/sys/dev/usb/uftdi.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/uftdi.c
diff -u src/sys/dev/usb/uftdi.c:1.59.4.1.4.2 src/sys/dev/usb/uftdi.c:1.59.4.1.4.3
--- src/sys/dev/usb/uftdi.c:1.59.4.1.4.2	Thu Jan 26 21:54:24 2017
+++ src/sys/dev/usb/uftdi.c	Fri Mar 31 10:25:55 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: uftdi.c,v 1.59.4.1.4.2 2017/01/26 21:54:24 skrll Exp $	*/
+/*	$NetBSD: uftdi.c,v 1.59.4.1.4.3 2017/03/31 10:25:55 skrll Exp $	*/
 
 /*
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uftdi.c,v 1.59.4.1.4.2 2017/01/26 21:54:24 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uftdi.c,v 1.59.4.1.4.3 2017/03/31 10:25:55 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -341,6 +341,9 @@ uftdi_attach(device_t parent, device_t s
 
 	usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev, sc->sc_dev);
 
+	if (!pmf_device_register(self, NULL, NULL))
+		aprint_error_dev(self, "couldn't establish power handler\n");
+
 	return;
 
 bad:



CVS commit: [netbsd-7-nhusb] src/sys/dev/usb

2017-03-31 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Mar 31 10:14:06 UTC 2017

Modified Files:
src/sys/dev/usb [netbsd-7-nhusb]: uhso.c

Log Message:
revision 1.25
fix off by one


To generate a diff of this commit:
cvs rdiff -u -r1.16.6.3 -r1.16.6.4 src/sys/dev/usb/uhso.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/uhso.c
diff -u src/sys/dev/usb/uhso.c:1.16.6.3 src/sys/dev/usb/uhso.c:1.16.6.4
--- src/sys/dev/usb/uhso.c:1.16.6.3	Fri Mar 31 09:38:05 2017
+++ src/sys/dev/usb/uhso.c	Fri Mar 31 10:14:06 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: uhso.c,v 1.16.6.3 2017/03/31 09:38:05 skrll Exp $	*/
+/*	$NetBSD: uhso.c,v 1.16.6.4 2017/03/31 10:14:06 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2009 Iain Hibbert
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uhso.c,v 1.16.6.3 2017/03/31 09:38:05 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhso.c,v 1.16.6.4 2017/03/31 10:14:06 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -641,14 +641,14 @@ uhso_get_iface_spec(struct usb_attach_ar
 
 	switch (hd->type) {
 	case UHSOTYPE_DEFAULT:
-		if (ifnum > __arraycount(uhso_spec_default))
+		if (ifnum >= __arraycount(uhso_spec_default))
 			break;
 
 		*spec = uhso_spec_default[ifnum];
 		return 1;
 
 	case UHSOTYPE_ICON321:
-		if (ifnum > __arraycount(uhso_spec_icon321))
+		if (ifnum >= __arraycount(uhso_spec_icon321))
 			break;
 
 		*spec = uhso_spec_icon321[ifnum];
@@ -665,8 +665,8 @@ uhso_get_iface_spec(struct usb_attach_ar
 		if (status != USBD_NORMAL_COMPLETION)
 			break;
 
-		if (ifnum > __arraycount(config)
-		|| config[ifnum] > __arraycount(uhso_spec_config))
+		if (ifnum >= __arraycount(config)
+		|| config[ifnum] >= __arraycount(uhso_spec_config))
 			break;
 
 		*spec = uhso_spec_config[config[ifnum]];



CVS commit: [netbsd-7-nhusb] src/sys/dev/usb

2017-03-31 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Mar 31 10:13:09 UTC 2017

Modified Files:
src/sys/dev/usb [netbsd-7-nhusb]: ukbd.c

Log Message:
revision 1.136
don't memcpy overlapping buffers, use memmove.
this is undefined behaviour.
CID 1299069

revision 1.135
kassert that we aren't overflowing the array.

this assert isn't expected to trigger due to current parameters used, but
to be sure, check.


To generate a diff of this commit:
cvs rdiff -u -r1.129.4.1.4.2 -r1.129.4.1.4.3 src/sys/dev/usb/ukbd.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/ukbd.c
diff -u src/sys/dev/usb/ukbd.c:1.129.4.1.4.2 src/sys/dev/usb/ukbd.c:1.129.4.1.4.3
--- src/sys/dev/usb/ukbd.c:1.129.4.1.4.2	Thu Jan 26 21:54:24 2017
+++ src/sys/dev/usb/ukbd.c	Fri Mar 31 10:13:09 2017
@@ -1,4 +1,4 @@
-/*  $NetBSD: ukbd.c,v 1.129.4.1.4.2 2017/01/26 21:54:24 skrll Exp $*/
+/*  $NetBSD: ukbd.c,v 1.129.4.1.4.3 2017/03/31 10:13:09 skrll Exp $*/
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ukbd.c,v 1.129.4.1.4.2 2017/01/26 21:54:24 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ukbd.c,v 1.129.4.1.4.3 2017/03/31 10:13:09 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -719,7 +719,10 @@ ukbd_decode(struct ukbd_softc *sc, struc
 	int s;
 	int nkeys, i, j;
 	int key;
-#define ADDKEY(c) ibuf[nkeys++] = (c)
+#define ADDKEY(c) do { \
+KASSERT(nkeys < MAXKEYS); \
+ibuf[nkeys++] = (c); \
+} while (0)
 
 #ifdef UKBD_DEBUG
 	/*
@@ -1001,7 +1004,7 @@ ukbd_cngetc(void *v, u_int *type, int *d
 	sc->sc_flags &= ~FLAG_POLLING;
 	c = sc->sc_pollchars[0];
 	sc->sc_npollchar--;
-	memcpy(sc->sc_pollchars, sc->sc_pollchars+1,
+	memmove(sc->sc_pollchars, sc->sc_pollchars+1,
 	   sc->sc_npollchar * sizeof(uint16_t));
 	*type = c & RELEASE ? WSCONS_EVENT_KEY_UP : WSCONS_EVENT_KEY_DOWN;
 	*data = c & CODEMASK;



CVS commit: [netbsd-7-nhusb] src/sys/dev/usb

2017-03-31 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Mar 31 10:13:09 UTC 2017

Modified Files:
src/sys/dev/usb [netbsd-7-nhusb]: ukbd.c

Log Message:
revision 1.136
don't memcpy overlapping buffers, use memmove.
this is undefined behaviour.
CID 1299069

revision 1.135
kassert that we aren't overflowing the array.

this assert isn't expected to trigger due to current parameters used, but
to be sure, check.


To generate a diff of this commit:
cvs rdiff -u -r1.129.4.1.4.2 -r1.129.4.1.4.3 src/sys/dev/usb/ukbd.c

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



CVS commit: [netbsd-7-nhusb] src/sys/dev/usb

2017-03-31 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Mar 31 10:05:07 UTC 2017

Modified Files:
src/sys/dev/usb [netbsd-7-nhusb]: if_urtwn_data.h motg.c uberry.c
ugen.c uipad.c uplcom.c

Log Message:
Whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.3.10.1 -r1.3.10.2 src/sys/dev/usb/if_urtwn_data.h
cvs rdiff -u -r1.6.4.2.4.2 -r1.6.4.2.4.3 src/sys/dev/usb/motg.c
cvs rdiff -u -r1.9.18.3 -r1.9.18.4 src/sys/dev/usb/uberry.c
cvs rdiff -u -r1.124.2.2.2.2 -r1.124.2.2.2.3 src/sys/dev/usb/ugen.c
cvs rdiff -u -r1.1.32.2 -r1.1.32.3 src/sys/dev/usb/uipad.c
cvs rdiff -u -r1.74.2.2.2.2 -r1.74.2.2.2.3 src/sys/dev/usb/uplcom.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/if_urtwn_data.h
diff -u src/sys/dev/usb/if_urtwn_data.h:1.3.10.1 src/sys/dev/usb/if_urtwn_data.h:1.3.10.2
--- src/sys/dev/usb/if_urtwn_data.h:1.3.10.1	Thu Jan 26 21:54:24 2017
+++ src/sys/dev/usb/if_urtwn_data.h	Fri Mar 31 10:05:07 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_urtwn_data.h,v 1.3.10.1 2017/01/26 21:54:24 skrll Exp $	*/
+/*	$NetBSD: if_urtwn_data.h,v 1.3.10.2 2017/03/31 10:05:07 skrll Exp $	*/
 /*	$OpenBSD: if_urtwnreg.h,v 1.3 2010/11/16 18:02:59 damien Exp $	*/
 
 /*-
@@ -50,7 +50,7 @@ static const struct {
 	{ 0x640, 0x40 }, { 0x642, 0x40 }, { 0x643, 0x00 }, { 0x652, 0xc8 },
 	{ 0x66e, 0x05 }, { 0x700, 0x21 }, { 0x701, 0x43 }, { 0x702, 0x65 },
 	{ 0x703, 0x87 }, { 0x708, 0x21 }, { 0x709, 0x43 }, { 0x70a, 0x65 },
-	{ 0x70b, 0x87 },
+	{ 0x70b, 0x87 }, 
 }, rtl8188eu_mac[] = {
 	{ 0x026, 0x41 }, { 0x027, 0x35 }, { 0x040, 0x00 }, { 0x428, 0x0a },
 	{ 0x429, 0x10 }, { 0x430, 0x00 }, { 0x431, 0x01 }, { 0x432, 0x02 },
@@ -548,7 +548,7 @@ static const uint16_t rtl8192eu_bb_regs[
 	0xe38, 0xe3c, 0xe40, 0xe44, 0xe48, 0xe4c, 0xe50, 0xe54,
 	0xe58, 0xe5c, 0xe60, 0xe68, 0xe6c, 0xe70, 0xe74, 0xe78,
 	0xe7c, 0xe80, 0xe84, 0xe88, 0xe8c, 0xed0, 0xed4, 0xed8,
-	0xedc, 0xee0, 0xeec, 0xee4, 0xee8, 0xf14, 0xf4c, 0xf00,
+	0xedc, 0xee0, 0xeec, 0xee4, 0xee8, 0xf14, 0xf4c, 0xf00, 
 };
 
 static const uint32_t rtl8192eu_bb_vals[] = {
@@ -910,7 +910,7 @@ static const uint8_t rtl8192eu_rf_regs[]
 	0x34, 0x34, 0x34, 0x34, 0x34, 0x00, 0x84, 0x86, 0x87, 0x8e,
 	0x8f, 0xef, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b,
 	0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b,
-	0xef, 0xfe, 0x18, 0xfe, 0xfe, 0xfe, 0xfe, 0x1e, 0x1f, 0x00,
+	0xef, 0xfe, 0x18, 0xfe, 0xfe, 0xfe, 0xfe, 0x1e, 0x1f, 0x00, 
 };
 
 static const uint32_t rtl8192eu_rf_vals[] = {
@@ -929,7 +929,7 @@ static const uint32_t rtl8192eu_rf_vals[
 	0xef7b0, 0xd4fb0, 0xcf060, 0xb0090, 0xa0080, 0x90080, 0x8f780,
 	0x787b0, 0x78730, 0x60fb0, 0x5ffa0, 0x40620, 0x37090, 0x20080,
 	0x1f060, 0x0ffb0, 0x000a0, 0x0, 0x0fc07, 0x0, 0x0,
-	0x0, 0x0, 0x1, 0x8, 0x33e70,
+	0x0, 0x0, 0x1, 0x8, 0x33e70, 
 };
 
 static const uint8_t rtl8192eu_rf2_regs[] = {
@@ -941,7 +941,7 @@ static const uint8_t rtl8192eu_rf2_regs[
 	0x34, 0x34, 0x34, 0x34, 0x34, 0x34, 0x00, 0x84, 0x86, 0x87,
 	0x8e, 0x8f, 0xef, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b,
 	0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b,
-	0x3b, 0xef, 0x00, 0xfe, 0xfe, 0xfe, 0xfe, 0x1e, 0x1f, 0x00,
+	0x3b, 0xef, 0x00, 0xfe, 0xfe, 0xfe, 0xfe, 0x1e, 0x1f, 0x00, 
 };
 
 static const uint32_t rtl8192eu_rf2_vals[] = {
@@ -957,7 +957,7 @@ static const uint32_t rtl8192eu_rf2_vals
 	0xf07b0, 0xf02b0, 0xef7b0, 0xd4fb0, 0xcf060, 0xb0090, 0xa0080,
 	0x90080, 0x8f780, 0x787b0, 0x78730, 0x60fb0, 0x5ffa0, 0x40620,
 	0x37090, 0x20080, 0x1f060, 0x0ffb0, 0x000a0, 0x10159, 0x0,
-	0x0, 0x0, 0x0, 0x1, 0x8, 0x33e70,
+	0x0, 0x0, 0x0, 0x1, 0x8, 0x33e70, 
 };
 
 static const struct urtwn_rf_prog rtl8192eu_rf_prog[] = {

Index: src/sys/dev/usb/motg.c
diff -u src/sys/dev/usb/motg.c:1.6.4.2.4.2 src/sys/dev/usb/motg.c:1.6.4.2.4.3
--- src/sys/dev/usb/motg.c:1.6.4.2.4.2	Thu Jan 26 21:54:24 2017
+++ src/sys/dev/usb/motg.c	Fri Mar 31 10:05:07 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: motg.c,v 1.6.4.2.4.2 2017/01/26 21:54:24 skrll Exp $	*/
+/*	$NetBSD: motg.c,v 1.6.4.2.4.3 2017/03/31 10:05:07 skrll Exp $	*/
 
 /*
  * Copyright (c) 1998, 2004, 2011, 2012, 2014 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: motg.c,v 1.6.4.2.4.2 2017/01/26 21:54:24 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: motg.c,v 1.6.4.2.4.3 2017/03/31 10:05:07 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_motg.h"
@@ -2087,7 +2087,7 @@ motg_device_intr_tx(struct motg_softc *s
 complete:
 	DPRINTFN(MD_BULK, "xfer %p complete, status %d", xfer,
 	(xfer != NULL) ? xfer->ux_status : 0, 0, 0);
-	KASSERTMSG(xfer && xfer->ux_status == USBD_IN_PROGRESS &&
+	KASSERTMSG(xfer && xfer->ux_status == USBD_IN_PROGRESS && 
 	ep->phase == DATA_OUT, "xfer %p status %d phase %d",
 	xfer, xfer->ux_status, ep->phase);
 	ep->phase = IDLE;

Index: 

CVS commit: [netbsd-7-nhusb] src/sys/dev/usb

2017-03-31 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Mar 31 10:05:07 UTC 2017

Modified Files:
src/sys/dev/usb [netbsd-7-nhusb]: if_urtwn_data.h motg.c uberry.c
ugen.c uipad.c uplcom.c

Log Message:
Whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.3.10.1 -r1.3.10.2 src/sys/dev/usb/if_urtwn_data.h
cvs rdiff -u -r1.6.4.2.4.2 -r1.6.4.2.4.3 src/sys/dev/usb/motg.c
cvs rdiff -u -r1.9.18.3 -r1.9.18.4 src/sys/dev/usb/uberry.c
cvs rdiff -u -r1.124.2.2.2.2 -r1.124.2.2.2.3 src/sys/dev/usb/ugen.c
cvs rdiff -u -r1.1.32.2 -r1.1.32.3 src/sys/dev/usb/uipad.c
cvs rdiff -u -r1.74.2.2.2.2 -r1.74.2.2.2.3 src/sys/dev/usb/uplcom.c

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



CVS commit: [netbsd-7-nhusb] src/sys/dev/usb

2017-03-31 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Mar 31 10:01:43 UTC 2017

Modified Files:
src/sys/dev/usb [netbsd-7-nhusb]: ulpt.c

Log Message:
Fix up comments


To generate a diff of this commit:
cvs rdiff -u -r1.95.8.2 -r1.95.8.3 src/sys/dev/usb/ulpt.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/ulpt.c
diff -u src/sys/dev/usb/ulpt.c:1.95.8.2 src/sys/dev/usb/ulpt.c:1.95.8.3
--- src/sys/dev/usb/ulpt.c:1.95.8.2	Thu Jan 26 21:54:24 2017
+++ src/sys/dev/usb/ulpt.c	Fri Mar 31 10:01:43 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ulpt.c,v 1.95.8.2 2017/01/26 21:54:24 skrll Exp $	*/
+/*	$NetBSD: ulpt.c,v 1.95.8.3 2017/03/31 10:01:43 skrll Exp $	*/
 
 /*
  * Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ulpt.c,v 1.95.8.2 2017/01/26 21:54:24 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ulpt.c,v 1.95.8.3 2017/03/31 10:01:43 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -704,7 +704,7 @@ ulpt_do_read(struct ulpt_softc *sc, stru
 		}
 
 		/*
-		 * XXX Even with the short timeout, this will tsleep,
+		 * XXX Even with the short timeout, this will sleep,
 		 * but it should be adequately prompt in practice.
 		 */
 		n = nreq;
@@ -748,7 +748,7 @@ ulpt_do_read(struct ulpt_softc *sc, stru
 
 		case USBD_INTERRUPTED:
 			/*
-			 * The tsleep in usbd_bulk_transfer was
+			 * The sleep in usbd_bulk_transfer was
 			 * interrupted.  Reflect it to the caller so
 			 * that reading can be interrupted.
 			 */



CVS commit: [netbsd-7-nhusb] src/sys/dev/usb

2017-03-31 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Mar 31 10:01:43 UTC 2017

Modified Files:
src/sys/dev/usb [netbsd-7-nhusb]: ulpt.c

Log Message:
Fix up comments


To generate a diff of this commit:
cvs rdiff -u -r1.95.8.2 -r1.95.8.3 src/sys/dev/usb/ulpt.c

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



CVS commit: [netbsd-7-nhusb] src/sys/dev/usb

2017-03-31 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Mar 31 10:00:15 UTC 2017

Modified Files:
src/sys/dev/usb [netbsd-7-nhusb]: uthum.c uvscom.c uyurex.c

Log Message:
Convert tsleep to kpause


To generate a diff of this commit:
cvs rdiff -u -r1.10.18.2 -r1.10.18.3 src/sys/dev/usb/uthum.c
cvs rdiff -u -r1.28.20.2 -r1.28.20.3 src/sys/dev/usb/uvscom.c
cvs rdiff -u -r1.9.12.1.4.3 -r1.9.12.1.4.4 src/sys/dev/usb/uyurex.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/uthum.c
diff -u src/sys/dev/usb/uthum.c:1.10.18.2 src/sys/dev/usb/uthum.c:1.10.18.3
--- src/sys/dev/usb/uthum.c:1.10.18.2	Thu Jan 26 21:54:25 2017
+++ src/sys/dev/usb/uthum.c	Fri Mar 31 10:00:15 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: uthum.c,v 1.10.18.2 2017/01/26 21:54:25 skrll Exp $   */
+/*	$NetBSD: uthum.c,v 1.10.18.3 2017/03/31 10:00:15 skrll Exp $   */
 /*	$OpenBSD: uthum.c,v 1.6 2010/01/03 18:43:02 deraadt Exp $   */
 
 /*
@@ -22,7 +22,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uthum.c,v 1.10.18.2 2017/01/26 21:54:25 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uthum.c,v 1.10.18.3 2017/03/31 10:00:15 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -294,7 +294,7 @@ uthum_read_data(struct uthum_softc *sc, 
 
 	/* wait if required */
 	if (need_delay > 1)
-		tsleep(>sc_sme, 0, "uthum", (need_delay*hz+999)/1000 + 1);
+		kpause("uthum", false, (need_delay*hz+999)/1000 + 1, NULL);
 
 	/* get answer */
 	if (uhidev_get_report(>sc_hdev, UHID_FEATURE_REPORT,

Index: src/sys/dev/usb/uvscom.c
diff -u src/sys/dev/usb/uvscom.c:1.28.20.2 src/sys/dev/usb/uvscom.c:1.28.20.3
--- src/sys/dev/usb/uvscom.c:1.28.20.2	Thu Jan 26 21:54:25 2017
+++ src/sys/dev/usb/uvscom.c	Fri Mar 31 10:00:15 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvscom.c,v 1.28.20.2 2017/01/26 21:54:25 skrll Exp $	*/
+/*	$NetBSD: uvscom.c,v 1.28.20.3 2017/03/31 10:00:15 skrll Exp $	*/
 /*-
  * Copyright (c) 2001-2002, Shunsuke Akiyama .
  * All rights reserved.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvscom.c,v 1.28.20.2 2017/01/26 21:54:25 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvscom.c,v 1.28.20.3 2017/03/31 10:00:15 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -759,7 +759,7 @@ uvscom_open(void *addr, int portno)
 		/* unit is not ready */
 
 		for (i = UVSCOM_UNIT_WAIT; i > 0; --i) {
-			tsleep(, TTIPRI, "uvsop", hz);	/* XXX */
+			kpause("uvsopen", false, hz, NULL);
 			if (ISSET(sc->sc_usr, UVSCOM_USTAT_MASK))
 break;
 		}

Index: src/sys/dev/usb/uyurex.c
diff -u src/sys/dev/usb/uyurex.c:1.9.12.1.4.3 src/sys/dev/usb/uyurex.c:1.9.12.1.4.4
--- src/sys/dev/usb/uyurex.c:1.9.12.1.4.3	Fri Mar 31 09:38:05 2017
+++ src/sys/dev/usb/uyurex.c	Fri Mar 31 10:00:15 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: uyurex.c,v 1.9.12.1.4.3 2017/03/31 09:38:05 skrll Exp $ */
+/*	$NetBSD: uyurex.c,v 1.9.12.1.4.4 2017/03/31 10:00:15 skrll Exp $ */
 /*	$OpenBSD: uyurex.c,v 1.3 2010/03/04 03:47:22 deraadt Exp $ */
 
 /*
@@ -22,7 +22,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uyurex.c,v 1.9.12.1.4.3 2017/03/31 09:38:05 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uyurex.c,v 1.9.12.1.4.4 2017/03/31 10:00:15 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -341,7 +341,7 @@ uyurex_set_mode(struct uyurex_softc *sc,
 	}
 
 	/* wait ack */
-	tsleep(>sc_sme, 0, "uyurex", (1000*hz+999)/1000 + 1);
+	kpause("uyurexsm", false, (1000*hz+999)/1000 + 1, NULL);
 }
 
 void
@@ -359,7 +359,7 @@ uyurex_read_value_request(struct uyurex_
 		return;
 
 	/* wait till sensor data are updated, 500ms will be enough */
-	tsleep(>sc_sme, 0, "uyurex", (500*hz+999)/1000 + 1);
+	kpause("uyurexrd", false, (500*hz+999)/1000 + 1, NULL);
 }
 
 void
@@ -382,5 +382,5 @@ uyurex_write_value_request(struct uyurex
 		return;
 
 	/* wait till sensor data are updated, 250ms will be enough */
-	tsleep(>sc_sme, 0, "uyurex", (250*hz+999)/1000 + 1);
+	kpause("uyurexwr", false, (250*hz+999)/1000 + 1, NULL);
 }



CVS commit: [netbsd-7-nhusb] src/sys/dev/usb

2017-03-31 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Mar 31 10:00:15 UTC 2017

Modified Files:
src/sys/dev/usb [netbsd-7-nhusb]: uthum.c uvscom.c uyurex.c

Log Message:
Convert tsleep to kpause


To generate a diff of this commit:
cvs rdiff -u -r1.10.18.2 -r1.10.18.3 src/sys/dev/usb/uthum.c
cvs rdiff -u -r1.28.20.2 -r1.28.20.3 src/sys/dev/usb/uvscom.c
cvs rdiff -u -r1.9.12.1.4.3 -r1.9.12.1.4.4 src/sys/dev/usb/uyurex.c

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



CVS commit: [netbsd-7-nhusb] src/sys/dev/usb

2017-03-31 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Mar 31 09:38:05 UTC 2017

Modified Files:
src/sys/dev/usb [netbsd-7-nhusb]: auvitek_video.c slurm.c uark.c uatp.c
uberry.c ubsa.c udsir.c uhso.c ukyopon.c usbdi_util.c uslsa.c
uyap.c uyurex.c

Log Message:
KNF


To generate a diff of this commit:
cvs rdiff -u -r1.6.36.1 -r1.6.36.2 src/sys/dev/usb/auvitek_video.c
cvs rdiff -u -r1.1.22.1 -r1.1.22.2 src/sys/dev/usb/slurm.c
cvs rdiff -u -r1.6.18.2 -r1.6.18.3 src/sys/dev/usb/uark.c
cvs rdiff -u -r1.10.2.1.4.2 -r1.10.2.1.4.3 src/sys/dev/usb/uatp.c
cvs rdiff -u -r1.9.18.2 -r1.9.18.3 src/sys/dev/usb/uberry.c
cvs rdiff -u -r1.30.20.2 -r1.30.20.3 src/sys/dev/usb/ubsa.c
cvs rdiff -u -r1.1.18.1 -r1.1.18.2 src/sys/dev/usb/udsir.c
cvs rdiff -u -r1.16.6.2 -r1.16.6.3 src/sys/dev/usb/uhso.c
cvs rdiff -u -r1.16.20.2 -r1.16.20.3 src/sys/dev/usb/ukyopon.c
cvs rdiff -u -r1.62.8.2 -r1.62.8.3 src/sys/dev/usb/usbdi_util.c
cvs rdiff -u -r1.19.10.2 -r1.19.10.3 src/sys/dev/usb/uslsa.c
cvs rdiff -u -r1.19.28.1 -r1.19.28.2 src/sys/dev/usb/uyap.c
cvs rdiff -u -r1.9.12.1.4.2 -r1.9.12.1.4.3 src/sys/dev/usb/uyurex.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/auvitek_video.c
diff -u src/sys/dev/usb/auvitek_video.c:1.6.36.1 src/sys/dev/usb/auvitek_video.c:1.6.36.2
--- src/sys/dev/usb/auvitek_video.c:1.6.36.1	Tue Sep  6 20:33:08 2016
+++ src/sys/dev/usb/auvitek_video.c	Fri Mar 31 09:38:05 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: auvitek_video.c,v 1.6.36.1 2016/09/06 20:33:08 skrll Exp $ */
+/* $NetBSD: auvitek_video.c,v 1.6.36.2 2017/03/31 09:38:05 skrll Exp $ */
 
 /*-
  * Copyright (c) 2010 Jared D. McNeill 
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: auvitek_video.c,v 1.6.36.1 2016/09/06 20:33:08 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: auvitek_video.c,v 1.6.36.2 2017/03/31 09:38:05 skrll Exp $");
 
 #include 
 #include 
@@ -134,7 +134,7 @@ auvitek_video_attach(struct auvitek_soft
 
 	auvitek_video_rescan(sc, NULL, NULL);
 
-	return (sc->sc_videodev != NULL);
+	return sc->sc_videodev != NULL;
 }
 
 int

Index: src/sys/dev/usb/slurm.c
diff -u src/sys/dev/usb/slurm.c:1.1.22.1 src/sys/dev/usb/slurm.c:1.1.22.2
--- src/sys/dev/usb/slurm.c:1.1.22.1	Tue Sep  6 20:33:09 2016
+++ src/sys/dev/usb/slurm.c	Fri Mar 31 09:38:05 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: slurm.c,v 1.1.22.1 2016/09/06 20:33:09 skrll Exp $ */
+/*	$NetBSD: slurm.c,v 1.1.22.2 2017/03/31 09:38:05 skrll Exp $ */
 
 /*
  * Copyright (c) 2012 Jonathan A. Kollasch
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: slurm.c,v 1.1.22.1 2016/09/06 20:33:09 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: slurm.c,v 1.1.22.2 2017/03/31 09:38:05 skrll Exp $");
 
 #include 
 #include 
@@ -156,7 +156,7 @@ slurm_detach(device_t self, int flags)
 
 	usbd_add_drv_event(USB_EVENT_DRIVER_DETACH, sc->sc_udev, sc->sc_dev);
 
-	return (rv);
+	return rv;
 }
 
 static int

Index: src/sys/dev/usb/uark.c
diff -u src/sys/dev/usb/uark.c:1.6.18.2 src/sys/dev/usb/uark.c:1.6.18.3
--- src/sys/dev/usb/uark.c:1.6.18.2	Thu Jan 26 21:54:24 2017
+++ src/sys/dev/usb/uark.c	Fri Mar 31 09:38:05 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: uark.c,v 1.6.18.2 2017/01/26 21:54:24 skrll Exp $	*/
+/*	$NetBSD: uark.c,v 1.6.18.3 2017/03/31 09:38:05 skrll Exp $	*/
 /*	$OpenBSD: uark.c,v 1.13 2009/10/13 19:33:17 pirofti Exp $	*/
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uark.c,v 1.6.18.2 2017/01/26 21:54:24 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uark.c,v 1.6.18.3 2017/03/31 09:38:05 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -229,7 +229,7 @@ uark_activate(device_t self, enum devact
 		sc->sc_dying = 1;
 		break;
 	}
-	return (rv);
+	return rv;
 }
 
 void
@@ -272,7 +272,7 @@ uark_param(void *vsc, int portno, struct
 		uark_cmd(sc, 3, 0x03);
 		break;
 	default:
-		return (EINVAL);
+		return EINVAL;
 	}
 
 	if (ISSET(t->c_cflag, CSTOPB))
@@ -317,7 +317,7 @@ uark_param(void *vsc, int portno, struct
 	}
 #endif
 
-	return (0);
+	return 0;
 }
 
 void
@@ -363,7 +363,7 @@ uark_cmd(struct uark_softc *sc, uint16_t
 	err = usbd_do_request(sc->sc_udev, , NULL);
 
 	if (err)
-		return (EIO);
+		return EIO;
 
-	return (0);
+	return 0;
 }

Index: src/sys/dev/usb/uatp.c
diff -u src/sys/dev/usb/uatp.c:1.10.2.1.4.2 src/sys/dev/usb/uatp.c:1.10.2.1.4.3
--- src/sys/dev/usb/uatp.c:1.10.2.1.4.2	Thu Jan 26 21:54:24 2017
+++ src/sys/dev/usb/uatp.c	Fri Mar 31 09:38:05 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: uatp.c,v 1.10.2.1.4.2 2017/01/26 21:54:24 skrll Exp $	*/
+/*	$NetBSD: uatp.c,v 1.10.2.1.4.3 2017/03/31 09:38:05 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2011-2014 The NetBSD Foundation, Inc.
@@ -146,7 +146,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uatp.c,v 1.10.2.1.4.2 2017/01/26 21:54:24 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uatp.c,v 1.10.2.1.4.3 2017/03/31 09:38:05 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 

CVS commit: [netbsd-7-nhusb] src/sys/dev/usb

2017-03-31 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Fri Mar 31 09:38:05 UTC 2017

Modified Files:
src/sys/dev/usb [netbsd-7-nhusb]: auvitek_video.c slurm.c uark.c uatp.c
uberry.c ubsa.c udsir.c uhso.c ukyopon.c usbdi_util.c uslsa.c
uyap.c uyurex.c

Log Message:
KNF


To generate a diff of this commit:
cvs rdiff -u -r1.6.36.1 -r1.6.36.2 src/sys/dev/usb/auvitek_video.c
cvs rdiff -u -r1.1.22.1 -r1.1.22.2 src/sys/dev/usb/slurm.c
cvs rdiff -u -r1.6.18.2 -r1.6.18.3 src/sys/dev/usb/uark.c
cvs rdiff -u -r1.10.2.1.4.2 -r1.10.2.1.4.3 src/sys/dev/usb/uatp.c
cvs rdiff -u -r1.9.18.2 -r1.9.18.3 src/sys/dev/usb/uberry.c
cvs rdiff -u -r1.30.20.2 -r1.30.20.3 src/sys/dev/usb/ubsa.c
cvs rdiff -u -r1.1.18.1 -r1.1.18.2 src/sys/dev/usb/udsir.c
cvs rdiff -u -r1.16.6.2 -r1.16.6.3 src/sys/dev/usb/uhso.c
cvs rdiff -u -r1.16.20.2 -r1.16.20.3 src/sys/dev/usb/ukyopon.c
cvs rdiff -u -r1.62.8.2 -r1.62.8.3 src/sys/dev/usb/usbdi_util.c
cvs rdiff -u -r1.19.10.2 -r1.19.10.3 src/sys/dev/usb/uslsa.c
cvs rdiff -u -r1.19.28.1 -r1.19.28.2 src/sys/dev/usb/uyap.c
cvs rdiff -u -r1.9.12.1.4.2 -r1.9.12.1.4.3 src/sys/dev/usb/uyurex.c

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



CVS commit: [netbsd-7-nhusb] src/sys/dev/usb

2017-01-30 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Jan 31 07:26:39 UTC 2017

Modified Files:
src/sys/dev/usb [netbsd-7-nhusb]: ohci.c

Log Message:
Sync with HEAD


To generate a diff of this commit:
cvs rdiff -u -r1.253.2.2.2.1 -r1.253.2.2.2.2 src/sys/dev/usb/ohci.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/ohci.c
diff -u src/sys/dev/usb/ohci.c:1.253.2.2.2.1 src/sys/dev/usb/ohci.c:1.253.2.2.2.2
--- src/sys/dev/usb/ohci.c:1.253.2.2.2.1	Tue Sep  6 20:33:09 2016
+++ src/sys/dev/usb/ohci.c	Tue Jan 31 07:26:39 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: ohci.c,v 1.253.2.2.2.1 2016/09/06 20:33:09 skrll Exp $	*/
+/*	$NetBSD: ohci.c,v 1.253.2.2.2.2 2017/01/31 07:26:39 skrll Exp $	*/
 
 /*
  * Copyright (c) 1998, 2004, 2005, 2012 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.253.2.2.2.1 2016/09/06 20:33:09 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.253.2.2.2.2 2017/01/31 07:26:39 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -622,22 +622,24 @@ ohci_reset_std_chain(ohci_softc_t *sc, s
 		KASSERT(next != cur);
 
 		curlen = 0;
-		ohci_physaddr_t sdataphys = DMAADDR(dma, curoffs);
+		const ohci_physaddr_t sdataphys = DMAADDR(dma, curoffs);
 		ohci_physaddr_t edataphys = DMAADDR(dma, curoffs + len - 1);
 
-		ohci_physaddr_t sphyspg = OHCI_PAGE(sdataphys);
+		const ohci_physaddr_t sphyspg = OHCI_PAGE(sdataphys);
 		ohci_physaddr_t ephyspg = OHCI_PAGE(edataphys);
 		/*
 		 * The OHCI hardware can handle at most one page
 		 * crossing per TD
 		 */
 		curlen = len;
-		if (!(sphyspg == ephyspg || sphyspg + 1 == ephyspg)) {
+		if (sphyspg != ephyspg &&
+		sphyspg + OHCI_PAGE_SIZE != ephyspg) {
 			/* must use multiple TDs, fill as much as possible. */
 			curlen = 2 * OHCI_PAGE_SIZE -
-			(sdataphys & (OHCI_PAGE_SIZE - 1));
+			OHCI_PAGE_OFFSET(sdataphys);
 			/* the length must be a multiple of the max size */
 			curlen -= curlen % mps;
+			edataphys = DMAADDR(dma, curoffs + curlen - 1);
 		}
 		KASSERT(curlen != 0);
 		DPRINTFN(4, "sdataphys=0x%08x edataphys=0x%08x "



CVS commit: [netbsd-7-nhusb] src/sys/dev/usb

2017-01-30 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Jan 31 07:26:39 UTC 2017

Modified Files:
src/sys/dev/usb [netbsd-7-nhusb]: ohci.c

Log Message:
Sync with HEAD


To generate a diff of this commit:
cvs rdiff -u -r1.253.2.2.2.1 -r1.253.2.2.2.2 src/sys/dev/usb/ohci.c

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



CVS commit: [netbsd-7-nhusb] src/sys/dev/usb

2017-01-18 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Jan 19 06:45:07 UTC 2017

Modified Files:
src/sys/dev/usb [netbsd-7-nhusb]: usbdevs

Log Message:
Sync with HEAD


To generate a diff of this commit:
cvs rdiff -u -r1.680.2.4.2.2 -r1.680.2.4.2.3 src/sys/dev/usb/usbdevs

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



CVS commit: [netbsd-7-nhusb] src/sys/dev/usb

2017-01-18 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Jan 19 06:45:07 UTC 2017

Modified Files:
src/sys/dev/usb [netbsd-7-nhusb]: usbdevs

Log Message:
Sync with HEAD


To generate a diff of this commit:
cvs rdiff -u -r1.680.2.4.2.2 -r1.680.2.4.2.3 src/sys/dev/usb/usbdevs

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/usbdevs
diff -u src/sys/dev/usb/usbdevs:1.680.2.4.2.2 src/sys/dev/usb/usbdevs:1.680.2.4.2.3
--- src/sys/dev/usb/usbdevs:1.680.2.4.2.2	Wed Jan 18 08:46:43 2017
+++ src/sys/dev/usb/usbdevs	Thu Jan 19 06:45:06 2017
@@ -1,4 +1,4 @@
-$NetBSD: usbdevs,v 1.680.2.4.2.2 2017/01/18 08:46:43 skrll Exp $
+$NetBSD: usbdevs,v 1.680.2.4.2.3 2017/01/19 06:45:06 skrll Exp $
 
 /*
  * Copyright (c) 1998-2004 The NetBSD Foundation, Inc.
@@ -1368,6 +1368,7 @@ product DLINK RTL8192CU_2	0x3309	RTL8192
 product DLINK RTL8192CU_3	0x330a	RTL8192CU
 product DLINK RTL8192CU_4	0x330b	RTL8192CU
 product DLINK DWA131B		0x330d	DWA-131 rev B
+product	DLINK DWA125D1		0x330f  DWA-125 rev D1
 product DLINK DWL122		0x3700	Wireless DWL122
 product DLINK DWLG120		0x3701	DWL-G120
 product DLINK DWL120F		0x3702	DWL-120 rev F



CVS commit: [netbsd-7-nhusb] src/sys/dev/usb

2017-01-18 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Jan 19 06:45:34 UTC 2017

Modified Files:
src/sys/dev/usb [netbsd-7-nhusb]: usbdevs.h usbdevs_data.h

Log Message:
regen


To generate a diff of this commit:
cvs rdiff -u -r1.672.2.4.2.2 -r1.672.2.4.2.3 src/sys/dev/usb/usbdevs.h
cvs rdiff -u -r1.673.2.4.2.2 -r1.673.2.4.2.3 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.



CVS commit: [netbsd-7-nhusb] src/sys/dev/usb

2017-01-18 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Jan 19 06:45:34 UTC 2017

Modified Files:
src/sys/dev/usb [netbsd-7-nhusb]: usbdevs.h usbdevs_data.h

Log Message:
regen


To generate a diff of this commit:
cvs rdiff -u -r1.672.2.4.2.2 -r1.672.2.4.2.3 src/sys/dev/usb/usbdevs.h
cvs rdiff -u -r1.673.2.4.2.2 -r1.673.2.4.2.3 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/usbdevs.h
diff -u src/sys/dev/usb/usbdevs.h:1.672.2.4.2.2 src/sys/dev/usb/usbdevs.h:1.672.2.4.2.3
--- src/sys/dev/usb/usbdevs.h:1.672.2.4.2.2	Wed Jan 18 08:46:43 2017
+++ src/sys/dev/usb/usbdevs.h	Thu Jan 19 06:45:33 2017
@@ -4,7 +4,7 @@
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: usbdevs,v 1.680.2.4.2.1 2016/09/06 20:33:09 skrll Exp
+ *	NetBSD: usbdevs,v 1.680.2.4.2.3 2017/01/19 06:45:06 skrll Exp
  */
 
 /*
@@ -1375,6 +1375,7 @@
 #define	USB_PRODUCT_DLINK_RTL8192CU_3	0x330a		/* RTL8192CU */
 #define	USB_PRODUCT_DLINK_RTL8192CU_4	0x330b		/* RTL8192CU */
 #define	USB_PRODUCT_DLINK_DWA131B	0x330d		/* DWA-131 rev B */
+#define	USB_PRODUCT_DLINK_DWA125D1	0x330f		/* DWA-125 rev D1 */
 #define	USB_PRODUCT_DLINK_DWL122	0x3700		/* Wireless DWL122 */
 #define	USB_PRODUCT_DLINK_DWLG120	0x3701		/* DWL-G120 */
 #define	USB_PRODUCT_DLINK_DWL120F	0x3702		/* DWL-120 rev F */

Index: src/sys/dev/usb/usbdevs_data.h
diff -u src/sys/dev/usb/usbdevs_data.h:1.673.2.4.2.2 src/sys/dev/usb/usbdevs_data.h:1.673.2.4.2.3
--- src/sys/dev/usb/usbdevs_data.h:1.673.2.4.2.2	Wed Jan 18 08:46:43 2017
+++ src/sys/dev/usb/usbdevs_data.h	Thu Jan 19 06:45:33 2017
@@ -4,7 +4,7 @@
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: usbdevs,v 1.680.2.4.2.1 2016/09/06 20:33:09 skrll Exp
+ *	NetBSD: usbdevs,v 1.680.2.4.2.3 2017/01/19 06:45:06 skrll Exp
  */
 
 /*
@@ -4451,6 +4451,10 @@ const struct usb_product usb_products[] 
 	"DWA-131 rev B",
 	},
 	{
+	USB_VENDOR_DLINK, USB_PRODUCT_DLINK_DWA125D1,
+	"DWA-125 rev D1",
+	},
+	{
 	USB_VENDOR_DLINK, USB_PRODUCT_DLINK_DWL122,
 	"Wireless DWL122",
 	},
@@ -10563,4 +10567,4 @@ const struct usb_product usb_products[] 
 	"Prestige",
 	},
 };
-const int usb_nproducts = 2091;
+const int usb_nproducts = 2092;



CVS commit: [netbsd-7-nhusb] src/sys/dev/usb

2016-11-28 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Nov 29 07:28:16 UTC 2016

Modified Files:
src/sys/dev/usb [netbsd-7-nhusb]: ucom.c

Log Message:
Sync with HEAD


To generate a diff of this commit:
cvs rdiff -u -r1.107.2.1.2.1 -r1.107.2.1.2.2 src/sys/dev/usb/ucom.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/ucom.c
diff -u src/sys/dev/usb/ucom.c:1.107.2.1.2.1 src/sys/dev/usb/ucom.c:1.107.2.1.2.2
--- src/sys/dev/usb/ucom.c:1.107.2.1.2.1	Tue Sep  6 20:33:09 2016
+++ src/sys/dev/usb/ucom.c	Tue Nov 29 07:28:16 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: ucom.c,v 1.107.2.1.2.1 2016/09/06 20:33:09 skrll Exp $	*/
+/*	$NetBSD: ucom.c,v 1.107.2.1.2.2 2016/11/29 07:28:16 skrll Exp $	*/
 
 /*
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -34,7 +34,11 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ucom.c,v 1.107.2.1.2.1 2016/09/06 20:33:09 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ucom.c,v 1.107.2.1.2.2 2016/11/29 07:28:16 skrll Exp $");
+
+#ifdef _KERNEL_OPT
+#include "opt_usb.h"
+#endif
 
 #include 
 #include 
@@ -139,11 +143,10 @@ struct ucom_softc {
 	device_t		sc_dev;		/* base device */
 
 	struct usbd_device *	sc_udev;	/* USB device */
-
 	struct usbd_interface *	sc_iface;	/* data interface */
 
 	int			sc_bulkin_no;	/* bulk in endpoint address */
-	struct usbd_pipe *	sc_bulkin_pipe;	/* bulk in pipe */
+	struct usbd_pipe *	sc_bulkin_pipe;/* bulk in pipe */
 	u_int			sc_ibufsize;	/* read buffer size */
 	u_int			sc_ibufsizepad;	/* read buffer size padded */
 	struct ucom_buffer	sc_ibuff[UCOM_IN_BUFFS];
@@ -173,17 +176,22 @@ struct ucom_softc {
 	u_char			sc_tx_stopped;
 	int			sc_swflags;
 
-	u_char			sc_opening;	/* lock during open */
-	u_char			sc_closing;	/* lock during close */
+	enum ucom_state {
+	UCOM_DEAD,
+	UCOM_ATTACHED,
+	UCOM_OPENING,
+	UCOM_CLOSING,
+	UCOM_OPEN
+	}			sc_state;
 	int			sc_refcnt;
-	u_char			sc_dying;	/* disconnecting */
+	bool			sc_dying;	/* disconnecting */
 
 	struct pps_state	sc_pps_state;	/* pps state */
 
 	krndsource_t		sc_rndsource;	/* random source */
 
 	kmutex_t		sc_lock;
-	kcondvar_t		sc_opencv;
+	kcondvar_t		sc_statecv;
 	kcondvar_t		sc_detachcv;
 };
 
@@ -227,11 +235,11 @@ static int	ucom_to_tiocm(struct ucom_sof
 static void	ucomreadcb(struct usbd_xfer *, void *, usbd_status);
 static void	ucom_submit_write(struct ucom_softc *, struct ucom_buffer *);
 static void	ucom_write_status(struct ucom_softc *, struct ucom_buffer *,
-			usbd_status);
+		usbd_status);
 
 static void	ucomwritecb(struct usbd_xfer *, void *, usbd_status);
 static void	ucom_read_complete(struct ucom_softc *);
-static usbd_status ucomsubmitread(struct ucom_softc *, struct ucom_buffer *);
+static int	ucomsubmitread(struct ucom_softc *, struct ucom_buffer *);
 static void	ucom_softintr(void *);
 
 int ucom_match(device_t, cfdata_t, void *);
@@ -253,7 +261,6 @@ ucom_attach(device_t parent, device_t se
 {
 	struct ucom_softc *sc = device_private(self);
 	struct ucom_attach_args *ucaa = aux;
-	struct tty *tp;
 
 	UCOMHIST_FUNC(); UCOMHIST_CALLED();
 
@@ -282,14 +289,13 @@ ucom_attach(device_t parent, device_t se
 	sc->sc_mcr = 0;
 	sc->sc_tx_stopped = 0;
 	sc->sc_swflags = 0;
-	sc->sc_opening = 0;
-	sc->sc_closing = 0;
 	sc->sc_refcnt = 0;
-	sc->sc_dying = 0;
+	sc->sc_dying = false;
+	sc->sc_state = UCOM_DEAD;
 
 	sc->sc_si = softint_establish(SOFTINT_USB, ucom_softintr, sc);
 	mutex_init(>sc_lock, MUTEX_DEFAULT, IPL_SOFTUSB);
-	cv_init(>sc_opencv, "ucomopen");
+	cv_init(>sc_statecv, "ucomstate");
 	cv_init(>sc_detachcv, "ucomdtch");
 
 	SIMPLEQ_INIT(>sc_ibuff_empty);
@@ -316,6 +322,17 @@ ucom_attach(device_t parent, device_t se
 		error = EIO;
 		goto fail_0;
 	}
+	/* Allocate input buffers */
+	for (ub = >sc_ibuff[0]; ub != >sc_ibuff[UCOM_IN_BUFFS];
+	ub++) {
+		error = usbd_create_xfer(sc->sc_bulkin_pipe,
+		sc->sc_ibufsizepad, USBD_SHORT_XFER_OK, 0,
+		>ub_xfer);
+		if (error)
+			goto fail_1;
+		ub->ub_data = usbd_get_buffer(ub->ub_xfer);
+	}
+
 	err = usbd_open_pipe(sc->sc_iface, sc->sc_bulkout_no,
 	USBD_EXCLUSIVE_USE, >sc_bulkout_pipe);
 	if (err) {
@@ -324,28 +341,17 @@ ucom_attach(device_t parent, device_t se
 		error = EIO;
 		goto fail_1;
 	}
-
-	/* Allocate input buffers */
-	for (ub = >sc_ibuff[0]; ub != >sc_ibuff[UCOM_IN_BUFFS];
-	ub++) {
-		error = usbd_create_xfer(sc->sc_bulkin_pipe, sc->sc_ibufsizepad,
-		USBD_SHORT_XFER_OK, 0, >ub_xfer);
-		if (error)
-			goto fail_2;
-		ub->ub_data = usbd_get_buffer(ub->ub_xfer);
-	}
-
 	for (ub = >sc_obuff[0]; ub != >sc_obuff[UCOM_OUT_BUFFS];
 	ub++) {
-		error = usbd_create_xfer(sc->sc_bulkout_pipe, sc->sc_obufsize,
-		0, 0, >ub_xfer);
+		error = usbd_create_xfer(sc->sc_bulkout_pipe,
+		sc->sc_obufsize, 0, 0, >ub_xfer);
 		if (error)
 			goto fail_2;
 		ub->ub_data = usbd_get_buffer(ub->ub_xfer);
 		SIMPLEQ_INSERT_TAIL(>sc_obuff_free, ub, ub_link);
 	}
 
-	

CVS commit: [netbsd-7-nhusb] src/sys/dev/usb

2016-11-28 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Nov 29 07:28:16 UTC 2016

Modified Files:
src/sys/dev/usb [netbsd-7-nhusb]: ucom.c

Log Message:
Sync with HEAD


To generate a diff of this commit:
cvs rdiff -u -r1.107.2.1.2.1 -r1.107.2.1.2.2 src/sys/dev/usb/ucom.c

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



CVS commit: [netbsd-7-nhusb] src/sys/dev/usb

2016-09-07 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Sep  7 10:26:39 UTC 2016

Modified Files:
src/sys/dev/usb [netbsd-7-nhusb]: if_athn_usb.c usb_subr.c usbdi.c
xhci.c xhcireg.h

Log Message:
Sync with HEAD


To generate a diff of this commit:
cvs rdiff -u -r1.6.12.1 -r1.6.12.2 src/sys/dev/usb/if_athn_usb.c
cvs rdiff -u -r1.196.4.2.2.1 -r1.196.4.2.2.2 src/sys/dev/usb/usb_subr.c
cvs rdiff -u -r1.161.2.1.4.1 -r1.161.2.1.4.2 src/sys/dev/usb/usbdi.c
cvs rdiff -u -r1.23.2.4.2.1 -r1.23.2.4.2.2 src/sys/dev/usb/xhci.c
cvs rdiff -u -r1.1.10.1.4.1 -r1.1.10.1.4.2 src/sys/dev/usb/xhcireg.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/if_athn_usb.c
diff -u src/sys/dev/usb/if_athn_usb.c:1.6.12.1 src/sys/dev/usb/if_athn_usb.c:1.6.12.2
--- src/sys/dev/usb/if_athn_usb.c:1.6.12.1	Tue Sep  6 20:33:08 2016
+++ src/sys/dev/usb/if_athn_usb.c	Wed Sep  7 10:26:39 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_athn_usb.c,v 1.6.12.1 2016/09/06 20:33:08 skrll Exp $	*/
+/*	$NetBSD: if_athn_usb.c,v 1.6.12.2 2016/09/07 10:26:39 skrll Exp $	*/
 /*	$OpenBSD: if_athn_usb.c,v 1.12 2013/01/14 09:50:31 jsing Exp $	*/
 
 /*-
@@ -22,7 +22,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_athn_usb.c,v 1.6.12.1 2016/09/06 20:33:08 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_athn_usb.c,v 1.6.12.2 2016/09/07 10:26:39 skrll Exp $");
 
 #ifdef	_KERNEL_OPT
 #include "opt_inet.h"
@@ -716,6 +716,7 @@ athn_usb_alloc_tx_cmd(struct athn_usb_so
 		"could not allocate command xfer\n");
 		return err;
 	}
+	data->buf = usbd_get_buffer(data->xfer);
 
 	return 0;
 }

Index: src/sys/dev/usb/usb_subr.c
diff -u src/sys/dev/usb/usb_subr.c:1.196.4.2.2.1 src/sys/dev/usb/usb_subr.c:1.196.4.2.2.2
--- src/sys/dev/usb/usb_subr.c:1.196.4.2.2.1	Tue Sep  6 20:33:09 2016
+++ src/sys/dev/usb/usb_subr.c	Wed Sep  7 10:26:39 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: usb_subr.c,v 1.196.4.2.2.1 2016/09/06 20:33:09 skrll Exp $	*/
+/*	$NetBSD: usb_subr.c,v 1.196.4.2.2.2 2016/09/07 10:26:39 skrll 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 
-__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.196.4.2.2.1 2016/09/06 20:33:09 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.196.4.2.2.2 2016/09/07 10:26:39 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -595,7 +595,7 @@ usbd_set_config_index(struct usbd_device
 {
 	USBHIST_FUNC(); USBHIST_CALLED(usbdebug);
 	usb_config_descriptor_t cd, *cdp;
-	usb_bos_descriptor_t bd, *bdp = NULL;
+	usb_bos_descriptor_t *bdp = NULL;
 	usbd_status err;
 	int i, ifcidx, nifc, len, selfpowered, power;
 
@@ -666,6 +666,8 @@ usbd_set_config_index(struct usbd_device
 	}
 
 	if (USB_IS_SS(dev->ud_speed)) {
+		usb_bos_descriptor_t bd;
+
 		/* get short bos desc */
 		err = usbd_get_bos_desc(dev, index, );
 		if (!err) {
@@ -1522,7 +1524,7 @@ usbd_fill_deviceinfo(struct usbd_device 
 		 int usedev)
 {
 	struct usbd_port *p;
-	int i, j, err, s;
+	int i, j, err;
 
 	di->udi_bus = device_unit(dev->ud_bus->ub_usbctl);
 	di->udi_addr = dev->ud_addr;
@@ -1573,38 +1575,38 @@ usbd_fill_deviceinfo(struct usbd_device 
 	for (/* j is set */; j < USB_MAX_DEVNAMES; j++)
 		di->udi_devnames[j][0] = 0; /* empty */
 
-	if (dev->ud_hub) {
-		for (i = 0;
-		 i < sizeof(di->udi_ports) / sizeof(di->udi_ports[0]) &&
-			 i < dev->ud_hub->uh_hubdesc.bNbrPorts;
-		 i++) {
-			p = >ud_hub->uh_ports[i];
-			if (p->up_dev)
-err = p->up_dev->ud_addr;
-			else {
-s = UGETW(p->up_status.wPortStatus);
-if (s & UPS_PORT_ENABLED)
-	err = USB_PORT_ENABLED;
-else if (s & UPS_SUSPEND)
-	err = USB_PORT_SUSPENDED;
-/*
- * Note: UPS_PORT_POWER_SS is available only
- * on 3.x, and UPS_PORT_POWER is available
- * only on 2.0 or 1.1.
- */
-else if (USB_IS_SS(dev->ud_speed) &&
-(s & UPS_PORT_POWER_SS))
-	err = USB_PORT_POWERED;
-else if (s & UPS_PORT_POWER)
-	err = USB_PORT_POWERED;
-else
-	err = USB_PORT_DISABLED;
-			}
-			di->udi_ports[i] = err;
-		}
-		di->udi_nports = dev->ud_hub->uh_hubdesc.bNbrPorts;
-	} else
+	if (!dev->ud_hub) {
 		di->udi_nports = 0;
+		return;
+	}
+
+	const int nports = dev->ud_hub->uh_hubdesc.bNbrPorts;
+	for (i = 0; i < __arraycount(di->udi_ports) && i < nports; i++) {
+		p = >ud_hub->uh_ports[i];
+		if (p->up_dev)
+			err = p->up_dev->ud_addr;
+		else {
+			int s = UGETW(p->up_status.wPortStatus);
+			if (s & UPS_PORT_ENABLED)
+err = USB_PORT_ENABLED;
+			else if (s & UPS_SUSPEND)
+err = USB_PORT_SUSPENDED;
+			/*
+			 * Note: UPS_PORT_POWER_SS is available only
+			 * on 3.x, and UPS_PORT_POWER is available
+			 * only on 2.0 or 1.1.
+			 */
+			else if (USB_IS_SS(dev->ud_speed) &&
+			(s & UPS_PORT_POWER_SS))
+err = USB_PORT_POWERED;
+			else if (s & UPS_PORT_POWER)
+err = USB_PORT_POWERED;
+			else

CVS commit: [netbsd-7-nhusb] src/sys/dev/usb

2016-09-07 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Sep  7 10:26:39 UTC 2016

Modified Files:
src/sys/dev/usb [netbsd-7-nhusb]: if_athn_usb.c usb_subr.c usbdi.c
xhci.c xhcireg.h

Log Message:
Sync with HEAD


To generate a diff of this commit:
cvs rdiff -u -r1.6.12.1 -r1.6.12.2 src/sys/dev/usb/if_athn_usb.c
cvs rdiff -u -r1.196.4.2.2.1 -r1.196.4.2.2.2 src/sys/dev/usb/usb_subr.c
cvs rdiff -u -r1.161.2.1.4.1 -r1.161.2.1.4.2 src/sys/dev/usb/usbdi.c
cvs rdiff -u -r1.23.2.4.2.1 -r1.23.2.4.2.2 src/sys/dev/usb/xhci.c
cvs rdiff -u -r1.1.10.1.4.1 -r1.1.10.1.4.2 src/sys/dev/usb/xhcireg.h

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



CVS commit: [netbsd-7-nhusb] src/sys/dev/usb

2016-09-07 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Sep  7 09:03:33 UTC 2016

Added Files:
src/sys/dev/usb [netbsd-7-nhusb]: usbhist.h usbroothub.c usbroothub.h

Log Message:
Add missing files (to the right branch this time)


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.4.4.2 src/sys/dev/usb/usbhist.h
cvs rdiff -u -r0 -r1.2.6.2 src/sys/dev/usb/usbroothub.c \
src/sys/dev/usb/usbroothub.h

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

Added files:

Index: src/sys/dev/usb/usbhist.h
diff -u /dev/null src/sys/dev/usb/usbhist.h:1.4.4.2
--- /dev/null	Wed Sep  7 09:03:33 2016
+++ src/sys/dev/usb/usbhist.h	Wed Sep  7 09:03:33 2016
@@ -0,0 +1,91 @@
+/*	$NetBSD: usbhist.h,v 1.4.4.2 2016/09/07 09:03:33 skrll Exp $	*/
+
+/*
+ * Copyright (c) 2012 Matthew R. Green
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ *derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _DEV_USB_USBHIST_H_
+#define _DEV_USB_USBHIST_H_
+
+#if defined(_KERNEL_OPT)
+#include "opt_usb.h"
+#endif
+
+/*
+ * Make USBHIST_PRINT force on KERNHIST_PRINT for at least USBHIST_* usage.
+ */
+#if defined(USBHIST_PRINT) && !defined(KERNHIST_PRINT)
+#define KERNHIST_PRINT 1
+#endif
+
+#include 
+
+#ifdef USB_DEBUG
+
+extern int usbdebug;
+
+#define USBHIST_DECL(NAME)		KERNHIST_DECL(NAME)
+#define USBHIST_DEFINE(NAME)		KERNHIST_DEFINE(NAME)
+#define USBHIST_INIT(NAME,N)		KERNHIST_INIT(NAME,N)
+#define USBHIST_INIT_STATIC(NAME,BUF)	KERNHIST_INIT_STATIC(NAME,BUF)
+#define USBHIST_LINK_STATIC(NAME)	KERNHIST_LINK_STATIC(NAME)
+#define USBHIST_LOGN(NAME,N,FMT,A,B,C,D)	do {		\
+	if ((NAME) >= (N)) {	\
+		KERNHIST_LOG(usbhist,FMT,A,B,C,D);		\
+	}			\
+} while (0)
+#define USBHIST_LOGM(NAME,N,FMT,A,B,C,D)	do {		\
+	if ((NAME) & (N)) {	\
+		KERNHIST_LOG(usbhist,FMT,A,B,C,D);		\
+	}			\
+} while (0)
+#define USBHIST_LOG(NAME,FMT,A,B,C,D)	USBHIST_LOGN(NAME,1,FMT,A,B,C,D)
+#define USBHIST_CALLED(NAME)			do {		\
+	if ((NAME) != 0) {	\
+		KERNHIST_CALLED(usbhist);			\
+	}			\
+} while (0)
+#define USBHIST_FUNC()			KERNHIST_FUNC(__func__)
+
+USBHIST_DECL(usbhist);
+
+#else
+
+#define USBHIST_DECL(NAME)
+#define USBHIST_DEFINE(NAME)
+#define USBHIST_INIT(NAME,N)
+#define USBHIST_INIT_STATIC(NAME,BUF)
+#define USBHIST_LINK_STATIC(NAME)
+#define USBHIST_LOGN(N,NAME,FMT,A,B,C,D)	do { } while(0)
+#define USBHIST_LOGM(N,NAME,FMT,A,B,C,D)	do { } while(0)
+#define USBHIST_LOG(NAME,FMT,A,B,C,D)		do { } while(0)
+#define USBHIST_CALLED(NAME)
+#define USBHIST_FUNC()
+
+#endif
+
+#endif /* _DEV_USBUSB_HIST_H_ */

Index: src/sys/dev/usb/usbroothub.c
diff -u /dev/null src/sys/dev/usb/usbroothub.c:1.2.6.2
--- /dev/null	Wed Sep  7 09:03:33 2016
+++ src/sys/dev/usb/usbroothub.c	Wed Sep  7 09:03:33 2016
@@ -0,0 +1,491 @@
+/* $NetBSD: usbroothub.c,v 1.2.6.2 2016/09/07 09:03:33 skrll Exp $ */
+
+/*-
+ * Copyright (c) 1998, 2004, 2011, 2012 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Lennart Augustsson (lenn...@augustsson.net) at
+ * Carlstedt Research & Technology, Jared D. McNeill (jmcne...@invisible.ca),
+ * Matthew R. Green (m...@eterna.com.au) and Nick Hudson.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *

CVS commit: [netbsd-7-nhusb] src/sys/dev/usb

2016-09-07 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Sep  7 09:03:33 UTC 2016

Added Files:
src/sys/dev/usb [netbsd-7-nhusb]: usbhist.h usbroothub.c usbroothub.h

Log Message:
Add missing files (to the right branch this time)


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.4.4.2 src/sys/dev/usb/usbhist.h
cvs rdiff -u -r0 -r1.2.6.2 src/sys/dev/usb/usbroothub.c \
src/sys/dev/usb/usbroothub.h

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



CVS commit: [netbsd-7-nhusb] src/sys/dev/usb

2016-09-07 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Sep  7 08:20:24 UTC 2016

Modified Files:
src/sys/dev/usb [netbsd-7-nhusb]: usbdevs.h usbdevs_data.h

Log Message:
Regen


To generate a diff of this commit:
cvs rdiff -u -r1.672.2.4 -r1.672.2.4.2.1 src/sys/dev/usb/usbdevs.h
cvs rdiff -u -r1.673.2.4 -r1.673.2.4.2.1 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/usbdevs.h
diff -u src/sys/dev/usb/usbdevs.h:1.672.2.4 src/sys/dev/usb/usbdevs.h:1.672.2.4.2.1
--- src/sys/dev/usb/usbdevs.h:1.672.2.4	Sun Oct 18 09:03:22 2015
+++ src/sys/dev/usb/usbdevs.h	Wed Sep  7 08:20:24 2016
@@ -1,10 +1,10 @@
-/*	$NetBSD: usbdevs.h,v 1.672.2.4 2015/10/18 09:03:22 martin Exp $	*/
+/* ??? */
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: usbdevs,v 1.680.2.4 2015/10/18 09:01:58 martin Exp
+ *	NetBSD: usbdevs,v 1.680.2.4.2.1 2016/09/06 20:33:09 skrll Exp
  */
 
 /*
@@ -324,6 +324,7 @@
 #define	USB_VENDOR_ARASAN	0x07da		/* Arasan Chip Systems */
 #define	USB_VENDOR_ALLIEDCABLE	0x07e6		/* Allied Cable */
 #define	USB_VENDOR_STSN	0x07ef		/* STSN */
+#define	USB_VENDOR_CENTURY	0x07f7		/* CENTURY Corporation */
 #define	USB_VENDOR_BEWAN	0x07fa		/* Bewan */
 #define	USB_VENDOR_ZOOM	0x0803		/* Zoom Telephonics */
 #define	USB_VENDOR_BROADLOGIC	0x0827		/* BroadLogic */
@@ -493,6 +494,7 @@
 #define	USB_VENDOR_MOBILITY	0x1342		/* Mobility */
 #define	USB_VENDOR_DICKSMITH	0x1371		/* Dick Smith Electronics */
 #define	USB_VENDOR_NETGEAR3	0x1385		/* Netgear */
+#define	USB_VENDOR_VALIDITY	0x138a		/* Validity Sensors, Inc. */
 #define	USB_VENDOR_BALTECH	0x13ad		/* Baltech */
 #define	USB_VENDOR_CISCOLINKSYS	0x13b1		/* Cisco-Linksys */
 #define	USB_VENDOR_SHARK	0x13d2		/* Shark */
@@ -557,9 +559,12 @@
 #define	USB_VENDOR_PARA	0x20b8		/* PARA Industrial */
 #define	USB_VENDOR_TRENDNET	0x20f4		/* TRENDnet */
 #define	USB_VENDOR_DLINK3	0x2101		/* D-Link */
+#define	USB_VENDOR_VIALABS	0x2109		/* VIA Labs */
 #define	USB_VENDOR_ERICSSON	0x2282		/* Ericsson */
 #define	USB_VENDOR_MOTOROLA2	0x22b8		/* Motorola */
 #define	USB_VENDOR_PINNACLE	0x2304		/* Pinnacle Systems */
+#define	USB_VENDOR_ARDUINO	0x2341		/* Arduino SA */
+#define	USB_VENDOR_TPLINK	0x2357		/* TP-Link */
 #define	USB_VENDOR_TRIPPLITE	0x2478		/* Tripp-Lite */
 #define	USB_VENDOR_HIROSE	0x2631		/* Hirose Electric */
 #define	USB_VENDOR_NHJ	0x2770		/* NHJ */
@@ -580,6 +585,7 @@
 #define	USB_VENDOR_SWEEX	0x5173		/* Sweex */
 #define	USB_VENDOR_ONSPEC2	0x55aa		/* OnSpec Electronic Inc. */
 #define	USB_VENDOR_ZINWELL	0x5a57		/* Zinwell */
+#define	USB_VENDOR_INGENIC	0x601a		/* Ingenic Semiconductor Ltd. */
 #define	USB_VENDOR_SITECOM	0x6189		/* Sitecom */
 #define	USB_VENDOR_SPRINGERDESIGN	0x6400		/* Springer Design, Inc. */
 #define	USB_VENDOR_ARKMICROCHIPS	0x6547		/* ArkMicroChips */
@@ -592,6 +598,9 @@
 #define	USB_VENDOR_NETGEAR4	0x9846		/* Netgear */
 #define	USB_VENDOR_xxFTDI	0x9e88		/* FTDI */
 #define	USB_VENDOR_CACE	0xcace		/* CACE Technologies */
+#define	USB_VENDOR_COMPARE	0xcdab		/* Compare */
+#define	USB_VENDOR_DATAAPEX	0xdaae		/* DataApex */
+#define	USB_VENDOR_EVOLUTION	0xdeee		/* Evolution Robotics */
 #define	USB_VENDOR_EMPIA	0xeb1a		/* eMPIA Technology */
 #define	USB_VENDOR_HP2	0xf003		/* Hewlett Packard */
 #define	USB_VENDOR_USRP	0xfffe		/* GNU Radio USRP */
@@ -863,10 +872,23 @@
 #define	USB_PRODUCT_APPLE_IPOD_TOUCH_4G	0x129e		/* iPod Touch 4G */
 #define	USB_PRODUCT_APPLE_IPHONE_3G	0x1292		/* iPhone 3G */
 #define	USB_PRODUCT_APPLE_IPHONE_3GS	0x1294		/* iPhone 3GS */
+#define	USB_PRODUCT_APPLE_IPHONE_4	0x1297		/* iPhone 4 */
+#define	USB_PRODUCT_APPLE_IPHONE_4_VZW	0x129c		/* iPhone 4 (VZW) */
+#define	USB_PRODUCT_APPLE_IPHONE_4S	0x12a0		/* iPhone 4S */
+#define	USB_PRODUCT_APPLE_IPHONE_5	0x12a8		/* iPhone 5 */
 #define	USB_PRODUCT_APPLE_IPAD	0x129a		/* Apple iPad */
+#define	USB_PRODUCT_APPLE_IPAD_2	0x12a2		/* Apple iPad 2 */
+#define	USB_PRODUCT_APPLE_IPAD_3	0x12a6		/* Apple iPad 3 */
+#define	USB_PRODUCT_APPLE_IPAD_MINI	0x12ab		/* Apple iPad Mini */
 #define	USB_PRODUCT_APPLE_ETHERNET	0x1402		/* Apple USB to Ethernet */
 #define	USB_PRODUCT_APPLE_BLUETOOTH2	0x8205		/* Bluetooth */
-#define	USB_PRODUCT_APPLE_BLUETOOTH_HOST_C	0x821f		/* Bluetooth USB Host Controller */
+#define	USB_PRODUCT_APPLE_BLUETOOTH_HOST_1	0x8213		/* Bluetooth USB Host Controller MacBookPro 7,1 */
+#define	USB_PRODUCT_APPLE_BLUETOOTH_HOST_2	0x8215		/* Bluetooth USB Host Controller iMac 11,1 */
+#define	USB_PRODUCT_APPLE_BLUETOOTH_HOST_3	0x821a		/* Bluetooth USB Host Controller MacBookPro 8,2 */
+#define	USB_PRODUCT_APPLE_BLUETOOTH_HOST_4	0x821b		/* Bluetooth USB Host Controller MacBookAir 3,1 3,2 */
+#define	USB_PRODUCT_APPLE_BLUETOOTH_HOST_5	0x821f		/* Bluetooth USB Host Controller MacBookAir 4,1 */
+#define	USB_PRODUCT_APPLE_BLUETOOTH_HOST_6	0x8281		/* Bluetooth USB Host Controller 

CVS commit: [netbsd-7-nhusb] src/sys/dev/usb

2016-09-07 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Sep  7 08:20:24 UTC 2016

Modified Files:
src/sys/dev/usb [netbsd-7-nhusb]: usbdevs.h usbdevs_data.h

Log Message:
Regen


To generate a diff of this commit:
cvs rdiff -u -r1.672.2.4 -r1.672.2.4.2.1 src/sys/dev/usb/usbdevs.h
cvs rdiff -u -r1.673.2.4 -r1.673.2.4.2.1 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.



CVS commit: [netbsd-7-nhusb] src/sys/dev/usb

2016-09-07 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Sep  7 08:19:00 UTC 2016

Modified Files:
src/sys/dev/usb [netbsd-7-nhusb]: usb.h

Log Message:
Missed update - no idea how this happened


To generate a diff of this commit:
cvs rdiff -u -r1.106.4.2.4.1 -r1.106.4.2.4.2 src/sys/dev/usb/usb.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/usb.h
diff -u src/sys/dev/usb/usb.h:1.106.4.2.4.1 src/sys/dev/usb/usb.h:1.106.4.2.4.2
--- src/sys/dev/usb/usb.h:1.106.4.2.4.1	Tue Sep  6 20:33:09 2016
+++ src/sys/dev/usb/usb.h	Wed Sep  7 08:19:00 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: usb.h,v 1.106.4.2.4.1 2016/09/06 20:33:09 skrll Exp $	*/
+/*	$NetBSD: usb.h,v 1.106.4.2.4.2 2016/09/07 08:19:00 skrll Exp $	*/
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -598,6 +598,7 @@ typedef struct {
 #define UPS_HIGH_SPEED			0x0400
 #define UPS_PORT_TEST			0x0800
 #define UPS_PORT_INDICATOR		0x1000
+#define UPS_OTHER_SPEED			0x2000	/* currently NetBSD specific */
 	uWord		wPortChange;
 #define UPS_C_CONNECT_STATUS		0x0001
 #define UPS_C_PORT_ENABLED		0x0002



CVS commit: [netbsd-7-nhusb] src/sys/dev/usb

2016-09-07 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Sep  7 08:19:00 UTC 2016

Modified Files:
src/sys/dev/usb [netbsd-7-nhusb]: usb.h

Log Message:
Missed update - no idea how this happened


To generate a diff of this commit:
cvs rdiff -u -r1.106.4.2.4.1 -r1.106.4.2.4.2 src/sys/dev/usb/usb.h

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