CVS commit: [netbsd-7] src/sys/dev/usb
Module Name:src Committed By: bouyer Date: Tue Jun 16 10:34:49 UTC 2020 Modified Files: src/sys/dev/usb [netbsd-7]: if_run.c Log Message: Pull up following revision(s) (requested by martin in ticket #1735): sys/dev/usb/if_run.c: revision 1.41 Better bounds checking for oversized packets, to avoid kernel memory corruption. Pointed out by Ilja Van Sprundel. To generate a diff of this commit: cvs rdiff -u -r1.10.4.4 -r1.10.4.5 src/sys/dev/usb/if_run.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_run.c diff -u src/sys/dev/usb/if_run.c:1.10.4.4 src/sys/dev/usb/if_run.c:1.10.4.5 --- src/sys/dev/usb/if_run.c:1.10.4.4 Wed Aug 8 10:17:11 2018 +++ src/sys/dev/usb/if_run.c Tue Jun 16 10:34:49 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_run.c,v 1.10.4.4 2018/08/08 10:17:11 martin Exp $ */ +/* $NetBSD: if_run.c,v 1.10.4.5 2020/06/16 10:34:49 bouyer Exp $ */ /* $OpenBSD: if_run.c,v 1.90 2012/03/24 15:11:04 jsg Exp $ */ /*- @@ -23,7 +23,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_run.c,v 1.10.4.4 2018/08/08 10:17:11 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_run.c,v 1.10.4.5 2020/06/16 10:34:49 bouyer Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -2067,7 +2067,8 @@ run_rx_frame(struct run_softc *sc, uint8 return; } if (len > MHLEN) { - MCLGET(m, M_DONTWAIT); + if (__predict_true(len <= MCLBYTES)) + MCLGET(m, M_DONTWAIT); if (__predict_false(!(m->m_flags & M_EXT))) { ifp->if_ierrors++; m_freem(m);
CVS commit: [netbsd-7] src/sys/dev/usb
Module Name:src Committed By: bouyer Date: Tue Jun 16 10:33:38 UTC 2020 Modified Files: src/sys/dev/usb [netbsd-7]: if_otus.c Log Message: Pull up following revision(s) (requested by martin in ticket #1734): sys/dev/usb/if_otus.c: revision 1.45 via patch Stricter bounds check for some packet length we get from the usb chip, to make sure we do not corrupt kernel memory. Pointed out by Ilja Van Sprundel. To generate a diff of this commit: cvs rdiff -u -r1.25.4.3 -r1.25.4.4 src/sys/dev/usb/if_otus.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_otus.c diff -u src/sys/dev/usb/if_otus.c:1.25.4.3 src/sys/dev/usb/if_otus.c:1.25.4.4 --- src/sys/dev/usb/if_otus.c:1.25.4.3 Wed Aug 8 10:17:11 2018 +++ src/sys/dev/usb/if_otus.c Tue Jun 16 10:33:38 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_otus.c,v 1.25.4.3 2018/08/08 10:17:11 martin Exp $ */ +/* $NetBSD: if_otus.c,v 1.25.4.4 2020/06/16 10:33:38 bouyer Exp $ */ /* $OpenBSD: if_otus.c,v 1.18 2010/08/27 17:08:00 jsg Exp $ */ /*- @@ -23,7 +23,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_otus.c,v 1.25.4.3 2018/08/08 10:17:11 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_otus.c,v 1.25.4.4 2020/06/16 10:33:38 bouyer Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -1750,6 +1750,10 @@ otus_sub_rxeof(struct otus_softc *sc, ui } /* Compute MPDU's length. */ mlen = len - AR_PLCP_HDR_LEN - sizeof(*tail); + if (__predict_false(mlen < IEEE80211_CRC_LEN)) { + ifp->if_ierrors++; + return; + } mlen -= IEEE80211_CRC_LEN; /* strip 802.11 FCS */ /* Make sure there's room for an 802.11 header. */ /* @@ -1770,7 +1774,8 @@ otus_sub_rxeof(struct otus_softc *sc, ui return; } if (align + mlen > MHLEN) { - MCLGET(m, M_DONTWAIT); + if (__predict_true(align + mlen <= MCLBYTES)) + MCLGET(m, M_DONTWAIT); if (__predict_false(!(m->m_flags & M_EXT))) { ifp->if_ierrors++; m_freem(m);
CVS commit: [netbsd-7] src/sys/dev/usb
Module Name:src Committed By: martin Date: Fri Jan 11 15:58:23 UTC 2019 Modified Files: src/sys/dev/usb [netbsd-7]: usbdi.c Log Message: Pull up following revision(s) (requested by skrll in ticket #1671): sys/dev/usb/usbdi.c: revision 1.181 Avoid use after free when closing interrupt pipe transfer by calling upm_close before destroying the interupt pipe xfer. Found by kasan on wiz's machine. To generate a diff of this commit: cvs rdiff -u -r1.161.2.3 -r1.161.2.4 src/sys/dev/usb/usbdi.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/usbdi.c diff -u src/sys/dev/usb/usbdi.c:1.161.2.3 src/sys/dev/usb/usbdi.c:1.161.2.4 --- src/sys/dev/usb/usbdi.c:1.161.2.3 Sat Aug 25 14:57:35 2018 +++ src/sys/dev/usb/usbdi.c Fri Jan 11 15:58:23 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: usbdi.c,v 1.161.2.3 2018/08/25 14:57:35 martin Exp $ */ +/* $NetBSD: usbdi.c,v 1.161.2.4 2019/01/11 15:58:23 martin Exp $ */ /* * Copyright (c) 1998, 2012, 2015 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.161.2.3 2018/08/25 14:57:35 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.161.2.4 2019/01/11 15:58:23 martin Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -254,13 +254,14 @@ usbd_close_pipe(struct usbd_pipe *pipe) LIST_REMOVE(pipe, up_next); pipe->up_endpoint->ue_refcnt--; + pipe->up_methods->upm_close(pipe); + if (pipe->up_intrxfer != NULL) { usbd_unlock_pipe(pipe); usbd_destroy_xfer(pipe->up_intrxfer); usbd_lock_pipe(pipe); } - pipe->up_methods->upm_close(pipe); usbd_unlock_pipe(pipe); kmem_free(pipe, pipe->up_dev->ud_bus->ub_pipesize);
CVS commit: [netbsd-7] src/sys/dev/usb
Module Name:src Committed By: martin Date: Sat Aug 25 17:00:14 UTC 2018 Modified Files: src/sys/dev/usb [netbsd-7]: ugen.c Log Message: Pull up following revision(s) (requested by mrg in ticket #1632): sys/dev/usb/usbdivar.h: revision 1.117 sys/external/bsd/dwc2/dwc2.c: revision 1.52 sys/dev/usb/xhcivar.h: revision 1.10 sys/dev/usb/motg.c: revision 1.22 sys/dev/usb/ehci.c: revision 1.260 sys/dev/usb/ehci.c: revision 1.261 sys/dev/usb/xhci.c: revision 1.96 sys/dev/usb/ohci.c: revision 1.282 sys/dev/usb/ohci.c: revision 1.283 sys/dev/usb/ehcivar.h: revision 1.45 sys/dev/usb/uhci.c: revision 1.281 sys/dev/usb/uhci.c: revision 1.282 sys/dev/usb/usbdi.c: revision 1.177 sys/dev/usb/ohcivar.h: revision 1.60 sys/dev/usb/uhcivar.h: revision 1.55 (all via patch) pull across abort fixes from nick-nhusb. add more abort fixes, using ideas from Taylor and Nick, and myself. special thanks to both who inspired much of the code here, if not wrote it directly. among other problems, this assert should no longer trigger: panic: kernel diagnostic assertion "xfer->ux_state == XFER_ONQU" failed: file "/current/src/sys/dev/usb/usbdi.c", line 914 using usbhist i was able to track down my instance of it being related to userland close() beginning, dropping the sc_lock, and then the usb softintr completes the transfer normally, and when it is done, the abort path attempts to re-complete the transfer, and the above assert is tripped. changes from nhusb were commited with these logs: -- Move the struct usb_task to struct usbd_xfer for everyone to use. -- Set device transfer status to USBD_IN_PROGRESS if start methods succeeds -- Actually set the transfer status on transfers in ohci_abort_xfer and the controller is dying -- Don't supply the lock to callout_halt when polling as it won't be held -- Improve transfer abort -- Mark device transfers as USBD_IN_PROGRESS appropriately and improve abort handling -- -- Mark device transfers as USBD_IN_PROGRESS appropriately and improve abort handling -- additional changes include: - initialise the usb abort task in the HCI allocx routine, so that it can be safely usb_rem_task()'d. - rework the handling of softintr vs cancellation vs timeout abort based upon a scheme from Taylor: when completing a transfer normally: - if the status is not in progress, it must be cancelled or timed out, and we should not process this xfer. - set the status as normal. - unconditionallly callout_stop() and usb_rem_task(). they're safe and either aren't running, or will run and do nothing. - finally call usb_transfer_complete(). when aborting a transfer: - status should be cancelled or timed out. - if cancelling, callout_halt and usb_rem_task_wait() to make sure the timer is either done or cancelled. - at this point, the ux_status must not be cancelled or timed out, and if it is not in progress we're done. - set the status. - if the controller is dying, just return. - perform HCI-specific tasks to abort this xfer. - finally call usb_transfer_complete(). for the timeout and timeout task: - if the HCI is not dying, and the ux_status is in progress, then trigger the usb abort task. - remove UXFER_ABORTWAIT and UXFER_ABORTING. tested on: - multiple PC systems with several types of devices: ugen/UPS, ucom, umass with disk, ssd and cdrom backends, kbd, ms, using uhci, ehci and xhci. - erlite3: sd@umass on dwc2. - sunblade2000: kbd/ms and umass disk on ohci. untested: - motg, slhci and ahci. motg has some portion of the new scheme applied, but slhci and ahci require more study. future work includes pushing a lot of the common abort handling into usbdi.c and leaving upm_abort() for HC specific tasks, but this change is pullup-able to netbsd-7 and netbsd-8 as it does not change any external API, as well as removing over 100 lines of code while adding over 30 new asserts. XXX: pullup-7, pullup-8. fix DIAGNOSTIC build by not copying ub_usepolling to stack before use Sprinkle __diagused To generate a diff of this commit: cvs rdiff -u -r1.124.2.4 -r1.124.2.5 src/sys/dev/usb/ugen.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/ugen.c diff -u src/sys/dev/usb/ugen.c:1.124.2.4 src/sys/dev/usb/ugen.c:1.124.2.5 --- src/sys/dev/usb/ugen.c:1.124.2.4 Mon Feb 19 19:33:06 2018 +++ src/sys/dev/usb/ugen.c Sat Aug 25 17:00:14 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: ugen.c,v 1.124.2.4 2018/02/19 19:33:06 snj Exp $ */ +/* $NetBSD: ugen.c,v 1.124.2.5 2018/08/25 17:00:14 martin Exp $ */ /* * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.124.2.4 2018/02/19 19:33:06 snj Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.124.2.5
CVS commit: [netbsd-7] src/sys/dev/usb
Module Name:src Committed By: martin Date: Wed Aug 8 10:17:11 UTC 2018 Modified Files: src/sys/dev/usb [netbsd-7]: if_athn_usb.c if_atu.c if_aue.c if_axe.c if_axen.c if_cue.c if_otus.c if_rum.c if_run.c if_smsc.c if_udav.c if_upgt.c if_ural.c if_url.c if_urtw.c if_urtwn.c if_zyd.c uatp.c umcs.c usb.c usb_subr.c usbdi.h Log Message: Pull up following revision(s) (requested by riastradh in ticket #1626): sys/dev/usb/if_cue.c: revision 1.80 sys/dev/usb/umcs.c: revision 1.11 sys/dev/usb/umcs.c: revision 1.12 sys/dev/usb/if_ural.c: revision 1.56 sys/dev/usb/if_run.c: revision 1.28 sys/dev/usb/if_ural.c: revision 1.57 sys/dev/usb/if_run.c: revision 1.29 sys/dev/usb/uatp.c: revision 1.16 sys/dev/usb/uatp.c: revision 1.17 sys/dev/usb/if_axe.c: revision 1.91 sys/dev/usb/if_axe.c: revision 1.92 sys/dev/usb/if_zyd.c: revision 1.49 sys/dev/usb/if_axen.c: revision 1.15 sys/dev/usb/if_url.c: revision 1.60 sys/dev/usb/if_udav.c: revision 1.54 sys/dev/usb/if_axen.c: revision 1.16 sys/dev/usb/if_udav.c: revision 1.55 sys/dev/usb/if_athn_usb.c: revision 1.28 sys/dev/usb/if_athn_usb.c: revision 1.29 sys/dev/usb/if_urtw.c: revision 1.16 sys/dev/usb/if_urtw.c: revision 1.17 sys/dev/usb/if_cue.c: revision 1.79 sys/dev/usb/if_rum.c: revision 1.62 sys/dev/usb/if_urtwn.c: revision 1.61 sys/dev/usb/if_rum.c: revision 1.63 sys/dev/usb/if_urtwn.c: revision 1.63 sys/dev/usb/usb.c: revision 1.170 sys/dev/usb/usb.c: revision 1.171 sys/dev/usb/if_smsc.c: revision 1.35 sys/dev/usb/if_smsc.c: revision 1.36 sys/dev/usb/if_zyd.c: revision 1.50 sys/dev/usb/if_aue.c: revision 1.144 sys/dev/usb/if_aue.c: revision 1.145 sys/dev/usb/usb_subr.c: revision 1.225 sys/dev/usb/usb_subr.c: revision 1.226 sys/dev/usb/if_upgt.c: revision 1.21 sys/dev/usb/usbdi.h: revision 1.93 sys/dev/usb/if_upgt.c: revision 1.22 sys/dev/usb/if_url.c: revision 1.59 sys/dev/usb/usbdi.h: revision 1.95 sys/dev/usb/if_otus.c: revision 1.34 sys/dev/usb/if_atu.c: revision 1.62 sys/dev/usb/if_otus.c: revision 1.35 sys/dev/usb/if_atu.c: revision 1.63 New function usb_rem_task_wait(dev, task, queue). If task is scheduled to run, removes it from the queue. If it may have already begun to run, waits for it to complete. Caller must guarantee it will not switch to another queue. If caller guarantees it will not be scheduled again, then usb_rem_task_wait guarantees it is not running on return. This will enable us to fix a litany of bugs in detach where we currently fail to wait for a pending task. Use usb_rem_task_wait in various drivers. To generate a diff of this commit: cvs rdiff -u -r1.6.6.3 -r1.6.6.4 src/sys/dev/usb/if_athn_usb.c cvs rdiff -u -r1.49.10.2 -r1.49.10.3 src/sys/dev/usb/if_atu.c cvs rdiff -u -r1.132.2.2 -r1.132.2.3 src/sys/dev/usb/if_aue.c cvs rdiff -u -r1.67.2.3 -r1.67.2.4 src/sys/dev/usb/if_axe.c cvs rdiff -u -r1.3.2.3 -r1.3.2.4 src/sys/dev/usb/if_axen.c cvs rdiff -u -r1.68.2.2 -r1.68.2.3 src/sys/dev/usb/if_cue.c cvs rdiff -u -r1.25.4.2 -r1.25.4.3 src/sys/dev/usb/if_otus.c cvs rdiff -u -r1.48.4.2 -r1.48.4.3 src/sys/dev/usb/if_rum.c cvs rdiff -u -r1.10.4.3 -r1.10.4.4 src/sys/dev/usb/if_run.c cvs rdiff -u -r1.19.2.4 -r1.19.2.5 src/sys/dev/usb/if_smsc.c cvs rdiff -u -r1.43.2.2 -r1.43.2.3 src/sys/dev/usb/if_udav.c cvs rdiff -u -r1.12.2.2 -r1.12.2.3 src/sys/dev/usb/if_upgt.c cvs rdiff -u -r1.44.12.3 -r1.44.12.4 src/sys/dev/usb/if_ural.c cvs rdiff -u -r1.48.2.2 -r1.48.2.3 src/sys/dev/usb/if_url.c cvs rdiff -u -r1.6.4.2 -r1.6.4.3 src/sys/dev/usb/if_urtw.c cvs rdiff -u -r1.34.2.4 -r1.34.2.5 src/sys/dev/usb/if_urtwn.c cvs rdiff -u -r1.36.12.2 -r1.36.12.3 src/sys/dev/usb/if_zyd.c cvs rdiff -u -r1.10.2.2 -r1.10.2.3 src/sys/dev/usb/uatp.c cvs rdiff -u -r1.7.6.2 -r1.7.6.3 src/sys/dev/usb/umcs.c cvs rdiff -u -r1.154.2.3 -r1.154.2.4 src/sys/dev/usb/usb.c cvs rdiff -u -r1.196.4.4 -r1.196.4.5 src/sys/dev/usb/usb_subr.c cvs rdiff -u -r1.90.2.1 -r1.90.2.2 src/sys/dev/usb/usbdi.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.6.3 src/sys/dev/usb/if_athn_usb.c:1.6.6.4 --- src/sys/dev/usb/if_athn_usb.c:1.6.6.3 Mon Feb 19 19:33:06 2018 +++ src/sys/dev/usb/if_athn_usb.c Wed Aug 8 10:17:11 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: if_athn_usb.c,v 1.6.6.3 2018/02/19 19:33:06 snj Exp $ */ +/* $NetBSD: if_athn_usb.c,v 1.6.6.4 2018/08/08 10:17:11 martin 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.6.3
CVS commit: [netbsd-7] src/sys/dev/usb
Module Name:src Committed By: martin Date: Wed Jun 6 15:42:31 UTC 2018 Modified Files: src/sys/dev/usb [netbsd-7]: usbdevs.h usbdevs_data.h Log Message: regen (ticket #1613) To generate a diff of this commit: cvs rdiff -u -r1.672.2.8 -r1.672.2.9 src/sys/dev/usb/usbdevs.h cvs rdiff -u -r1.673.2.8 -r1.673.2.9 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.8 src/sys/dev/usb/usbdevs.h:1.672.2.9 --- src/sys/dev/usb/usbdevs.h:1.672.2.8 Wed Apr 5 19:54:20 2017 +++ src/sys/dev/usb/usbdevs.h Wed Jun 6 15:42:28 2018 @@ -4,7 +4,7 @@ * THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. * * generated from: - * NetBSD: usbdevs,v 1.680.2.7 2016/12/14 19:16:14 snj Exp + * NetBSD: usbdevs,v 1.680.2.9 2018/06/06 15:41:47 martin Exp */ /* @@ -3261,6 +3261,7 @@ /* TP-Link products */ #define USB_PRODUCT_TPLINK_RTL8192CU 0x0100 /* RTL8192CU */ +#define USB_PRODUCT_TPLINK_RTL8188EU 0x010c /* RTL8188EU */ /* Trek Technology products */ #define USB_PRODUCT_TREK_THUMBDRIVE 0x /* ThumbDrive */ Index: src/sys/dev/usb/usbdevs_data.h diff -u src/sys/dev/usb/usbdevs_data.h:1.673.2.8 src/sys/dev/usb/usbdevs_data.h:1.673.2.9 --- src/sys/dev/usb/usbdevs_data.h:1.673.2.8 Wed Apr 5 19:54:20 2017 +++ src/sys/dev/usb/usbdevs_data.h Wed Jun 6 15:42:28 2018 @@ -4,7 +4,7 @@ * THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. * * generated from: - * NetBSD: usbdevs,v 1.680.2.7 2016/12/14 19:16:14 snj Exp + * NetBSD: usbdevs,v 1.680.2.9 2018/06/06 15:41:47 martin Exp */ /* @@ -9923,6 +9923,10 @@ const struct usb_product usb_products[] "RTL8192CU", }, { + USB_VENDOR_TPLINK, USB_PRODUCT_TPLINK_RTL8188EU, + "RTL8188EU", + }, + { USB_VENDOR_TREK, USB_PRODUCT_TREK_THUMBDRIVE, "ThumbDrive", }, @@ -10567,4 +10571,4 @@ const struct usb_product usb_products[] "Prestige", }, }; -const int usb_nproducts = 2092; +const int usb_nproducts = 2093;
CVS commit: [netbsd-7] src/sys/dev/usb
Module Name:src Committed By: martin Date: Wed Jun 6 15:41:47 UTC 2018 Modified Files: src/sys/dev/usb [netbsd-7]: if_urtwn.c usbdevs Log Message: Pull up following revision(s) (requested by maya in ticket #1613): sys/dev/usb/if_urtwn.c: revision 1.53 sys/dev/usb/usbdevs: revision 1.733 PR/52212 - Kai-Uwe Eckhardt -- add TP-Link TL-WN722N v2 To generate a diff of this commit: cvs rdiff -u -r1.34.2.3 -r1.34.2.4 src/sys/dev/usb/if_urtwn.c cvs rdiff -u -r1.680.2.8 -r1.680.2.9 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/if_urtwn.c diff -u src/sys/dev/usb/if_urtwn.c:1.34.2.3 src/sys/dev/usb/if_urtwn.c:1.34.2.4 --- src/sys/dev/usb/if_urtwn.c:1.34.2.3 Mon Feb 19 19:33:06 2018 +++ src/sys/dev/usb/if_urtwn.c Wed Jun 6 15:41:47 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: if_urtwn.c,v 1.34.2.3 2018/02/19 19:33:06 snj Exp $ */ +/* $NetBSD: if_urtwn.c,v 1.34.2.4 2018/06/06 15:41:47 martin Exp $ */ /* $OpenBSD: if_urtwn.c,v 1.42 2015/02/10 23:25:46 mpi Exp $ */ /*- @@ -25,7 +25,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.34.2.3 2018/02/19 19:33:06 snj Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.34.2.4 2018/06/06 15:41:47 martin Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -191,6 +191,7 @@ static const struct urtwn_dev { URTWN_RTL8188E_DEV(REALTEK, RTL8188ETV), URTWN_RTL8188E_DEV(REALTEK, RTL8188EU), URTWN_RTL8188E_DEV(ABOCOM, RTL8188EU), + URTWN_RTL8188E_DEV(TPLINK, RTL8188EU), /* URTWN_RTL8192EU */ URTWN_RTL8192EU_DEV(REALTEK, RTL8192EU), Index: src/sys/dev/usb/usbdevs diff -u src/sys/dev/usb/usbdevs:1.680.2.8 src/sys/dev/usb/usbdevs:1.680.2.9 --- src/sys/dev/usb/usbdevs:1.680.2.8 Wed Apr 5 19:54:20 2017 +++ src/sys/dev/usb/usbdevs Wed Jun 6 15:41:47 2018 @@ -1,4 +1,4 @@ -$NetBSD: usbdevs,v 1.680.2.8 2017/04/05 19:54:20 snj Exp $ +$NetBSD: usbdevs,v 1.680.2.9 2018/06/06 15:41:47 martin Exp $ /* * Copyright (c) 1998-2004 The NetBSD Foundation, Inc. @@ -3254,6 +3254,7 @@ product TOSHIBA HSDPA_MODEM_EU870DT1 0x1 /* TP-Link products */ product TPLINK RTL8192CU 0x0100 RTL8192CU +product TPLINK RTL8188EU 0x010c RTL8188EU /* Trek Technology products */ product TREK THUMBDRIVE 0x ThumbDrive
CVS commit: [netbsd-7] src/sys/dev/usb
Module Name:src Committed By: snj Date: Mon Feb 19 19:33:06 UTC 2018 Modified Files: src/sys/dev/usb [netbsd-7]: if_athn_usb.c if_atu.c if_aue.c if_axe.c if_axen.c if_cdce.c if_cue.c if_kue.c if_otus.c if_rum.c if_run.c if_smsc.c if_udav.c if_upgt.c if_upl.c if_ural.c if_url.c if_urndis.c if_urtw.c if_urtwn.c if_zyd.c irmce.c pseye.c ubt.c ucom.c udsir.c ugen.c uhso.c uirda.c ulpt.c umass.c umidi.c uscanner.c usscanner.c ustir.c utoppy.c uvideo.c Log Message: Pull up following revision(s) (requested by skrll in ticket #1556): sys/dev/usb/if_athn_usb.c: 1.25 sys/dev/usb/if_atu.c: 1.56 sys/dev/usb/if_aue.c: 1.142 sys/dev/usb/if_axe.c: 1.84 sys/dev/usb/if_axen.c: 1.12 sys/dev/usb/if_cdce.c: 1.45 sys/dev/usb/if_cue.c: 1.77 sys/dev/usb/if_kue.c: 1.91 sys/dev/usb/if_otus.c: 1.32 sys/dev/usb/if_rum.c: 1.59 sys/dev/usb/if_run.c: 1.25 sys/dev/usb/if_smsc.c: 1.33 sys/dev/usb/if_udav.c: 1.52 sys/dev/usb/if_upgt.c: 1.18 sys/dev/usb/if_upl.c: 1.61 sys/dev/usb/if_ural.c: 1.53 sys/dev/usb/if_url.c: 1.57 sys/dev/usb/if_urndis.c: 1.17 sys/dev/usb/if_urtw.c: 1.14 sys/dev/usb/if_urtwn.c: 1.56 sys/dev/usb/if_zyd.c: 1.45 sys/dev/usb/irmce.c: 1.4 sys/dev/usb/pseye.c: 1.24 sys/dev/usb/ubt.c: 1.60 sys/dev/usb/ucom.c: 1.120 sys/dev/usb/udsir.c: 1.6 sys/dev/usb/ugen.c: 1.137 sys/dev/usb/uhso.c: 1.27 sys/dev/usb/uirda.c: 1.43 sys/dev/usb/ulpt.c: 1.99 sys/dev/usb/umass.c: 1.163 sys/dev/usb/umidi.c: 1.74 sys/dev/usb/uscanner.c: 1.82 sys/dev/usb/usscanner.c: 1.43 sys/dev/usb/ustir.c: 1.39 sys/dev/usb/utoppy.c: 1.30 sys/dev/usb/uvideo.c: 1.46 PR kern/52931 Kernel panics with Atheros usb wireless interface Audit the flags to usbd_create_xfer so that USBD_FORCE_SHORT_XFER is supplied wherever such a transfer is setup. We can drop USBD_SHORT_XFER_OK as it has not bearing on number of TDs To generate a diff of this commit: cvs rdiff -u -r1.6.6.2 -r1.6.6.3 src/sys/dev/usb/if_athn_usb.c cvs rdiff -u -r1.49.10.1 -r1.49.10.2 src/sys/dev/usb/if_atu.c cvs rdiff -u -r1.132.2.1 -r1.132.2.2 src/sys/dev/usb/if_aue.c cvs rdiff -u -r1.67.2.2 -r1.67.2.3 src/sys/dev/usb/if_axe.c cvs rdiff -u -r1.3.2.2 -r1.3.2.3 src/sys/dev/usb/if_axen.c cvs rdiff -u -r1.38.12.1 -r1.38.12.2 src/sys/dev/usb/if_cdce.c cvs rdiff -u -r1.68.2.1 -r1.68.2.2 src/sys/dev/usb/if_cue.c cvs rdiff -u -r1.81.2.1 -r1.81.2.2 src/sys/dev/usb/if_kue.c cvs rdiff -u -r1.25.4.1 -r1.25.4.2 src/sys/dev/usb/if_otus.c cvs rdiff -u -r1.48.4.1 -r1.48.4.2 src/sys/dev/usb/if_rum.c cvs rdiff -u -r1.10.4.2 -r1.10.4.3 src/sys/dev/usb/if_run.c cvs rdiff -u -r1.19.2.3 -r1.19.2.4 src/sys/dev/usb/if_smsc.c cvs rdiff -u -r1.43.2.1 -r1.43.2.2 src/sys/dev/usb/if_udav.c cvs rdiff -u -r1.12.2.1 -r1.12.2.2 src/sys/dev/usb/if_upgt.c cvs rdiff -u -r1.47.2.1 -r1.47.2.2 src/sys/dev/usb/if_upl.c cvs rdiff -u -r1.44.12.2 -r1.44.12.3 src/sys/dev/usb/if_ural.c cvs rdiff -u -r1.48.2.1 -r1.48.2.2 src/sys/dev/usb/if_url.c cvs rdiff -u -r1.9.2.1 -r1.9.2.2 src/sys/dev/usb/if_urndis.c cvs rdiff -u -r1.6.4.1 -r1.6.4.2 src/sys/dev/usb/if_urtw.c cvs rdiff -u -r1.34.2.2 -r1.34.2.3 src/sys/dev/usb/if_urtwn.c cvs rdiff -u -r1.36.12.1 -r1.36.12.2 src/sys/dev/usb/if_zyd.c cvs rdiff -u -r1.1.30.1 -r1.1.30.2 src/sys/dev/usb/irmce.c cvs rdiff -u -r1.21.32.1 -r1.21.32.2 src/sys/dev/usb/pseye.c cvs rdiff -u -r1.51.2.1 -r1.51.2.2 src/sys/dev/usb/ubt.c cvs rdiff -u -r1.107.2.2 -r1.107.2.3 src/sys/dev/usb/ucom.c cvs rdiff -u -r1.1.12.1 -r1.1.12.2 src/sys/dev/usb/udsir.c cvs rdiff -u -r1.124.2.3 -r1.124.2.4 src/sys/dev/usb/ugen.c cvs rdiff -u -r1.16.2.1 -r1.16.2.2 src/sys/dev/usb/uhso.c cvs rdiff -u -r1.38.4.1 -r1.38.4.2 src/sys/dev/usb/uirda.c \ src/sys/dev/usb/usscanner.c cvs rdiff -u -r1.95.2.1 -r1.95.2.2 src/sys/dev/usb/ulpt.c cvs rdiff -u -r1.148.4.1 -r1.148.4.2 src/sys/dev/usb/umass.c cvs rdiff -u -r1.65.12.2 -r1.65.12.3 src/sys/dev/usb/umidi.c cvs rdiff -u -r1.75.2.1 -r1.75.2.2 src/sys/dev/usb/uscanner.c cvs rdiff -u -r1.33.8.1 -r1.33.8.2 src/sys/dev/usb/ustir.c cvs rdiff -u -r1.24.2.1 -r1.24.2.2 src/sys/dev/usb/utoppy.c cvs rdiff -u -r1.40.4.1 -r1.40.4.2 src/sys/dev/usb/uvideo.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_athn_usb.c diff -u src/sys/dev/usb/if_athn_usb.c:1.6.6.2 src/sys/dev/usb/if_athn_usb.c:1.6.6.3 --- src/sys/dev/usb/if_athn_usb.c:1.6.6.2 Mon Oct 23 19:15:09 2017 +++ src/sys/dev/usb/if_athn_usb.c Mon Feb 19 19:33:06 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: if_athn_usb.c,v 1.6.6.2 2017/10/23 19:15:09 snj Exp $ */ +/* $NetBSD: if_athn_usb.c,v 1.6.6.3 2018/02/19 19:33:06 snj Exp $ */ /* $OpenBSD: if_athn_usb.c,v 1.12 2013/01/14
CVS commit: [netbsd-7] src/sys/dev/usb
Module Name:src Committed By: snj Date: Wed Jan 3 21:18:03 UTC 2018 Modified Files: src/sys/dev/usb [netbsd-7]: usb_subr.c Log Message: Pull up following revision(s) (requested by khorben in ticket #1541): sys/dev/usb/usb_subr.c: revision 1.222 Be more defensive towards malicious USB devices This avoids potential panics due to 0-sized memory allocation attempts, which could be triggered by malicious USB devices. Tested on NetBSD/amd64 with a Sony Xperia X (SailfishOS). Based on an initial patch by Nick Hudson, thanks! Fixes PR kern/52383. To generate a diff of this commit: cvs rdiff -u -r1.196.4.3 -r1.196.4.4 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.196.4.3 src/sys/dev/usb/usb_subr.c:1.196.4.4 --- src/sys/dev/usb/usb_subr.c:1.196.4.3 Wed Apr 5 19:54:20 2017 +++ src/sys/dev/usb/usb_subr.c Wed Jan 3 21:18:03 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: usb_subr.c,v 1.196.4.3 2017/04/05 19:54:20 snj Exp $ */ +/* $NetBSD: usb_subr.c,v 1.196.4.4 2018/01/03 21:18:03 snj 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.3 2017/04/05 19:54:20 snj Exp $"); +__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.196.4.4 2018/01/03 21:18:03 snj Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -644,6 +644,10 @@ usbd_set_config_index(struct usbd_device return err; } len = UGETW(cd.wTotalLength); + if (len == 0) { + DPRINTF("empty short descriptor", 0, 0, 0, 0); + return USBD_INVAL; + } cdp = kmem_alloc(len, KM_SLEEP); if (cdp == NULL) return USBD_NOMEM; @@ -672,6 +676,11 @@ usbd_set_config_index(struct usbd_device err = usbd_get_bos_desc(dev, index, ); if (!err) { int blen = UGETW(bd.wTotalLength); + if (blen == 0) { +DPRINTF("empty bos descriptor", 0, 0, 0, 0); +err = USBD_INVAL; +goto bad; + } bdp = kmem_alloc(blen, KM_SLEEP); if (bdp == NULL) { err = USBD_NOMEM; @@ -765,6 +774,11 @@ usbd_set_config_index(struct usbd_device /* Allocate and fill interface data. */ nifc = cdp->bNumInterface; + if (nifc == 0) { + DPRINTF("no interfaces", 0, 0, 0, 0); + err = USBD_INVAL; + goto bad; + } dev->ud_ifaces = kmem_alloc(nifc * sizeof(struct usbd_interface), KM_SLEEP); if (dev->ud_ifaces == NULL) {
CVS commit: [netbsd-7] src/sys/dev/usb
Module Name:src Committed By: snj Date: Wed Jan 3 20:00:23 UTC 2018 Modified Files: src/sys/dev/usb [netbsd-7]: if_urtwn.c Log Message: Pull up following revision(s) (requested by skrll in ticket #1528): sys/dev/usb/if_urtwn.c: revision 1.55 PR/52702 Malicious USB devices attaching as urtwn(4) can corrupt kernel memory Patch from PR slighly updated by me To generate a diff of this commit: cvs rdiff -u -r1.34.2.1 -r1.34.2.2 src/sys/dev/usb/if_urtwn.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.c diff -u src/sys/dev/usb/if_urtwn.c:1.34.2.1 src/sys/dev/usb/if_urtwn.c:1.34.2.2 --- src/sys/dev/usb/if_urtwn.c:1.34.2.1 Wed Apr 5 19:54:19 2017 +++ src/sys/dev/usb/if_urtwn.c Wed Jan 3 20:00:23 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: if_urtwn.c,v 1.34.2.1 2017/04/05 19:54:19 snj Exp $ */ +/* $NetBSD: if_urtwn.c,v 1.34.2.2 2018/01/03 20:00:23 snj Exp $ */ /* $OpenBSD: if_urtwn.c,v 1.42 2015/02/10 23:25:46 mpi Exp $ */ /*- @@ -25,7 +25,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.34.2.1 2017/04/05 19:54:19 snj Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.34.2.2 2018/01/03 20:00:23 snj Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -588,8 +588,8 @@ static int urtwn_open_pipes(struct urtwn_softc *sc) { /* Bulk-out endpoints addresses (from highest to lowest prio). */ - static uint8_t epaddr[3]; - static uint8_t rxepaddr[3]; + static uint8_t epaddr[R92C_MAX_EPOUT]; + static uint8_t rxepaddr[R92C_MAX_EPIN]; usb_interface_descriptor_t *id; usb_endpoint_descriptor_t *ed; size_t i, ntx = 0, nrx = 0; @@ -601,26 +601,32 @@ urtwn_open_pipes(struct urtwn_softc *sc) id = usbd_get_interface_descriptor(sc->sc_iface); for (i = 0; i < id->bNumEndpoints; i++) { ed = usbd_interface2endpoint_descriptor(sc->sc_iface, i); - if (ed != NULL && - UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK && - UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_OUT) { - epaddr[ntx] = ed->bEndpointAddress; + if (ed == NULL || UE_GET_XFERTYPE(ed->bmAttributes) != UE_BULK) { + continue; + } + if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_OUT) { + if (ntx < sizeof(epaddr)) +epaddr[ntx] = ed->bEndpointAddress; ntx++; } - if (ed != NULL && - UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK && - UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN) { - rxepaddr[nrx] = ed->bEndpointAddress; + if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN) { + if (nrx < sizeof(rxepaddr)) +rxepaddr[nrx] = ed->bEndpointAddress; nrx++; } } - DPRINTFN(DBG_INIT, ("%s: %s: found %zd bulk-out pipes\n", - device_xname(sc->sc_dev), __func__, ntx)); + if (nrx == 0 || nrx > R92C_MAX_EPIN) { + aprint_error_dev(sc->sc_dev, + "%zd: invalid number of Rx bulk pipes\n", nrx); + return EIO; + } if (ntx == 0 || ntx > R92C_MAX_EPOUT) { aprint_error_dev(sc->sc_dev, "%zd: invalid number of Tx bulk pipes\n", ntx); return EIO; } + DPRINTFN(DBG_INIT, ("%s: %s: found %zd/%zd bulk-in/out pipes\n", + device_xname(sc->sc_dev), __func__, nrx, ntx)); sc->rx_npipe = nrx; sc->tx_npipe = ntx;
CVS commit: [netbsd-7] src/sys/dev/usb
Module Name:src Committed By: snj Date: Wed Jan 3 19:48:46 UTC 2018 Modified Files: src/sys/dev/usb [netbsd-7]: xhci.c Log Message: Pull up following revision(s) (requested by msaitoh in ticket #1526): sys/dev/usb/xhci.c: revision 1.76 Wait 1ms first. Existing Intel xHCI requies 1ms delay to prevent system hang (Errata). To generate a diff of this commit: cvs rdiff -u -r1.23.2.5 -r1.23.2.6 src/sys/dev/usb/xhci.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/xhci.c diff -u src/sys/dev/usb/xhci.c:1.23.2.5 src/sys/dev/usb/xhci.c:1.23.2.6 --- src/sys/dev/usb/xhci.c:1.23.2.5 Wed Apr 5 19:54:21 2017 +++ src/sys/dev/usb/xhci.c Wed Jan 3 19:48:45 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: xhci.c,v 1.23.2.5 2017/04/05 19:54:21 snj Exp $ */ +/* $NetBSD: xhci.c,v 1.23.2.6 2018/01/03 19:48:45 snj Exp $ */ /* * Copyright (c) 2013 Jonathan A. Kollasch @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.23.2.5 2017/04/05 19:54:21 snj Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.23.2.6 2018/01/03 19:48:45 snj Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -689,10 +689,14 @@ xhci_hc_reset(struct xhci_softc * const usbcmd = XHCI_CMD_HCRST; xhci_op_write_4(sc, XHCI_USBCMD, usbcmd); for (i = 0; i < XHCI_WAIT_HCRST; i++) { + /* + * Wait 1ms first. Existing Intel xHCI requies 1ms delay to + * prevent system hang (Errata). + */ + usb_delay_ms(>sc_bus, 1); usbcmd = xhci_op_read_4(sc, XHCI_USBCMD); if ((usbcmd & XHCI_CMD_HCRST) == 0) break; - usb_delay_ms(>sc_bus, 1); } if (i >= XHCI_WAIT_HCRST) { aprint_error_dev(sc->sc_dev, "host controller reset timeout\n");
CVS commit: [netbsd-7] src/sys/dev/usb
Module Name:src Committed By: snj Date: Mon Oct 23 19:15:09 UTC 2017 Modified Files: src/sys/dev/usb [netbsd-7]: if_athn_usb.c Log Message: Pull up following revision(s) (requested by skrll in ticket #1515): sys/dev/usb/if_athn_usb.c: revision 1.23 PR/52553 Panic on "ifconfig athn0 up" Don't race for a transfer in athn_usb_init on the free list for beacons. Instead pre-assign a transfer to beacons in athn_usb_alloc_tx_list To generate a diff of this commit: cvs rdiff -u -r1.6.6.1 -r1.6.6.2 src/sys/dev/usb/if_athn_usb.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_athn_usb.c diff -u src/sys/dev/usb/if_athn_usb.c:1.6.6.1 src/sys/dev/usb/if_athn_usb.c:1.6.6.2 --- src/sys/dev/usb/if_athn_usb.c:1.6.6.1 Wed Apr 5 19:54:19 2017 +++ src/sys/dev/usb/if_athn_usb.c Mon Oct 23 19:15:09 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: if_athn_usb.c,v 1.6.6.1 2017/04/05 19:54:19 snj Exp $ */ +/* $NetBSD: if_athn_usb.c,v 1.6.6.2 2017/10/23 19:15:09 snj 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.6.1 2017/04/05 19:54:19 snj Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_athn_usb.c,v 1.6.6.2 2017/10/23 19:15:09 snj Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -733,9 +733,15 @@ athn_usb_alloc_tx_list(struct athn_usb_s /* Append this Tx buffer to our free list. */ TAILQ_INSERT_TAIL(>usc_tx_free_list, data, next); } - if (error != 0) + if (error == 0) { + /* Steal one buffer for beacons. */ + usc->usc_tx_bcn = TAILQ_FIRST(>usc_tx_free_list); + TAILQ_REMOVE(>usc_tx_free_list, usc->usc_tx_bcn, next); + } else { athn_usb_free_tx_list(usc); + } mutex_exit(>usc_tx_mtx); + return error; } @@ -754,6 +760,10 @@ athn_usb_free_tx_list(struct athn_usb_so if (xfer != NULL) usbd_destroy_xfer(xfer); } + if (usc->usc_tx_bcn) { + usbd_destroy_xfer(usc->usc_tx_bcn->xfer); + usc->usc_tx_bcn = NULL; + } } Static int @@ -2761,12 +2771,6 @@ athn_usb_init_locked(struct ifnet *ifp) usc->usc_cmdq.cur = usc->usc_cmdq.next = usc->usc_cmdq.queued = 0; mutex_spin_exit(>usc_task_mtx); - /* Steal one buffer for beacons. */ - mutex_enter(>usc_tx_mtx); - usc->usc_tx_bcn = TAILQ_FIRST(>usc_tx_free_list); - TAILQ_REMOVE(>usc_tx_free_list, usc->usc_tx_bcn, next); - mutex_exit(>usc_tx_mtx); - curchan = ic->ic_curchan; extchan = NULL;
CVS commit: [netbsd-7] src/sys/dev/usb
Module Name:src Committed By: snj Date: Fri Oct 13 08:11:20 UTC 2017 Modified Files: src/sys/dev/usb [netbsd-7]: uhidev.c ukbd.c Log Message: Pull up following revision(s) (requested by jakllsch in ticket #1503): sys/dev/usb/uhidev.c: revision 1.71 sys/dev/usb/ukbd.c: revision 1.137-1.138 Fix memory leak in report parsing error paths. -- Support more varieties of USB keyboard reports. The previous code asssumed reports would closely match the Bootstrap Keyboard Protocol. This is no longer always the case, particularly with higher-end keyboards. -- Always try to set USB HID devices into Report Protocol. (Unless the device is known to be quirky.) Some of the most-widely-compatible methods of implementing USB Keyboard NKRO depend on this Request to function as designed. Issuing this Request is recommended by the HID 1.11 spec (7.2.6): ... "the host should not make any assumptions about the device's state and should set the desired protocol whenever initializing a device." To generate a diff of this commit: cvs rdiff -u -r1.61.2.3 -r1.61.2.4 src/sys/dev/usb/uhidev.c cvs rdiff -u -r1.129.4.2 -r1.129.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/uhidev.c diff -u src/sys/dev/usb/uhidev.c:1.61.2.3 src/sys/dev/usb/uhidev.c:1.61.2.4 --- src/sys/dev/usb/uhidev.c:1.61.2.3 Wed Apr 5 19:54:20 2017 +++ src/sys/dev/usb/uhidev.c Fri Oct 13 08:11:20 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: uhidev.c,v 1.61.2.3 2017/04/05 19:54:20 snj Exp $ */ +/* $NetBSD: uhidev.c,v 1.61.2.4 2017/10/13 08:11:20 snj Exp $ */ /* * Copyright (c) 2001, 2012 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uhidev.c,v 1.61.2.3 2017/04/05 19:54:20 snj Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uhidev.c,v 1.61.2.4 2017/10/13 08:11:20 snj Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -152,12 +152,9 @@ uhidev_attach(device_t parent, device_t aprint_error_dev(self, "couldn't establish power handler\n"); (void)usbd_set_idle(iface, 0, 0); -#if 0 - if ((usbd_get_quirks(sc->sc_udev)->uq_flags & UQ_NO_SET_PROTO) == 0 && - id->bInterfaceSubClass != UISUBCLASS_BOOT) + if ((usbd_get_quirks(sc->sc_udev)->uq_flags & UQ_NO_SET_PROTO) == 0) (void)usbd_set_protocol(iface, 1); -#endif maxinpktsize = 0; sc->sc_iep_addr = sc->sc_oep_addr = -1; Index: src/sys/dev/usb/ukbd.c diff -u src/sys/dev/usb/ukbd.c:1.129.4.2 src/sys/dev/usb/ukbd.c:1.129.4.3 --- src/sys/dev/usb/ukbd.c:1.129.4.2 Wed Apr 5 19:54:20 2017 +++ src/sys/dev/usb/ukbd.c Fri Oct 13 08:11:20 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: ukbd.c,v 1.129.4.2 2017/04/05 19:54:20 snj Exp $*/ +/* $NetBSD: ukbd.c,v 1.129.4.3 2017/10/13 08:11:20 snj Exp $*/ /* * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ukbd.c,v 1.129.4.2 2017/04/05 19:54:20 snj Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ukbd.c,v 1.129.4.3 2017/10/13 08:11:20 snj Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -83,12 +83,11 @@ int ukbddebug = 0; #define DPRINTFN(n,x) #endif -#define MAXKEYCODE 6 -#define MAXMOD 8 /* max 32 */ +#define MAXKEYCODE 32 +#define MAXKEYS 256 struct ukbd_data { - uint32_t modifiers; - uint8_t keycode[MAXKEYCODE]; + uint8_t keys[MAXKEYS/NBBY]; }; #define PRESS0x000 @@ -234,19 +233,14 @@ Static const uint8_t ukbd_trtab[256] = { #define KEY_ERROR 0x01 -#define MAXKEYS (MAXMOD+2*MAXKEYCODE) - struct ukbd_softc { struct uhidev sc_hdev; struct ukbd_data sc_ndata; struct ukbd_data sc_odata; - struct hid_location sc_modloc[MAXMOD]; - u_int sc_nmod; - struct { - uint32_t mask; - uint8_t key; - } sc_mods[MAXMOD]; + struct hid_location sc_keyloc[MAXKEYS]; + uint8_t sc_keyuse[MAXKEYS]; + u_int sc_nkeyloc; struct hid_location sc_keycodeloc; u_int sc_nkeycode; @@ -307,15 +301,17 @@ void ukbdtracedump(void); void ukbdtracedump(void) { - int i; + size_t i, j; for (i = 0; i < UKBDTRACESIZE; i++) { struct ukbdtraceinfo *p = [(i+ukbdtraceindex)%UKBDTRACESIZE]; - printf("%"PRIu64".%06"PRIu64": mod=0x%02x key0=0x%02x key1=0x%02x " - "key2=0x%02x key3=0x%02x\n", - p->tv.tv_sec, (uint64_t)p->tv.tv_usec, - p->ud.modifiers, p->ud.keycode[0], p->ud.keycode[1], - p->ud.keycode[2], p->ud.keycode[3]); + printf("%"PRIu64".%06"PRIu64":", p->tv.tv_sec, + (uint64_t)p->tv.tv_usec); + for (j = 0; j < MAXKEYS; j++) { + if (isset(p->ud.keys, j)) +printf(" %zu", j); + } + printf(".\n"); } } #endif @@ -438,7 +434,7 @@ ukbd_attach(device_t parent, device_t se #endif #ifdef DIAGNOSTIC - aprint_normal(": %d modifier keys, %d key codes", sc->sc_nmod, + aprint_normal(": %d Variable keys, %d Array codes", sc->sc_nkeyloc, sc->sc_nkeycode); if (sc->sc_flags & FLAG_APPLE_FN) aprint_normal(", apple fn key");
CVS commit: [netbsd-7] src/sys/dev/usb
Module Name:src Committed By: snj Date: Sun Oct 1 17:12:41 UTC 2017 Modified Files: src/sys/dev/usb [netbsd-7]: usb.c Log Message: Pull up following revision(s) (requested by skrll in ticket #1502): sys/dev/usb/usb.c: revision 1.166 Add a missing break that should have been included in revision 1.163. Spotted by "sc dying" and reported on current-users To generate a diff of this commit: cvs rdiff -u -r1.154.2.2 -r1.154.2.3 src/sys/dev/usb/usb.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.c diff -u src/sys/dev/usb/usb.c:1.154.2.2 src/sys/dev/usb/usb.c:1.154.2.3 --- src/sys/dev/usb/usb.c:1.154.2.2 Wed Apr 5 19:54:20 2017 +++ src/sys/dev/usb/usb.c Sun Oct 1 17:12:41 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: usb.c,v 1.154.2.2 2017/04/05 19:54:20 snj Exp $ */ +/* $NetBSD: usb.c,v 1.154.2.3 2017/10/01 17:12:41 snj Exp $ */ /* * Copyright (c) 1998, 2002, 2008, 2012 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.154.2.2 2017/04/05 19:54:20 snj Exp $"); +__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.154.2.3 2017/10/01 17:12:41 snj Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -775,6 +775,7 @@ usbioctl(dev_t devt, u_long cmd, void *d len = UGETW(ur->ucr_request.wLength); kmem_free(ptr, len); } + break; } case USB_DEVICEINFO:
CVS commit: [netbsd-7] src/sys/dev/usb
Module Name:src Committed By: snj Date: Wed Aug 9 06:34:53 UTC 2017 Modified Files: src/sys/dev/usb [netbsd-7]: if_ural.c Log Message: Pull up following revision(s) (requested by skrll in ticket #1462): sys/dev/usb/if_ural.c: revision 1.52 Free the RX list if ural_alloc_rx_list fails part way through. Reported by Ilja Van Sprundel. To generate a diff of this commit: cvs rdiff -u -r1.44.12.1 -r1.44.12.2 src/sys/dev/usb/if_ural.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_ural.c diff -u src/sys/dev/usb/if_ural.c:1.44.12.1 src/sys/dev/usb/if_ural.c:1.44.12.2 --- src/sys/dev/usb/if_ural.c:1.44.12.1 Wed Apr 5 19:54:19 2017 +++ src/sys/dev/usb/if_ural.c Wed Aug 9 06:34:53 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: if_ural.c,v 1.44.12.1 2017/04/05 19:54:19 snj Exp $ */ +/* $NetBSD: if_ural.c,v 1.44.12.2 2017/08/09 06:34:53 snj Exp $ */ /* $FreeBSD: /repoman/r/ncvs/src/sys/dev/usb/if_ural.c,v 1.40 2006/06/02 23:14:40 sam Exp $ */ /*- @@ -24,7 +24,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_ural.c,v 1.44.12.1 2017/04/05 19:54:19 snj Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ural.c,v 1.44.12.2 2017/08/09 06:34:53 snj Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -652,7 +652,7 @@ ural_alloc_rx_list(struct ural_softc *sc return 0; -fail: ural_free_tx_list(sc); +fail: ural_free_rx_list(sc); return error; }
CVS commit: [netbsd-7] src/sys/dev/usb
Module Name:src Committed By: snj Date: Sun Jul 23 06:11:47 UTC 2017 Modified Files: src/sys/dev/usb [netbsd-7]: uhci.c Log Message: Pull up following revision(s) (requested by skrll in ticket #1456): sys/dev/usb/uhci.c: revision 1.276 Only call uhci_free_stds if there are TDs to free. In uhci_alloc_std_chain ensure we fill the TD array correctly and note the number of allocated TDs so that uhci_free_stds will do the right thing Fixes a problem seen by anon To generate a diff of this commit: cvs rdiff -u -r1.264.2.1 -r1.264.2.2 src/sys/dev/usb/uhci.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/uhci.c diff -u src/sys/dev/usb/uhci.c:1.264.2.1 src/sys/dev/usb/uhci.c:1.264.2.2 --- src/sys/dev/usb/uhci.c:1.264.2.1 Wed Apr 5 19:54:20 2017 +++ src/sys/dev/usb/uhci.c Sun Jul 23 06:11:47 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: uhci.c,v 1.264.2.1 2017/04/05 19:54:20 snj Exp $ */ +/* $NetBSD: uhci.c,v 1.264.2.2 2017/07/23 06:11:47 snj Exp $ */ /* * Copyright (c) 1998, 2004, 2011, 2012 The NetBSD Foundation, Inc. @@ -42,7 +42,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.264.2.1 2017/04/05 19:54:20 snj Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.264.2.2 2017/07/23 06:11:47 snj Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -1995,7 +1995,6 @@ uhci_alloc_std_chain(uhci_softc_t *sc, s uxfer->ux_stds = NULL; uxfer->ux_nstd = ntd; - p = NULL; if (ntd == 0) { *sp = NULL; DPRINTF("ntd=0", 0, 0, 0, 0); @@ -2004,11 +2003,13 @@ uhci_alloc_std_chain(uhci_softc_t *sc, s uxfer->ux_stds = kmem_alloc(sizeof(uhci_soft_td_t *) * ntd, KM_SLEEP); - ntd--; - for (int i = ntd; i >= 0; i--) { + for (int i = 0; i < ntd; i++) { p = uhci_alloc_std(sc); if (p == NULL) { - uhci_free_stds(sc, uxfer); + if (i != 0) { +uxfer->ux_nstd = i; +uhci_free_stds(sc, uxfer); + } kmem_free(uxfer->ux_stds, sizeof(uhci_soft_td_t *) * ntd); return ENOMEM; @@ -2212,9 +2213,10 @@ uhci_device_bulk_fini(struct usbd_xfer * KASSERT(ux->ux_type == UX_BULK); - uhci_free_stds(sc, ux); - if (ux->ux_nstd) + if (ux->ux_nstd) { + uhci_free_stds(sc, ux); kmem_free(ux->ux_stds, sizeof(uhci_soft_td_t *) * ux->ux_nstd); + } } usbd_status @@ -2482,9 +2484,10 @@ uhci_device_ctrl_fini(struct usbd_xfer * KASSERT(ux->ux_type == UX_CTRL); - uhci_free_stds(sc, ux); - if (ux->ux_nstd) + if (ux->ux_nstd) { + uhci_free_stds(sc, ux); kmem_free(ux->ux_stds, sizeof(uhci_soft_td_t *) * ux->ux_nstd); + } } usbd_status @@ -2687,9 +2690,10 @@ uhci_device_intr_fini(struct usbd_xfer * KASSERT(ux->ux_type == UX_INTR); - uhci_free_stds(sc, ux); - if (ux->ux_nstd) + if (ux->ux_nstd) { + uhci_free_stds(sc, ux); kmem_free(ux->ux_stds, sizeof(uhci_soft_td_t *) * ux->ux_nstd); + } } usbd_status
CVS commit: [netbsd-7] src/sys/dev/usb
Module Name:src Committed By: snj Date: Sat Jun 3 17:03:02 UTC 2017 Modified Files: src/sys/dev/usb [netbsd-7]: files.usb Log Message: Pull up following revision(s) (requested by pgoyette in ticket #1421): sys/dev/usb/files.usb: revision 1.144 Fix the USBVERBOSE stuff so it does not get included in the build if there are no USB devices or controllers. Without this change, a kernel with no USB devices but with USBVERBOSE defined in the configuration file will include the usb_verbose.c file, but will fail to link due to undefined symbols. To generate a diff of this commit: cvs rdiff -u -r1.132.2.2 -r1.132.2.3 src/sys/dev/usb/files.usb 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/files.usb diff -u src/sys/dev/usb/files.usb:1.132.2.2 src/sys/dev/usb/files.usb:1.132.2.3 --- src/sys/dev/usb/files.usb:1.132.2.2 Wed Apr 5 19:54:19 2017 +++ src/sys/dev/usb/files.usb Sat Jun 3 17:03:02 2017 @@ -1,4 +1,4 @@ -# $NetBSD: files.usb,v 1.132.2.2 2017/04/05 19:54:19 snj Exp $ +# $NetBSD: files.usb,v 1.132.2.3 2017/06/03 17:03:02 snj Exp $ # # Config file and device description for machine-independent USB code. # Included by ports that need it. Ports that use it must provide @@ -103,8 +103,7 @@ file dev/usb/usb_quirks.c usb define usb_dma: usb file dev/usb/usb_mem.c usb_dma needs-flag -define usbverbose: usb -file dev/usb/usb_verbose.c usbverbose +file dev/usb/usb_verbose.c usbverbose & usb # Hub driver device uhub: usbdevif, usbifif
CVS commit: [netbsd-7] src/sys/dev/usb
Module Name:src Committed By: snj Date: Wed Dec 14 19:18:58 UTC 2016 Modified Files: src/sys/dev/usb [netbsd-7]: uchcom.c Log Message: Pull up following revision(s) (requested by bouyer in ticket #1321): sys/dev/usb/uchcom.c: revision 1.17 Followling an advice in a linux forum, don't update LCR1/LCR2. With this change this CH340 usb/serial based device: https://www.olimex.com/Products/Breadboarding/BB-CH340T/open-source-hardware (the chip is written H340T) works as expected. As I'm not sure if this is needed for older device, make this change for sc_version 0x30 or newer only. While there, match USB_PRODUCT_WINCHIPHEAD2_CH341_2 too. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.13.4.1 src/sys/dev/usb/uchcom.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/uchcom.c diff -u src/sys/dev/usb/uchcom.c:1.13 src/sys/dev/usb/uchcom.c:1.13.4.1 --- src/sys/dev/usb/uchcom.c:1.13 Sat Mar 15 19:20:27 2014 +++ src/sys/dev/usb/uchcom.c Wed Dec 14 19:18:58 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: uchcom.c,v 1.13 2014/03/15 19:20:27 martin Exp $ */ +/* $NetBSD: uchcom.c,v 1.13.4.1 2016/12/14 19:18:58 snj Exp $ */ /* * Copyright (c) 2007 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uchcom.c,v 1.13 2014/03/15 19:20:27 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uchcom.c,v 1.13.4.1 2016/12/14 19:18:58 snj Exp $"); /* * driver for WinChipHead CH341/340, the worst USB-serial chip in the world. @@ -91,6 +91,7 @@ int uchcomdebug = 0; #define UCHCOM_REG_LCR2 0x25 #define UCHCOM_VER_20 0x20 +#define UCHCOM_VER_30 0x30 #define UCHCOM_BASE_UNKNOWN 0 #define UCHCOM_BPS_MOD_BASE 2000 @@ -176,6 +177,7 @@ static const struct uchcom_divider_recor static const struct usb_devno uchcom_devs[] = { { USB_VENDOR_WINCHIPHEAD, USB_PRODUCT_WINCHIPHEAD_CH341SER }, { USB_VENDOR_WINCHIPHEAD2, USB_PRODUCT_WINCHIPHEAD2_CH341 }, + { USB_VENDOR_WINCHIPHEAD2, USB_PRODUCT_WINCHIPHEAD2_CH341_2 }, }; #define uchcom_lookup(v, p) usb_lookup(uchcom_devs, v, p) @@ -570,6 +572,7 @@ update_version(struct uchcom_softc *sc) usbd_errstr(err)); return EIO; } + DPRINTF(("%s: update_version %d\n", device_xname(sc->sc_dev), sc->sc_version)); return 0; } @@ -715,50 +718,52 @@ set_dte_rate(struct uchcom_softc *sc, ui static int set_line_control(struct uchcom_softc *sc, tcflag_t cflag) { - usbd_status err; - uint8_t lcr1val = 0, lcr2val = 0; + if (sc->sc_version < UCHCOM_VER_30) { + usbd_status err; + uint8_t lcr1val = 0, lcr2val = 0; - err = read_reg(sc, UCHCOM_REG_LCR1, , UCHCOM_REG_LCR2, ); - if (err) { - aprint_error_dev(sc->sc_dev, "cannot get LCR: %s\n", - usbd_errstr(err)); - return EIO; - } + err = read_reg(sc, UCHCOM_REG_LCR1, , UCHCOM_REG_LCR2, ); + if (err) { + aprint_error_dev(sc->sc_dev, "cannot get LCR: %s\n", + usbd_errstr(err)); + return EIO; + } - lcr1val &= ~UCHCOM_LCR1_MASK; - lcr2val &= ~UCHCOM_LCR2_MASK; + lcr1val &= ~UCHCOM_LCR1_MASK; + lcr2val &= ~UCHCOM_LCR2_MASK; - /* - * XXX: it is difficult to handle the line control appropriately: - * - CS8, !CSTOPB and any parity mode seems ok, but - * - the chip doesn't have the function to calculate parity - * in !CS8 mode. - * - it is unclear that the chip supports CS5,6 mode. - * - it is unclear how to handle stop bits. - */ - - switch (ISSET(cflag, CSIZE)) { - case CS5: - case CS6: - case CS7: - return EINVAL; - case CS8: - break; - } + /* + * XXX: it is difficult to handle the line control appropriately: + * - CS8, !CSTOPB and any parity mode seems ok, but + * - the chip doesn't have the function to calculate parity + * in !CS8 mode. + * - it is unclear that the chip supports CS5,6 mode. + * - it is unclear how to handle stop bits. + */ + + switch (ISSET(cflag, CSIZE)) { + case CS5: + case CS6: + case CS7: + return EINVAL; + case CS8: + break; + } - if (ISSET(cflag, PARENB)) { - lcr1val |= UCHCOM_LCR1_PARENB; - if (ISSET(cflag, PARODD)) - lcr2val |= UCHCOM_LCR2_PARODD; - else - lcr2val |= UCHCOM_LCR2_PAREVEN; - } + if (ISSET(cflag, PARENB)) { + lcr1val |= UCHCOM_LCR1_PARENB; + if (ISSET(cflag, PARODD)) +lcr2val |= UCHCOM_LCR2_PARODD; + else +lcr2val |= UCHCOM_LCR2_PAREVEN; + } - err = write_reg(sc, UCHCOM_REG_LCR1, lcr1val, UCHCOM_REG_LCR2, lcr2val); - if (err) { - aprint_error_dev(sc->sc_dev, "cannot set LCR: %s\n", - usbd_errstr(err)); - return EIO; + err = write_reg(sc, UCHCOM_REG_LCR1, lcr1val, UCHCOM_REG_LCR2, lcr2val); + if (err) { + aprint_error_dev(sc->sc_dev, "cannot set LCR: %s\n", + usbd_errstr(err)); + return EIO; + } } return 0;
CVS commit: [netbsd-7] src/sys/dev/usb
Module Name:src Committed By: snj Date: Wed Dec 14 19:16:56 UTC 2016 Modified Files: src/sys/dev/usb [netbsd-7]: usbdevs.h usbdevs_data.h Log Message: regen for ticket 1320 To generate a diff of this commit: cvs rdiff -u -r1.672.2.6 -r1.672.2.7 src/sys/dev/usb/usbdevs.h cvs rdiff -u -r1.673.2.6 -r1.673.2.7 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.6 src/sys/dev/usb/usbdevs.h:1.672.2.7 --- src/sys/dev/usb/usbdevs.h:1.672.2.6 Thu Dec 8 07:50:15 2016 +++ src/sys/dev/usb/usbdevs.h Wed Dec 14 19:16:55 2016 @@ -1,10 +1,10 @@ -/* $NetBSD: usbdevs.h,v 1.672.2.6 2016/12/08 07:50:15 snj Exp $ */ +/* $NetBSD: usbdevs.h,v 1.672.2.7 2016/12/14 19:16:55 snj Exp $ */ /* * THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. * * generated from: - * NetBSD: usbdevs,v 1.680.2.6 2016/12/08 07:49:42 snj Exp + * NetBSD: usbdevs,v 1.680.2.7 2016/12/14 19:16:14 snj Exp */ /* @@ -3384,7 +3384,8 @@ /* WinChipHead products */ #define USB_PRODUCT_WINCHIPHEAD_CH341SER 0x5523 /* CH341/CH340 USB-Serial Bridge */ -#define USB_PRODUCT_WINCHIPHEAD2_CH341 0x7523 /* CH341 serial/parallel */ +#define USB_PRODUCT_WINCHIPHEAD2_CH341 0x7523 /* CH341 USB-Serial Bridge */ +#define USB_PRODUCT_WINCHIPHEAD2_CH341_2 0x5523 /* CH341 USB-Serial Bridge */ /* Wistron NeWeb products */ #define USB_PRODUCT_WISTRONNEWEB_WNC0600 0x0326 /* WNC-0600USB */ Index: src/sys/dev/usb/usbdevs_data.h diff -u src/sys/dev/usb/usbdevs_data.h:1.673.2.6 src/sys/dev/usb/usbdevs_data.h:1.673.2.7 --- src/sys/dev/usb/usbdevs_data.h:1.673.2.6 Thu Dec 8 07:50:15 2016 +++ src/sys/dev/usb/usbdevs_data.h Wed Dec 14 19:16:55 2016 @@ -1,10 +1,10 @@ -/* $NetBSD: usbdevs_data.h,v 1.673.2.6 2016/12/08 07:50:15 snj Exp $ */ +/* $NetBSD: usbdevs_data.h,v 1.673.2.7 2016/12/14 19:16:55 snj Exp $ */ /* * THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. * * generated from: - * NetBSD: usbdevs,v 1.680.2.6 2016/12/08 07:49:42 snj Exp + * NetBSD: usbdevs,v 1.680.2.7 2016/12/14 19:16:14 snj Exp */ /* @@ -10184,7 +10184,11 @@ const struct usb_product usb_products[] }, { USB_VENDOR_WINCHIPHEAD2, USB_PRODUCT_WINCHIPHEAD2_CH341, - "CH341 serial/parallel", + "CH341 USB-Serial Bridge", + }, + { + USB_VENDOR_WINCHIPHEAD2, USB_PRODUCT_WINCHIPHEAD2_CH341_2, + "CH341 USB-Serial Bridge", }, { USB_VENDOR_WISTRONNEWEB, USB_PRODUCT_WISTRONNEWEB_WNC0600, @@ -10535,4 +10539,4 @@ const struct usb_product usb_products[] "Prestige", }, }; -const int usb_nproducts = 2084; +const int usb_nproducts = 2085;
CVS commit: [netbsd-7] src/sys/dev/usb
Module Name:src Committed By: snj Date: Wed Dec 14 19:16:14 UTC 2016 Modified Files: src/sys/dev/usb [netbsd-7]: usbdevs Log Message: Pull up following revision(s) (requested by bouyer in ticket #1320): sys/dev/usb/usbdevs: revision 1.728 Rename "CH341 serial/parallel" to "CH341 USB-Serial Bridge", and add a second device id for this chip. >From FreeBSD. To generate a diff of this commit: cvs rdiff -u -r1.680.2.6 -r1.680.2.7 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.6 src/sys/dev/usb/usbdevs:1.680.2.7 --- src/sys/dev/usb/usbdevs:1.680.2.6 Thu Dec 8 07:49:42 2016 +++ src/sys/dev/usb/usbdevs Wed Dec 14 19:16:14 2016 @@ -1,4 +1,4 @@ -$NetBSD: usbdevs,v 1.680.2.6 2016/12/08 07:49:42 snj Exp $ +$NetBSD: usbdevs,v 1.680.2.7 2016/12/14 19:16:14 snj Exp $ /* * Copyright (c) 1998-2004 The NetBSD Foundation, Inc. @@ -3377,7 +3377,8 @@ product WESTERN EXTHDD 0x0400 External /* WinChipHead products */ product WINCHIPHEAD CH341SER 0x5523 CH341/CH340 USB-Serial Bridge -product WINCHIPHEAD2 CH341 0x7523 CH341 serial/parallel +product WINCHIPHEAD2 CH341 0x7523 CH341 USB-Serial Bridge +product WINCHIPHEAD2 CH341_2 0x5523 CH341 USB-Serial Bridge /* Wistron NeWeb products */ product WISTRONNEWEB WNC0600 0x0326 WNC-0600USB
CVS commit: [netbsd-7] src/sys/dev/usb
Module Name:src Committed By: snj Date: Thu Dec 8 07:50:17 UTC 2016 Modified Files: src/sys/dev/usb [netbsd-7]: usbdevs.h usbdevs_data.h Log Message: regen for ticket 1289 To generate a diff of this commit: cvs rdiff -u -r1.672.2.5 -r1.672.2.6 src/sys/dev/usb/usbdevs.h cvs rdiff -u -r1.673.2.5 -r1.673.2.6 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.5 src/sys/dev/usb/usbdevs.h:1.672.2.6 --- src/sys/dev/usb/usbdevs.h:1.672.2.5 Sun Sep 18 06:01:05 2016 +++ src/sys/dev/usb/usbdevs.h Thu Dec 8 07:50:15 2016 @@ -1,10 +1,10 @@ -/* $NetBSD: usbdevs.h,v 1.672.2.5 2016/09/18 06:01:05 snj Exp $ */ +/* $NetBSD: usbdevs.h,v 1.672.2.6 2016/12/08 07:50:15 snj Exp $ */ /* * THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. * * generated from: - * NetBSD: usbdevs,v 1.680.2.5 2016/09/18 06:00:20 snj Exp + * NetBSD: usbdevs,v 1.680.2.6 2016/12/08 07:49:42 snj 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 */ @@ -647,6 +656,7 @@ #define USB_PRODUCT_ABOCOM_UFE2000 0x420a /* UFE2000 USB2.0 Fast Ethernet Adapter */ #define USB_PRODUCT_ABOCOM_WL54 0x6001 /* WL54 */ #define USB_PRODUCT_ABOCOM_RTL8192CU 0x8178 /* RTL8192CU */ +#define USB_PRODUCT_ABOCOM_RTL8188EU 0x8179 /* RTL8188EU */ #define USB_PRODUCT_ABOCOM_RTL8188CU_1 0x8188 /* RTL8188CU */ #define USB_PRODUCT_ABOCOM_RTL8188CU_2 0x8189 /* RTL8188CU */ #define USB_PRODUCT_ABOCOM_XX10 0xabc1 /* XX10 */ @@ -863,7 +873,14 @@ #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 */ @@ -912,8 +929,11 @@ #define USB_PRODUCT_ASUSTEK_USBN10 0x1786 /* USB-N10 */ #define
CVS commit: [netbsd-7] src/sys/dev/usb
Module Name:src Committed By: snj Date: Thu Dec 8 07:49:42 UTC 2016 Modified Files: src/sys/dev/usb [netbsd-7]: usbdevs Log Message: Pull up following revision(s) (requested by msaitoh in ticket #1289): sys/dev/usb/usbdevs: revisions 1.683-1.684, 1.686-1.689, 1.691-1.695, 1.697-1.700, 1.702-1.711, 1.713-1.715, 1.717-1.727 - Add Realtek RTL8152, RTL8153, RTL8192EU. - Add Atheros AR3012. - Add Validity Sensors, Inc. and their devices. PR#45732 from Greg A. Woods. - Add some SMSC devices (PR#49484) - Add Silicon Labs EC3 USB debug adapter. - Add Xbox 360 Wireless Receiver. - Add Arduino, TP-Link, Compare, DataApex, Evoluton Robotics devices. - Add another RTL8192CU device of Asustek. - Add Belkin Components RTL8192CPU, RTL8188CU and F7D2102. - Add another RTL8188CUS. device of Chicony Electronics. - Add another RTL8192CU and DWA-131 rev. B of D-Link. - Add Guillemot RTL8192CU. - Add Hawking RTL8192CU. - Add IO-DATA WN-G150UM and RTL8192CU. - Add another RTL8188RU of Realtek. - Add Huawei U8150, E353_HiLink. - Add vendor ID of Ingenic Semiconductor Ltd. - Add Conexant USB Modem. - Add TI TUSB3410, MSP-FET430UIF and MSP-FET430UIF JTAG. Part of PR#49814. - Add Lenovo ThinkPad Compact USB keyboard with TrackPoint. - Add Panasonic Lumix Camera DMC-FS45 from kern/49809. - Add Asustek USB-N53 and USB-N66. - Add D-Link DWA-1xx devices. - Add Ralink RT3573 and RT5572. - Add Sitecom Europe ET3072 and LN-031. - Add Elecom WDC-433SU2M2. - Add Apple iPhone[45], iPad[23] and iPad Mini. - Add Century CT-USB1HUB. - Add MosChip MCS7832 Ethernet Adapter. - Add another RTL8188CU of Realtek. - Add DisplayLink MIMO, Polaris2 USB dock, Plugable docking station, FY-DVI and FY-DVI2. - Add a NetChip USB-IDE bridge. - Add MS Confort Mouse 6000 from Martijn van Buul (PR#50701). - Add NTT DOCOMO L-05A. - Add Buffalo WI-U2-300D. - Add Sandisk Cruzer (PR#46547). - Add D-Link DWA 125 rev. D1 USB wireless network adapter from Jake Slazenger (part of PR#51529). - Add C-Meida USB Pnp Sound. - Add AboCom RTL8188EU. - Add Intel Advanced-N 6235 Combo Bluetooth. - Add Validity Sensors VFS491. - Add Linksys HG20F9 Ethernet. To generate a diff of this commit: cvs rdiff -u -r1.680.2.5 -r1.680.2.6 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.5 src/sys/dev/usb/usbdevs:1.680.2.6 --- src/sys/dev/usb/usbdevs:1.680.2.5 Sun Sep 18 06:00:20 2016 +++ src/sys/dev/usb/usbdevs Thu Dec 8 07:49:42 2016 @@ -1,4 +1,4 @@ -$NetBSD: usbdevs,v 1.680.2.5 2016/09/18 06:00:20 snj Exp $ +$NetBSD: usbdevs,v 1.680.2.6 2016/12/08 07:49:42 snj Exp $ /* * Copyright (c) 1998-2004 The NetBSD Foundation, Inc. @@ -317,6 +317,7 @@ vendor APTIO 0x07d2 Aptio Products vendor ARASAN 0x07da Arasan Chip Systems vendor ALLIEDCABLE 0x07e6 Allied Cable vendor STSN 0x07ef STSN +vendor CENTURY 0x07f7 CENTURY Corporation vendor BEWAN 0x07fa Bewan vendor ZOOM 0x0803 Zoom Telephonics vendor BROADLOGIC 0x0827 BroadLogic @@ -486,6 +487,7 @@ vendor AINCOMM 0x12fd Aincomm vendor MOBILITY 0x1342 Mobility vendor DICKSMITH 0x1371 Dick Smith Electronics vendor NETGEAR3 0x1385 Netgear +vendor VALIDITY 0x138a Validity Sensors, Inc. vendor BALTECH 0x13ad Baltech vendor CISCOLINKSYS 0x13b1 Cisco-Linksys vendor SHARK 0x13d2 Shark @@ -550,9 +552,12 @@ vendor HAUPPAUGE2 0x2040 Hauppauge Compu vendor PARA 0x20b8 PARA Industrial vendor TRENDNET 0x20f4 TRENDnet vendor DLINK3 0x2101 D-Link +vendor VIALABS 0x2109 VIA Labs vendor ERICSSON 0x2282 Ericsson vendor MOTOROLA2 0x22b8 Motorola vendor PINNACLE 0x2304 Pinnacle Systems +vendor ARDUINO 0x2341 Arduino SA +vendor TPLINK 0x2357 TP-Link vendor TRIPPLITE 0x2478 Tripp-Lite vendor HIROSE 0x2631 Hirose Electric vendor NHJ 0x2770 NHJ @@ -573,6 +578,7 @@ vendor AVERATEC 0x50c2 Averatec vendor SWEEX 0x5173 Sweex vendor ONSPEC2 0x55aa OnSpec Electronic Inc. vendor ZINWELL 0x5a57 Zinwell +vendor INGENIC 0x601a Ingenic Semiconductor Ltd. vendor SITECOM 0x6189 Sitecom vendor SPRINGERDESIGN 0x6400 Springer Design, Inc. vendor ARKMICROCHIPS 0x6547 ArkMicroChips @@ -585,6 +591,9 @@ vendor MOSCHIP 0x9710 MosChip Semicondu vendor NETGEAR4 0x9846 Netgear vendor xxFTDI 0x9e88 FTDI vendor CACE 0xcace CACE Technologies +vendor COMPARE 0xcdab Compare +vendor DATAAPEX 0xdaae DataApex +vendor EVOLUTION 0xdeee Evolution Robotics vendor EMPIA 0xeb1a eMPIA Technology vendor HP2 0xf003 Hewlett Packard vendor USRP 0xfffe GNU Radio USRP @@ -640,6 +649,7 @@ product ABOCOM XX9 0x4104 XX9 product ABOCOM UFE2000 0x420a UFE2000 USB2.0 Fast Ethernet Adapter product ABOCOM WL54 0x6001 WL54 product ABOCOM RTL8192CU 0x8178 RTL8192CU +product ABOCOM RTL8188EU 0x8179 RTL8188EU product ABOCOM RTL8188CU_1 0x8188 RTL8188CU product ABOCOM RTL8188CU_2 0x8189 RTL8188CU product ABOCOM XX10 0xabc1 XX10
CVS commit: [netbsd-7] src/sys/dev/usb
Module Name:src Committed By: snj Date: Sun Sep 18 06:01:07 UTC 2016 Modified Files: src/sys/dev/usb [netbsd-7]: usbdevs.h usbdevs_data.h Log Message: regen for ticket 1245 To generate a diff of this commit: cvs rdiff -u -r1.672.2.4 -r1.672.2.5 src/sys/dev/usb/usbdevs.h cvs rdiff -u -r1.673.2.4 -r1.673.2.5 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.5 --- src/sys/dev/usb/usbdevs.h:1.672.2.4 Sun Oct 18 09:03:22 2015 +++ src/sys/dev/usb/usbdevs.h Sun Sep 18 06:01:05 2016 @@ -1,10 +1,10 @@ -/* $NetBSD: usbdevs.h,v 1.672.2.4 2015/10/18 09:03:22 martin Exp $ */ +/* $NetBSD: usbdevs.h,v 1.672.2.5 2016/09/18 06:01:05 snj 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.5 2016/09/18 06:00:20 snj Exp */ /* @@ -1364,6 +1364,7 @@ #define USB_PRODUCT_DLINK2_AR9271 0x3a10 /* AR9271 */ #define USB_PRODUCT_DLINK2_DWLG122C1 0x3c03 /* DWL-G122 rev C1 */ #define USB_PRODUCT_DLINK2_WUA1340 0x3c04 /* WUA-1340 */ +#define USB_PRODUCT_DLINK2_DUBE100B1 0x3c05 /* DUB-E100 rev B1 */ #define USB_PRODUCT_DLINK2_DWA111 0x3c06 /* DWA-111 */ #define USB_PRODUCT_DLINK2_DWA110 0x3c07 /* DWA-110 */ #define USB_PRODUCT_DLINK2_RT2870_1 0x3c09 /* RT2870 */ Index: src/sys/dev/usb/usbdevs_data.h diff -u src/sys/dev/usb/usbdevs_data.h:1.673.2.4 src/sys/dev/usb/usbdevs_data.h:1.673.2.5 --- src/sys/dev/usb/usbdevs_data.h:1.673.2.4 Sun Oct 18 09:03:22 2015 +++ src/sys/dev/usb/usbdevs_data.h Sun Sep 18 06:01:05 2016 @@ -1,10 +1,10 @@ -/* $NetBSD: usbdevs_data.h,v 1.673.2.4 2015/10/18 09:03:22 martin Exp $ */ +/* $NetBSD: usbdevs_data.h,v 1.673.2.5 2016/09/18 06:01:05 snj 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.5 2016/09/18 06:00:20 snj Exp */ /* @@ -4419,6 +4419,10 @@ const struct usb_product usb_products[] "WUA-1340", }, { + USB_VENDOR_DLINK2, USB_PRODUCT_DLINK2_DUBE100B1, + "DUB-E100 rev B1", + }, + { USB_VENDOR_DLINK2, USB_PRODUCT_DLINK2_DWA111, "DWA-111", }, @@ -10203,4 +10207,4 @@ const struct usb_product usb_products[] "Prestige", }, }; -const int usb_nproducts = 2010; +const int usb_nproducts = 2011;
CVS commit: [netbsd-7] src/sys/dev/usb
Module Name:src Committed By: snj Date: Sun Sep 18 06:00:20 UTC 2016 Modified Files: src/sys/dev/usb [netbsd-7]: if_axe.c usbdevs Log Message: Pull up following revision(s) (requested by skrll in ticket #1245): sys/dev/usb/if_axe.c: revision 1.73, 1.74 sys/dev/usb/usbdevs: revision 1.716 Add flxd's axe(4) -- flxd's axe(4) - I think. -- Fix harmless typo To generate a diff of this commit: cvs rdiff -u -r1.67 -r1.67.2.1 src/sys/dev/usb/if_axe.c cvs rdiff -u -r1.680.2.4 -r1.680.2.5 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/if_axe.c diff -u src/sys/dev/usb/if_axe.c:1.67 src/sys/dev/usb/if_axe.c:1.67.2.1 --- src/sys/dev/usb/if_axe.c:1.67 Sun Aug 10 16:44:36 2014 +++ src/sys/dev/usb/if_axe.c Sun Sep 18 06:00:20 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: if_axe.c,v 1.67 2014/08/10 16:44:36 tls Exp $ */ +/* $NetBSD: if_axe.c,v 1.67.2.1 2016/09/18 06:00:20 snj Exp $ */ /* $OpenBSD: if_axe.c,v 1.96 2010/01/09 05:33:08 jsg Exp $ */ /* @@ -89,7 +89,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_axe.c,v 1.67 2014/08/10 16:44:36 tls Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_axe.c,v 1.67.2.1 2016/09/18 06:00:20 snj Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -155,6 +155,7 @@ static const struct axe_type axe_devs[] { { USB_VENDOR_COREGA, USB_PRODUCT_COREGA_FETHER_USB2_TX }, 0}, { { USB_VENDOR_DLINK, USB_PRODUCT_DLINK_DUBE100}, 0 }, { { USB_VENDOR_DLINK, USB_PRODUCT_DLINK_DUBE100B1 }, AX772 }, + { { USB_VENDOR_DLINK2, USB_PRODUCT_DLINK2_DUBE100B1 }, AX772 }, { { USB_VENDOR_DLINK, USB_PRODUCT_DLINK_DUBE100C1 }, AX772 | AX772B }, { { USB_VENDOR_GOODWAY, USB_PRODUCT_GOODWAY_GWUSB2E}, 0 }, { { USB_VENDOR_IODATA, USB_PRODUCT_IODATA_ETGUS2 }, AX178 }, Index: src/sys/dev/usb/usbdevs diff -u src/sys/dev/usb/usbdevs:1.680.2.4 src/sys/dev/usb/usbdevs:1.680.2.5 --- src/sys/dev/usb/usbdevs:1.680.2.4 Sun Oct 18 09:01:58 2015 +++ src/sys/dev/usb/usbdevs Sun Sep 18 06:00:20 2016 @@ -1,4 +1,4 @@ -$NetBSD: usbdevs,v 1.680.2.4 2015/10/18 09:01:58 martin Exp $ +$NetBSD: usbdevs,v 1.680.2.5 2016/09/18 06:00:20 snj Exp $ /* * Copyright (c) 1998-2004 The NetBSD Foundation, Inc. @@ -1357,6 +1357,7 @@ product DLINK2 DWA130D1 0x3a0f DWA-130 product DLINK2 AR9271 0x3a10 AR9271 product DLINK2 DWLG122C1 0x3c03 DWL-G122 rev C1 product DLINK2 WUA1340 0x3c04 WUA-1340 +product DLINK2 DUBE100B1 0x3c05 DUB-E100 rev B1 product DLINK2 DWA111 0x3c06 DWA-111 product DLINK2 DWA110 0x3c07 DWA-110 product DLINK2 RT2870_1 0x3c09 RT2870
CVS commit: [netbsd-7] src/sys/dev/usb
Module Name:src Committed By: skrll Date: Wed Sep 7 08:35:27 UTC 2016 Removed Files: src/sys/dev/usb [netbsd-7]: usbroothub.c usbroothub.h Log Message: Wrong branch (for now) To generate a diff of this commit: cvs rdiff -u -r1.2.4.2 -r0 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] src/sys/dev/usb
Module Name:src Committed By: skrll Date: Wed Sep 7 08:29:49 UTC 2016 Added Files: src/sys/dev/usb [netbsd-7]: usbroothub.c usbroothub.h Log Message: Add missing files To generate a diff of this commit: cvs rdiff -u -r0 -r1.2.4.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/usbroothub.c diff -u /dev/null src/sys/dev/usb/usbroothub.c:1.2.4.2 --- /dev/null Wed Sep 7 08:29:49 2016 +++ src/sys/dev/usb/usbroothub.c Wed Sep 7 08:29:49 2016 @@ -0,0 +1,491 @@ +/* $NetBSD: usbroothub.c,v 1.2.4.2 2016/09/07 08:29:49 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 + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``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 FOUNDATION OR CONTRIBUTORS + * 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. + */ + +/* + * Copyright (c) 2008 + * Matthias Drochner. 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. + * + * 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. + * + */ + +#include +#include +#include +#include +#include + +extern int usbdebug; + +/* helper functions for USB root hub emulation */ + +static usbd_status roothub_ctrl_transfer(struct usbd_xfer *); +static usbd_status roothub_ctrl_start(struct usbd_xfer *); +static void roothub_ctrl_abort(struct usbd_xfer *); +static void roothub_ctrl_close(struct usbd_pipe *); +static void roothub_ctrl_done(struct usbd_xfer *); +static void roothub_noop(struct usbd_pipe *pipe); + +const struct usbd_pipe_methods roothub_ctrl_methods = { + .upm_transfer = roothub_ctrl_transfer, + .upm_start = roothub_ctrl_start, + .upm_abort = roothub_ctrl_abort, + .upm_close = roothub_ctrl_close, + .upm_cleartoggle = roothub_noop, + .upm_done = roothub_ctrl_done, +}; + +int +usb_makestrdesc(usb_string_descriptor_t *p, int l, const char *s) +{ + int i; + + if (l == 0) + return 0; + p->bLength = 2 * strlen(s) + 2; + if (l == 1) + return 1; + p->bDescriptorType = UDESC_STRING; + l -= 2; + /* poor man's utf-16le conversion */ + for (i = 0; s[i] && l > 1; i++, l -= 2) + USETW2(p->bString[i], 0, s[i]); + return 2 * i + 2; +} + +int +usb_makelangtbl(usb_string_descriptor_t *p, int l) +{ + + if (l == 0) + return 0; +
CVS commit: [netbsd-7] src/sys/dev/usb
Module Name:src Committed By: snj Date: Tue Mar 8 09:52:39 UTC 2016 Modified Files: src/sys/dev/usb [netbsd-7]: if_smsc.c Log Message: Pull up following revision(s) (requested by skrll in ticket #1135): sys/dev/usb/if_smsc.c: revision 1.26 PR/50904: Fix variable assignment inside if-clause. To generate a diff of this commit: cvs rdiff -u -r1.19.2.1 -r1.19.2.2 src/sys/dev/usb/if_smsc.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_smsc.c diff -u src/sys/dev/usb/if_smsc.c:1.19.2.1 src/sys/dev/usb/if_smsc.c:1.19.2.2 --- src/sys/dev/usb/if_smsc.c:1.19.2.1 Mon Sep 22 11:11:10 2014 +++ src/sys/dev/usb/if_smsc.c Tue Mar 8 09:52:39 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: if_smsc.c,v 1.19.2.1 2014/09/22 11:11:10 martin Exp $ */ +/* $NetBSD: if_smsc.c,v 1.19.2.2 2016/03/08 09:52:39 snj Exp $ */ /* $OpenBSD: if_smsc.c,v 1.4 2012/09/27 12:38:11 jsg Exp $ */ /* $FreeBSD: src/sys/dev/usb/net/if_smsc.c,v 1.1 2012/08/15 04:03:55 gonzo Exp $ */ @@ -771,7 +771,7 @@ smsc_chip_init(struct smsc_softc *sc) smsc_write_reg(sc, SMSC_PM_CTRL, SMSC_PM_CTRL_PHY_RST); if ((err = smsc_wait_for_bits(sc, SMSC_PM_CTRL, - SMSC_PM_CTRL_PHY_RST) != 0)) { + SMSC_PM_CTRL_PHY_RST)) != 0) { smsc_warn_printf(sc, "timed-out waiting for phy reset to " "complete\n"); goto init_failed;
CVS commit: [netbsd-7] src/sys/dev/usb
Module Name:src Committed By: snj Date: Tue Mar 8 09:49:00 UTC 2016 Modified Files: src/sys/dev/usb [netbsd-7]: uhub.c Log Message: Pull up following revision(s) (requested by skrll in ticket #1134): sys/dev/usb/uhub.c: revision 1.130 Use the port status straight after the reset and not after the usbd_clear_port_feature(dev, port, UHF_C_PORT_RESET) The Gadget USB HUB in the IBM x3250 sborrill sent me returns the wrong status and this would appear to leave the attached cdce(4) in the default state. The next device probed fails as a result. To generate a diff of this commit: cvs rdiff -u -r1.124 -r1.124.4.1 src/sys/dev/usb/uhub.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/uhub.c diff -u src/sys/dev/usb/uhub.c:1.124 src/sys/dev/usb/uhub.c:1.124.4.1 --- src/sys/dev/usb/uhub.c:1.124 Sun Sep 15 15:33:47 2013 +++ src/sys/dev/usb/uhub.c Tue Mar 8 09:49:00 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: uhub.c,v 1.124 2013/09/15 15:33:47 martin Exp $ */ +/* $NetBSD: uhub.c,v 1.124.4.1 2016/03/08 09:49:00 snj Exp $ */ /* $FreeBSD: src/sys/dev/usb/uhub.c,v 1.18 1999/11/17 22:33:43 n_hibma Exp $ */ /* @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uhub.c,v 1.124 2013/09/15 15:33:47 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uhub.c,v 1.124.4.1 2016/03/08 09:49:00 snj Exp $"); #include #include @@ -513,6 +513,7 @@ uhub_explore(usbd_device_handle dev) "port %d reset failed\n", port); continue; } +#if 0 /* Get port status again, it might have changed during reset */ err = usbd_get_port_status(dev, port, >status); if (err) { @@ -520,6 +521,7 @@ uhub_explore(usbd_device_handle dev) "error=%s\n", usbd_errstr(err))); continue; } +#endif status = UGETW(up->status.wPortStatus); change = UGETW(up->status.wPortChange); if (!(status & UPS_CURRENT_CONNECT_STATUS)) {
CVS commit: [netbsd-7] src/sys/dev/usb
Module Name:src Committed By: martin Date: Mon Mar 7 14:36:55 UTC 2016 Modified Files: src/sys/dev/usb [netbsd-7]: ugen.c Log Message: Additionally pull up r1.131 for ticket #1124 (requested by skrll) To generate a diff of this commit: cvs rdiff -u -r1.124.2.1 -r1.124.2.2 src/sys/dev/usb/ugen.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/ugen.c diff -u src/sys/dev/usb/ugen.c:1.124.2.1 src/sys/dev/usb/ugen.c:1.124.2.2 --- src/sys/dev/usb/ugen.c:1.124.2.1 Sun Mar 6 18:08:04 2016 +++ src/sys/dev/usb/ugen.c Mon Mar 7 14:36:55 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: ugen.c,v 1.124.2.1 2016/03/06 18:08:04 martin Exp $ */ +/* $NetBSD: ugen.c,v 1.124.2.2 2016/03/07 14:36:55 martin Exp $ */ /* * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.124.2.1 2016/03/06 18:08:04 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.124.2.2 2016/03/07 14:36:55 martin Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -172,6 +172,7 @@ Static usb_config_descriptor_t *ugen_get int index, int *lenp); Static usbd_status ugen_set_interface(struct ugen_softc *, int, int); Static int ugen_get_alt_index(struct ugen_softc *sc, int ifaceidx); +Static void ugen_clear_endpoints(struct ugen_softc *); #define UGENUNIT(n) ((minor(n) >> 4) & 0xf) #define UGENENDPOINT(n) (minor(n) & 0xf)
CVS commit: [netbsd-7] src/sys/dev/usb
Module Name:src Committed By: martin Date: Sun Mar 6 18:08:04 UTC 2016 Modified Files: src/sys/dev/usb [netbsd-7]: ugen.c Log Message: Pull up following revision(s) (requested by skrll in ticket #1124): sys/dev/usb/ugen.c: revision 1.127 sys/dev/usb/ugen.c: revision 1.128 sys/dev/usb/ugen.c: revision 1.129 sys/dev/usb/ugen.c: revision 1.130 s/0/NULL/ One more s/0/NULL/ Remove always true conditional Only clear the endpoint information in ugen_set_interface only if setting the new altno suceeds. Avoids the null de-ref in PR/50597 and PR/50810 To generate a diff of this commit: cvs rdiff -u -r1.124 -r1.124.2.1 src/sys/dev/usb/ugen.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/ugen.c diff -u src/sys/dev/usb/ugen.c:1.124 src/sys/dev/usb/ugen.c:1.124.2.1 --- src/sys/dev/usb/ugen.c:1.124 Fri Jul 25 08:10:39 2014 +++ src/sys/dev/usb/ugen.c Sun Mar 6 18:08:04 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: ugen.c,v 1.124 2014/07/25 08:10:39 dholland Exp $ */ +/* $NetBSD: ugen.c,v 1.124.2.1 2016/03/06 18:08:04 martin Exp $ */ /* * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.124 2014/07/25 08:10:39 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.124.2.1 2016/03/06 18:08:04 martin Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -267,6 +267,19 @@ ugen_attach(device_t parent, device_t se return; } +Static void +ugen_clear_endpoints(struct ugen_softc *sc) +{ + + /* Clear out the old info, but leave the selinfo and cv initialised. */ + for (int i = 0; i < USB_MAX_ENDPOINTS; i++) { + for (int dir = OUT; dir <= IN; dir++) { + struct ugen_endpoint *sce = >sc_endpoints[i][dir]; + memset(sce, 0, UGEN_ENDPOINT_NONZERO_CRUFT); + } + } +} + Static int ugen_set_config(struct ugen_softc *sc, int configno) { @@ -278,7 +291,7 @@ ugen_set_config(struct ugen_softc *sc, i u_int8_t niface, nendpt; int ifaceno, endptno, endpt; usbd_status err; - int dir, i; + int dir; DPRINTFN(1,("ugen_set_config: %s to configno %d, sc=%p\n", device_xname(sc->sc_dev), configno, sc)); @@ -307,13 +320,7 @@ ugen_set_config(struct ugen_softc *sc, i if (err) return (err); - /* Clear out the old info, but leave the selinfo and cv initialised. */ - for (i = 0; i < USB_MAX_ENDPOINTS; i++) { - for (dir = OUT; dir <= IN; dir++) { - sce = >sc_endpoints[i][dir]; - memset(sce, 0, UGEN_ENDPOINT_NONZERO_CRUFT); - } - } + ugen_clear_endpoints(sc); for (ifaceno = 0; ifaceno < niface; ifaceno++) { DPRINTFN(1,("ugen_set_config: ifaceno %d\n", ifaceno)); @@ -378,7 +385,7 @@ ugenopen(dev_t dev, int flag, int mode, for (dir = OUT; dir <= IN; dir++) { if (flag & (dir == OUT ? FWRITE : FREAD)) { sce = >sc_endpoints[endpt][dir]; - if (sce == 0 || sce->edesc == 0) + if (sce->edesc == NULL) return (ENXIO); } } @@ -532,7 +539,7 @@ ugenclose(dev_t dev, int flag, int mode, if (!(flag & (dir == OUT ? FWRITE : FREAD))) continue; sce = >sc_endpoints[endpt][dir]; - if (sce == NULL || sce->pipeh == NULL) + if (sce->pipeh == NULL) continue; DPRINTFN(5, ("ugenclose: endpt=%d dir=%d sce=%p\n", endpt, dir, sce)); @@ -1032,7 +1039,7 @@ ugen_detach(device_t self, int flags) for (i = 0; i < USB_MAX_ENDPOINTS; i++) { for (dir = OUT; dir <= IN; dir++) { sce = >sc_endpoints[i][dir]; - if (sce && sce->pipeh) + if (sce->pipeh) usbd_abort_pipe(sce->pipeh); } } @@ -1333,16 +1340,6 @@ ugen_set_interface(struct ugen_softc *sc err = usbd_endpoint_count(iface, ); if (err) return (err); - /* XXX should only do this after setting new altno has succeeded */ - for (endptno = 0; endptno < nendpt; endptno++) { - ed = usbd_interface2endpoint_descriptor(iface,endptno); - endpt = ed->bEndpointAddress; - dir = UE_GET_DIR(endpt) == UE_DIR_IN ? IN : OUT; - sce = >sc_endpoints[UE_GET_ADDR(endpt)][dir]; - sce->sc = 0; - sce->edesc = 0; - sce->iface = 0; - } /* change setting */ err = usbd_set_interface(iface, altno); @@ -1352,6 +1349,9 @@ ugen_set_interface(struct ugen_softc *sc err = usbd_endpoint_count(iface, ); if (err) return (err); + + ugen_clear_endpoints(sc); + for (endptno = 0; endptno < nendpt; endptno++) { ed = usbd_interface2endpoint_descriptor(iface,endptno); KASSERT(ed != NULL);
CVS commit: [netbsd-7] src/sys/dev/usb
Module Name:src Committed By: snj Date: Fri Feb 26 21:34:27 UTC 2016 Modified Files: src/sys/dev/usb [netbsd-7]: hid.c Log Message: Pull up following revision(s) (requested by riastradh in ticket #1089): sys/dev/usb/hid.c: revision 1.43 Convert unsigned char to wider type before left shift. Avoids undefined behaviour if shifted quantity overflows int. CID 980971 To generate a diff of this commit: cvs rdiff -u -r1.35.14.1 -r1.35.14.2 src/sys/dev/usb/hid.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/hid.c diff -u src/sys/dev/usb/hid.c:1.35.14.1 src/sys/dev/usb/hid.c:1.35.14.2 --- src/sys/dev/usb/hid.c:1.35.14.1 Mon Feb 9 09:43:09 2015 +++ src/sys/dev/usb/hid.c Fri Feb 26 21:34:27 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: hid.c,v 1.35.14.1 2015/02/09 09:43:09 martin Exp $ */ +/* $NetBSD: hid.c,v 1.35.14.2 2016/02/26 21:34:27 snj Exp $ */ /* $FreeBSD: src/sys/dev/usb/hid.c,v 1.11 1999/11/17 22:33:39 n_hibma Exp $ */ /* @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hid.c,v 1.35.14.1 2015/02/09 09:43:09 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hid.c,v 1.35.14.2 2016/02/26 21:34:27 snj Exp $"); #include #include @@ -455,7 +455,7 @@ hid_get_udata(const u_char *buf, const s num = (hpos + hsize + 7) / 8 - off; for (i = 0; i < num; i++) - data |= buf[off + i] << (i * 8); + data |= (unsigned long)buf[off + i] << (i * 8); data >>= hpos % 8; data &= (1 << hsize) - 1;
CVS commit: [netbsd-7] src/sys/dev/usb
Module Name:src Committed By: snj Date: Sat Feb 6 20:58:13 UTC 2016 Modified Files: src/sys/dev/usb [netbsd-7]: usb.c usb_subr.c usbdivar.h xhci.c Log Message: Pull up following revision(s) (requested by skrll in ticket #1097): sys/dev/usb/usb.c: revision 1.161 sys/dev/usb/usb_subr.c: revisions 1.207, 1.208 sys/dev/usb/usbdivar.h: revision 1.111 sys/dev/usb/xhci.c: revision 1.33 Get the iManufacturer, iProduct, and iSerialNumber strings before probing for drivers and cache them for later use. This reduces bus transactions and fixes attachment for at least two of my umass(4)s. -- Need sys/kmem.h To generate a diff of this commit: cvs rdiff -u -r1.154 -r1.154.2.1 src/sys/dev/usb/usb.c cvs rdiff -u -r1.196.4.1 -r1.196.4.2 src/sys/dev/usb/usb_subr.c cvs rdiff -u -r1.107 -r1.107.4.1 src/sys/dev/usb/usbdivar.h cvs rdiff -u -r1.23.2.3 -r1.23.2.4 src/sys/dev/usb/xhci.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.c diff -u src/sys/dev/usb/usb.c:1.154 src/sys/dev/usb/usb.c:1.154.2.1 --- src/sys/dev/usb/usb.c:1.154 Fri Jul 25 08:10:39 2014 +++ src/sys/dev/usb/usb.c Sat Feb 6 20:58:13 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: usb.c,v 1.154 2014/07/25 08:10:39 dholland Exp $ */ +/* $NetBSD: usb.c,v 1.154.2.1 2016/02/06 20:58:13 snj Exp $ */ /* * Copyright (c) 1998, 2002, 2008, 2012 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.154 2014/07/25 08:10:39 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.154.2.1 2016/02/06 20:58:13 snj Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -899,7 +899,7 @@ usbd_add_dev_event(int type, usbd_device { struct usb_event *ue = usb_alloc_event(); - usbd_fill_deviceinfo(udev, >u.ue_device, USB_EVENT_IS_ATTACH(type)); + usbd_fill_deviceinfo(udev, >u.ue_device, false); usb_add_event(type, ue); } Index: src/sys/dev/usb/usb_subr.c diff -u src/sys/dev/usb/usb_subr.c:1.196.4.1 src/sys/dev/usb/usb_subr.c:1.196.4.2 --- src/sys/dev/usb/usb_subr.c:1.196.4.1 Mon Nov 16 14:45:03 2015 +++ src/sys/dev/usb/usb_subr.c Sat Feb 6 20:58:13 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: usb_subr.c,v 1.196.4.1 2015/11/16 14:45:03 msaitoh Exp $ */ +/* $NetBSD: usb_subr.c,v 1.196.4.2 2016/02/06 20:58:13 snj 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.1 2015/11/16 14:45:03 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.196.4.2 2016/02/06 20:58:13 snj Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -42,6 +42,7 @@ __KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v #include #include #include +#include #include #include #include @@ -206,6 +207,33 @@ usbd_trim_spaces(char *p) *e = '\0'; /* kill trailing spaces */ } +static void +usbd_get_device_string(struct usbd_device *ud, uByte index, char **buf) +{ + char *b = kmem_alloc(USB_MAX_ENCODED_STRING_LEN, KM_SLEEP); + if (b) { + usbd_status err = usbd_get_string0(ud, index, b, true); + if (err != USBD_NORMAL_COMPLETION) { + kmem_free(b, USB_MAX_ENCODED_STRING_LEN); + b = NULL; + } else { + usbd_trim_spaces(b); + } + } + *buf = b; +} + +void +usbd_get_device_strings(struct usbd_device *ud) +{ + usb_device_descriptor_t *udd = >ddesc; + + usbd_get_device_string(ud, udd->iManufacturer, >ud_vendor); + usbd_get_device_string(ud, udd->iProduct, >ud_product); + usbd_get_device_string(ud, udd->iSerialNumber, >ud_serial); +} + + Static void usbd_devinfo_vp(usbd_device_handle dev, char *v, size_t vl, char *p, size_t pl, int usedev, int useencoded) @@ -223,6 +251,13 @@ usbd_devinfo_vp(usbd_device_handle dev, if (usbd_get_string0(dev, udd->iProduct, p, useencoded) == USBD_NORMAL_COMPLETION) usbd_trim_spaces(p); + } else { + if (dev->ud_vendor) { + strlcpy(v, dev->ud_vendor, vl); + } + if (dev->ud_product) { + strlcpy(p, dev->ud_product, pl); + } } if (v[0] == '\0') get_usb_vendor(v, vl, UGETW(udd->idVendor)); @@ -260,7 +295,7 @@ usbd_devinfo(usbd_device_handle dev, int ep = cp + l; usbd_devinfo_vp(dev, vendor, USB_MAX_ENCODED_STRING_LEN, - product, USB_MAX_ENCODED_STRING_LEN, 1, 1); + product, USB_MAX_ENCODED_STRING_LEN, 0, 1); cp += snprintf(cp, ep - cp, "%s %s", vendor, product); if (showclass) cp += snprintf(cp, ep - cp, ", class %d/%d", @@ -831,19 +866,10 @@ usbd_attach_roothub(device_t parent, usb static void usbd_serialnumber(device_t dv, usbd_device_handle dev) { - usb_device_descriptor_t *dd = >ddesc; - char *serialnumber; - - serialnumber = malloc(USB_MAX_ENCODED_STRING_LEN, M_USB, M_NOWAIT); - if (serialnumber == NULL) - return; - serialnumber[0] = '\0'; - (void)usbd_get_string(dev, dd->iSerialNumber, serialnumber); - if (serialnumber[0]) { + if (dev->ud_serial) {
CVS commit: [netbsd-7] src/sys/dev/usb
Module Name:src Committed By: riz Date: Sat Jan 2 14:43:48 UTC 2016 Modified Files: src/sys/dev/usb [netbsd-7]: ohci.c Log Message: Pull up following revision(s) (requested by skrll in ticket #1054): sys/dev/usb/ohci.c: revision 1.257 Fix 10year old bug of mine affecting interrupt IN transfers. To generate a diff of this commit: cvs rdiff -u -r1.253.2.1 -r1.253.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.1 src/sys/dev/usb/ohci.c:1.253.2.2 --- src/sys/dev/usb/ohci.c:1.253.2.1 Mon Dec 1 11:38:43 2014 +++ src/sys/dev/usb/ohci.c Sat Jan 2 14:43:48 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: ohci.c,v 1.253.2.1 2014/12/01 11:38:43 martin Exp $ */ +/* $NetBSD: ohci.c,v 1.253.2.2 2016/01/02 14:43:48 riz 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.1 2014/12/01 11:38:43 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.253.2.2 2016/01/02 14:43:48 riz Exp $"); #include #include @@ -3191,7 +3191,7 @@ ohci_device_intr_start(usbd_xfer_handle tail->xfer = NULL; data->td.td_flags = HTOO32( - isread ? OHCI_TD_IN : OHCI_TD_OUT | + (isread ? OHCI_TD_IN : OHCI_TD_OUT) | OHCI_TD_NOCC | OHCI_TD_SET_DI(1) | OHCI_TD_TOGGLE_CARRY); if (xfer->flags & USBD_SHORT_XFER_OK)
CVS commit: [netbsd-7] src/sys/dev/usb
Module Name:src Committed By: msaitoh Date: Mon Nov 16 14:41:44 UTC 2015 Modified Files: src/sys/dev/usb [netbsd-7]: ucom.c Log Message: Pull up following revision(s) (requested by joerg in ticket #1031): sys/dev/usb/ucom.c: revision 1.110 Add the port number to the device properties to make it easier to relate a specific ucom instance with the physical port of multi-port devices like the FTDI 4232. To generate a diff of this commit: cvs rdiff -u -r1.107 -r1.107.2.1 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 src/sys/dev/usb/ucom.c:1.107.2.1 --- src/sys/dev/usb/ucom.c:1.107 Sun Aug 10 16:44:36 2014 +++ src/sys/dev/usb/ucom.c Mon Nov 16 14:41:44 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: ucom.c,v 1.107 2014/08/10 16:44:36 tls Exp $ */ +/* $NetBSD: ucom.c,v 1.107.2.1 2015/11/16 14:41:44 msaitoh Exp $ */ /* * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ucom.c,v 1.107 2014/08/10 16:44:36 tls Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ucom.c,v 1.107.2.1 2015/11/16 14:41:44 msaitoh Exp $"); #include #include @@ -219,6 +219,8 @@ ucom_attach(device_t parent, device_t se aprint_normal(": %s", uca->info); aprint_normal("\n"); + prop_dictionary_set_int32(device_properties(self), "port", uca->portno); + sc->sc_dev = self; sc->sc_udev = uca->device; sc->sc_iface = uca->iface;
CVS commit: [netbsd-7] src/sys/dev/usb
Module Name:src Committed By: msaitoh Date: Mon Nov 16 14:45:03 UTC 2015 Modified Files: src/sys/dev/usb [netbsd-7]: usb_subr.c Log Message: Pull up following revision(s) (requested by joerg in ticket #1032): sys/dev/usb/usb_subr.c: revision 1.204 Attach serial number as property to all USB devices having one. To generate a diff of this commit: cvs rdiff -u -r1.196 -r1.196.4.1 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.196 src/sys/dev/usb/usb_subr.c:1.196.4.1 --- src/sys/dev/usb/usb_subr.c:1.196 Mon Feb 17 07:34:21 2014 +++ src/sys/dev/usb/usb_subr.c Mon Nov 16 14:45:03 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: usb_subr.c,v 1.196 2014/02/17 07:34:21 skrll Exp $ */ +/* $NetBSD: usb_subr.c,v 1.196.4.1 2015/11/16 14:45:03 msaitoh 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 2014/02/17 07:34:21 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.196.4.1 2015/11/16 14:45:03 msaitoh Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -828,6 +828,24 @@ usbd_attach_roothub(device_t parent, usb return (USBD_NORMAL_COMPLETION); } +static void +usbd_serialnumber(device_t dv, usbd_device_handle dev) +{ + usb_device_descriptor_t *dd = >ddesc; + char *serialnumber; + + serialnumber = malloc(USB_MAX_ENCODED_STRING_LEN, M_USB, M_NOWAIT); + if (serialnumber == NULL) + return; + serialnumber[0] = '\0'; + (void)usbd_get_string(dev, dd->iSerialNumber, serialnumber); + if (serialnumber[0]) { + prop_dictionary_set_cstring(device_properties(dv), + "serialnumber", serialnumber); + } + free(serialnumber, M_USB); +} + static usbd_status usbd_attachwholedevice(device_t parent, usbd_device_handle dev, int port, int usegeneric) @@ -864,6 +882,7 @@ usbd_attachwholedevice(device_t parent, dev->subdevs[0] = dv; dev->subdevlen = 1; dev->nifaces_claimed = 1; /* XXX */ + usbd_serialnumber(dv, dev); } return (USBD_NORMAL_COMPLETION); } @@ -924,6 +943,9 @@ usbd_attachinterfaces(device_t parent, u usbd_ifprint, config_stdsubmatch); if (!dv) continue; + + usbd_serialnumber(dv, dev); + ifaces[i] = 0; /* claim */ /* account for ifaces claimed by the driver behind our back */ for (j = 0; j < nifaces; j++) {
CVS commit: [netbsd-7] src/sys/dev/usb
Module Name:src Committed By: riz Date: Sun Nov 8 05:17:40 UTC 2015 Modified Files: src/sys/dev/usb [netbsd-7]: uplcom.c Log Message: Pull up following revision(s) (requested by skrll in ticket #1027): sys/dev/usb/uplcom.c: revision 1.76 Don't pretend to do zero length IN control transfers as dwctwo(4) (correctly according to usb 2.0 specification 8.5.3) uses IN status stage when no (zero length) data stage. Instead read into a 1 byte array. My uplcom(4) now works on RPI. To generate a diff of this commit: cvs rdiff -u -r1.74.2.1 -r1.74.2.2 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/uplcom.c diff -u src/sys/dev/usb/uplcom.c:1.74.2.1 src/sys/dev/usb/uplcom.c:1.74.2.2 --- src/sys/dev/usb/uplcom.c:1.74.2.1 Thu Jul 30 15:51:58 2015 +++ src/sys/dev/usb/uplcom.c Sun Nov 8 05:17:40 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: uplcom.c,v 1.74.2.1 2015/07/30 15:51:58 snj Exp $ */ +/* $NetBSD: uplcom.c,v 1.74.2.2 2015/11/08 05:17:40 riz Exp $ */ /* * Copyright (c) 2001 The NetBSD Foundation, Inc. * All rights reserved. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uplcom.c,v 1.74.2.1 2015/07/30 15:51:58 snj Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uplcom.c,v 1.74.2.2 2015/11/08 05:17:40 riz Exp $"); #include #include @@ -499,21 +499,20 @@ struct pl2303x_init { uint8_t request; uint16_t value; uint16_t index; - uint16_t length; }; static const struct pl2303x_init pl2303x[] = { - { UT_READ_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 0x8484,0, 0 }, - { UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 0x0404,0, 0 }, - { UT_READ_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 0x8484,0, 0 }, - { UT_READ_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 0x8383,0, 0 }, - { UT_READ_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 0x8484,0, 0 }, - { UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 0x0404,1, 0 }, - { UT_READ_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 0x8484,0, 0 }, - { UT_READ_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 0x8383,0, 0 }, - { UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 0,1, 0 }, - { UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 1,0, 0 }, - { UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 2, 0x44, 0 } + { UT_READ_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 0x8484,0 }, + { UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 0x0404,0 }, + { UT_READ_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 0x8484,0 }, + { UT_READ_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 0x8383,0 }, + { UT_READ_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 0x8484,0 }, + { UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 0x0404,1 }, + { UT_READ_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 0x8484,0 }, + { UT_READ_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 0x8383,0 }, + { UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 0,1 }, + { UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 1,0 }, + { UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 2, 0x44 } }; #define N_PL2302X_INIT (sizeof(pl2303x)/sizeof(pl2303x[0])) @@ -525,13 +524,22 @@ uplcom_pl2303x_init(struct uplcom_softc int i; for (i = 0; i < N_PL2302X_INIT; i++) { + char buf[1]; + void *b; + req.bmRequestType = pl2303x[i].req_type; req.bRequest = pl2303x[i].request; USETW(req.wValue, pl2303x[i].value); USETW(req.wIndex, pl2303x[i].index); - USETW(req.wLength, pl2303x[i].length); + if (UT_GET_DIR(req.bmRequestType) == UT_READ) { + b = buf; + USETW(req.wLength, sizeof(buf)); + } else { + b = NULL; + USETW(req.wLength, 0); + } - err = usbd_do_request(sc->sc_udev, , 0); + err = usbd_do_request(sc->sc_udev, , b); if (err) { aprint_error_dev(sc->sc_dev, "uplcom_pl2303x_init failed: %s\n",
CVS commit: [netbsd-7] src/sys/dev/usb
Module Name:src Committed By: martin Date: Sun Oct 18 09:01:58 UTC 2015 Modified Files: src/sys/dev/usb [netbsd-7]: usbdevs Log Message: Pull up rev 1.696 for ticket #869: Add Apple "Magic Trackpad" device id (bluetooth device) To generate a diff of this commit: cvs rdiff -u -r1.680.2.3 -r1.680.2.4 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.3 src/sys/dev/usb/usbdevs:1.680.2.4 --- src/sys/dev/usb/usbdevs:1.680.2.3 Sat Feb 21 19:38:02 2015 +++ src/sys/dev/usb/usbdevs Sun Oct 18 09:01:58 2015 @@ -1,4 +1,4 @@ -$NetBSD: usbdevs,v 1.680.2.3 2015/02/21 19:38:02 martin Exp $ +$NetBSD: usbdevs,v 1.680.2.4 2015/10/18 09:01:58 martin Exp $ /* * Copyright (c) 1998-2004 The NetBSD Foundation, Inc. @@ -846,6 +846,7 @@ product APPLE MIGHTYMOUSE 0x0304 Mighty product APPLE FOUNTAIN_TP 0x030a Apple Internal Trackpad (Fountain) product APPLE GEYSER1_TP 0x030b Apple Internal Trackpad (Geyser) product APPLE MAGICMOUSE 0x030d Magic Mouse +product APPLE MAGICTRACKPAD 0x030e Magic Trackpad product APPLE BLUETOOTH_HIDMODE 0x1000 Bluetooth HCI (HID-proxy mode) product APPLE EXT_KBD_HUB 0x1003 Hub in Apple Extended USB Keyboard product APPLE SPEAKERS 0x1101 Speakers
CVS commit: [netbsd-7] src/sys/dev/usb
Module Name:src Committed By: martin Date: Sun Oct 18 09:03:22 UTC 2015 Modified Files: src/sys/dev/usb [netbsd-7]: usbdevs.h usbdevs_data.h Log Message: regen (ticket #869) To generate a diff of this commit: cvs rdiff -u -r1.672.2.3 -r1.672.2.4 src/sys/dev/usb/usbdevs.h cvs rdiff -u -r1.673.2.3 -r1.673.2.4 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.3 src/sys/dev/usb/usbdevs.h:1.672.2.4 --- src/sys/dev/usb/usbdevs.h:1.672.2.3 Sat Feb 21 19:38:51 2015 +++ src/sys/dev/usb/usbdevs.h Sun Oct 18 09:03:22 2015 @@ -1,10 +1,10 @@ -/* $NetBSD: usbdevs.h,v 1.672.2.3 2015/02/21 19:38:51 martin Exp $ */ +/* $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.3 2015/02/21 19:38:02 martin Exp + * NetBSD: usbdevs,v 1.680.2.4 2015/10/18 09:01:58 martin Exp */ /* @@ -853,6 +853,7 @@ #define USB_PRODUCT_APPLE_FOUNTAIN_TP 0x030a /* Apple Internal Trackpad (Fountain) */ #define USB_PRODUCT_APPLE_GEYSER1_TP 0x030b /* Apple Internal Trackpad (Geyser) */ #define USB_PRODUCT_APPLE_MAGICMOUSE 0x030d /* Magic Mouse */ +#define USB_PRODUCT_APPLE_MAGICTRACKPAD 0x030e /* Magic Trackpad */ #define USB_PRODUCT_APPLE_BLUETOOTH_HIDMODE 0x1000 /* Bluetooth HCI (HID-proxy mode) */ #define USB_PRODUCT_APPLE_EXT_KBD_HUB 0x1003 /* Hub in Apple Extended USB Keyboard */ #define USB_PRODUCT_APPLE_SPEAKERS 0x1101 /* Speakers */ Index: src/sys/dev/usb/usbdevs_data.h diff -u src/sys/dev/usb/usbdevs_data.h:1.673.2.3 src/sys/dev/usb/usbdevs_data.h:1.673.2.4 --- src/sys/dev/usb/usbdevs_data.h:1.673.2.3 Sat Feb 21 19:38:51 2015 +++ src/sys/dev/usb/usbdevs_data.h Sun Oct 18 09:03:22 2015 @@ -1,10 +1,10 @@ -/* $NetBSD: usbdevs_data.h,v 1.673.2.3 2015/02/21 19:38:51 martin Exp $ */ +/* $NetBSD: usbdevs_data.h,v 1.673.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.3 2015/02/21 19:38:02 martin Exp + * NetBSD: usbdevs,v 1.680.2.4 2015/10/18 09:01:58 martin Exp */ /* @@ -2867,6 +2867,10 @@ const struct usb_product usb_products[] "Magic Mouse", }, { + USB_VENDOR_APPLE, USB_PRODUCT_APPLE_MAGICTRACKPAD, + "Magic Trackpad", + }, + { USB_VENDOR_APPLE, USB_PRODUCT_APPLE_BLUETOOTH_HIDMODE, "Bluetooth HCI (HID-proxy mode)", }, @@ -10199,4 +10203,4 @@ const struct usb_product usb_products[] "Prestige", }, }; -const int usb_nproducts = 2009; +const int usb_nproducts = 2010;
CVS commit: [netbsd-7] src/sys/dev/usb
Module Name:src Committed By: snj Date: Thu Jul 30 15:51:58 UTC 2015 Modified Files: src/sys/dev/usb [netbsd-7]: uplcom.c Log Message: Pull up following revision(s) (requested by riastradh in ticket #908): sys/dev/usb/uplcom.c: revision 1.75 Null suspend/resume handler for uplcom(4). To generate a diff of this commit: cvs rdiff -u -r1.74 -r1.74.2.1 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/uplcom.c diff -u src/sys/dev/usb/uplcom.c:1.74 src/sys/dev/usb/uplcom.c:1.74.2.1 --- src/sys/dev/usb/uplcom.c:1.74 Mon Jul 14 12:04:48 2014 +++ src/sys/dev/usb/uplcom.c Thu Jul 30 15:51:58 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: uplcom.c,v 1.74 2014/07/14 12:04:48 ryoon Exp $ */ +/* $NetBSD: uplcom.c,v 1.74.2.1 2015/07/30 15:51:58 snj Exp $ */ /* * Copyright (c) 2001 The NetBSD Foundation, Inc. * All rights reserved. @@ -34,7 +34,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: uplcom.c,v 1.74 2014/07/14 12:04:48 ryoon Exp $); +__KERNEL_RCSID(0, $NetBSD: uplcom.c,v 1.74.2.1 2015/07/30 15:51:58 snj Exp $); #include sys/param.h #include sys/systm.h @@ -418,6 +418,9 @@ uplcom_attach(device_t parent, device_t sc-sc_subdev = config_found_sm_loc(self, ucombus, NULL, uca, ucomprint, ucomsubmatch); + if (!pmf_device_register(self, NULL, NULL)) + aprint_error_dev(self, couldn't establish power handler\n); + return; } @@ -452,6 +455,9 @@ uplcom_detach(device_t self, int flags) usbd_add_drv_event(USB_EVENT_DRIVER_DETACH, sc-sc_udev, sc-sc_dev); + if (rv == 0) + pmf_device_deregister(self); + return (rv); }
CVS commit: [netbsd-7] src/sys/dev/usb
Module Name:src Committed By: snj Date: Sat Mar 21 17:30:43 UTC 2015 Modified Files: src/sys/dev/usb [netbsd-7]: TODO.usbmp uatp.c ucycom.c uhid.c uhidev.c uhidev.h ukbd.c uyurex.c Log Message: Pull up following revision(s) (requested by mrg in ticket #626): sys/dev/usb/TODO.usbmp: revision 1.9 sys/dev/usb/uatp.c: revision 1.11 sys/dev/usb/ucycom.c: revision 1.42 sys/dev/usb/uhid.c: revision 1.93, 1.94 sys/dev/usb/uhidev.c: revision 1.63 sys/dev/usb/uhidev.h: revision 1.17 sys/dev/usb/ukbd.c: revision 1.130 sys/dev/usb/uyurex.c: revision 1.10 properly protect uhid's sc_q member with sc_lock. should fix PR#49728. while here, remove D_MPSAFE from uhid* and all uhid users, as it really needs all the callers to be safe and they're not. -- don't take the device lock when stopping the uhidev. that calls to abort and close pipes, both of which may take an adaptive lock. fixes a LOCKDEBUG abort see on one particular machine. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.8.2.1 src/sys/dev/usb/TODO.usbmp cvs rdiff -u -r1.10 -r1.10.2.1 src/sys/dev/usb/uatp.c cvs rdiff -u -r1.39 -r1.39.2.1 src/sys/dev/usb/ucycom.c cvs rdiff -u -r1.92 -r1.92.2.1 src/sys/dev/usb/uhid.c cvs rdiff -u -r1.61.2.1 -r1.61.2.2 src/sys/dev/usb/uhidev.c cvs rdiff -u -r1.15.2.1 -r1.15.2.2 src/sys/dev/usb/uhidev.h cvs rdiff -u -r1.129 -r1.129.4.1 src/sys/dev/usb/ukbd.c cvs rdiff -u -r1.9 -r1.9.12.1 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/TODO.usbmp diff -u src/sys/dev/usb/TODO.usbmp:1.8 src/sys/dev/usb/TODO.usbmp:1.8.2.1 --- src/sys/dev/usb/TODO.usbmp:1.8 Sat Aug 2 15:50:16 2014 +++ src/sys/dev/usb/TODO.usbmp Sat Mar 21 17:30:43 2015 @@ -1,4 +1,4 @@ -$NetBSD: TODO.usbmp,v 1.8 2014/08/02 15:50:16 skrll Exp $ +$NetBSD: TODO.usbmp,v 1.8.2.1 2015/03/21 17:30:43 snj Exp $ the majority of the USB MP device interface is documented in usbdivar.h. @@ -41,8 +41,8 @@ convert uhidev users to MPSAFE: - own cdevsw that isn't D_MPSAFE; need to check intr handlers uhid(4) - - needs some locking here (not completely tested changes) - - done + - D_MPSAFE not set as all users need it first. + - mostly done ukbd(4) ums(4) @@ -135,7 +135,7 @@ driver testing: STATUS - ral - rum - run - - urtw + - urtw working - urtwn - upgt - zyd Index: src/sys/dev/usb/uatp.c diff -u src/sys/dev/usb/uatp.c:1.10 src/sys/dev/usb/uatp.c:1.10.2.1 --- src/sys/dev/usb/uatp.c:1.10 Thu Jul 17 17:11:12 2014 +++ src/sys/dev/usb/uatp.c Sat Mar 21 17:30:43 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: uatp.c,v 1.10 2014/07/17 17:11:12 riastradh Exp $ */ +/* $NetBSD: uatp.c,v 1.10.2.1 2015/03/21 17:30:43 snj Exp $ */ /*- * Copyright (c) 2011-2014 The NetBSD Foundation, Inc. @@ -146,7 +146,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: uatp.c,v 1.10 2014/07/17 17:11:12 riastradh Exp $); +__KERNEL_RCSID(0, $NetBSD: uatp.c,v 1.10.2.1 2015/03/21 17:30:43 snj Exp $); #include sys/types.h #include sys/param.h @@ -1350,8 +1350,7 @@ geyser34_initialize(struct uatp_softc *s DPRINTF(sc, UATP_DEBUG_MISC, (initializing\n)); geyser34_enable_raw_mode(sc); - usb_init_task(sc-sc_reset_task, geyser34_reset_task, sc, - USB_TASKQ_MPSAFE); + usb_init_task(sc-sc_reset_task, geyser34_reset_task, sc, 0); } static int @@ -2012,7 +2011,7 @@ tap_debug(struct uatp_softc *sc, const c static void tap_initialize(struct uatp_softc *sc) { - callout_init(sc-sc_untap_callout, CALLOUT_MPSAFE); + callout_init(sc-sc_untap_callout, 0); callout_setfunc(sc-sc_untap_callout, untap_callout, sc); mutex_init(sc-sc_tap_mutex, MUTEX_DEFAULT, IPL_USB); cv_init(sc-sc_tap_cv, uatptap); Index: src/sys/dev/usb/ucycom.c diff -u src/sys/dev/usb/ucycom.c:1.39 src/sys/dev/usb/ucycom.c:1.39.2.1 --- src/sys/dev/usb/ucycom.c:1.39 Fri Jul 25 08:10:39 2014 +++ src/sys/dev/usb/ucycom.c Sat Mar 21 17:30:43 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: ucycom.c,v 1.39 2014/07/25 08:10:39 dholland Exp $ */ +/* $NetBSD: ucycom.c,v 1.39.2.1 2015/03/21 17:30:43 snj Exp $ */ /* * Copyright (c) 2005 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: ucycom.c,v 1.39 2014/07/25 08:10:39 dholland Exp $); +__KERNEL_RCSID(0, $NetBSD: ucycom.c,v 1.39.2.1 2015/03/21 17:30:43 snj Exp $); #include sys/param.h #include sys/systm.h @@ -1124,9 +1124,14 @@ ucycom_get_cfg(struct ucycom_softc *sc) Static void ucycom_cleanup(struct ucycom_softc *sc) { + uint8_t *obuf; + DPRINTF((ucycom_cleanup: closing uhidev\n)); - if (sc-sc_obuf !=NULL) - free (sc-sc_obuf, M_USBDEV); + obuf = sc-sc_obuf; + sc-sc_obuf = NULL; uhidev_close(sc-sc_hdev); + + if (obuf != NULL) + free (obuf, M_USBDEV); } Index: src/sys/dev/usb/uhid.c diff -u src/sys/dev/usb/uhid.c:1.92 src/sys/dev/usb/uhid.c:1.92.2.1 ---
CVS commit: [netbsd-7] src/sys/dev/usb
Module Name:src Committed By: snj Date: Sun Mar 15 22:47:55 UTC 2015 Modified Files: src/sys/dev/usb [netbsd-7]: if_run.c Log Message: Pull up following revision(s) (requested by nonakap in ticket #592): sys/dev/usb/if_run.c: revision 1.11 Add pmf hooks. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.10.4.1 src/sys/dev/usb/if_run.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_run.c diff -u src/sys/dev/usb/if_run.c:1.10 src/sys/dev/usb/if_run.c:1.10.4.1 --- src/sys/dev/usb/if_run.c:1.10 Tue Jan 28 13:08:13 2014 +++ src/sys/dev/usb/if_run.c Sun Mar 15 22:47:55 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: if_run.c,v 1.10 2014/01/28 13:08:13 martin Exp $ */ +/* $NetBSD: if_run.c,v 1.10.4.1 2015/03/15 22:47:55 snj Exp $ */ /* $OpenBSD: if_run.c,v 1.90 2012/03/24 15:11:04 jsg Exp $ */ /*- @@ -23,7 +23,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: if_run.c,v 1.10 2014/01/28 13:08:13 martin Exp $); +__KERNEL_RCSID(0, $NetBSD: if_run.c,v 1.10.4.1 2015/03/15 22:47:55 snj Exp $); #include sys/param.h #include sys/sockio.h @@ -662,6 +662,9 @@ run_attach(device_t parent, device_t sel ieee80211_announce(ic); 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); } static int @@ -675,6 +678,8 @@ run_detach(device_t self, int flags) if (ifp-if_softc == NULL) return (0); + pmf_device_deregister(self); + s = splnet(); sc-sc_flags |= RUN_DETACHING;
CVS commit: [netbsd-7] src/sys/dev/usb
Module Name:src Committed By: martin Date: Sat Feb 21 19:38:02 UTC 2015 Modified Files: src/sys/dev/usb [netbsd-7]: uftdi.c usbdevs Log Message: Pull up following revision(s) (requested by nonaka in ticket #538): sys/dev/usb/uftdi.c: revision 1.60 sys/dev/usb/usbdevs: revision 1.690 PR/49681: Support BUFFALO PC-OP-RS1 PR/49681: Support BUFFALO PC-OP-RS1 To generate a diff of this commit: cvs rdiff -u -r1.59 -r1.59.4.1 src/sys/dev/usb/uftdi.c cvs rdiff -u -r1.680.2.2 -r1.680.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/uftdi.c diff -u src/sys/dev/usb/uftdi.c:1.59 src/sys/dev/usb/uftdi.c:1.59.4.1 --- src/sys/dev/usb/uftdi.c:1.59 Thu Dec 19 08:22:40 2013 +++ src/sys/dev/usb/uftdi.c Sat Feb 21 19:38:02 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: uftdi.c,v 1.59 2013/12/19 08:22:40 msaitoh Exp $ */ +/* $NetBSD: uftdi.c,v 1.59.4.1 2015/02/21 19:38:02 martin Exp $ */ /* * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: uftdi.c,v 1.59 2013/12/19 08:22:40 msaitoh Exp $); +__KERNEL_RCSID(0, $NetBSD: uftdi.c,v 1.59.4.1 2015/02/21 19:38:02 martin Exp $); #include sys/param.h #include sys/systm.h @@ -159,6 +159,7 @@ static const struct usb_devno uftdi_devs { USB_VENDOR_xxFTDI, USB_PRODUCT_xxFTDI_SHEEVAPLUG_JTAG }, { USB_VENDOR_INTREPIDCS, USB_PRODUCT_INTREPIDCS_VALUECAN }, { USB_VENDOR_INTREPIDCS, USB_PRODUCT_INTREPIDCS_NEOVI }, + { USB_VENDOR_MELCO, USB_PRODUCT_MELCO_PCOPRS1 }, { USB_VENDOR_RATOC, USB_PRODUCT_RATOC_REXUSB60F }, { USB_VENDOR_SEALEVEL, USB_PRODUCT_SEALEVEL_USBSERIAL }, { USB_VENDOR_SEALEVEL, USB_PRODUCT_SEALEVEL_SEAPORT4P1 }, Index: src/sys/dev/usb/usbdevs diff -u src/sys/dev/usb/usbdevs:1.680.2.2 src/sys/dev/usb/usbdevs:1.680.2.3 --- src/sys/dev/usb/usbdevs:1.680.2.2 Fri Jan 16 08:30:42 2015 +++ src/sys/dev/usb/usbdevs Sat Feb 21 19:38:02 2015 @@ -1,4 +1,4 @@ -$NetBSD: usbdevs,v 1.680.2.2 2015/01/16 08:30:42 martin Exp $ +$NetBSD: usbdevs,v 1.680.2.3 2015/02/21 19:38:02 martin Exp $ /* * Copyright (c) 1998-2004 The NetBSD Foundation, Inc. @@ -2082,6 +2082,7 @@ product MELCO KG54 0x0066 WLI-U2-KG54 W product MELCO KG54AI 0x0067 WLI-U2-KG54-AI WLAN product MELCO LUAU2GT 0x006e LUA-U2-GT Ethernet product MELCO NINWIFI 0x008b Nintendo Wi-Fi +product MELCO PCOPRS1 0x00b3 RemoteStation PC-OP-RS1 product MELCO SG54HP 0x00d8 WLI-U2-SG54HP product MELCO G54HP 0x00d9 WLI-U2-G54HP product MELCO KG54L 0x00da WLI-U2-KG54L
CVS commit: [netbsd-7] src/sys/dev/usb
Module Name:src Committed By: martin Date: Sat Feb 21 19:38:51 UTC 2015 Modified Files: src/sys/dev/usb [netbsd-7]: usbdevs.h usbdevs_data.h Log Message: regen To generate a diff of this commit: cvs rdiff -u -r1.672.2.2 -r1.672.2.3 src/sys/dev/usb/usbdevs.h cvs rdiff -u -r1.673.2.2 -r1.673.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.2 src/sys/dev/usb/usbdevs.h:1.672.2.3 --- src/sys/dev/usb/usbdevs.h:1.672.2.2 Fri Jan 16 08:31:31 2015 +++ src/sys/dev/usb/usbdevs.h Sat Feb 21 19:38:51 2015 @@ -1,10 +1,10 @@ -/* $NetBSD: usbdevs.h,v 1.672.2.2 2015/01/16 08:31:31 martin Exp $ */ +/* $NetBSD: usbdevs.h,v 1.672.2.3 2015/02/21 19:38:51 martin Exp $ */ /* * THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. * * generated from: - * NetBSD: usbdevs,v 1.680.2.2 2015/01/16 08:30:42 martin Exp + * NetBSD: usbdevs,v 1.680.2.3 2015/02/21 19:38:02 martin Exp */ /* @@ -2089,6 +2089,7 @@ #define USB_PRODUCT_MELCO_KG54AI 0x0067 /* WLI-U2-KG54-AI WLAN */ #define USB_PRODUCT_MELCO_LUAU2GT 0x006e /* LUA-U2-GT Ethernet */ #define USB_PRODUCT_MELCO_NINWIFI 0x008b /* Nintendo Wi-Fi */ +#define USB_PRODUCT_MELCO_PCOPRS1 0x00b3 /* RemoteStation PC-OP-RS1 */ #define USB_PRODUCT_MELCO_SG54HP 0x00d8 /* WLI-U2-SG54HP */ #define USB_PRODUCT_MELCO_G54HP 0x00d9 /* WLI-U2-G54HP */ #define USB_PRODUCT_MELCO_KG54L 0x00da /* WLI-U2-KG54L */ Index: src/sys/dev/usb/usbdevs_data.h diff -u src/sys/dev/usb/usbdevs_data.h:1.673.2.2 src/sys/dev/usb/usbdevs_data.h:1.673.2.3 --- src/sys/dev/usb/usbdevs_data.h:1.673.2.2 Fri Jan 16 08:31:31 2015 +++ src/sys/dev/usb/usbdevs_data.h Sat Feb 21 19:38:51 2015 @@ -1,10 +1,10 @@ -/* $NetBSD: usbdevs_data.h,v 1.673.2.2 2015/01/16 08:31:31 martin Exp $ */ +/* $NetBSD: usbdevs_data.h,v 1.673.2.3 2015/02/21 19:38:51 martin Exp $ */ /* * THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. * * generated from: - * NetBSD: usbdevs,v 1.680.2.2 2015/01/16 08:30:42 martin Exp + * NetBSD: usbdevs,v 1.680.2.3 2015/02/21 19:38:02 martin Exp */ /* @@ -6467,6 +6467,10 @@ const struct usb_product usb_products[] Nintendo Wi-Fi, }, { + USB_VENDOR_MELCO, USB_PRODUCT_MELCO_PCOPRS1, + RemoteStation PC-OP-RS1, + }, + { USB_VENDOR_MELCO, USB_PRODUCT_MELCO_SG54HP, WLI-U2-SG54HP, }, @@ -10195,4 +10199,4 @@ const struct usb_product usb_products[] Prestige, }, }; -const int usb_nproducts = 2008; +const int usb_nproducts = 2009;
CVS commit: [netbsd-7] src/sys/dev/usb
Module Name:src Committed By: snj Date: Sat Feb 14 08:03:05 UTC 2015 Modified Files: src/sys/dev/usb [netbsd-7]: if_axen.c Log Message: Pull up following revision(s) (requested by nonaka in ticket #512): sys/dev/usb/if_axen.c: revision 1.4 Apply PR kern/49659 patch from Takahiro HAYASHI. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.3.2.1 src/sys/dev/usb/if_axen.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_axen.c diff -u src/sys/dev/usb/if_axen.c:1.3 src/sys/dev/usb/if_axen.c:1.3.2.1 --- src/sys/dev/usb/if_axen.c:1.3 Sun Aug 10 16:44:36 2014 +++ src/sys/dev/usb/if_axen.c Sat Feb 14 08:03:05 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: if_axen.c,v 1.3 2014/08/10 16:44:36 tls Exp $ */ +/* $NetBSD: if_axen.c,v 1.3.2.1 2015/02/14 08:03:05 snj Exp $ */ /* $OpenBSD: if_axen.c,v 1.3 2013/10/21 10:10:22 yuo Exp $ */ /* @@ -23,7 +23,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: if_axen.c,v 1.3 2014/08/10 16:44:36 tls Exp $); +__KERNEL_RCSID(0, $NetBSD: if_axen.c,v 1.3.2.1 2015/02/14 08:03:05 snj Exp $); #ifdef _KERNEL_OPT #include opt_inet.h @@ -688,10 +688,18 @@ axen_attach(device_t parent, device_t se id = usbd_get_interface_descriptor(sc-axen_iface); - /* XXX fix when USB3.0 HC is supported */ /* decide on what our bufsize will be */ - sc-axen_bufsz = (sc-axen_udev-speed == USB_SPEED_HIGH) ? - AXEN_BUFSZ_HS * 1024 : AXEN_BUFSZ_LS * 1024; + switch (sc-axen_udev-speed) { + case USB_SPEED_SUPER: + sc-axen_bufsz = AXEN_BUFSZ_SS * 1024; + break; + case USB_SPEED_HIGH: + sc-axen_bufsz = AXEN_BUFSZ_HS * 1024; + break; + default: + sc-axen_bufsz = AXEN_BUFSZ_LS * 1024; + break; + } /* Find endpoints. */ for (i = 0; i id-bNumEndpoints; i++) { @@ -1071,7 +1079,7 @@ axen_rxeof(usbd_xfer_handle xfer, usbd_p /* skip pseudo header (2byte) */ ifp-if_ipackets++; m-m_pkthdr.rcvif = ifp; - m-m_pkthdr.len = m-m_len = pkt_len - 2; + m-m_pkthdr.len = m-m_len = pkt_len - 6; #ifdef AXEN_TOE /* cheksum err */ @@ -1094,7 +1102,7 @@ axen_rxeof(usbd_xfer_handle xfer, usbd_p } #endif - memcpy(mtod(m, char *), buf + 2, pkt_len - 2); + memcpy(mtod(m, char *), buf + 2, pkt_len - 6); /* push the packet up */ s = splnet();
CVS commit: [netbsd-7] src/sys/dev/usb
Module Name:src Committed By: snj Date: Wed Feb 11 08:25:40 UTC 2015 Modified Files: src/sys/dev/usb [netbsd-7]: uhidev.c uhidev.h Added Files: src/sys/dev/usb [netbsd-7]: x1input_rdesc.h Log Message: Pull up following revision(s) (requested by jmcneill in ticket #502): sys/dev/usb/uhidev.c: revision 1.62 sys/dev/usb/uhidev.h: revision 1.16 sys/dev/usb/x1input_rdesc.h: revision 1.1 Add Xbox One controller support. Report descriptor from https://github.com/lloeki/xbox_one_controller To generate a diff of this commit: cvs rdiff -u -r1.61 -r1.61.2.1 src/sys/dev/usb/uhidev.c cvs rdiff -u -r1.15 -r1.15.2.1 src/sys/dev/usb/uhidev.h cvs rdiff -u -r0 -r1.1.2.2 src/sys/dev/usb/x1input_rdesc.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/uhidev.c diff -u src/sys/dev/usb/uhidev.c:1.61 src/sys/dev/usb/uhidev.c:1.61.2.1 --- src/sys/dev/usb/uhidev.c:1.61 Sun Aug 10 16:44:36 2014 +++ src/sys/dev/usb/uhidev.c Wed Feb 11 08:25:40 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: uhidev.c,v 1.61 2014/08/10 16:44:36 tls Exp $ */ +/* $NetBSD: uhidev.c,v 1.61.2.1 2015/02/11 08:25:40 snj Exp $ */ /* * Copyright (c) 2001, 2012 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: uhidev.c,v 1.61 2014/08/10 16:44:36 tls Exp $); +__KERNEL_RCSID(0, $NetBSD: uhidev.c,v 1.61.2.1 2015/02/11 08:25:40 snj Exp $); #include sys/param.h #include sys/systm.h @@ -61,6 +61,8 @@ __KERNEL_RCSID(0, $NetBSD: uhidev.c,v 1 #include dev/usb/ugraphire_rdesc.h /* Report descriptor for game controllers in XInput mode */ #include dev/usb/xinput_rdesc.h +/* Report descriptor for Xbox One controllers */ +#include dev/usb/x1input_rdesc.h #include locators.h @@ -95,6 +97,10 @@ uhidev_match(device_t parent, cfdata_t m /* Game controllers in XInput mode */ if (USBIF_IS_XINPUT(uaa)) return UMATCH_IFACECLASS_IFACESUBCLASS_IFACEPROTO; + /* Xbox One controllers */ + if (USBIF_IS_X1INPUT(uaa) uaa-ifaceno == 0) + return UMATCH_IFACECLASS_IFACESUBCLASS_IFACEPROTO; + if (uaa-class != UICLASS_HID) return (UMATCH_NONE); if (usbd_get_quirks(uaa-device)-uq_flags UQ_HID_IGNORE) @@ -224,6 +230,11 @@ uhidev_attach(device_t parent, device_t size = sizeof uhid_xinput_report_descr; descptr = uhid_xinput_report_descr; } + if (USBIF_IS_X1INPUT(uaa)) { + sc-sc_flags |= UHIDEV_F_XB1; + size = sizeof uhid_x1input_report_descr; + descptr = uhid_x1input_report_descr; + } if (descptr) { desc = malloc(size, M_USBDEV, M_NOWAIT); @@ -595,9 +606,27 @@ uhidev_open(struct uhidev *scd) error = ENOMEM; goto out3; } + + if (sc-sc_flags UHIDEV_F_XB1) { + uint8_t init_data[] = { 0x05, 0x20 }; + int init_data_len = sizeof(init_data); + err = usbd_intr_transfer(sc-sc_oxfer, sc-sc_opipe, 0, + USBD_NO_TIMEOUT, init_data, init_data_len, + uhidevxb1); + if (err != USBD_NORMAL_COMPLETION) { +DPRINTF((uhidev_open: xb1 init failed, +error=%d\n, err)); +error = EIO; +goto out4; + } + } } return (0); +out4: + /* Free output xfer */ + if (sc-sc_oxfer != NULL) + usbd_free_xfer(sc-sc_oxfer); out3: /* Abort output pipe */ usbd_close_pipe(sc-sc_opipe); Index: src/sys/dev/usb/uhidev.h diff -u src/sys/dev/usb/uhidev.h:1.15 src/sys/dev/usb/uhidev.h:1.15.2.1 --- src/sys/dev/usb/uhidev.h:1.15 Tue Jun 17 09:35:46 2014 +++ src/sys/dev/usb/uhidev.h Wed Feb 11 08:25:40 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: uhidev.h,v 1.15 2014/06/17 09:35:46 skrll Exp $ */ +/* $NetBSD: uhidev.h,v 1.15.2.1 2015/02/11 08:25:40 snj Exp $ */ /* * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -57,6 +57,9 @@ struct uhidev_softc { u_char sc_dying; kmutex_t sc_lock; /* protects writes to sc_state */ + + u_int sc_flags; +#define UHIDEV_F_XB1 0x0001 /* Xbox 1 controller */ }; struct uhidev { Added files: Index: src/sys/dev/usb/x1input_rdesc.h diff -u /dev/null src/sys/dev/usb/x1input_rdesc.h:1.1.2.2 --- /dev/null Wed Feb 11 08:25:40 2015 +++ src/sys/dev/usb/x1input_rdesc.h Wed Feb 11 08:25:40 2015 @@ -0,0 +1,105 @@ +/* $NetBSD: x1input_rdesc.h,v 1.1.2.2 2015/02/11 08:25:40 snj Exp $ */ + +/*- + * Copyright (C) 2014 Loic Nageleisen + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of the copyright holders nor the + * names of its contributors may be used to endorse or promote products + *
CVS commit: [netbsd-7] src/sys/dev/usb
Module Name:src Committed By: martin Date: Wed Feb 11 09:32:19 UTC 2015 Modified Files: src/sys/dev/usb [netbsd-7]: usbdi.c Log Message: Pull up following revision(s) (requested by aymeric in ticket #505): sys/dev/usb/usbdi.c: revision 1.163 clip xfer-actlen also in the !DIAGNOSTIC case To generate a diff of this commit: cvs rdiff -u -r1.161 -r1.161.2.1 src/sys/dev/usb/usbdi.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/usbdi.c diff -u src/sys/dev/usb/usbdi.c:1.161 src/sys/dev/usb/usbdi.c:1.161.2.1 --- src/sys/dev/usb/usbdi.c:1.161 Tue Aug 5 06:35:24 2014 +++ src/sys/dev/usb/usbdi.c Wed Feb 11 09:32:19 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: usbdi.c,v 1.161 2014/08/05 06:35:24 skrll Exp $ */ +/* $NetBSD: usbdi.c,v 1.161.2.1 2015/02/11 09:32:19 martin Exp $ */ /* * Copyright (c) 1998, 2012 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: usbdi.c,v 1.161 2014/08/05 06:35:24 skrll Exp $); +__KERNEL_RCSID(0, $NetBSD: usbdi.c,v 1.161.2.1 2015/02/11 09:32:19 martin Exp $); #ifdef _KERNEL_OPT #include opt_compat_netbsd.h @@ -806,13 +806,13 @@ usb_transfer_complete(usbd_xfer_handle x if (!(xfer-flags USBD_NO_COPY) xfer-actlen != 0 usbd_xfer_isread(xfer)) { -#ifdef DIAGNOSTIC if (xfer-actlen xfer-length) { +#ifdef DIAGNOSTIC printf(%s: actlen (%d) len (%d)\n, __func__, xfer-actlen, xfer-length); +#endif xfer-actlen = xfer-length; } -#endif memcpy(xfer-buffer, KERNADDR(dmap, 0), xfer-actlen); }
CVS commit: [netbsd-7] src/sys/dev/usb
Module Name:src Committed By: martin Date: Mon Feb 9 09:43:10 UTC 2015 Modified Files: src/sys/dev/usb [netbsd-7]: hid.c Log Message: Pull up following revision(s) (requested by jmcneill in ticket #500): sys/dev/usb/hid.c: revision 1.36 From FreeBSD via OpenBSD: Global Item #3 should be Physical Minimum not Maximum according to the HID spec. To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.35.14.1 src/sys/dev/usb/hid.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/hid.c diff -u src/sys/dev/usb/hid.c:1.35 src/sys/dev/usb/hid.c:1.35.14.1 --- src/sys/dev/usb/hid.c:1.35 Fri Feb 24 06:48:23 2012 +++ src/sys/dev/usb/hid.c Mon Feb 9 09:43:09 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: hid.c,v 1.35 2012/02/24 06:48:23 mrg Exp $ */ +/* $NetBSD: hid.c,v 1.35.14.1 2015/02/09 09:43:09 martin Exp $ */ /* $FreeBSD: src/sys/dev/usb/hid.c,v 1.11 1999/11/17 22:33:39 n_hibma Exp $ */ /* @@ -32,7 +32,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: hid.c,v 1.35 2012/02/24 06:48:23 mrg Exp $); +__KERNEL_RCSID(0, $NetBSD: hid.c,v 1.35.14.1 2015/02/09 09:43:09 martin Exp $); #include sys/param.h #include sys/systm.h @@ -267,7 +267,7 @@ hid_get_item(struct hid_data *s, struct c-logical_maximum = dval; break; case 3: -c-physical_maximum = dval; +c-physical_minimum = dval; break; case 4: c-physical_maximum = dval;
CVS commit: [netbsd-7] src/sys/dev/usb
Module Name:src Committed By: martin Date: Fri Jan 16 08:30:42 UTC 2015 Modified Files: src/sys/dev/usb [netbsd-7]: udl.c usbdevs Log Message: Pull up following revision(s) (requested by dholland in ticket #420): sys/dev/usb/udl.c: revision 1.12 sys/dev/usb/usbdevs: revision 1.685 Add BUFFALO GX-DVI/U2B DisplayLink USB-DVI box. PR#49105 from MOCHIDA Shuji. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.11.4.1 src/sys/dev/usb/udl.c cvs rdiff -u -r1.680.2.1 -r1.680.2.2 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/udl.c diff -u src/sys/dev/usb/udl.c:1.11 src/sys/dev/usb/udl.c:1.11.4.1 --- src/sys/dev/usb/udl.c:1.11 Sun Feb 23 13:22:32 2014 +++ src/sys/dev/usb/udl.c Fri Jan 16 08:30:42 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: udl.c,v 1.11 2014/02/23 13:22:32 skrll Exp $ */ +/* $NetBSD: udl.c,v 1.11.4.1 2015/01/16 08:30:42 martin Exp $ */ /*- * Copyright (c) 2009 FUKAUMI Naoki. @@ -53,7 +53,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: udl.c,v 1.11 2014/02/23 13:22:32 skrll Exp $); +__KERNEL_RCSID(0, $NetBSD: udl.c,v 1.11.4.1 2015/01/16 08:30:42 martin Exp $); #include sys/param.h #include sys/device.h @@ -314,6 +314,7 @@ static const struct usb_devno udl_devs[] { USB_VENDOR_DISPLAYLINK, USB_PRODUCT_DISPLAYLINK_WSDVI }, { USB_VENDOR_DISPLAYLINK, USB_PRODUCT_DISPLAYLINK_EC008 }, { USB_VENDOR_DISPLAYLINK, USB_PRODUCT_DISPLAYLINK_GXDVIU2 }, + { USB_VENDOR_DISPLAYLINK, USB_PRODUCT_DISPLAYLINK_GXDVIU2B }, { USB_VENDOR_DISPLAYLINK, USB_PRODUCT_DISPLAYLINK_LCD4300U }, { USB_VENDOR_DISPLAYLINK, USB_PRODUCT_DISPLAYLINK_LCD8000U }, { USB_VENDOR_DISPLAYLINK, USB_PRODUCT_DISPLAYLINK_HPDOCK }, Index: src/sys/dev/usb/usbdevs diff -u src/sys/dev/usb/usbdevs:1.680.2.1 src/sys/dev/usb/usbdevs:1.680.2.2 --- src/sys/dev/usb/usbdevs:1.680.2.1 Wed Oct 15 08:43:08 2014 +++ src/sys/dev/usb/usbdevs Fri Jan 16 08:30:42 2015 @@ -1,4 +1,4 @@ -$NetBSD: usbdevs,v 1.680.2.1 2014/10/15 08:43:08 martin Exp $ +$NetBSD: usbdevs,v 1.680.2.2 2015/01/16 08:30:42 martin Exp $ /* * Copyright (c) 1998-2004 The NetBSD Foundation, Inc. @@ -1299,6 +1299,7 @@ product DISPLAYLINK HPDOCK 0x01d4 HP USB product DISPLAYLINK NL571 0x01d7 HP USB DVI product DISPLAYLINK M01061 0x01e2 Lenovo DVI product DISPLAYLINK NBDOCK 0x0215 VideoHome NBdock1920 +product DISPLAYLINK GXDVIU2B 0x0223 BUFFALO GX-DVI/U2B product DISPLAYLINK SWDVI 0x024c SUNWEIT DVI product DISPLAYLINK LUM70 0x02a9 Lilliput UM-70 product DISPLAYLINK LCD8000UD_DVI 0x02b8 LCD-8000UD-DVI
CVS commit: [netbsd-7] src/sys/dev/usb
Module Name:src Committed By: martin Date: Fri Jan 16 08:31:31 UTC 2015 Modified Files: src/sys/dev/usb [netbsd-7]: usbdevs.h usbdevs_data.h Log Message: regen To generate a diff of this commit: cvs rdiff -u -r1.672.2.1 -r1.672.2.2 src/sys/dev/usb/usbdevs.h cvs rdiff -u -r1.673.2.1 -r1.673.2.2 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.1 src/sys/dev/usb/usbdevs.h:1.672.2.2 --- src/sys/dev/usb/usbdevs.h:1.672.2.1 Wed Oct 15 08:44:36 2014 +++ src/sys/dev/usb/usbdevs.h Fri Jan 16 08:31:31 2015 @@ -1,10 +1,10 @@ -/* $NetBSD: usbdevs.h,v 1.672.2.1 2014/10/15 08:44:36 martin Exp $ */ +/* $NetBSD: usbdevs.h,v 1.672.2.2 2015/01/16 08:31:31 martin Exp $ */ /* * THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. * * generated from: - * NetBSD: usbdevs,v 1.680.2.1 2014/10/15 08:43:08 martin Exp + * NetBSD: usbdevs,v 1.680.2.2 2015/01/16 08:30:42 martin Exp */ /* @@ -1306,6 +1306,7 @@ #define USB_PRODUCT_DISPLAYLINK_NL571 0x01d7 /* HP USB DVI */ #define USB_PRODUCT_DISPLAYLINK_M01061 0x01e2 /* Lenovo DVI */ #define USB_PRODUCT_DISPLAYLINK_NBDOCK 0x0215 /* VideoHome NBdock1920 */ +#define USB_PRODUCT_DISPLAYLINK_GXDVIU2B 0x0223 /* BUFFALO GX-DVI/U2B */ #define USB_PRODUCT_DISPLAYLINK_SWDVI 0x024c /* SUNWEIT DVI */ #define USB_PRODUCT_DISPLAYLINK_LUM70 0x02a9 /* Lilliput UM-70 */ #define USB_PRODUCT_DISPLAYLINK_LCD8000UD_DVI 0x02b8 /* LCD-8000UD-DVI */ Index: src/sys/dev/usb/usbdevs_data.h diff -u src/sys/dev/usb/usbdevs_data.h:1.673.2.1 src/sys/dev/usb/usbdevs_data.h:1.673.2.2 --- src/sys/dev/usb/usbdevs_data.h:1.673.2.1 Wed Oct 15 08:44:36 2014 +++ src/sys/dev/usb/usbdevs_data.h Fri Jan 16 08:31:31 2015 @@ -1,10 +1,10 @@ -/* $NetBSD: usbdevs_data.h,v 1.673.2.1 2014/10/15 08:44:36 martin Exp $ */ +/* $NetBSD: usbdevs_data.h,v 1.673.2.2 2015/01/16 08:31:31 martin Exp $ */ /* * THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. * * generated from: - * NetBSD: usbdevs,v 1.680.2.1 2014/10/15 08:43:08 martin Exp + * NetBSD: usbdevs,v 1.680.2.2 2015/01/16 08:30:42 martin Exp */ /* @@ -4211,6 +4211,10 @@ const struct usb_product usb_products[] VideoHome NBdock1920, }, { + USB_VENDOR_DISPLAYLINK, USB_PRODUCT_DISPLAYLINK_GXDVIU2B, + BUFFALO GX-DVI/U2B, + }, + { USB_VENDOR_DISPLAYLINK, USB_PRODUCT_DISPLAYLINK_SWDVI, SUNWEIT DVI, }, @@ -10191,4 +10195,4 @@ const struct usb_product usb_products[] Prestige, }, }; -const int usb_nproducts = 2007; +const int usb_nproducts = 2008;
CVS commit: [netbsd-7] src/sys/dev/usb
Module Name:src Committed By: martin Date: Fri Jan 2 22:44:34 UTC 2015 Modified Files: src/sys/dev/usb [netbsd-7]: xhci.c xhcireg.h Log Message: Pull up following revision(s) (requested by skrll in ticket #372): sys/dev/usb/xhcireg.h: revision 1.2 sys/dev/usb/xhci.c: revision 1.28 kern/49391: Fixes to XHCI driver command ring and status TRB CRCR needs 64byte aligned address Use usb_allocmem instead of usb_allocmem_flags(..., 0) Correct status stage TRB in xhci_device_ctrl_start - direction logic was wrong. Correct a typo in a comment To generate a diff of this commit: cvs rdiff -u -r1.23.2.2 -r1.23.2.3 src/sys/dev/usb/xhci.c cvs rdiff -u -r1.1 -r1.1.10.1 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/xhci.c diff -u src/sys/dev/usb/xhci.c:1.23.2.2 src/sys/dev/usb/xhci.c:1.23.2.3 --- src/sys/dev/usb/xhci.c:1.23.2.2 Wed Aug 13 21:47:18 2014 +++ src/sys/dev/usb/xhci.c Fri Jan 2 22:44:34 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: xhci.c,v 1.23.2.2 2014/08/13 21:47:18 riz Exp $ */ +/* $NetBSD: xhci.c,v 1.23.2.3 2015/01/02 22:44:34 martin Exp $ */ /* * Copyright (c) 2013 Jonathan A. Kollasch @@ -27,7 +27,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: xhci.c,v 1.23.2.2 2014/08/13 21:47:18 riz Exp $); +__KERNEL_RCSID(0, $NetBSD: xhci.c,v 1.23.2.3 2015/01/02 22:44:34 martin Exp $); #include sys/param.h #include sys/systm.h @@ -1338,7 +1338,7 @@ xhci_allocm(struct usbd_bus *bus, usb_dm DPRINTF((%s\n, __func__)); - err = usb_allocmem_flags(sc-sc_bus, size, 0, dma, 0); + err = usb_allocmem(sc-sc_bus, size, 0, dma); #if 0 if (err == USBD_NOMEM) err = usb_reserve_allocm(sc-sc_dma_reserve, dma, size); @@ -2433,7 +2433,7 @@ xhci_root_ctrl_done(usbd_xfer_handle xfe xfer-hcpriv = NULL; } -/* root hub intrerrupt */ +/* root hub interrupt */ static usbd_status xhci_root_intr_transfer(usbd_xfer_handle xfer) @@ -2589,9 +2589,9 @@ xhci_device_ctrl_start(usbd_xfer_handle no_data: parameter = 0; - status = XHCI_TRB_2_IRQ_SET(0) | XHCI_TRB_2_TDSZ_SET(1); + status = XHCI_TRB_2_IRQ_SET(0); /* the status stage has inverted direction */ - control = (isread ? 0 : XHCI_TRB_3_DIR_IN) | + control = ((isread (len 0)) ? 0 : XHCI_TRB_3_DIR_IN) | XHCI_TRB_3_TYPE_SET(XHCI_TRB_TYPE_STATUS_STAGE) | XHCI_TRB_3_CHAIN_BIT | XHCI_TRB_3_ENT_BIT; xhci_trb_put(xx-xx_trb[i++], parameter, status, control); Index: src/sys/dev/usb/xhcireg.h diff -u src/sys/dev/usb/xhcireg.h:1.1 src/sys/dev/usb/xhcireg.h:1.1.10.1 --- src/sys/dev/usb/xhcireg.h:1.1 Sat Sep 14 00:40:31 2013 +++ src/sys/dev/usb/xhcireg.h Fri Jan 2 22:44:34 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: xhcireg.h,v 1.1 2013/09/14 00:40:31 jakllsch Exp $ */ +/* $NetBSD: xhcireg.h,v 1.1.10.1 2015/01/02 22:44:34 martin Exp $ */ /* $FreeBSD$ */ /*- @@ -212,7 +212,7 @@ #define XHCI_STREAM_CONTEXT_ALIGN 16 #define XHCI_STREAM_ARRAY_ALIGN 16 #define XHCI_TRANSFER_RING_SEGMENTS_ALIGN 16 -#define XHCI_COMMAND_RING_SEGMENTS_ALIGN 16 +#define XHCI_COMMAND_RING_SEGMENTS_ALIGN 64 #define XHCI_EVENT_RING_SEGMENTS_ALIGN 64 #define XHCI_EVENT_RING_SEGMENT_TABLE_ALIGN 64 #define XHCI_SCRATCHPAD_BUFFER_ARRAY_ALIGN 64
CVS commit: [netbsd-7] src/sys/dev/usb
Module Name:src Committed By: martin Date: Wed Oct 15 08:43:08 UTC 2014 Modified Files: src/sys/dev/usb [netbsd-7]: u3g.c usbdevs Log Message: Pull up following revision(s) (requested by christos in ticket #142): sys/dev/usb/u3g.c: revision 1.31 sys/dev/usb/usbdevs: revision 1.681 sys/dev/usb/usbdevs: revision 1.682 PR/49233: Ben Gergely: Add huawei e353 to u3g (factor out some common code in the process) To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.30.4.1 src/sys/dev/usb/u3g.c cvs rdiff -u -r1.680 -r1.680.2.1 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/u3g.c diff -u src/sys/dev/usb/u3g.c:1.30 src/sys/dev/usb/u3g.c:1.30.4.1 --- src/sys/dev/usb/u3g.c:1.30 Mon Sep 2 07:39:03 2013 +++ src/sys/dev/usb/u3g.c Wed Oct 15 08:43:08 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: u3g.c,v 1.30 2013/09/02 07:39:03 christos Exp $ */ +/* $NetBSD: u3g.c,v 1.30.4.1 2014/10/15 08:43:08 martin Exp $ */ /*- * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -50,7 +50,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: u3g.c,v 1.30 2013/09/02 07:39:03 christos Exp $); +__KERNEL_RCSID(0, $NetBSD: u3g.c,v 1.30.4.1 2014/10/15 08:43:08 martin Exp $); #include sys/param.h #include sys/systm.h @@ -192,6 +192,7 @@ static const struct usb_devno u3g_devs[] { USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_K3765 }, { USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_MOBILE }, { USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_E171 }, + { USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_E353 }, /* OEM: Merlin */ { USB_VENDOR_MERLIN, USB_PRODUCT_MERLIN_V620 }, /* OEM: Novatel */ @@ -334,6 +335,16 @@ send_bulkmsg(usbd_device_handle dev, voi return (err == USBD_NORMAL_COMPLETION ? UMATCH_HIGHEST : UMATCH_NONE); } +/* Byte 0..3: Command Block Wrapper (CBW) signature */ +static void +set_cbw(unsigned char *cmd) +{ + cmd[0] = 0x55; + cmd[1] = 0x53; + cmd[2] = 0x42; + cmd[3] = 0x43; +} + static int u3g_bulk_scsi_eject(usbd_device_handle dev) { @@ -341,10 +352,7 @@ u3g_bulk_scsi_eject(usbd_device_handle d memset(cmd, 0, sizeof(cmd)); /* Byte 0..3: Command Block Wrapper (CBW) signature */ - cmd[0] = 0x55; - cmd[1] = 0x53; - cmd[2] = 0x42; - cmd[3] = 0x43; + set_cbw(cmd); /* 4..7: CBW Tag, has to unique, but only a single transfer used. */ cmd[4] = 0x01; /* 8..11: CBW Transfer Length, no data here */ @@ -372,10 +380,7 @@ u3g_bulk_ata_eject(usbd_device_handle de memset(cmd, 0, sizeof(cmd)); /* Byte 0..3: Command Block Wrapper (CBW) signature */ - cmd[0] = 0x55; - cmd[1] = 0x53; - cmd[2] = 0x42; - cmd[3] = 0x43; + set_cbw(cmd); /* 4..7: CBW Tag, has to unique, but only a single transfer used. */ cmd[4] = 0x01; /* 8..11: CBW Transfer Length, no data here */ @@ -455,16 +460,14 @@ u3g_huawei_k3765_reinit(usbd_device_hand /* magic string adapted from some webpage */ memset(cmd, 0, sizeof(cmd)); - cmd[0] = 0x55; - cmd[1] = 0x53; - cmd[2] = 0x42; - cmd[3] = 0x43; + /* Byte 0..3: Command Block Wrapper (CBW) signature */ + set_cbw(cmd); + cmd[15]= 0x11; cmd[16]= 0x06; return send_bulkmsg(dev, cmd, sizeof(cmd)); } - static int u3g_huawei_e171_reinit(usbd_device_handle dev) { @@ -472,10 +475,9 @@ u3g_huawei_e171_reinit(usbd_device_handl /* magic string adapted from some webpage */ memset(cmd, 0, sizeof(cmd)); - cmd[0] = 0x55; - cmd[1] = 0x53; - cmd[2] = 0x42; - cmd[3] = 0x43; + /* Byte 0..3: Command Block Wrapper (CBW) signature */ + set_cbw(cmd); + cmd[15]= 0x11; cmd[16]= 0x06; cmd[17]= 0x20; @@ -485,6 +487,28 @@ u3g_huawei_e171_reinit(usbd_device_handl } static int +u3g_huawei_e353_reinit(usbd_device_handle dev) +{ + unsigned char cmd[31]; + + /* magic string adapted from some webpage */ + memset(cmd, 0, sizeof(cmd)); + /* Byte 0..3: Command Block Wrapper (CBW) signature */ + set_cbw(cmd); + + cmd[4] = 0x7f; + cmd[9] = 0x02; + cmd[12] = 0x80; + cmd[14] = 0x0a; + cmd[15] = 0x11; + cmd[16] = 0x06; + cmd[17] = 0x20; + cmd[23] = 0x01; + + return send_bulkmsg(dev, cmd, sizeof(cmd)); +} + +static int u3g_sierra_reinit(usbd_device_handle dev) { /* Some Sierra devices presents themselves as a umass device with @@ -508,12 +532,25 @@ static int u3g_4gsystems_reinit(usbd_device_handle dev) { /* magic string adapted from usb_modeswitch database */ - static unsigned char cmd[31] = { - 0x55, 0x53, 0x42, 0x43, 0x12, 0x34, 0x56, 0x78, 0x80, 0x00, - 0x00, 0x00, 0x80, 0x00, 0x06, 0x06, 0xf5, 0x04, 0x02, 0x52, - 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00 - }; + unsigned char cmd[31]; + + memset(cmd, 0, sizeof(cmd)); + /* Byte 0..3: Command Block Wrapper (CBW) signature */ + set_cbw(cmd); + + cmd[4] = 0x12; + cmd[5] = 0x34; + cmd[6] = 0x56; + cmd[7] = 0x78; + cmd[8] = 0x80; + cmd[12] = 0x80; + cmd[14] = 0x06; + cmd[15] = 0x06; + cmd[16] = 0xf5; + cmd[17] = 0x04; + cmd[18] = 0x02; + cmd[19] = 0x52; +
CVS commit: [netbsd-7] src/sys/dev/usb
Module Name:src Committed By: martin Date: Wed Oct 15 08:44:36 UTC 2014 Modified Files: src/sys/dev/usb [netbsd-7]: usbdevs.h usbdevs_data.h Log Message: regen for #142 To generate a diff of this commit: cvs rdiff -u -r1.672 -r1.672.2.1 src/sys/dev/usb/usbdevs.h cvs rdiff -u -r1.673 -r1.673.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 src/sys/dev/usb/usbdevs.h:1.672.2.1 --- src/sys/dev/usb/usbdevs.h:1.672 Mon Aug 4 20:01:12 2014 +++ src/sys/dev/usb/usbdevs.h Wed Oct 15 08:44:36 2014 @@ -1,10 +1,10 @@ -/* $NetBSD: usbdevs.h,v 1.672 2014/08/04 20:01:12 jdc Exp $ */ +/* $NetBSD: usbdevs.h,v 1.672.2.1 2014/10/15 08:44:36 martin Exp $ */ /* * THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. * * generated from: - * NetBSD: usbdevs,v 1.680 2014/08/04 19:59:37 jdc Exp + * NetBSD: usbdevs,v 1.680.2.1 2014/10/15 08:43:08 martin Exp */ /* @@ -1740,7 +1740,9 @@ #define USB_PRODUCT_HUAWEI_E1820 0x14ac /* Huawei E1820 */ #define USB_PRODUCT_HUAWEI_E171INIT 0x14fe /* Huawei E171 USB CD */ #define USB_PRODUCT_HUAWEI_E171 0x1506 /* Huawei E171 */ +#define USB_PRODUCT_HUAWEI_E353 0x1507 /* Huawei E353 */ #define USB_PRODUCT_HUAWEI_K3765INIT 0x1520 /* Huawei K3765 USB CD */ +#define USB_PRODUCT_HUAWEI_E353INIT 0x1f01 /* Huawei E353 USB CD */ /* Huawei-3Com products */ #define USB_PRODUCT_HUAWEI3COM_RT2573 0x0009 /* RT2573 */ Index: src/sys/dev/usb/usbdevs_data.h diff -u src/sys/dev/usb/usbdevs_data.h:1.673 src/sys/dev/usb/usbdevs_data.h:1.673.2.1 --- src/sys/dev/usb/usbdevs_data.h:1.673 Mon Aug 4 20:01:12 2014 +++ src/sys/dev/usb/usbdevs_data.h Wed Oct 15 08:44:36 2014 @@ -1,10 +1,10 @@ -/* $NetBSD: usbdevs_data.h,v 1.673 2014/08/04 20:01:12 jdc Exp $ */ +/* $NetBSD: usbdevs_data.h,v 1.673.2.1 2014/10/15 08:44:36 martin Exp $ */ /* * THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. * * generated from: - * NetBSD: usbdevs,v 1.680 2014/08/04 19:59:37 jdc Exp + * NetBSD: usbdevs,v 1.680.2.1 2014/10/15 08:43:08 martin Exp */ /* @@ -5459,10 +5459,18 @@ const struct usb_product usb_products[] Huawei E171, }, { + USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_E353, + Huawei E353, + }, + { USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_K3765INIT, Huawei K3765 USB CD, }, { + USB_VENDOR_HUAWEI, USB_PRODUCT_HUAWEI_E353INIT, + Huawei E353 USB CD, + }, + { USB_VENDOR_HUAWEI3COM, USB_PRODUCT_HUAWEI3COM_RT2573, RT2573, }, @@ -10183,4 +10191,4 @@ const struct usb_product usb_products[] Prestige, }, }; -const int usb_nproducts = 2005; +const int usb_nproducts = 2007;
CVS commit: [netbsd-7] src/sys/dev/usb
Module Name:src Committed By: martin Date: Mon Sep 22 11:11:10 UTC 2014 Modified Files: src/sys/dev/usb [netbsd-7]: if_smsc.c Log Message: Pull up following revision(s) (requested by jmcneill in ticket #113): sys/dev/usb/if_smsc.c: revision 1.22 if the pkt length in rx header is ETHER_HDR_LEN, drop it To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.19.2.1 src/sys/dev/usb/if_smsc.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_smsc.c diff -u src/sys/dev/usb/if_smsc.c:1.19 src/sys/dev/usb/if_smsc.c:1.19.2.1 --- src/sys/dev/usb/if_smsc.c:1.19 Sun Aug 10 16:44:36 2014 +++ src/sys/dev/usb/if_smsc.c Mon Sep 22 11:11:10 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: if_smsc.c,v 1.19 2014/08/10 16:44:36 tls Exp $ */ +/* $NetBSD: if_smsc.c,v 1.19.2.1 2014/09/22 11:11:10 martin Exp $ */ /* $OpenBSD: if_smsc.c,v 1.4 2012/09/27 12:38:11 jsg Exp $ */ /* $FreeBSD: src/sys/dev/usb/net/if_smsc.c,v 1.1 2012/08/15 04:03:55 gonzo Exp $ */ @@ -1303,6 +1303,13 @@ smsc_rxeof(usbd_xfer_handle xfer, usbd_p smsc_dbg_printf(sc, rxeof total_len %d pktlen %d rxhdr 0x%08x\n, total_len, pktlen, rxhdr); + if (pktlen ETHER_HDR_LEN) { + smsc_dbg_printf(sc, pktlen %d ETHER_HDR_LEN %d\n, + pktlen, ETHER_HDR_LEN); + ifp-if_ierrors++; + goto done; + } + pktlen += ETHER_ALIGN; if (pktlen MCLBYTES) {
CVS commit: [netbsd-7] src/sys/dev/usb
Module Name:src Committed By: riz Date: Sun Aug 31 17:18:15 UTC 2014 Modified Files: src/sys/dev/usb [netbsd-7]: umcs.c Log Message: Pull up following revision(s) (requested by martin in ticket #58): sys/dev/usb/umcs.c: revision 1.8 Fix a few logical vs. physical port number confusions to make this driver work with two port variants. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.7.6.1 src/sys/dev/usb/umcs.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/umcs.c diff -u src/sys/dev/usb/umcs.c:1.7 src/sys/dev/usb/umcs.c:1.7.6.1 --- src/sys/dev/usb/umcs.c:1.7 Mon May 5 20:56:15 2014 +++ src/sys/dev/usb/umcs.c Sun Aug 31 17:18:15 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: umcs.c,v 1.7 2014/05/05 20:56:15 joerg Exp $ */ +/* $NetBSD: umcs.c,v 1.7.6.1 2014/08/31 17:18:15 riz Exp $ */ /* $FreeBSD: head/sys/dev/usb/serial/umcs.c 260559 2014-01-12 11:44:28Z hselasky $ */ /*- @@ -41,7 +41,7 @@ * */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: umcs.c,v 1.7 2014/05/05 20:56:15 joerg Exp $); +__KERNEL_RCSID(0, $NetBSD: umcs.c,v 1.7.6.1 2014/08/31 17:18:15 riz Exp $); #include sys/param.h #include sys/systm.h @@ -420,7 +420,8 @@ umcs7840_set_UART_reg(struct umcs7840_so } static int -umcs7840_set_baudrate(struct umcs7840_softc *sc, uint8_t portno, uint32_t rate) +umcs7840_set_baudrate(struct umcs7840_softc *sc, uint8_t portno, + uint32_t rate) { int err; uint16_t divisor; @@ -434,7 +435,8 @@ umcs7840_set_baudrate(struct umcs7840_so return (-1); } if (divisor == 0 || (clk MCS7840_DEV_SPx_CLOCK_MASK) != clk) { - DPRINTF((Port %d bad speed calculation: %d\n, portno, rate)); + DPRINTF((Port %d bad speed calculation: %d\n, portno, + rate)); return (-1); } DPRINTF((Port %d set speed: %d (%02x / %d)\n, portno, rate, clk, divisor)); @@ -585,20 +587,19 @@ static void umcs7840_set(void *self, int portno, int reg, int onoff) { struct umcs7840_softc *sc = self; - int pn = sc-sc_ports[portno].sc_port_phys; if (sc-sc_dying) return; switch (reg) { case UCOM_SET_DTR: - umcs7840_dtr(sc, pn, onoff); + umcs7840_dtr(sc, portno, onoff); break; case UCOM_SET_RTS: - umcs7840_rts(sc, pn, onoff); + umcs7840_rts(sc, portno, onoff); break; case UCOM_SET_BREAK: - umcs7840_break(sc, pn, onoff); + umcs7840_break(sc, portno, onoff); break; default: break; @@ -665,7 +666,7 @@ umcs7840_param(void *self, int portno, s umcs7840_set_UART_reg(sc, pn, MCS7840_UART_REG_MCR, sc-sc_ports[pn].sc_port_mcr); - if (umcs7840_set_baudrate(sc, pn, t-c_ospeed)) + if (umcs7840_set_baudrate(sc, portno, t-c_ospeed)) return EIO; return 0; @@ -804,7 +805,7 @@ umcs7840_port_open(void *self, int portn return EIO; /* Set speed 9600 */ - if (umcs7840_set_baudrate(sc, pn, 9600)) + if (umcs7840_set_baudrate(sc, portno, 9600)) return EIO;
CVS commit: [netbsd-7] src/sys/dev/usb
Module Name:src Committed By: martin Date: Thu Aug 14 06:56:55 UTC 2014 Modified Files: src/sys/dev/usb [netbsd-7]: usb.h Log Message: Pull up following revision(s) (requested by skrll in ticket #10): sys/dev/usb/usb.h: revision 1.107 Define AXEN_DEBUG. From Takahiro HAYASHI. To generate a diff of this commit: cvs rdiff -u -r1.106.4.1 -r1.106.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.1 src/sys/dev/usb/usb.h:1.106.4.2 --- src/sys/dev/usb/usb.h:1.106.4.1 Wed Aug 13 21:50:39 2014 +++ src/sys/dev/usb/usb.h Thu Aug 14 06:56:55 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: usb.h,v 1.106.4.1 2014/08/13 21:50:39 riz Exp $ */ +/* $NetBSD: usb.h,v 1.106.4.2 2014/08/14 06:56:55 martin Exp $ */ /* $FreeBSD: src/sys/dev/usb/usb.h,v 1.14 1999/11/17 22:33:46 n_hibma Exp $ */ /* @@ -60,6 +60,7 @@ MALLOC_DECLARE(M_USBHC); #define AUE_DEBUG 1 #define AUVITEK_I2C_DEBUG 1 #define AXE_DEBUG 1 +#define AXEN_DEBUG 1 #define CUE_DEBUG 1 #define DWC2_DEBUG 1 #define EHCI_DEBUG 1
CVS commit: [netbsd-7] src/sys/dev/usb
Module Name:src Committed By: riz Date: Wed Aug 13 21:47:18 UTC 2014 Modified Files: src/sys/dev/usb [netbsd-7]: xhci.c Log Message: Pull up following revision(s) (requested by skrll in ticket #11): sys/dev/usb/xhci.c: revision 1.25 Serialise xhci_intr1 calls with sc_intr_lock. From Takahiro HAYASHI. To generate a diff of this commit: cvs rdiff -u -r1.23.2.1 -r1.23.2.2 src/sys/dev/usb/xhci.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/xhci.c diff -u src/sys/dev/usb/xhci.c:1.23.2.1 src/sys/dev/usb/xhci.c:1.23.2.2 --- src/sys/dev/usb/xhci.c:1.23.2.1 Mon Aug 11 15:36:45 2014 +++ src/sys/dev/usb/xhci.c Wed Aug 13 21:47:18 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: xhci.c,v 1.23.2.1 2014/08/11 15:36:45 martin Exp $ */ +/* $NetBSD: xhci.c,v 1.23.2.2 2014/08/13 21:47:18 riz Exp $ */ /* * Copyright (c) 2013 Jonathan A. Kollasch @@ -27,7 +27,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: xhci.c,v 1.23.2.1 2014/08/11 15:36:45 martin Exp $); +__KERNEL_RCSID(0, $NetBSD: xhci.c,v 1.23.2.2 2014/08/13 21:47:18 riz Exp $); #include sys/param.h #include sys/systm.h @@ -853,10 +853,16 @@ int xhci_intr(void *v) { struct xhci_softc * const sc = v; + int ret = 0; - if (sc == NULL || sc-sc_dying || !device_has_power(sc-sc_dev)) + if (sc == NULL) return 0; + mutex_spin_enter(sc-sc_intr_lock); + + if (sc-sc_dying || !device_has_power(sc-sc_dev)) + goto done; + DPRINTF((%s: %s\n, __func__, device_xname(sc-sc_dev))); /* If we get an interrupt while polling, then just ignore it. */ @@ -864,10 +870,13 @@ xhci_intr(void *v) #ifdef DIAGNOSTIC DPRINTFN(16, (xhci_intr: ignored interrupt while polling\n)); #endif - return 0; + goto done; } - return xhci_intr1(sc); + ret = xhci_intr1(sc); +done: + mutex_spin_exit(sc-sc_intr_lock); + return ret; } int @@ -1314,7 +1323,9 @@ xhci_poll(struct usbd_bus *bus) DPRINTF((%s: %s\n, __func__, device_xname(sc-sc_dev))); + mutex_spin_enter(sc-sc_intr_lock); xhci_intr1(sc); + mutex_spin_exit(sc-sc_intr_lock); return; }
CVS commit: [netbsd-7] src/sys/dev/usb
Module Name:src Committed By: riz Date: Wed Aug 13 21:50:39 UTC 2014 Modified Files: src/sys/dev/usb [netbsd-7]: files.usb usb.h Log Message: Pull up following revision(s) (requested by skrll in ticket #12): sys/dev/usb/files.usb: revision 1.133 sys/dev/usb/usb.h: revision 1.108 Add XHCI_DEBUG. From Takahiro HAYASHI with tweaks from me. One day someone(tm) will tidyup USB debug stuff. To generate a diff of this commit: cvs rdiff -u -r1.132 -r1.132.2.1 src/sys/dev/usb/files.usb cvs rdiff -u -r1.106 -r1.106.4.1 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/files.usb diff -u src/sys/dev/usb/files.usb:1.132 src/sys/dev/usb/files.usb:1.132.2.1 --- src/sys/dev/usb/files.usb:1.132 Sat Apr 5 23:47:26 2014 +++ src/sys/dev/usb/files.usb Wed Aug 13 21:50:39 2014 @@ -1,4 +1,4 @@ -# $NetBSD: files.usb,v 1.132 2014/04/05 23:47:26 khorben Exp $ +# $NetBSD: files.usb,v 1.132.2.1 2014/08/13 21:50:39 riz Exp $ # # Config file and device description for machine-independent USB code. # Included by ports that need it. Ports that use it must provide @@ -6,7 +6,8 @@ defflag USBVERBOSE defflag opt_usb.h USB_FRAG_DMA_WORKAROUND -defflag opt_usb.h EHCI_DEBUG OHCI_DEBUG UHCI_DEBUG UHUB_DEBUG USB_DEBUG +defflag opt_usb.h UHUB_DEBUG USB_DEBUG +defflag opt_usb.h EHCI_DEBUG OHCI_DEBUG UHCI_DEBUG XHCI_DEBUG defflag opt_umodem.h UMODEM_DEBUG defflag opt_uvideo.h UVIDEO_DEBUG Index: src/sys/dev/usb/usb.h diff -u src/sys/dev/usb/usb.h:1.106 src/sys/dev/usb/usb.h:1.106.4.1 --- src/sys/dev/usb/usb.h:1.106 Fri Nov 1 14:32:54 2013 +++ src/sys/dev/usb/usb.h Wed Aug 13 21:50:39 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: usb.h,v 1.106 2013/11/01 14:32:54 skrll Exp $ */ +/* $NetBSD: usb.h,v 1.106.4.1 2014/08/13 21:50:39 riz Exp $ */ /* $FreeBSD: src/sys/dev/usb/usb.h,v 1.14 1999/11/17 22:33:46 n_hibma Exp $ */ /* @@ -125,6 +125,7 @@ MALLOC_DECLARE(M_USBHC); #define UVSCOM_DEBUG 1 #define UYUREX_DEBUG 1 #define UZCOM_DEBUG 1 +#define XHCI_DEBUG 1 #define ZYD_DEBUG 1 #define Static #else
CVS commit: [netbsd-7] src/sys/dev/usb
Module Name:src Committed By: martin Date: Tue Aug 12 10:22:54 UTC 2014 Modified Files: src/sys/dev/usb [netbsd-7]: motg.c Log Message: Pull up following revision(s) (requested by skrll in ticket #6): sys/dev/usb/motg.c: revision 1.7 sys/dev/usb/motg.c: revision 1.8 Trailing whitespace. Make this compile when DIAGNOSTIC isn't defined. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.6.4.1 src/sys/dev/usb/motg.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/motg.c diff -u src/sys/dev/usb/motg.c:1.6 src/sys/dev/usb/motg.c:1.6.4.1 --- src/sys/dev/usb/motg.c:1.6 Tue Aug 5 06:35:55 2014 +++ src/sys/dev/usb/motg.c Tue Aug 12 10:22:54 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: motg.c,v 1.6 2014/08/05 06:35:55 skrll Exp $ */ +/* $NetBSD: motg.c,v 1.6.4.1 2014/08/12 10:22:54 martin Exp $ */ /* * Copyright (c) 1998, 2004, 2011, 2012, 2014 The NetBSD Foundation, Inc. @@ -40,7 +40,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: motg.c,v 1.6 2014/08/05 06:35:55 skrll Exp $); +__KERNEL_RCSID(0, $NetBSD: motg.c,v 1.6.4.1 2014/08/12 10:22:54 martin Exp $); #include sys/param.h #include sys/systm.h @@ -182,7 +182,7 @@ UREAD4(struct motg_softc *sc, bus_size_t #endif static void -musbotg_pull_common(struct motg_softc *sc, uint8_t on) +musbotg_pull_common(struct motg_softc *sc, uint8_t on) { uint8_t val; @@ -259,7 +259,7 @@ motg_init(struct motg_softc *sc) UWRITE2(sc, MUSB2_REG_INTRXE, 0); /* disable pullup */ - musbotg_pull_common(sc, 0); + musbotg_pull_common(sc, 0); /* disable double packet buffering XXX what's this ? */ UWRITE2(sc, MUSB2_REG_RXDBDIS, 0x); @@ -288,11 +288,11 @@ motg_init(struct motg_softc *sc) UWRITE1(sc, MUSB2_REG_TESTMODE, 0); - /* set default value */ + /* set default value */ UWRITE1(sc, MUSB2_REG_MISC, 0); - /* select endpoint index 0 */ + /* select endpoint index 0 */ UWRITE1(sc, MUSB2_REG_EPINDEX, 0); @@ -318,11 +318,11 @@ motg_init(struct motg_softc *sc) dynfifo = (val MUSB2_MASK_CD_DYNFIFOSZ) ? 1 : 0; - if (dynfifo) { + if (dynfifo) { aprint_normal_dev(sc-sc_dev, Dynamic FIFO sizing detected, assuming 16Kbytes of FIFO RAM\n); - } - + } + DPRINTF((HW version: 0x%04x\n, UREAD1(sc, MUSB2_REG_HWVERS))); /* initialise endpoint profiles */ @@ -335,7 +335,7 @@ motg_init(struct motg_softc *sc) for (i = 1; i = sc-sc_ep_max; i++) { int fiforx_size, fifotx_size, fifo_size; - /* select endpoint */ + /* select endpoint */ UWRITE1(sc, MUSB2_REG_EPINDEX, i); val = UREAD1(sc, MUSB2_REG_FSIZE); @@ -351,24 +351,24 @@ motg_init(struct motg_softc *sc) } else if (i 10) { fifo_size = 10; /* 1K */ } else { -fifo_size = 7;/* 128 bytes */ - } +fifo_size = 7;/* 128 bytes */ + } if (fiforx_size (i = nrx)) { fiforx_size = fifo_size; if (fifo_size 7) { #if 0 - UWRITE1(sc, MUSB2_REG_RXFIFOSZ, + UWRITE1(sc, MUSB2_REG_RXFIFOSZ, MUSB2_VAL_FIFOSZ(fifo_size) | MUSB2_MASK_FIFODB); #else - UWRITE1(sc, MUSB2_REG_RXFIFOSZ, + UWRITE1(sc, MUSB2_REG_RXFIFOSZ, MUSB2_VAL_FIFOSZ(fifo_size)); #endif } else { - UWRITE1(sc, MUSB2_REG_RXFIFOSZ, + UWRITE1(sc, MUSB2_REG_RXFIFOSZ, MUSB2_VAL_FIFOSZ(fifo_size)); } -UWRITE2(sc, MUSB2_REG_RXFIFOADD, +UWRITE2(sc, MUSB2_REG_RXFIFOADD, offset 3); offset += (1 fiforx_size); } @@ -376,21 +376,21 @@ motg_init(struct motg_softc *sc) fifotx_size = fifo_size; if (fifo_size 7) { #if 0 - UWRITE1(sc, MUSB2_REG_TXFIFOSZ, - MUSB2_VAL_FIFOSZ(fifo_size) | + UWRITE1(sc, MUSB2_REG_TXFIFOSZ, + MUSB2_VAL_FIFOSZ(fifo_size) | MUSB2_MASK_FIFODB); #else - UWRITE1(sc, MUSB2_REG_TXFIFOSZ, - MUSB2_VAL_FIFOSZ(fifo_size)); + UWRITE1(sc, MUSB2_REG_TXFIFOSZ, + MUSB2_VAL_FIFOSZ(fifo_size)); #endif } else { - UWRITE1(sc, MUSB2_REG_TXFIFOSZ, - MUSB2_VAL_FIFOSZ(fifo_size)); -} - -UWRITE2(sc, MUSB2_REG_TXFIFOADD, + UWRITE1(sc, MUSB2_REG_TXFIFOSZ, + MUSB2_VAL_FIFOSZ(fifo_size)); +} + +UWRITE2(sc, MUSB2_REG_TXFIFOADD, offset 3); - + offset += (1 fifotx_size); } } @@ -405,7 +405,7 @@ motg_init(struct motg_softc *sc) sc-sc_out_ep[i].ep_number = sc-sc_in_ep[i].ep_number = i; } - + DPRINTF((Dynamic FIFO size = %d bytes\n, offset)); /* turn on default interrupts */ @@ -513,7 +513,7 @@ motg_open(usbd_pipe_handle pipe) break; case UE_BULK: case UE_INTERRUPT: - DPRINTFN(MD_BULK, + DPRINTFN(MD_BULK, (new %s %s pipe wMaxPacketSize %d\n, (ed-bmAttributes UE_XFERTYPE) == UE_BULK ? bulk : interrupt, @@ -1503,7 +1503,7 @@
CVS commit: [netbsd-7] src/sys/dev/usb
Module Name:src Committed By: martin Date: Mon Aug 11 15:36:45 UTC 2014 Modified Files: src/sys/dev/usb [netbsd-7]: xhci.c Log Message: Pull up following revision(s) (requested by skrll in ticket #3): sys/dev/usb/xhci.c: revision 1.24 PR/49091: xhci: wrong wMaxPacketSize value While this is correct according to the specification only fixed sizes are allowed, i.e. 512 for SS, etc. Maybe these should be used? To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.23.2.1 src/sys/dev/usb/xhci.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/xhci.c diff -u src/sys/dev/usb/xhci.c:1.23 src/sys/dev/usb/xhci.c:1.23.2.1 --- src/sys/dev/usb/xhci.c:1.23 Tue Aug 5 10:33:46 2014 +++ src/sys/dev/usb/xhci.c Mon Aug 11 15:36:45 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: xhci.c,v 1.23 2014/08/05 10:33:46 skrll Exp $ */ +/* $NetBSD: xhci.c,v 1.23.2.1 2014/08/11 15:36:45 martin Exp $ */ /* * Copyright (c) 2013 Jonathan A. Kollasch @@ -27,7 +27,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: xhci.c,v 1.23 2014/08/05 10:33:46 skrll Exp $); +__KERNEL_RCSID(0, $NetBSD: xhci.c,v 1.23.2.1 2014/08/11 15:36:45 martin Exp $); #include sys/param.h #include sys/systm.h @@ -1524,10 +1524,17 @@ xhci_new_device(device_t parent, usbd_bu err = usbd_get_initial_ddesc(dev, dd); if (err) return err; - USETW(dev-def_ep_desc.wMaxPacketSize, dd-bMaxPacketSize); + /* 4.8.2.1 */ + if (speed == USB_SPEED_SUPER) + USETW(dev-def_ep_desc.wMaxPacketSize, + (1 dd-bMaxPacketSize)); + else + USETW(dev-def_ep_desc.wMaxPacketSize, + dd-bMaxPacketSize); device_printf(sc-sc_dev, %s bMaxPacketSize %u\n, __func__, dd-bMaxPacketSize); - xhci_update_ep0_mps(sc, xs, dd-bMaxPacketSize); + xhci_update_ep0_mps(sc, xs, + UGETW(dev-def_ep_desc.wMaxPacketSize)); err = usbd_reload_device_desc(dev); if (err) return err;