Prefix ucom_attach_args struct members with ucaa_ and rename variables for consistency. No functional change.diff -r1.8.14.6 -r1.8.14.7 src/sys/dev/usb/moscom.c
(skrll)
--- src/sys/dev/usb/Attic/moscom.c 2015/03/21 11:33:37 1.8.14.6
+++ src/sys/dev/usb/Attic/moscom.c 2016/04/16 13:22:00 1.8.14.7
@@ -1,34 +1,34 @@ | @@ -1,34 +1,34 @@ | |||
1 | /* $NetBSD: moscom.c,v 1.8.14.6 2015/03/21 11:33:37 skrll Exp $ */ | 1 | /* $NetBSD: moscom.c,v 1.8.14.7 2016/04/16 13:22:00 skrll Exp $ */ | |
2 | /* $OpenBSD: moscom.c,v 1.11 2007/10/11 18:33:14 deraadt Exp $ */ | 2 | /* $OpenBSD: moscom.c,v 1.11 2007/10/11 18:33:14 deraadt Exp $ */ | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * Copyright (c) 2006 Jonathan Gray <jsg@openbsd.org> | 5 | * Copyright (c) 2006 Jonathan Gray <jsg@openbsd.org> | |
6 | * | 6 | * | |
7 | * Permission to use, copy, modify, and distribute this software for any | 7 | * Permission to use, copy, modify, and distribute this software for any | |
8 | * purpose with or without fee is hereby granted, provided that the above | 8 | * purpose with or without fee is hereby granted, provided that the above | |
9 | * copyright notice and this permission notice appear in all copies. | 9 | * copyright notice and this permission notice appear in all copies. | |
10 | * | 10 | * | |
11 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | 11 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
12 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | 12 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
13 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | 13 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
14 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | 14 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
15 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | 15 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | |
16 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 16 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | |
17 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 17 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
18 | */ | 18 | */ | |
19 | 19 | |||
20 | #include <sys/cdefs.h> | 20 | #include <sys/cdefs.h> | |
21 | __KERNEL_RCSID(0, "$NetBSD: moscom.c,v 1.8.14.6 2015/03/21 11:33:37 skrll Exp $"); | 21 | __KERNEL_RCSID(0, "$NetBSD: moscom.c,v 1.8.14.7 2016/04/16 13:22:00 skrll Exp $"); | |
22 | 22 | |||
23 | #include <sys/param.h> | 23 | #include <sys/param.h> | |
24 | #include <sys/systm.h> | 24 | #include <sys/systm.h> | |
25 | #include <sys/kernel.h> | 25 | #include <sys/kernel.h> | |
26 | #include <sys/conf.h> | 26 | #include <sys/conf.h> | |
27 | #include <sys/tty.h> | 27 | #include <sys/tty.h> | |
28 | #include <sys/device.h> | 28 | #include <sys/device.h> | |
29 | 29 | |||
30 | #include <dev/usb/usb.h> | 30 | #include <dev/usb/usb.h> | |
31 | #include <dev/usb/usbdi.h> | 31 | #include <dev/usb/usbdi.h> | |
32 | #include <dev/usb/usbdi_util.h> | 32 | #include <dev/usb/usbdi_util.h> | |
33 | #include <dev/usb/usbdevs.h> | 33 | #include <dev/usb/usbdevs.h> | |
34 | 34 | |||
@@ -187,100 +187,100 @@ moscom_match(device_t parent, cfdata_t m | @@ -187,100 +187,100 @@ moscom_match(device_t parent, cfdata_t m | |||
187 | { | 187 | { | |
188 | struct usb_attach_arg *uaa = aux; | 188 | struct usb_attach_arg *uaa = aux; | |
189 | 189 | |||
190 | return (moscom_lookup(uaa->uaa_vendor, uaa->uaa_product) != NULL ? | 190 | return (moscom_lookup(uaa->uaa_vendor, uaa->uaa_product) != NULL ? | |
191 | UMATCH_VENDOR_PRODUCT : UMATCH_NONE); | 191 | UMATCH_VENDOR_PRODUCT : UMATCH_NONE); | |
192 | } | 192 | } | |
193 | 193 | |||
194 | void | 194 | void | |
195 | moscom_attach(device_t parent, device_t self, void *aux) | 195 | moscom_attach(device_t parent, device_t self, void *aux) | |
196 | { | 196 | { | |
197 | struct moscom_softc *sc = device_private(self); | 197 | struct moscom_softc *sc = device_private(self); | |
198 | struct usb_attach_arg *uaa = aux; | 198 | struct usb_attach_arg *uaa = aux; | |
199 | struct usbd_device *dev = uaa->uaa_device; | 199 | struct usbd_device *dev = uaa->uaa_device; | |
200 | struct ucom_attach_args uca; | 200 | struct ucom_attach_args ucaa; | |
201 | usb_interface_descriptor_t *id; | 201 | usb_interface_descriptor_t *id; | |
202 | usb_endpoint_descriptor_t *ed; | 202 | usb_endpoint_descriptor_t *ed; | |
203 | char *devinfop; | 203 | char *devinfop; | |
204 | usbd_status error; | 204 | usbd_status error; | |
205 | int i; | 205 | int i; | |
206 | 206 | |||
207 | aprint_naive("\n"); | 207 | aprint_naive("\n"); | |
208 | aprint_normal("\n"); | 208 | aprint_normal("\n"); | |
209 | 209 | |||
210 | devinfop = usbd_devinfo_alloc(dev, 0); | 210 | devinfop = usbd_devinfo_alloc(dev, 0); | |
211 | aprint_normal_dev(self, "%s\n", devinfop); | 211 | aprint_normal_dev(self, "%s\n", devinfop); | |
212 | usbd_devinfo_free(devinfop); | 212 | usbd_devinfo_free(devinfop); | |
213 | 213 | |||
214 | sc->sc_dev = self; | 214 | sc->sc_dev = self; | |
215 | 215 | |||
216 | memset(&uca, 0, sizeof(uca)); | 216 | memset(&ucaa, 0, sizeof(ucaa)); | |
217 | sc->sc_udev = uaa->uaa_device; | 217 | sc->sc_udev = uaa->uaa_device; | |
218 | 218 | |||
219 | if (usbd_set_config_index(sc->sc_udev, MOSCOM_CONFIG_NO, 1) != 0) { | 219 | if (usbd_set_config_index(sc->sc_udev, MOSCOM_CONFIG_NO, 1) != 0) { | |
220 | aprint_error_dev(self, "could not set configuration no\n"); | 220 | aprint_error_dev(self, "could not set configuration no\n"); | |
221 | sc->sc_dying = 1; | 221 | sc->sc_dying = 1; | |
222 | return; | 222 | return; | |
223 | } | 223 | } | |
224 | 224 | |||
225 | /* get the first interface handle */ | 225 | /* get the first interface handle */ | |
226 | error = usbd_device2interface_handle(sc->sc_udev, MOSCOM_IFACE_NO, | 226 | error = usbd_device2interface_handle(sc->sc_udev, MOSCOM_IFACE_NO, | |
227 | &sc->sc_iface); | 227 | &sc->sc_iface); | |
228 | if (error != 0) { | 228 | if (error != 0) { | |
229 | aprint_error_dev(self, "could not get interface handle\n"); | 229 | aprint_error_dev(self, "could not get interface handle\n"); | |
230 | sc->sc_dying = 1; | 230 | sc->sc_dying = 1; | |
231 | return; | 231 | return; | |
232 | } | 232 | } | |
233 | 233 | |||
234 | id = usbd_get_interface_descriptor(sc->sc_iface); | 234 | id = usbd_get_interface_descriptor(sc->sc_iface); | |
235 | 235 | |||
236 | uca.bulkin = uca.bulkout = -1; | 236 | ucaa.ucaa_bulkin = ucaa.ucaa_bulkout = -1; | |
237 | for (i = 0; i < id->bNumEndpoints; i++) { | 237 | for (i = 0; i < id->bNumEndpoints; i++) { | |
238 | ed = usbd_interface2endpoint_descriptor(sc->sc_iface, i); | 238 | ed = usbd_interface2endpoint_descriptor(sc->sc_iface, i); | |
239 | if (ed == NULL) { | 239 | if (ed == NULL) { | |
240 | aprint_error_dev(self, | 240 | aprint_error_dev(self, | |
241 | "no endpoint descriptor found for %d\n", i); | 241 | "no endpoint descriptor found for %d\n", i); | |
242 | sc->sc_dying = 1; | 242 | sc->sc_dying = 1; | |
243 | return; | 243 | return; | |
244 | } | 244 | } | |
245 | 245 | |||
246 | if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && | 246 | if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && | |
247 | UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) | 247 | UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) | |
248 | uca.bulkin = ed->bEndpointAddress; | 248 | ucaa.ucaa_bulkin = ed->bEndpointAddress; | |
249 | else if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_OUT && | 249 | else if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_OUT && | |
250 | UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) | 250 | UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) | |
251 | uca.bulkout = ed->bEndpointAddress; | 251 | ucaa.ucaa_bulkout = ed->bEndpointAddress; | |
252 | } | 252 | } | |
253 | 253 | |||
254 | if (uca.bulkin == -1 || uca.bulkout == -1) { | 254 | if (ucaa.ucaa_bulkin == -1 || ucaa.ucaa_bulkout == -1) { | |
255 | aprint_error_dev(self, "missing endpoint\n"); | 255 | aprint_error_dev(self, "missing endpoint\n"); | |
256 | sc->sc_dying = 1; | 256 | sc->sc_dying = 1; | |
257 | return; | 257 | return; | |
258 | } | 258 | } | |
259 | 259 | |||
260 | uca.ibufsize = MOSCOMBUFSZ; | 260 | ucaa.ucaa_ibufsize = MOSCOMBUFSZ; | |
261 | uca.obufsize = MOSCOMBUFSZ; | 261 | ucaa.ucaa_obufsize = MOSCOMBUFSZ; | |
262 | uca.ibufsizepad = MOSCOMBUFSZ; | 262 | ucaa.ucaa_ibufsizepad = MOSCOMBUFSZ; | |
263 | uca.opkthdrlen = 0; | 263 | ucaa.ucaa_opkthdrlen = 0; | |
264 | uca.device = sc->sc_udev; | 264 | ucaa.ucaa_device = sc->sc_udev; | |
265 | uca.iface = sc->sc_iface; | 265 | ucaa.ucaa_iface = sc->sc_iface; | |
266 | uca.methods = &moscom_methods; | 266 | ucaa.ucaa_methods = &moscom_methods; | |
267 | uca.arg = sc; | 267 | ucaa.ucaa_arg = sc; | |
268 | uca.info = NULL; | 268 | ucaa.ucaa_info = NULL; | |
269 | 269 | |||
270 | usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev, | 270 | usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev, | |
271 | sc->sc_dev); | 271 | sc->sc_dev); | |
272 | 272 | |||
273 | sc->sc_subdev = config_found_sm_loc(self, "ucombus", NULL, &uca, | 273 | sc->sc_subdev = config_found_sm_loc(self, "ucombus", NULL, &ucaa, | |
274 | ucomprint, ucomsubmatch); | 274 | ucomprint, ucomsubmatch); | |
275 | 275 | |||
276 | return; | 276 | return; | |
277 | } | 277 | } | |
278 | 278 | |||
279 | void | 279 | void | |
280 | moscom_childdet(device_t self, device_t child) | 280 | moscom_childdet(device_t self, device_t child) | |
281 | { | 281 | { | |
282 | struct moscom_softc *sc = device_private(self); | 282 | struct moscom_softc *sc = device_private(self); | |
283 | 283 | |||
284 | KASSERT(sc->sc_subdev == child); | 284 | KASSERT(sc->sc_subdev == child); | |
285 | sc->sc_subdev = NULL; | 285 | sc->sc_subdev = NULL; | |
286 | } | 286 | } |
--- src/sys/dev/usb/u3g.c 2015/10/06 21:32:15 1.31.2.10
+++ src/sys/dev/usb/u3g.c 2016/04/16 13:22:00 1.31.2.11
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: u3g.c,v 1.31.2.10 2015/10/06 21:32:15 skrll Exp $ */ | 1 | /* $NetBSD: u3g.c,v 1.31.2.11 2016/04/16 13:22:00 skrll Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2009 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2009 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation. | 7 | * This code is derived from software contributed to The NetBSD Foundation. | |
8 | * | 8 | * | |
9 | * Redistribution and use in source and binary forms, with or without | 9 | * Redistribution and use in source and binary forms, with or without | |
10 | * modification, are permitted provided that the following conditions | 10 | * modification, are permitted provided that the following conditions | |
11 | * are met: | 11 | * are met: | |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright | |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. | |
14 | * 2. Redistributions in binary form must reproduce the above copyright | 14 | * 2. Redistributions in binary form must reproduce the above copyright | |
@@ -40,27 +40,27 @@ | @@ -40,27 +40,27 @@ | |||
40 | * | 40 | * | |
41 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | 41 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
42 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | 42 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
43 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | 43 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
44 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | 44 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
45 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | 45 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | |
46 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 46 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | |
47 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 47 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
48 | * | 48 | * | |
49 | * $FreeBSD$ | 49 | * $FreeBSD$ | |
50 | */ | 50 | */ | |
51 | 51 | |||
52 | #include <sys/cdefs.h> | 52 | #include <sys/cdefs.h> | |
53 | __KERNEL_RCSID(0, "$NetBSD: u3g.c,v 1.31.2.10 2015/10/06 21:32:15 skrll Exp $"); | 53 | __KERNEL_RCSID(0, "$NetBSD: u3g.c,v 1.31.2.11 2016/04/16 13:22:00 skrll Exp $"); | |
54 | 54 | |||
55 | #include <sys/param.h> | 55 | #include <sys/param.h> | |
56 | #include <sys/systm.h> | 56 | #include <sys/systm.h> | |
57 | #include <sys/kernel.h> | 57 | #include <sys/kernel.h> | |
58 | #include <sys/kmem.h> | 58 | #include <sys/kmem.h> | |
59 | #include <sys/bus.h> | 59 | #include <sys/bus.h> | |
60 | #include <sys/conf.h> | 60 | #include <sys/conf.h> | |
61 | #include <sys/tty.h> | 61 | #include <sys/tty.h> | |
62 | 62 | |||
63 | #include <dev/usb/usb.h> | 63 | #include <dev/usb/usb.h> | |
64 | #include <dev/usb/usbdi.h> | 64 | #include <dev/usb/usbdi.h> | |
65 | #include <dev/usb/usbdivar.h> | 65 | #include <dev/usb/usbdivar.h> | |
66 | #include <dev/usb/usbdi_util.h> | 66 | #include <dev/usb/usbdi_util.h> | |
@@ -718,102 +718,102 @@ u3g_match(device_t parent, cfdata_t matc | @@ -718,102 +718,102 @@ u3g_match(device_t parent, cfdata_t matc | |||
718 | return id->bInterfaceClass == UICLASS_VENDOR ? | 718 | return id->bInterfaceClass == UICLASS_VENDOR ? | |
719 | UMATCH_VENDOR_PRODUCT : UMATCH_NONE; | 719 | UMATCH_VENDOR_PRODUCT : UMATCH_NONE; | |
720 | } | 720 | } | |
721 | 721 | |||
722 | static void | 722 | static void | |
723 | u3g_attach(device_t parent, device_t self, void *aux) | 723 | u3g_attach(device_t parent, device_t self, void *aux) | |
724 | { | 724 | { | |
725 | struct u3g_softc *sc = device_private(self); | 725 | struct u3g_softc *sc = device_private(self); | |
726 | struct usbif_attach_arg *uiaa = aux; | 726 | struct usbif_attach_arg *uiaa = aux; | |
727 | struct usbd_device *dev = uiaa->uiaa_device; | 727 | struct usbd_device *dev = uiaa->uiaa_device; | |
728 | struct usbd_interface *iface; | 728 | struct usbd_interface *iface; | |
729 | usb_interface_descriptor_t *id; | 729 | usb_interface_descriptor_t *id; | |
730 | usb_endpoint_descriptor_t *ed; | 730 | usb_endpoint_descriptor_t *ed; | |
731 | struct ucom_attach_args uca; | 731 | struct ucom_attach_args ucaa; | |
732 | usbd_status error; | 732 | usbd_status error; | |
733 | int n, intr_address, intr_size; | 733 | int n, intr_address, intr_size; | |
734 | 734 | |||
735 | aprint_naive("\n"); | 735 | aprint_naive("\n"); | |
736 | aprint_normal("\n"); | 736 | aprint_normal("\n"); | |
737 | 737 | |||
738 | sc->sc_dev = self; | 738 | sc->sc_dev = self; | |
739 | sc->sc_dying = false; | 739 | sc->sc_dying = false; | |
740 | sc->sc_udev = dev; | 740 | sc->sc_udev = dev; | |
741 | 741 | |||
742 | error = usbd_device2interface_handle(dev, uiaa->uiaa_ifaceno, &iface); | 742 | error = usbd_device2interface_handle(dev, uiaa->uiaa_ifaceno, &iface); | |
743 | if (error) { | 743 | if (error) { | |
744 | aprint_error_dev(self, "failed to get interface, err=%s\n", | 744 | aprint_error_dev(self, "failed to get interface, err=%s\n", | |
745 | usbd_errstr(error)); | 745 | usbd_errstr(error)); | |
746 | return; | 746 | return; | |
747 | } | 747 | } | |
748 | 748 | |||
749 | id = usbd_get_interface_descriptor(iface); | 749 | id = usbd_get_interface_descriptor(iface); | |
750 | 750 | |||
751 | uca.info = "3G Modem"; | 751 | ucaa.ucaa_info = "3G Modem"; | |
752 | uca.ibufsize = U3G_BUFF_SIZE; | 752 | ucaa.ucaa_ibufsize = U3G_BUFF_SIZE; | |
753 | uca.obufsize = U3G_BUFF_SIZE; | 753 | ucaa.ucaa_obufsize = U3G_BUFF_SIZE; | |
754 | uca.ibufsizepad = U3G_BUFF_SIZE; | 754 | ucaa.ucaa_ibufsizepad = U3G_BUFF_SIZE; | |
755 | uca.opkthdrlen = 0; | 755 | ucaa.ucaa_opkthdrlen = 0; | |
756 | uca.device = dev; | 756 | ucaa.ucaa_device = dev; | |
757 | uca.iface = iface; | 757 | ucaa.ucaa_iface = iface; | |
758 | uca.methods = &u3g_methods; | 758 | ucaa.ucaa_methods = &u3g_methods; | |
759 | uca.arg = sc; | 759 | ucaa.ucaa_arg = sc; | |
760 | uca.portno = -1; | 760 | ucaa.ucaa_portno = -1; | |
761 | uca.bulkin = uca.bulkout = -1; | 761 | ucaa.ucaa_bulkin = ucaa.ucaa_bulkout = -1; | |
762 | 762 | |||
763 | 763 | |||
764 | sc->sc_ifaceno = uiaa->uiaa_ifaceno; | 764 | sc->sc_ifaceno = uiaa->uiaa_ifaceno; | |
765 | intr_address = -1; | 765 | intr_address = -1; | |
766 | intr_size = 0; | 766 | intr_size = 0; | |
767 | 767 | |||
768 | for (n = 0; n < id->bNumEndpoints; n++) { | 768 | for (n = 0; n < id->bNumEndpoints; n++) { | |
769 | ed = usbd_interface2endpoint_descriptor(iface, n); | 769 | ed = usbd_interface2endpoint_descriptor(iface, n); | |
770 | if (ed == NULL) { | 770 | if (ed == NULL) { | |
771 | aprint_error_dev(self, "no endpoint descriptor " | 771 | aprint_error_dev(self, "no endpoint descriptor " | |
772 | "for %d (interface: %d)\n", n, sc->sc_ifaceno); | 772 | "for %d (interface: %d)\n", n, sc->sc_ifaceno); | |
773 | sc->sc_dying = true; | 773 | sc->sc_dying = true; | |
774 | return; | 774 | return; | |
775 | } | 775 | } | |
776 | 776 | |||
777 | if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && | 777 | if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && | |
778 | UE_GET_XFERTYPE(ed->bmAttributes) == UE_INTERRUPT) { | 778 | UE_GET_XFERTYPE(ed->bmAttributes) == UE_INTERRUPT) { | |
779 | intr_address = ed->bEndpointAddress; | 779 | intr_address = ed->bEndpointAddress; | |
780 | intr_size = UGETW(ed->wMaxPacketSize); | 780 | intr_size = UGETW(ed->wMaxPacketSize); | |
781 | } else | 781 | } else | |
782 | if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && | 782 | if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && | |
783 | UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) { | 783 | UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) { | |
784 | uca.bulkin = ed->bEndpointAddress; | 784 | ucaa.ucaa_bulkin = ed->bEndpointAddress; | |
785 | } else | 785 | } else | |
786 | if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_OUT && | 786 | if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_OUT && | |
787 | UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) { | 787 | UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) { | |
788 | uca.bulkout = ed->bEndpointAddress; | 788 | ucaa.ucaa_bulkout = ed->bEndpointAddress; | |
789 | } | 789 | } | |
790 | if (uca.bulkin != -1 && uca.bulkout != -1) { | 790 | if (ucaa.ucaa_bulkin != -1 && ucaa.ucaa_bulkout != -1) { | |
791 | struct u3g_com *com; | 791 | struct u3g_com *com; | |
792 | if (sc->sc_ncom == __arraycount(sc->sc_com)) { | 792 | if (sc->sc_ncom == __arraycount(sc->sc_com)) { | |
793 | aprint_error_dev(self, "Need to configure " | 793 | aprint_error_dev(self, "Need to configure " | |
794 | "more than %zu ttys", sc->sc_ncom); | 794 | "more than %zu ttys", sc->sc_ncom); | |
795 | continue; | 795 | continue; | |
796 | } | 796 | } | |
797 | uca.portno = sc->sc_ncom++; | 797 | ucaa.ucaa_portno = sc->sc_ncom++; | |
798 | com = &sc->sc_com[uca.portno]; | 798 | com = &sc->sc_com[ucaa.ucaa_portno]; | |
799 | com->c_outpins = 0; | 799 | com->c_outpins = 0; | |
800 | com->c_msr = UMSR_DSR | UMSR_CTS | UMSR_DCD; | 800 | com->c_msr = UMSR_DSR | UMSR_CTS | UMSR_DCD; | |
801 | com->c_open = false; | 801 | com->c_open = false; | |
802 | com->c_purging = false; | 802 | com->c_purging = false; | |
803 | com->c_dev = config_found_sm_loc(self, "ucombus", | 803 | com->c_dev = config_found_sm_loc(self, "ucombus", | |
804 | NULL, &uca, ucomprint, ucomsubmatch); | 804 | NULL, &ucaa, ucomprint, ucomsubmatch); | |
805 | uca.bulkin = -1; | 805 | ucaa.ucaa_bulkin = -1; | |
806 | uca.bulkout = -1; | 806 | ucaa.ucaa_bulkout = -1; | |
807 | } | 807 | } | |
808 | } | 808 | } | |
809 | 809 | |||
810 | if (sc->sc_ncom == 0) { | 810 | if (sc->sc_ncom == 0) { | |
811 | aprint_error_dev(self, "Missing bulk in/out for interface %d\n", | 811 | aprint_error_dev(self, "Missing bulk in/out for interface %d\n", | |
812 | sc->sc_ifaceno); | 812 | sc->sc_ifaceno); | |
813 | sc->sc_dying = true; | 813 | sc->sc_dying = true; | |
814 | return; | 814 | return; | |
815 | } | 815 | } | |
816 | 816 | |||
817 | /* | 817 | /* | |
818 | * If the interface has an interrupt pipe, open it immediately so | 818 | * If the interface has an interrupt pipe, open it immediately so | |
819 | * that we can track input pin state changes regardless of whether | 819 | * that we can track input pin state changes regardless of whether |
--- src/sys/dev/usb/uark.c 2015/09/28 16:24:19 1.6.14.4
+++ src/sys/dev/usb/uark.c 2016/04/16 13:22:00 1.6.14.5
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: uark.c,v 1.6.14.4 2015/09/28 16:24:19 skrll Exp $ */ | 1 | /* $NetBSD: uark.c,v 1.6.14.5 2016/04/16 13:22:00 skrll Exp $ */ | |
2 | /* $OpenBSD: uark.c,v 1.13 2009/10/13 19:33:17 pirofti Exp $ */ | 2 | /* $OpenBSD: uark.c,v 1.13 2009/10/13 19:33:17 pirofti Exp $ */ | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * Copyright (c) 2006 Jonathan Gray <jsg@openbsd.org> | 5 | * Copyright (c) 2006 Jonathan Gray <jsg@openbsd.org> | |
6 | * | 6 | * | |
7 | * Permission to use, copy, modify, and distribute this software for any | 7 | * Permission to use, copy, modify, and distribute this software for any | |
8 | * purpose with or without fee is hereby granted, provided that the above | 8 | * purpose with or without fee is hereby granted, provided that the above | |
9 | * copyright notice and this permission notice appear in all copies. | 9 | * copyright notice and this permission notice appear in all copies. | |
10 | * | 10 | * | |
11 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | 11 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
12 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | 12 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
13 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | 13 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
14 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | 14 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
@@ -89,49 +89,49 @@ struct ucom_methods uark_methods = { | @@ -89,49 +89,49 @@ struct ucom_methods uark_methods = { | |||
89 | }; | 89 | }; | |
90 | 90 | |||
91 | static const struct usb_devno uark_devs[] = { | 91 | static const struct usb_devno uark_devs[] = { | |
92 | { USB_VENDOR_ARKMICROCHIPS, USB_PRODUCT_ARKMICROCHIPS_USBSERIAL }, | 92 | { USB_VENDOR_ARKMICROCHIPS, USB_PRODUCT_ARKMICROCHIPS_USBSERIAL }, | |
93 | }; | 93 | }; | |
94 | 94 | |||
95 | int uark_match(device_t, cfdata_t, void *); | 95 | int uark_match(device_t, cfdata_t, void *); | |
96 | void uark_attach(device_t, device_t, void *); | 96 | void uark_attach(device_t, device_t, void *); | |
97 | int uark_detach(device_t, int); | 97 | int uark_detach(device_t, int); | |
98 | int uark_activate(device_t, enum devact); | 98 | int uark_activate(device_t, enum devact); | |
99 | extern struct cfdriver uark_cd; | 99 | extern struct cfdriver uark_cd; | |
100 | CFATTACH_DECL_NEW(uark, sizeof(struct uark_softc), uark_match, uark_attach, uark_detach, uark_activate); | 100 | CFATTACH_DECL_NEW(uark, sizeof(struct uark_softc), uark_match, uark_attach, uark_detach, uark_activate); | |
101 | 101 | |||
102 | int | 102 | int | |
103 | uark_match(device_t parent, cfdata_t match, void *aux) | 103 | uark_match(device_t parent, cfdata_t match, void *aux) | |
104 | { | 104 | { | |
105 | struct usb_attach_arg *uaa = aux; | 105 | struct usb_attach_arg *uaa = aux; | |
106 | 106 | |||
107 | return (usb_lookup(uark_devs, uaa->uaa_vendor, uaa->uaa_product) != NULL) ? | 107 | return (usb_lookup(uark_devs, uaa->uaa_vendor, uaa->uaa_product) != NULL) ? | |
108 | UMATCH_VENDOR_PRODUCT : UMATCH_NONE; | 108 | UMATCH_VENDOR_PRODUCT : UMATCH_NONE; | |
109 | } | 109 | } | |
110 | 110 | |||
111 | void | 111 | void | |
112 | uark_attach(device_t parent, device_t self, void *aux) | 112 | uark_attach(device_t parent, device_t self, void *aux) | |
113 | { | 113 | { | |
114 | struct uark_softc *sc = device_private(self); | 114 | struct uark_softc *sc = device_private(self); | |
115 | struct usb_attach_arg *uaa = aux; | 115 | struct usb_attach_arg *uaa = aux; | |
116 | struct usbd_device *dev = uaa->uaa_device; | 116 | struct usbd_device *dev = uaa->uaa_device; | |
117 | char *devinfop; | 117 | char *devinfop; | |
118 | struct ucom_attach_args uca; | 118 | struct ucom_attach_args ucaa; | |
119 | usb_interface_descriptor_t *id; | 119 | usb_interface_descriptor_t *id; | |
120 | usb_endpoint_descriptor_t *ed; | 120 | usb_endpoint_descriptor_t *ed; | |
121 | usbd_status error; | 121 | usbd_status error; | |
122 | int i; | 122 | int i; | |
123 | 123 | |||
124 | memset(&uca, 0, sizeof(uca)); | 124 | memset(&ucaa, 0, sizeof(ucaa)); | |
125 | sc->sc_dev = self; | 125 | sc->sc_dev = self; | |
126 | 126 | |||
127 | devinfop = usbd_devinfo_alloc(dev, 0); | 127 | devinfop = usbd_devinfo_alloc(dev, 0); | |
128 | aprint_naive("\n"); | 128 | aprint_naive("\n"); | |
129 | aprint_normal("\n"); | 129 | aprint_normal("\n"); | |
130 | aprint_normal_dev(self, "%s\n", devinfop); | 130 | aprint_normal_dev(self, "%s\n", devinfop); | |
131 | usbd_devinfo_free(devinfop); | 131 | usbd_devinfo_free(devinfop); | |
132 | 132 | |||
133 | sc->sc_udev = dev; | 133 | sc->sc_udev = dev; | |
134 | 134 | |||
135 | if (usbd_set_config_index(sc->sc_udev, UARK_CONFIG_NO, 1) != 0) { | 135 | if (usbd_set_config_index(sc->sc_udev, UARK_CONFIG_NO, 1) != 0) { | |
136 | aprint_error_dev(self, "could not set configuration no\n"); | 136 | aprint_error_dev(self, "could not set configuration no\n"); | |
137 | sc->sc_dying = 1; | 137 | sc->sc_dying = 1; | |
@@ -139,64 +139,64 @@ uark_attach(device_t parent, device_t se | @@ -139,64 +139,64 @@ uark_attach(device_t parent, device_t se | |||
139 | } | 139 | } | |
140 | 140 | |||
141 | /* get the first interface handle */ | 141 | /* get the first interface handle */ | |
142 | error = usbd_device2interface_handle(sc->sc_udev, UARK_IFACE_NO, | 142 | error = usbd_device2interface_handle(sc->sc_udev, UARK_IFACE_NO, | |
143 | &sc->sc_iface); | 143 | &sc->sc_iface); | |
144 | if (error != 0) { | 144 | if (error != 0) { | |
145 | aprint_error_dev(self, "could not get interface handle\n"); | 145 | aprint_error_dev(self, "could not get interface handle\n"); | |
146 | sc->sc_dying = 1; | 146 | sc->sc_dying = 1; | |
147 | return; | 147 | return; | |
148 | } | 148 | } | |
149 | 149 | |||
150 | id = usbd_get_interface_descriptor(sc->sc_iface); | 150 | id = usbd_get_interface_descriptor(sc->sc_iface); | |
151 | 151 | |||
152 | uca.bulkin = uca.bulkout = -1; | 152 | ucaa.ucaa_bulkin = ucaa.ucaa_bulkout = -1; | |
153 | for (i = 0; i < id->bNumEndpoints; i++) { | 153 | for (i = 0; i < id->bNumEndpoints; i++) { | |
154 | ed = usbd_interface2endpoint_descriptor(sc->sc_iface, i); | 154 | ed = usbd_interface2endpoint_descriptor(sc->sc_iface, i); | |
155 | if (ed == NULL) { | 155 | if (ed == NULL) { | |
156 | aprint_error_dev(self, "no endpoint descriptor found for %d\n", | 156 | aprint_error_dev(self, "no endpoint descriptor found for %d\n", | |
157 | i); | 157 | i); | |
158 | sc->sc_dying = 1; | 158 | sc->sc_dying = 1; | |
159 | return; | 159 | return; | |
160 | } | 160 | } | |
161 | 161 | |||
162 | if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && | 162 | if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && | |
163 | UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) | 163 | UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) | |
164 | uca.bulkin = ed->bEndpointAddress; | 164 | ucaa.ucaa_bulkin = ed->bEndpointAddress; | |
165 | else if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_OUT && | 165 | else if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_OUT && | |
166 | UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) | 166 | UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) | |
167 | uca.bulkout = ed->bEndpointAddress; | 167 | ucaa.ucaa_bulkout = ed->bEndpointAddress; | |
168 | } | 168 | } | |
169 | 169 | |||
170 | if (uca.bulkin == -1 || uca.bulkout == -1) { | 170 | if (ucaa.ucaa_bulkin == -1 || ucaa.ucaa_bulkout == -1) { | |
171 | aprint_error_dev(self, "missing endpoint\n"); | 171 | aprint_error_dev(self, "missing endpoint\n"); | |
172 | sc->sc_dying = 1; | 172 | sc->sc_dying = 1; | |
173 | return; | 173 | return; | |
174 | } | 174 | } | |
175 | 175 | |||
176 | uca.ibufsize = UARKBUFSZ; | 176 | ucaa.ucaa_ibufsize = UARKBUFSZ; | |
177 | uca.obufsize = UARKBUFSZ; | 177 | ucaa.ucaa_obufsize = UARKBUFSZ; | |
178 | uca.ibufsizepad = UARKBUFSZ; | 178 | ucaa.ucaa_ibufsizepad = UARKBUFSZ; | |
179 | uca.opkthdrlen = 0; | 179 | ucaa.ucaa_opkthdrlen = 0; | |
180 | uca.device = sc->sc_udev; | 180 | ucaa.ucaa_device = sc->sc_udev; | |
181 | uca.iface = sc->sc_iface; | 181 | ucaa.ucaa_iface = sc->sc_iface; | |
182 | uca.methods = &uark_methods; | 182 | ucaa.ucaa_methods = &uark_methods; | |
183 | uca.arg = sc; | 183 | ucaa.ucaa_arg = sc; | |
184 | uca.info = NULL; | 184 | ucaa.ucaa_info = NULL; | |
185 | 185 | |||
186 | usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev, | 186 | usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev, | |
187 | sc->sc_dev); | 187 | sc->sc_dev); | |
188 | 188 | |||
189 | sc->sc_subdev = config_found_sm_loc(self, "ucombus", NULL, &uca, | 189 | sc->sc_subdev = config_found_sm_loc(self, "ucombus", NULL, &ucaa, | |
190 | ucomprint, ucomsubmatch); | 190 | ucomprint, ucomsubmatch); | |
191 | 191 | |||
192 | return; | 192 | return; | |
193 | } | 193 | } | |
194 | 194 | |||
195 | int | 195 | int | |
196 | uark_detach(device_t self, int flags) | 196 | uark_detach(device_t self, int flags) | |
197 | { | 197 | { | |
198 | struct uark_softc *sc = device_private(self); | 198 | struct uark_softc *sc = device_private(self); | |
199 | int rv = 0; | 199 | int rv = 0; | |
200 | 200 | |||
201 | sc->sc_dying = 1; | 201 | sc->sc_dying = 1; | |
202 | if (sc->sc_subdev != NULL) { | 202 | if (sc->sc_subdev != NULL) { | |
@@ -308,27 +308,27 @@ uark_param(void *vsc, int portno, struct | @@ -308,27 +308,27 @@ uark_param(void *vsc, int portno, struct | |||
308 | /* xon/xoff flow ctl */ | 308 | /* xon/xoff flow ctl */ | |
309 | } else { | 309 | } else { | |
310 | /* disable flow ctl */ | 310 | /* disable flow ctl */ | |
311 | } | 311 | } | |
312 | #endif | 312 | #endif | |
313 | 313 | |||
314 | return (0); | 314 | return (0); | |
315 | } | 315 | } | |
316 | 316 | |||
317 | void | 317 | void | |
318 | uark_get_status(void *vsc, int portno, u_char *lsr, u_char *msr) | 318 | uark_get_status(void *vsc, int portno, u_char *lsr, u_char *msr) | |
319 | { | 319 | { | |
320 | struct uark_softc *sc = vsc; | 320 | struct uark_softc *sc = vsc; | |
321 | 321 | |||
322 | if (msr != NULL) | 322 | if (msr != NULL) | |
323 | *msr = sc->sc_msr; | 323 | *msr = sc->sc_msr; | |
324 | if (lsr != NULL) | 324 | if (lsr != NULL) | |
325 | *lsr = sc->sc_lsr; | 325 | *lsr = sc->sc_lsr; | |
326 | } | 326 | } | |
327 | 327 | |||
328 | void | 328 | void | |
329 | uark_break(void *vsc, int portno, int onoff) | 329 | uark_break(void *vsc, int portno, int onoff) | |
330 | { | 330 | { | |
331 | #if 0 | 331 | #if 0 | |
332 | struct uark_softc *sc = vsc; | 332 | struct uark_softc *sc = vsc; | |
333 | 333 | |||
334 | #ifdef UARK_DEBUG | 334 | #ifdef UARK_DEBUG |
--- src/sys/dev/usb/ubsa.c 2015/12/28 08:28:11 1.30.16.6
+++ src/sys/dev/usb/ubsa.c 2016/04/16 13:22:00 1.30.16.7
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: ubsa.c,v 1.30.16.6 2015/12/28 08:28:11 skrll Exp $ */ | 1 | /* $NetBSD: ubsa.c,v 1.30.16.7 2016/04/16 13:22:00 skrll Exp $ */ | |
2 | /*- | 2 | /*- | |
3 | * Copyright (c) 2002, Alexander Kabaev <kan.FreeBSD.org>. | 3 | * Copyright (c) 2002, Alexander Kabaev <kan.FreeBSD.org>. | |
4 | * All rights reserved. | 4 | * All rights reserved. | |
5 | * | 5 | * | |
6 | * Redistribution and use in source and binary forms, with or without | 6 | * Redistribution and use in source and binary forms, with or without | |
7 | * modification, are permitted provided that the following conditions | 7 | * modification, are permitted provided that the following conditions | |
8 | * are met: | 8 | * are met: | |
9 | * 1. Redistributions of source code must retain the above copyright | 9 | * 1. Redistributions of source code must retain the above copyright | |
10 | * notice, this list of conditions and the following disclaimer. | 10 | * notice, this list of conditions and the following disclaimer. | |
11 | * 2. Redistributions in binary form must reproduce the above copyright | 11 | * 2. Redistributions in binary form must reproduce the above copyright | |
12 | * notice, this list of conditions and the following disclaimer in the | 12 | * notice, this list of conditions and the following disclaimer in the | |
13 | * documentation and/or other materials provided with the distribution. | 13 | * documentation and/or other materials provided with the distribution. | |
14 | * | 14 | * | |
@@ -44,27 +44,27 @@ | @@ -44,27 +44,27 @@ | |||
44 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | 44 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
45 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 45 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
46 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | 46 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
47 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 47 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
48 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 48 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
49 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 49 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
50 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 50 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
51 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 51 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
52 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 52 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
53 | * POSSIBILITY OF SUCH DAMAGE. | 53 | * POSSIBILITY OF SUCH DAMAGE. | |
54 | */ | 54 | */ | |
55 | 55 | |||
56 | #include <sys/cdefs.h> | 56 | #include <sys/cdefs.h> | |
57 | __KERNEL_RCSID(0, "$NetBSD: ubsa.c,v 1.30.16.6 2015/12/28 08:28:11 skrll Exp $"); | 57 | __KERNEL_RCSID(0, "$NetBSD: ubsa.c,v 1.30.16.7 2016/04/16 13:22:00 skrll Exp $"); | |
58 | 58 | |||
59 | #include <sys/param.h> | 59 | #include <sys/param.h> | |
60 | #include <sys/systm.h> | 60 | #include <sys/systm.h> | |
61 | #include <sys/kernel.h> | 61 | #include <sys/kernel.h> | |
62 | #include <sys/kmem.h> | 62 | #include <sys/kmem.h> | |
63 | #include <sys/ioccom.h> | 63 | #include <sys/ioccom.h> | |
64 | #include <sys/fcntl.h> | 64 | #include <sys/fcntl.h> | |
65 | #include <sys/conf.h> | 65 | #include <sys/conf.h> | |
66 | #include <sys/tty.h> | 66 | #include <sys/tty.h> | |
67 | #include <sys/file.h> | 67 | #include <sys/file.h> | |
68 | #include <sys/select.h> | 68 | #include <sys/select.h> | |
69 | #include <sys/proc.h> | 69 | #include <sys/proc.h> | |
70 | #include <sys/device.h> | 70 | #include <sys/device.h> | |
@@ -146,27 +146,27 @@ ubsa_match(device_t parent, cfdata_t mat | @@ -146,27 +146,27 @@ ubsa_match(device_t parent, cfdata_t mat | |||
146 | } | 146 | } | |
147 | 147 | |||
148 | void | 148 | void | |
149 | ubsa_attach(device_t parent, device_t self, void *aux) | 149 | ubsa_attach(device_t parent, device_t self, void *aux) | |
150 | { | 150 | { | |
151 | struct ubsa_softc *sc = device_private(self); | 151 | struct ubsa_softc *sc = device_private(self); | |
152 | struct usb_attach_arg *uaa = aux; | 152 | struct usb_attach_arg *uaa = aux; | |
153 | struct usbd_device *dev = uaa->uaa_device; | 153 | struct usbd_device *dev = uaa->uaa_device; | |
154 | usb_config_descriptor_t *cdesc; | 154 | usb_config_descriptor_t *cdesc; | |
155 | usb_interface_descriptor_t *id; | 155 | usb_interface_descriptor_t *id; | |
156 | usb_endpoint_descriptor_t *ed; | 156 | usb_endpoint_descriptor_t *ed; | |
157 | char *devinfop; | 157 | char *devinfop; | |
158 | usbd_status err; | 158 | usbd_status err; | |
159 | struct ucom_attach_args uca; | 159 | struct ucom_attach_args ucaa; | |
160 | int i; | 160 | int i; | |
161 | 161 | |||
162 | sc->sc_dev = self; | 162 | sc->sc_dev = self; | |
163 | 163 | |||
164 | aprint_naive("\n"); | 164 | aprint_naive("\n"); | |
165 | aprint_normal("\n"); | 165 | aprint_normal("\n"); | |
166 | 166 | |||
167 | devinfop = usbd_devinfo_alloc(dev, 0); | 167 | devinfop = usbd_devinfo_alloc(dev, 0); | |
168 | aprint_normal_dev(self, "%s\n", devinfop); | 168 | aprint_normal_dev(self, "%s\n", devinfop); | |
169 | usbd_devinfo_free(devinfop); | 169 | usbd_devinfo_free(devinfop); | |
170 | 170 | |||
171 | sc->sc_udev = dev; | 171 | sc->sc_udev = dev; | |
172 | sc->sc_config_index = UBSA_DEFAULT_CONFIG_INDEX; | 172 | sc->sc_config_index = UBSA_DEFAULT_CONFIG_INDEX; | |
@@ -222,81 +222,81 @@ ubsa_attach(device_t parent, device_t se | @@ -222,81 +222,81 @@ ubsa_attach(device_t parent, device_t se | |||
222 | err = usbd_device2interface_handle(dev, UBSA_IFACE_INDEX_OFFSET, | 222 | err = usbd_device2interface_handle(dev, UBSA_IFACE_INDEX_OFFSET, | |
223 | &sc->sc_iface[0]); | 223 | &sc->sc_iface[0]); | |
224 | if (err) { | 224 | if (err) { | |
225 | /* can not get main interface */ | 225 | /* can not get main interface */ | |
226 | sc->sc_dying = 1; | 226 | sc->sc_dying = 1; | |
227 | goto error; | 227 | goto error; | |
228 | } | 228 | } | |
229 | 229 | |||
230 | /* Find the endpoints */ | 230 | /* Find the endpoints */ | |
231 | id = usbd_get_interface_descriptor(sc->sc_iface[0]); | 231 | id = usbd_get_interface_descriptor(sc->sc_iface[0]); | |
232 | sc->sc_iface_number[0] = id->bInterfaceNumber; | 232 | sc->sc_iface_number[0] = id->bInterfaceNumber; | |
233 | 233 | |||
234 | /* initialize endpoints */ | 234 | /* initialize endpoints */ | |
235 | uca.bulkin = uca.bulkout = -1; | 235 | ucaa.ucaa_bulkin = ucaa.ucaa_bulkout = -1; | |
236 | 236 | |||
237 | for (i = 0; i < id->bNumEndpoints; i++) { | 237 | for (i = 0; i < id->bNumEndpoints; i++) { | |
238 | ed = usbd_interface2endpoint_descriptor(sc->sc_iface[0], i); | 238 | ed = usbd_interface2endpoint_descriptor(sc->sc_iface[0], i); | |
239 | if (ed == NULL) { | 239 | if (ed == NULL) { | |
240 | aprint_error_dev(self, | 240 | aprint_error_dev(self, | |
241 | "no endpoint descriptor for %d\n", i); | 241 | "no endpoint descriptor for %d\n", i); | |
242 | break; | 242 | break; | |
243 | } | 243 | } | |
244 | 244 | |||
245 | if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && | 245 | if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && | |
246 | UE_GET_XFERTYPE(ed->bmAttributes) == UE_INTERRUPT) { | 246 | UE_GET_XFERTYPE(ed->bmAttributes) == UE_INTERRUPT) { | |
247 | sc->sc_intr_number = ed->bEndpointAddress; | 247 | sc->sc_intr_number = ed->bEndpointAddress; | |
248 | sc->sc_isize = UGETW(ed->wMaxPacketSize); | 248 | sc->sc_isize = UGETW(ed->wMaxPacketSize); | |
249 | } else if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && | 249 | } else if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && | |
250 | UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) { | 250 | UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) { | |
251 | uca.bulkin = ed->bEndpointAddress; | 251 | ucaa.ucaa_bulkin = ed->bEndpointAddress; | |
252 | uca.ibufsize = UGETW(ed->wMaxPacketSize); | 252 | ucaa.ucaa_ibufsize = UGETW(ed->wMaxPacketSize); | |
253 | } else if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_OUT && | 253 | } else if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_OUT && | |
254 | UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) { | 254 | UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) { | |
255 | uca.bulkout = ed->bEndpointAddress; | 255 | ucaa.ucaa_bulkout = ed->bEndpointAddress; | |
256 | uca.obufsize = UGETW(ed->wMaxPacketSize); | 256 | ucaa.ucaa_obufsize = UGETW(ed->wMaxPacketSize); | |
257 | } | 257 | } | |
258 | } /* end of Endpoint loop */ | 258 | } /* end of Endpoint loop */ | |
259 | 259 | |||
260 | if (sc->sc_intr_number == -1) { | 260 | if (sc->sc_intr_number == -1) { | |
261 | aprint_error_dev(self, "Could not find interrupt in\n"); | 261 | aprint_error_dev(self, "Could not find interrupt in\n"); | |
262 | sc->sc_dying = 1; | 262 | sc->sc_dying = 1; | |
263 | goto error; | 263 | goto error; | |
264 | } | 264 | } | |
265 | 265 | |||
266 | if (uca.bulkin == -1) { | 266 | if (ucaa.ucaa_bulkin == -1) { | |
267 | aprint_error_dev(self, "Could not find data bulk in\n"); | 267 | aprint_error_dev(self, "Could not find data bulk in\n"); | |
268 | sc->sc_dying = 1; | 268 | sc->sc_dying = 1; | |
269 | goto error; | 269 | goto error; | |
270 | } | 270 | } | |
271 | 271 | |||
272 | if (uca.bulkout == -1) { | 272 | if (ucaa.ucaa_bulkout == -1) { | |
273 | aprint_error_dev(self, "Could not find data bulk out\n"); | 273 | aprint_error_dev(self, "Could not find data bulk out\n"); | |
274 | sc->sc_dying = 1; | 274 | sc->sc_dying = 1; | |
275 | goto error; | 275 | goto error; | |
276 | } | 276 | } | |
277 | 277 | |||
278 | uca.portno = 0; | 278 | ucaa.ucaa_portno = 0; | |
279 | /* bulkin, bulkout set above */ | 279 | /* bulkin, bulkout set above */ | |
280 | uca.ibufsizepad = uca.ibufsize; | 280 | ucaa.ucaa_ibufsizepad = ucaa.ucaa_ibufsize; | |
281 | uca.opkthdrlen = 0; | 281 | ucaa.ucaa_opkthdrlen = 0; | |
282 | uca.device = dev; | 282 | ucaa.ucaa_device = dev; | |
283 | uca.iface = sc->sc_iface[0]; | 283 | ucaa.ucaa_iface = sc->sc_iface[0]; | |
284 | uca.methods = &ubsa_methods; | 284 | ucaa.ucaa_methods = &ubsa_methods; | |
285 | uca.arg = sc; | 285 | ucaa.ucaa_arg = sc; | |
286 | uca.info = NULL; | 286 | ucaa.ucaa_info = NULL; | |
287 | DPRINTF(("ubsa: int#=%d, in = 0x%x, out = 0x%x, intr = 0x%x\n", | 287 | DPRINTF(("ubsa: int#=%d, in = 0x%x, out = 0x%x, intr = 0x%x\n", | |
288 | i, uca.bulkin, uca.bulkout, sc->sc_intr_number)); | 288 | i, ucaa.ucaa_bulkin, ucaa.ucaa_bulkout, sc->sc_intr_number)); | |
289 | sc->sc_subdevs[0] = config_found_sm_loc(self, "ucombus", NULL, &uca, | 289 | sc->sc_subdevs[0] = config_found_sm_loc(self, "ucombus", NULL, &ucaa, | |
290 | ucomprint, ucomsubmatch); | 290 | ucomprint, ucomsubmatch); | |
291 | 291 | |||
292 | usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev, | 292 | usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev, | |
293 | sc->sc_dev); | 293 | sc->sc_dev); | |
294 | 294 | |||
295 | return; | 295 | return; | |
296 | 296 | |||
297 | error: | 297 | error: | |
298 | return; | 298 | return; | |
299 | } | 299 | } | |
300 | 300 | |||
301 | 301 | |||
302 | void | 302 | void |
--- src/sys/dev/usb/uchcom.c 2016/03/20 09:15:07 1.13.6.7
+++ src/sys/dev/usb/uchcom.c 2016/04/16 13:22:00 1.13.6.8
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: uchcom.c,v 1.13.6.7 2016/03/20 09:15:07 skrll Exp $ */ | 1 | /* $NetBSD: uchcom.c,v 1.13.6.8 2016/04/16 13:22:00 skrll Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 2007 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2007 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Takuya SHIOZAKI (tshiozak@netbsd.org). | 8 | * by Takuya SHIOZAKI (tshiozak@netbsd.org). | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -20,27 +20,27 @@ | @@ -20,27 +20,27 @@ | |||
20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | 22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
29 | * POSSIBILITY OF SUCH DAMAGE. | 29 | * POSSIBILITY OF SUCH DAMAGE. | |
30 | */ | 30 | */ | |
31 | 31 | |||
32 | #include <sys/cdefs.h> | 32 | #include <sys/cdefs.h> | |
33 | __KERNEL_RCSID(0, "$NetBSD: uchcom.c,v 1.13.6.7 2016/03/20 09:15:07 skrll Exp $"); | 33 | __KERNEL_RCSID(0, "$NetBSD: uchcom.c,v 1.13.6.8 2016/04/16 13:22:00 skrll Exp $"); | |
34 | 34 | |||
35 | /* | 35 | /* | |
36 | * driver for WinChipHead CH341/340, the worst USB-serial chip in the world. | 36 | * driver for WinChipHead CH341/340, the worst USB-serial chip in the world. | |
37 | */ | 37 | */ | |
38 | 38 | |||
39 | #include <sys/param.h> | 39 | #include <sys/param.h> | |
40 | #include <sys/systm.h> | 40 | #include <sys/systm.h> | |
41 | #include <sys/kernel.h> | 41 | #include <sys/kernel.h> | |
42 | #include <sys/kmem.h> | 42 | #include <sys/kmem.h> | |
43 | #include <sys/ioctl.h> | 43 | #include <sys/ioctl.h> | |
44 | #include <sys/conf.h> | 44 | #include <sys/conf.h> | |
45 | #include <sys/tty.h> | 45 | #include <sys/tty.h> | |
46 | #include <sys/file.h> | 46 | #include <sys/file.h> | |
@@ -233,27 +233,27 @@ uchcom_match(device_t parent, cfdata_t m | @@ -233,27 +233,27 @@ uchcom_match(device_t parent, cfdata_t m | |||
233 | 233 | |||
234 | return (uchcom_lookup(uaa->uaa_vendor, uaa->uaa_product) != NULL ? | 234 | return (uchcom_lookup(uaa->uaa_vendor, uaa->uaa_product) != NULL ? | |
235 | UMATCH_VENDOR_PRODUCT : UMATCH_NONE); | 235 | UMATCH_VENDOR_PRODUCT : UMATCH_NONE); | |
236 | } | 236 | } | |
237 | 237 | |||
238 | void | 238 | void | |
239 | uchcom_attach(device_t parent, device_t self, void *aux) | 239 | uchcom_attach(device_t parent, device_t self, void *aux) | |
240 | { | 240 | { | |
241 | struct uchcom_softc *sc = device_private(self); | 241 | struct uchcom_softc *sc = device_private(self); | |
242 | struct usb_attach_arg *uaa = aux; | 242 | struct usb_attach_arg *uaa = aux; | |
243 | struct usbd_device *dev = uaa->uaa_device; | 243 | struct usbd_device *dev = uaa->uaa_device; | |
244 | char *devinfop; | 244 | char *devinfop; | |
245 | struct uchcom_endpoints endpoints; | 245 | struct uchcom_endpoints endpoints; | |
246 | struct ucom_attach_args uca; | 246 | struct ucom_attach_args ucaa; | |
247 | 247 | |||
248 | aprint_naive("\n"); | 248 | aprint_naive("\n"); | |
249 | aprint_normal("\n"); | 249 | aprint_normal("\n"); | |
250 | 250 | |||
251 | devinfop = usbd_devinfo_alloc(dev, 0); | 251 | devinfop = usbd_devinfo_alloc(dev, 0); | |
252 | aprint_normal_dev(self, "%s\n", devinfop); | 252 | aprint_normal_dev(self, "%s\n", devinfop); | |
253 | usbd_devinfo_free(devinfop); | 253 | usbd_devinfo_free(devinfop); | |
254 | 254 | |||
255 | sc->sc_dev = self; | 255 | sc->sc_dev = self; | |
256 | sc->sc_udev = dev; | 256 | sc->sc_udev = dev; | |
257 | sc->sc_dying = 0; | 257 | sc->sc_dying = 0; | |
258 | sc->sc_dtr = sc->sc_rts = -1; | 258 | sc->sc_dtr = sc->sc_rts = -1; | |
259 | sc->sc_lsr = sc->sc_msr = 0; | 259 | sc->sc_lsr = sc->sc_msr = 0; | |
@@ -272,43 +272,43 @@ uchcom_attach(device_t parent, device_t | @@ -272,43 +272,43 @@ uchcom_attach(device_t parent, device_t | |||
272 | break; | 272 | break; | |
273 | } | 273 | } | |
274 | 274 | |||
275 | if (find_ifaces(sc, &sc->sc_iface)) | 275 | if (find_ifaces(sc, &sc->sc_iface)) | |
276 | goto failed; | 276 | goto failed; | |
277 | 277 | |||
278 | if (find_endpoints(sc, &endpoints)) | 278 | if (find_endpoints(sc, &endpoints)) | |
279 | goto failed; | 279 | goto failed; | |
280 | 280 | |||
281 | sc->sc_intr_endpoint = endpoints.ep_intr; | 281 | sc->sc_intr_endpoint = endpoints.ep_intr; | |
282 | sc->sc_intr_size = endpoints.ep_intr_size; | 282 | sc->sc_intr_size = endpoints.ep_intr_size; | |
283 | 283 | |||
284 | /* setup ucom layer */ | 284 | /* setup ucom layer */ | |
285 | uca.portno = UCOM_UNK_PORTNO; | 285 | ucaa.ucaa_portno = UCOM_UNK_PORTNO; | |
286 | uca.bulkin = endpoints.ep_bulkin; | 286 | ucaa.ucaa_bulkin = endpoints.ep_bulkin; | |
287 | uca.bulkout = endpoints.ep_bulkout; | 287 | ucaa.ucaa_bulkout = endpoints.ep_bulkout; | |
288 | uca.ibufsize = UCHCOMIBUFSIZE; | 288 | ucaa.ucaa_ibufsize = UCHCOMIBUFSIZE; | |
289 | uca.obufsize = UCHCOMOBUFSIZE; | 289 | ucaa.ucaa_obufsize = UCHCOMOBUFSIZE; | |
290 | uca.ibufsizepad = UCHCOMIBUFSIZE; | 290 | ucaa.ucaa_ibufsizepad = UCHCOMIBUFSIZE; | |
291 | uca.opkthdrlen = 0; | 291 | ucaa.ucaa_opkthdrlen = 0; | |
292 | uca.device = dev; | 292 | ucaa.ucaa_device = dev; | |
293 | uca.iface = sc->sc_iface; | 293 | ucaa.ucaa_iface = sc->sc_iface; | |
294 | uca.methods = &uchcom_methods; | 294 | ucaa.ucaa_methods = &uchcom_methods; | |
295 | uca.arg = sc; | 295 | ucaa.ucaa_arg = sc; | |
296 | uca.info = NULL; | 296 | ucaa.ucaa_info = NULL; | |
297 | 297 | |||
298 | usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev, | 298 | usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev, | |
299 | sc->sc_dev); | 299 | sc->sc_dev); | |
300 | 300 | |||
301 | sc->sc_subdev = config_found_sm_loc(self, "ucombus", NULL, &uca, | 301 | sc->sc_subdev = config_found_sm_loc(self, "ucombus", NULL, &ucaa, | |
302 | ucomprint, ucomsubmatch); | 302 | ucomprint, ucomsubmatch); | |
303 | 303 | |||
304 | return; | 304 | return; | |
305 | 305 | |||
306 | failed: | 306 | failed: | |
307 | sc->sc_dying = 1; | 307 | sc->sc_dying = 1; | |
308 | return; | 308 | return; | |
309 | } | 309 | } | |
310 | 310 | |||
311 | void | 311 | void | |
312 | uchcom_childdet(device_t self, device_t child) | 312 | uchcom_childdet(device_t self, device_t child) | |
313 | { | 313 | { | |
314 | struct uchcom_softc *sc = device_private(self); | 314 | struct uchcom_softc *sc = device_private(self); |
--- src/sys/dev/usb/ucom.c 2016/02/06 07:59:26 1.108.2.12
+++ src/sys/dev/usb/ucom.c 2016/04/16 13:22:00 1.108.2.13
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: ucom.c,v 1.108.2.12 2016/02/06 07:59:26 skrll Exp $ */ | 1 | /* $NetBSD: ucom.c,v 1.108.2.13 2016/04/16 13:22:00 skrll Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Lennart Augustsson (lennart@augustsson.net) at | 8 | * by Lennart Augustsson (lennart@augustsson.net) at | |
9 | * Carlstedt Research & Technology. | 9 | * Carlstedt Research & Technology. | |
10 | * | 10 | * | |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without | |
12 | * modification, are permitted provided that the following conditions | 12 | * modification, are permitted provided that the following conditions | |
13 | * are met: | 13 | * are met: | |
14 | * 1. Redistributions of source code must retain the above copyright | 14 | * 1. Redistributions of source code must retain the above copyright | |
@@ -24,27 +24,27 @@ | @@ -24,27 +24,27 @@ | |||
24 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 24 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
26 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 26 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
30 | * POSSIBILITY OF SUCH DAMAGE. | 30 | * POSSIBILITY OF SUCH DAMAGE. | |
31 | */ | 31 | */ | |
32 | /* | 32 | /* | |
33 | * This code is very heavily based on the 16550 driver, com.c. | 33 | * This code is very heavily based on the 16550 driver, com.c. | |
34 | */ | 34 | */ | |
35 | 35 | |||
36 | #include <sys/cdefs.h> | 36 | #include <sys/cdefs.h> | |
37 | __KERNEL_RCSID(0, "$NetBSD: ucom.c,v 1.108.2.12 2016/02/06 07:59:26 skrll Exp $"); | 37 | __KERNEL_RCSID(0, "$NetBSD: ucom.c,v 1.108.2.13 2016/04/16 13:22:00 skrll Exp $"); | |
38 | 38 | |||
39 | #include <sys/param.h> | 39 | #include <sys/param.h> | |
40 | #include <sys/systm.h> | 40 | #include <sys/systm.h> | |
41 | #include <sys/kernel.h> | 41 | #include <sys/kernel.h> | |
42 | #include <sys/ioctl.h> | 42 | #include <sys/ioctl.h> | |
43 | #include <sys/conf.h> | 43 | #include <sys/conf.h> | |
44 | #include <sys/tty.h> | 44 | #include <sys/tty.h> | |
45 | #include <sys/file.h> | 45 | #include <sys/file.h> | |
46 | #include <sys/select.h> | 46 | #include <sys/select.h> | |
47 | #include <sys/proc.h> | 47 | #include <sys/proc.h> | |
48 | #include <sys/vnode.h> | 48 | #include <sys/vnode.h> | |
49 | #include <sys/device.h> | 49 | #include <sys/device.h> | |
50 | #include <sys/poll.h> | 50 | #include <sys/poll.h> | |
@@ -241,49 +241,50 @@ extern struct cfdriver ucom_cd; | @@ -241,49 +241,50 @@ extern struct cfdriver ucom_cd; | |||
241 | CFATTACH_DECL_NEW(ucom, sizeof(struct ucom_softc), ucom_match, ucom_attach, | 241 | CFATTACH_DECL_NEW(ucom, sizeof(struct ucom_softc), ucom_match, ucom_attach, | |
242 | ucom_detach, ucom_activate); | 242 | ucom_detach, ucom_activate); | |
243 | 243 | |||
244 | int | 244 | int | |
245 | ucom_match(device_t parent, cfdata_t match, void *aux) | 245 | ucom_match(device_t parent, cfdata_t match, void *aux) | |
246 | { | 246 | { | |
247 | return 1; | 247 | return 1; | |
248 | } | 248 | } | |
249 | 249 | |||
250 | void | 250 | void | |
251 | ucom_attach(device_t parent, device_t self, void *aux) | 251 | ucom_attach(device_t parent, device_t self, void *aux) | |
252 | { | 252 | { | |
253 | struct ucom_softc *sc = device_private(self); | 253 | struct ucom_softc *sc = device_private(self); | |
254 | struct ucom_attach_args *uca = aux; | 254 | struct ucom_attach_args *ucaa = aux; | |
255 | struct tty *tp; | 255 | struct tty *tp; | |
256 | 256 | |||
257 | UCOMHIST_FUNC(); UCOMHIST_CALLED(); | 257 | UCOMHIST_FUNC(); UCOMHIST_CALLED(); | |
258 | 258 | |||
259 | if (uca->info != NULL) | 259 | if (ucaa->ucaa_info != NULL) | |
260 | aprint_normal(": %s", uca->info); | 260 | aprint_normal(": %s", ucaa->ucaa_info); | |
261 | aprint_normal("\n"); | 261 | aprint_normal("\n"); | |
262 | 262 | |||
263 | prop_dictionary_set_int32(device_properties(self), "port", uca->portno); | 263 | prop_dictionary_set_int32(device_properties(self), "port", | |
264 | ucaa->ucaa_portno); | |||
264 | 265 | |||
265 | sc->sc_dev = self; | 266 | sc->sc_dev = self; | |
266 | sc->sc_udev = uca->device; | 267 | sc->sc_udev = ucaa->ucaa_device; | |
267 | sc->sc_iface = uca->iface; | 268 | sc->sc_iface = ucaa->ucaa_iface; | |
268 | sc->sc_bulkout_no = uca->bulkout; | 269 | sc->sc_bulkout_no = ucaa->ucaa_bulkout; | |
269 | sc->sc_bulkin_no = uca->bulkin; | 270 | sc->sc_bulkin_no = ucaa->ucaa_bulkin; | |
270 | sc->sc_ibufsize = uca->ibufsize; | 271 | sc->sc_ibufsize = ucaa->ucaa_ibufsize; | |
271 | sc->sc_ibufsizepad = uca->ibufsizepad; | 272 | sc->sc_ibufsizepad = ucaa->ucaa_ibufsizepad; | |
272 | sc->sc_obufsize = uca->obufsize; | 273 | sc->sc_obufsize = ucaa->ucaa_obufsize; | |
273 | sc->sc_opkthdrlen = uca->opkthdrlen; | 274 | sc->sc_opkthdrlen = ucaa->ucaa_opkthdrlen; | |
274 | sc->sc_methods = uca->methods; | 275 | sc->sc_methods = ucaa->ucaa_methods; | |
275 | sc->sc_parent = uca->arg; | 276 | sc->sc_parent = ucaa->ucaa_arg; | |
276 | sc->sc_portno = uca->portno; | 277 | sc->sc_portno = ucaa->ucaa_portno; | |
277 | 278 | |||
278 | sc->sc_lsr = 0; | 279 | sc->sc_lsr = 0; | |
279 | sc->sc_msr = 0; | 280 | sc->sc_msr = 0; | |
280 | sc->sc_mcr = 0; | 281 | sc->sc_mcr = 0; | |
281 | sc->sc_tx_stopped = 0; | 282 | sc->sc_tx_stopped = 0; | |
282 | sc->sc_swflags = 0; | 283 | sc->sc_swflags = 0; | |
283 | sc->sc_opening = 0; | 284 | sc->sc_opening = 0; | |
284 | sc->sc_refcnt = 0; | 285 | sc->sc_refcnt = 0; | |
285 | sc->sc_dying = 0; | 286 | sc->sc_dying = 0; | |
286 | 287 | |||
287 | sc->sc_si = softint_establish(SOFTINT_USB, ucom_softintr, sc); | 288 | sc->sc_si = softint_establish(SOFTINT_USB, ucom_softintr, sc); | |
288 | mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_SOFTUSB); | 289 | mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_SOFTUSB); | |
289 | cv_init(&sc->sc_opencv, "ucomopen"); | 290 | cv_init(&sc->sc_opencv, "ucomopen"); | |
@@ -1483,34 +1484,34 @@ ucom_cleanup(struct ucom_softc *sc) | @@ -1483,34 +1484,34 @@ ucom_cleanup(struct ucom_softc *sc) | |||
1483 | struct usbd_pipe *bulkout_pipe = sc->sc_bulkout_pipe; | 1484 | struct usbd_pipe *bulkout_pipe = sc->sc_bulkout_pipe; | |
1484 | sc->sc_bulkout_pipe = NULL; | 1485 | sc->sc_bulkout_pipe = NULL; | |
1485 | mutex_exit(&sc->sc_lock); | 1486 | mutex_exit(&sc->sc_lock); | |
1486 | usbd_abort_pipe(bulkout_pipe); | 1487 | usbd_abort_pipe(bulkout_pipe); | |
1487 | mutex_enter(&sc->sc_lock); | 1488 | mutex_enter(&sc->sc_lock); | |
1488 | } | 1489 | } | |
1489 | } | 1490 | } | |
1490 | 1491 | |||
1491 | #endif /* NUCOM > 0 */ | 1492 | #endif /* NUCOM > 0 */ | |
1492 | 1493 | |||
1493 | int | 1494 | int | |
1494 | ucomprint(void *aux, const char *pnp) | 1495 | ucomprint(void *aux, const char *pnp) | |
1495 | { | 1496 | { | |
1496 | struct ucom_attach_args *uca = aux; | 1497 | struct ucom_attach_args *ucaa = aux; | |
1497 | 1498 | |||
1498 | if (pnp) | 1499 | if (pnp) | |
1499 | aprint_normal("ucom at %s", pnp); | 1500 | aprint_normal("ucom at %s", pnp); | |
1500 | if (uca->portno != UCOM_UNK_PORTNO) | 1501 | if (ucaa->ucaa_portno != UCOM_UNK_PORTNO) | |
1501 | aprint_normal(" portno %d", uca->portno); | 1502 | aprint_normal(" portno %d", ucaa->ucaa_portno); | |
1502 | return UNCONF; | 1503 | return UNCONF; | |
1503 | } | 1504 | } | |
1504 | 1505 | |||
1505 | int | 1506 | int | |
1506 | ucomsubmatch(device_t parent, cfdata_t cf, | 1507 | ucomsubmatch(device_t parent, cfdata_t cf, | |
1507 | const int *ldesc, void *aux) | 1508 | const int *ldesc, void *aux) | |
1508 | { | 1509 | { | |
1509 | struct ucom_attach_args *uca = aux; | 1510 | struct ucom_attach_args *ucaa = aux; | |
1510 | 1511 | |||
1511 | if (uca->portno != UCOM_UNK_PORTNO && | 1512 | if (ucaa->ucaa_portno != UCOM_UNK_PORTNO && | |
1512 | cf->cf_loc[UCOMBUSCF_PORTNO] != UCOMBUSCF_PORTNO_DEFAULT && | 1513 | cf->cf_loc[UCOMBUSCF_PORTNO] != UCOMBUSCF_PORTNO_DEFAULT && | |
1513 | cf->cf_loc[UCOMBUSCF_PORTNO] != uca->portno) | 1514 | cf->cf_loc[UCOMBUSCF_PORTNO] != ucaa->ucaa_portno) | |
1514 | return 0; | 1515 | return 0; | |
1515 | return config_match(parent, cf, aux); | 1516 | return config_match(parent, cf, aux); | |
1516 | } | 1517 | } |
--- src/sys/dev/usb/ucomvar.h 2015/03/19 17:26:43 1.20.24.3
+++ src/sys/dev/usb/ucomvar.h 2016/04/16 13:22:00 1.20.24.4
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: ucomvar.h,v 1.20.24.3 2015/03/19 17:26:43 skrll Exp $ */ | 1 | /* $NetBSD: ucomvar.h,v 1.20.24.4 2016/04/16 13:22:00 skrll Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1999 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 1999 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Lennart Augustsson (lennart@augustsson.net) at | 8 | * by Lennart Augustsson (lennart@augustsson.net) at | |
9 | * Carlstedt Research & Technology. | 9 | * Carlstedt Research & Technology. | |
10 | * | 10 | * | |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without | |
12 | * modification, are permitted provided that the following conditions | 12 | * modification, are permitted provided that the following conditions | |
13 | * are met: | 13 | * are met: | |
14 | * 1. Redistributions of source code must retain the above copyright | 14 | * 1. Redistributions of source code must retain the above copyright | |
@@ -80,30 +80,30 @@ struct ucom_methods { | @@ -80,30 +80,30 @@ struct ucom_methods { | |||
80 | 80 | |||
81 | /* modem status register */ | 81 | /* modem status register */ | |
82 | /* All deltas are from the last read of the MSR. */ | 82 | /* All deltas are from the last read of the MSR. */ | |
83 | #define UMSR_DCD 0x80 /* Current Data Carrier Detect */ | 83 | #define UMSR_DCD 0x80 /* Current Data Carrier Detect */ | |
84 | #define UMSR_RI 0x40 /* Current Ring Indicator */ | 84 | #define UMSR_RI 0x40 /* Current Ring Indicator */ | |
85 | #define UMSR_DSR 0x20 /* Current Data Set Ready */ | 85 | #define UMSR_DSR 0x20 /* Current Data Set Ready */ | |
86 | #define UMSR_CTS 0x10 /* Current Clear to Send */ | 86 | #define UMSR_CTS 0x10 /* Current Clear to Send */ | |
87 | #define UMSR_DDCD 0x08 /* DCD has changed state */ | 87 | #define UMSR_DDCD 0x08 /* DCD has changed state */ | |
88 | #define UMSR_TERI 0x04 /* RI has toggled low to high */ | 88 | #define UMSR_TERI 0x04 /* RI has toggled low to high */ | |
89 | #define UMSR_DDSR 0x02 /* DSR has changed state */ | 89 | #define UMSR_DDSR 0x02 /* DSR has changed state */ | |
90 | #define UMSR_DCTS 0x01 /* CTS has changed state */ | 90 | #define UMSR_DCTS 0x01 /* CTS has changed state */ | |
91 | 91 | |||
92 | struct ucom_attach_args { | 92 | struct ucom_attach_args { | |
93 | int portno; | 93 | int ucaa_portno; | |
94 | int bulkin; | 94 | int ucaa_bulkin; | |
95 | int bulkout; | 95 | int ucaa_bulkout; | |
96 | u_int ibufsize; | 96 | u_int ucaa_ibufsize; | |
97 | u_int ibufsizepad; | 97 | u_int ucaa_ibufsizepad; | |
98 | u_int obufsize; | 98 | u_int ucaa_obufsize; | |
99 | u_int opkthdrlen; | 99 | u_int ucaa_opkthdrlen; | |
100 | const char *info; /* attach message */ | 100 | const char *ucaa_info; /* attach message */ | |
101 | struct usbd_device *device; | 101 | struct usbd_device *ucaa_device; | |
102 | struct usbd_interface *iface; | 102 | struct usbd_interface *ucaa_iface; | |
103 | const struct ucom_methods *methods; | 103 | const struct ucom_methods *ucaa_methods; | |
104 | void *arg; | 104 | void *ucaa_arg; | |
105 | }; | 105 | }; | |
106 | 106 | |||
107 | int ucomprint(void *, const char *); | 107 | int ucomprint(void *, const char *); | |
108 | int ucomsubmatch(device_t t, cfdata_t, const int *, void *); | 108 | int ucomsubmatch(device_t t, cfdata_t, const int *, void *); | |
109 | void ucom_status_change(struct ucom_softc *); | 109 | void ucom_status_change(struct ucom_softc *); |
--- src/sys/dev/usb/uftdi.c 2015/04/06 15:18:13 1.59.6.8
+++ src/sys/dev/usb/uftdi.c 2016/04/16 13:22:00 1.59.6.9
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: uftdi.c,v 1.59.6.8 2015/04/06 15:18:13 skrll Exp $ */ | 1 | /* $NetBSD: uftdi.c,v 1.59.6.9 2016/04/16 13:22:00 skrll Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 2000 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2000 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Lennart Augustsson (lennart@augustsson.net). | 8 | * by Lennart Augustsson (lennart@augustsson.net). | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -20,27 +20,27 @@ | @@ -20,27 +20,27 @@ | |||
20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | 22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
29 | * POSSIBILITY OF SUCH DAMAGE. | 29 | * POSSIBILITY OF SUCH DAMAGE. | |
30 | */ | 30 | */ | |
31 | 31 | |||
32 | #include <sys/cdefs.h> | 32 | #include <sys/cdefs.h> | |
33 | __KERNEL_RCSID(0, "$NetBSD: uftdi.c,v 1.59.6.8 2015/04/06 15:18:13 skrll Exp $"); | 33 | __KERNEL_RCSID(0, "$NetBSD: uftdi.c,v 1.59.6.9 2016/04/16 13:22:00 skrll Exp $"); | |
34 | 34 | |||
35 | #include <sys/param.h> | 35 | #include <sys/param.h> | |
36 | #include <sys/systm.h> | 36 | #include <sys/systm.h> | |
37 | #include <sys/kernel.h> | 37 | #include <sys/kernel.h> | |
38 | #include <sys/device.h> | 38 | #include <sys/device.h> | |
39 | #include <sys/conf.h> | 39 | #include <sys/conf.h> | |
40 | #include <sys/tty.h> | 40 | #include <sys/tty.h> | |
41 | 41 | |||
42 | #include <dev/usb/usb.h> | 42 | #include <dev/usb/usb.h> | |
43 | 43 | |||
44 | #include <dev/usb/usbdi.h> | 44 | #include <dev/usb/usbdi.h> | |
45 | #include <dev/usb/usbdi_util.h> | 45 | #include <dev/usb/usbdi_util.h> | |
46 | #include <dev/usb/usbdevs.h> | 46 | #include <dev/usb/usbdevs.h> | |
@@ -197,27 +197,27 @@ void | @@ -197,27 +197,27 @@ void | |||
197 | uftdi_attach(device_t parent, device_t self, void *aux) | 197 | uftdi_attach(device_t parent, device_t self, void *aux) | |
198 | { | 198 | { | |
199 | struct uftdi_softc *sc = device_private(self); | 199 | struct uftdi_softc *sc = device_private(self); | |
200 | struct usb_attach_arg *uaa = aux; | 200 | struct usb_attach_arg *uaa = aux; | |
201 | struct usbd_device *dev = uaa->uaa_device; | 201 | struct usbd_device *dev = uaa->uaa_device; | |
202 | struct usbd_interface *iface; | 202 | struct usbd_interface *iface; | |
203 | usb_device_descriptor_t *ddesc; | 203 | usb_device_descriptor_t *ddesc; | |
204 | usb_interface_descriptor_t *id; | 204 | usb_interface_descriptor_t *id; | |
205 | usb_endpoint_descriptor_t *ed; | 205 | usb_endpoint_descriptor_t *ed; | |
206 | char *devinfop; | 206 | char *devinfop; | |
207 | const char *devname = device_xname(self); | 207 | const char *devname = device_xname(self); | |
208 | int i,idx; | 208 | int i,idx; | |
209 | usbd_status err; | 209 | usbd_status err; | |
210 | struct ucom_attach_args uca; | 210 | struct ucom_attach_args ucaa; | |
211 | 211 | |||
212 | DPRINTFN(10,("\nuftdi_attach: sc=%p\n", sc)); | 212 | DPRINTFN(10,("\nuftdi_attach: sc=%p\n", sc)); | |
213 | 213 | |||
214 | aprint_naive("\n"); | 214 | aprint_naive("\n"); | |
215 | aprint_normal("\n"); | 215 | aprint_normal("\n"); | |
216 | 216 | |||
217 | devinfop = usbd_devinfo_alloc(dev, 0); | 217 | devinfop = usbd_devinfo_alloc(dev, 0); | |
218 | aprint_normal_dev(self, "%s\n", devinfop); | 218 | aprint_normal_dev(self, "%s\n", devinfop); | |
219 | usbd_devinfo_free(devinfop); | 219 | usbd_devinfo_free(devinfop); | |
220 | 220 | |||
221 | /* Move the device into the configured state. */ | 221 | /* Move the device into the configured state. */ | |
222 | err = usbd_set_config_index(dev, UFTDI_CONFIG_INDEX, 1); | 222 | err = usbd_set_config_index(dev, UFTDI_CONFIG_INDEX, 1); | |
223 | if (err) { | 223 | if (err) { | |
@@ -257,92 +257,92 @@ uftdi_attach(device_t parent, device_t s | @@ -257,92 +257,92 @@ uftdi_attach(device_t parent, device_t s | |||
257 | for (idx = UFTDI_IFACE_INDEX; idx < sc->sc_numports; idx++) { | 257 | for (idx = UFTDI_IFACE_INDEX; idx < sc->sc_numports; idx++) { | |
258 | err = usbd_device2interface_handle(dev, idx, &iface); | 258 | err = usbd_device2interface_handle(dev, idx, &iface); | |
259 | if (err) { | 259 | if (err) { | |
260 | aprint_error( | 260 | aprint_error( | |
261 | "\n%s: failed to get interface idx=%d, err=%s\n", | 261 | "\n%s: failed to get interface idx=%d, err=%s\n", | |
262 | devname, idx, usbd_errstr(err)); | 262 | devname, idx, usbd_errstr(err)); | |
263 | goto bad; | 263 | goto bad; | |
264 | } | 264 | } | |
265 | 265 | |||
266 | id = usbd_get_interface_descriptor(iface); | 266 | id = usbd_get_interface_descriptor(iface); | |
267 | 267 | |||
268 | sc->sc_iface[idx] = iface; | 268 | sc->sc_iface[idx] = iface; | |
269 | 269 | |||
270 | uca.bulkin = uca.bulkout = -1; | 270 | ucaa.ucaa_bulkin = ucaa.ucaa_bulkout = -1; | |
271 | uca.ibufsize = uca.obufsize = 0; | 271 | ucaa.ucaa_ibufsize = ucaa.ucaa_obufsize = 0; | |
272 | for (i = 0; i < id->bNumEndpoints; i++) { | 272 | for (i = 0; i < id->bNumEndpoints; i++) { | |
273 | int addr, dir, attr; | 273 | int addr, dir, attr; | |
274 | ed = usbd_interface2endpoint_descriptor(iface, i); | 274 | ed = usbd_interface2endpoint_descriptor(iface, i); | |
275 | if (ed == NULL) { | 275 | if (ed == NULL) { | |
276 | aprint_error_dev(self, | 276 | aprint_error_dev(self, | |
277 | "could not read endpoint descriptor: %s\n", | 277 | "could not read endpoint descriptor: %s\n", | |
278 | usbd_errstr(err)); | 278 | usbd_errstr(err)); | |
279 | goto bad; | 279 | goto bad; | |
280 | } | 280 | } | |
281 | 281 | |||
282 | addr = ed->bEndpointAddress; | 282 | addr = ed->bEndpointAddress; | |
283 | dir = UE_GET_DIR(ed->bEndpointAddress); | 283 | dir = UE_GET_DIR(ed->bEndpointAddress); | |
284 | attr = ed->bmAttributes & UE_XFERTYPE; | 284 | attr = ed->bmAttributes & UE_XFERTYPE; | |
285 | if (dir == UE_DIR_IN && attr == UE_BULK) { | 285 | if (dir == UE_DIR_IN && attr == UE_BULK) { | |
286 | uca.bulkin = addr; | 286 | ucaa.ucaa_bulkin = addr; | |
287 | uca.ibufsize = UGETW(ed->wMaxPacketSize); | 287 | ucaa.ucaa_ibufsize = UGETW(ed->wMaxPacketSize); | |
288 | if (uca.ibufsize >= UFTDI_MAX_IBUFSIZE) | 288 | if (ucaa.ucaa_ibufsize >= UFTDI_MAX_IBUFSIZE) | |
289 | uca.ibufsize = UFTDI_MAX_IBUFSIZE; | 289 | ucaa.ucaa_ibufsize = UFTDI_MAX_IBUFSIZE; | |
290 | } else if (dir == UE_DIR_OUT && attr == UE_BULK) { | 290 | } else if (dir == UE_DIR_OUT && attr == UE_BULK) { | |
291 | uca.bulkout = addr; | 291 | ucaa.ucaa_bulkout = addr; | |
292 | uca.obufsize = UGETW(ed->wMaxPacketSize) | 292 | ucaa.ucaa_obufsize = UGETW(ed->wMaxPacketSize) | |
293 | - sc->sc_hdrlen; | 293 | - sc->sc_hdrlen; | |
294 | if (uca.obufsize >= UFTDI_MAX_OBUFSIZE) | 294 | if (ucaa.ucaa_obufsize >= UFTDI_MAX_OBUFSIZE) | |
295 | uca.obufsize = UFTDI_MAX_OBUFSIZE; | 295 | ucaa.ucaa_obufsize = UFTDI_MAX_OBUFSIZE; | |
296 | /* Limit length if we have a 6-bit header. */ | 296 | /* Limit length if we have a 6-bit header. */ | |
297 | if ((sc->sc_hdrlen > 0) && | 297 | if ((sc->sc_hdrlen > 0) && | |
298 | (uca.obufsize > UFTDIOBUFSIZE)) | 298 | (ucaa.ucaa_obufsize > UFTDIOBUFSIZE)) | |
299 | uca.obufsize = UFTDIOBUFSIZE; | 299 | ucaa.ucaa_obufsize = UFTDIOBUFSIZE; | |
300 | } else { | 300 | } else { | |
301 | aprint_error_dev(self, | 301 | aprint_error_dev(self, | |
302 | "unexpected endpoint\n"); | 302 | "unexpected endpoint\n"); | |
303 | goto bad; | 303 | goto bad; | |
304 | } | 304 | } | |
305 | } | 305 | } | |
306 | if (uca.bulkin == -1) { | 306 | if (ucaa.ucaa_bulkin == -1) { | |
307 | aprint_error_dev(self, | 307 | aprint_error_dev(self, | |
308 | "Could not find data bulk in\n"); | 308 | "Could not find data bulk in\n"); | |
309 | goto bad; | 309 | goto bad; | |
310 | } | 310 | } | |
311 | if (uca.bulkout == -1) { | 311 | if (ucaa.ucaa_bulkout == -1) { | |
312 | aprint_error_dev(self, | 312 | aprint_error_dev(self, | |
313 | "Could not find data bulk out\n"); | 313 | "Could not find data bulk out\n"); | |
314 | goto bad; | 314 | goto bad; | |
315 | } | 315 | } | |
316 | 316 | |||
317 | uca.portno = FTDI_PIT_SIOA + idx; | 317 | ucaa.ucaa_portno = FTDI_PIT_SIOA + idx; | |
318 | /* bulkin, bulkout set above */ | 318 | /* ucaa_bulkin, ucaa_bulkout set above */ | |
319 | if (uca.ibufsize == 0) | 319 | if (ucaa.ucaa_ibufsize == 0) | |
320 | uca.ibufsize = UFTDIIBUFSIZE; | 320 | ucaa.ucaa_ibufsize = UFTDIIBUFSIZE; | |
321 | uca.ibufsizepad = uca.ibufsize; | 321 | ucaa.ucaa_ibufsizepad = ucaa.ucaa_ibufsize; | |
322 | if (uca.obufsize == 0) | 322 | if (ucaa.ucaa_obufsize == 0) | |
323 | uca.obufsize = UFTDIOBUFSIZE - sc->sc_hdrlen; | 323 | ucaa.ucaa_obufsize = UFTDIOBUFSIZE - sc->sc_hdrlen; | |
324 | uca.opkthdrlen = sc->sc_hdrlen; | 324 | ucaa.ucaa_opkthdrlen = sc->sc_hdrlen; | |
325 | uca.device = dev; | 325 | ucaa.ucaa_device = dev; | |
326 | uca.iface = iface; | 326 | ucaa.ucaa_iface = iface; | |
327 | uca.methods = &uftdi_methods; | 327 | ucaa.ucaa_methods = &uftdi_methods; | |
328 | uca.arg = sc; | 328 | ucaa.ucaa_arg = sc; | |
329 | uca.info = NULL; | 329 | ucaa.ucaa_info = NULL; | |
330 | 330 | |||
331 | DPRINTF(("uftdi: in=0x%x out=0x%x isize=0x%x osize=0x%x\n", | 331 | DPRINTF(("uftdi: in=0x%x out=0x%x isize=0x%x osize=0x%x\n", | |
332 | uca.bulkin, uca.bulkout, | 332 | ucaa.ucaa_bulkin, ucaa.ucaa_bulkout, | |
333 | uca.ibufsize, uca.obufsize)); | 333 | ucaa.ucaa_ibufsize, ucaa.ucaa_obufsize)); | |
334 | sc->sc_subdev[idx] = config_found_sm_loc(self, "ucombus", NULL, | 334 | sc->sc_subdev[idx] = config_found_sm_loc(self, "ucombus", NULL, | |
335 | &uca, ucomprint, ucomsubmatch); | 335 | &ucaa, ucomprint, ucomsubmatch); | |
336 | } | 336 | } | |
337 | 337 | |||
338 | usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev, | 338 | usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev, | |
339 | sc->sc_dev); | 339 | sc->sc_dev); | |
340 | 340 | |||
341 | return; | 341 | return; | |
342 | 342 | |||
343 | bad: | 343 | bad: | |
344 | DPRINTF(("uftdi_attach: ATTACH ERROR\n")); | 344 | DPRINTF(("uftdi_attach: ATTACH ERROR\n")); | |
345 | sc->sc_dying = 1; | 345 | sc->sc_dying = 1; | |
346 | return; | 346 | return; | |
347 | } | 347 | } | |
348 | 348 |
--- src/sys/dev/usb/ugensa.c 2015/03/21 11:33:37 1.31.6.6
+++ src/sys/dev/usb/ugensa.c 2016/04/16 13:22:00 1.31.6.7
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: ugensa.c,v 1.31.6.6 2015/03/21 11:33:37 skrll Exp $ */ | 1 | /* $NetBSD: ugensa.c,v 1.31.6.7 2016/04/16 13:22:00 skrll Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 2004, 2005 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2004, 2005 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Roland C. Dowdeswell <elric@netbsd.org>. | 8 | * by Roland C. Dowdeswell <elric@netbsd.org>. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -20,27 +20,27 @@ | @@ -20,27 +20,27 @@ | |||
20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | 22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
29 | * POSSIBILITY OF SUCH DAMAGE. | 29 | * POSSIBILITY OF SUCH DAMAGE. | |
30 | */ | 30 | */ | |
31 | 31 | |||
32 | #include <sys/cdefs.h> | 32 | #include <sys/cdefs.h> | |
33 | __KERNEL_RCSID(0, "$NetBSD: ugensa.c,v 1.31.6.6 2015/03/21 11:33:37 skrll Exp $"); | 33 | __KERNEL_RCSID(0, "$NetBSD: ugensa.c,v 1.31.6.7 2016/04/16 13:22:00 skrll Exp $"); | |
34 | 34 | |||
35 | #include <sys/param.h> | 35 | #include <sys/param.h> | |
36 | #include <sys/systm.h> | 36 | #include <sys/systm.h> | |
37 | #include <sys/kernel.h> | 37 | #include <sys/kernel.h> | |
38 | #include <sys/device.h> | 38 | #include <sys/device.h> | |
39 | #include <sys/conf.h> | 39 | #include <sys/conf.h> | |
40 | #include <sys/tty.h> | 40 | #include <sys/tty.h> | |
41 | 41 | |||
42 | #include <dev/usb/usb.h> | 42 | #include <dev/usb/usb.h> | |
43 | 43 | |||
44 | #include <dev/usb/usbdi.h> | 44 | #include <dev/usb/usbdi.h> | |
45 | #include <dev/usb/usbdi_util.h> | 45 | #include <dev/usb/usbdi_util.h> | |
46 | #include <dev/usb/usbdevs.h> | 46 | #include <dev/usb/usbdevs.h> | |
@@ -136,27 +136,27 @@ ugensa_match(device_t parent, cfdata_t m | @@ -136,27 +136,27 @@ ugensa_match(device_t parent, cfdata_t m | |||
136 | 136 | |||
137 | void | 137 | void | |
138 | ugensa_attach(device_t parent, device_t self, void *aux) | 138 | ugensa_attach(device_t parent, device_t self, void *aux) | |
139 | { | 139 | { | |
140 | struct ugensa_softc *sc = device_private(self); | 140 | struct ugensa_softc *sc = device_private(self); | |
141 | struct usb_attach_arg *uaa = aux; | 141 | struct usb_attach_arg *uaa = aux; | |
142 | struct usbd_device *dev = uaa->uaa_device; | 142 | struct usbd_device *dev = uaa->uaa_device; | |
143 | struct usbd_interface *iface; | 143 | struct usbd_interface *iface; | |
144 | usb_interface_descriptor_t *id; | 144 | usb_interface_descriptor_t *id; | |
145 | usb_endpoint_descriptor_t *ed; | 145 | usb_endpoint_descriptor_t *ed; | |
146 | char *devinfop; | 146 | char *devinfop; | |
147 | const char *devname = device_xname(self); | 147 | const char *devname = device_xname(self); | |
148 | usbd_status err; | 148 | usbd_status err; | |
149 | struct ucom_attach_args uca; | 149 | struct ucom_attach_args ucaa; | |
150 | int i; | 150 | int i; | |
151 | 151 | |||
152 | DPRINTFN(10,("\nugensa_attach: sc=%p\n", sc)); | 152 | DPRINTFN(10,("\nugensa_attach: sc=%p\n", sc)); | |
153 | 153 | |||
154 | sc->sc_dev = self; | 154 | sc->sc_dev = self; | |
155 | 155 | |||
156 | aprint_naive("\n"); | 156 | aprint_naive("\n"); | |
157 | aprint_normal("\n"); | 157 | aprint_normal("\n"); | |
158 | 158 | |||
159 | devinfop = usbd_devinfo_alloc(dev, 0); | 159 | devinfop = usbd_devinfo_alloc(dev, 0); | |
160 | aprint_normal_dev(self, "%s\n", devinfop); | 160 | aprint_normal_dev(self, "%s\n", devinfop); | |
161 | usbd_devinfo_free(devinfop); | 161 | usbd_devinfo_free(devinfop); | |
162 | 162 | |||
@@ -174,80 +174,81 @@ ugensa_attach(device_t parent, device_t | @@ -174,80 +174,81 @@ ugensa_attach(device_t parent, device_t | |||
174 | devname, usbd_errstr(err)); | 174 | devname, usbd_errstr(err)); | |
175 | goto bad; | 175 | goto bad; | |
176 | } | 176 | } | |
177 | 177 | |||
178 | if (ugensa_lookup(uaa->uaa_vendor, uaa->uaa_product)->ugensa_flags & UNTESTED) | 178 | if (ugensa_lookup(uaa->uaa_vendor, uaa->uaa_product)->ugensa_flags & UNTESTED) | |
179 | aprint_normal_dev(self, "WARNING: This device is marked as " | 179 | aprint_normal_dev(self, "WARNING: This device is marked as " | |
180 | "untested. Please submit a report via send-pr(1).\n"); | 180 | "untested. Please submit a report via send-pr(1).\n"); | |
181 | 181 | |||
182 | id = usbd_get_interface_descriptor(iface); | 182 | id = usbd_get_interface_descriptor(iface); | |
183 | 183 | |||
184 | sc->sc_udev = dev; | 184 | sc->sc_udev = dev; | |
185 | sc->sc_iface = iface; | 185 | sc->sc_iface = iface; | |
186 | 186 | |||
187 | uca.info = "Generic Serial Device"; | 187 | ucaa.ucaa_info = "Generic Serial Device"; | |
188 | uca.ibufsize = UGENSA_BUFSIZE; | 188 | ucaa.ucaa_ibufsize = UGENSA_BUFSIZE; | |
189 | uca.obufsize = UGENSA_BUFSIZE; | 189 | ucaa.ucaa_obufsize = UGENSA_BUFSIZE; | |
190 | uca.ibufsizepad = UGENSA_BUFSIZE; | 190 | ucaa.ucaa_ibufsizepad = UGENSA_BUFSIZE; | |
191 | uca.portno = UCOM_UNK_PORTNO; | 191 | ucaa.ucaa_portno = UCOM_UNK_PORTNO; | |
192 | uca.opkthdrlen = 0; | 192 | ucaa.ucaa_opkthdrlen = 0; | |
193 | uca.device = dev; | 193 | ucaa.ucaa_device = dev; | |
194 | uca.iface = iface; | 194 | ucaa.ucaa_iface = iface; | |
195 | uca.methods = &ugensa_methods; | 195 | ucaa.ucaa_methods = &ugensa_methods; | |
196 | uca.arg = sc; | 196 | ucaa.ucaa_arg = sc; | |
197 | 197 | |||
198 | usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev, | 198 | usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev, | |
199 | sc->sc_dev); | 199 | sc->sc_dev); | |
200 | 200 | |||
201 | uca.bulkin = uca.bulkout = -1; | 201 | ucaa.ucaa_bulkin = ucaa.ucaa_bulkout = -1; | |
202 | for (i = 0; i < id->bNumEndpoints; i++) { | 202 | for (i = 0; i < id->bNumEndpoints; i++) { | |
203 | int addr, dir, attr; | 203 | int addr, dir, attr; | |
204 | 204 | |||
205 | ed = usbd_interface2endpoint_descriptor(iface, i); | 205 | ed = usbd_interface2endpoint_descriptor(iface, i); | |
206 | if (ed == NULL) { | 206 | if (ed == NULL) { | |
207 | aprint_error_dev(self, | 207 | aprint_error_dev(self, | |
208 | "could not read endpoint descriptor: %s\n", | 208 | "could not read endpoint descriptor: %s\n", | |
209 | usbd_errstr(err)); | 209 | usbd_errstr(err)); | |
210 | goto bad; | 210 | goto bad; | |
211 | } | 211 | } | |
212 | 212 | |||
213 | addr = ed->bEndpointAddress; | 213 | addr = ed->bEndpointAddress; | |
214 | dir = UE_GET_DIR(ed->bEndpointAddress); | 214 | dir = UE_GET_DIR(ed->bEndpointAddress); | |
215 | attr = ed->bmAttributes & UE_XFERTYPE; | 215 | attr = ed->bmAttributes & UE_XFERTYPE; | |
216 | if (attr == UE_BULK) { | 216 | if (attr == UE_BULK) { | |
217 | if (uca.bulkin == -1 && dir == UE_DIR_IN) { | 217 | if (ucaa.ucaa_bulkin == -1 && dir == UE_DIR_IN) { | |
218 | DPRINTF(("%s: Bulk in %d\n", devname, i)); | 218 | DPRINTF(("%s: Bulk in %d\n", devname, i)); | |
219 | uca.bulkin = addr; | 219 | ucaa.ucaa_bulkin = addr; | |
220 | continue; | 220 | continue; | |
221 | } | 221 | } | |
222 | if (uca.bulkout == -1 && dir == UE_DIR_OUT) { | 222 | if (ucaa.ucaa_bulkout == -1 && dir == UE_DIR_OUT) { | |
223 | DPRINTF(("%s: Bulk out %d\n", devname, i)); | 223 | DPRINTF(("%s: Bulk out %d\n", devname, i)); | |
224 | uca.bulkout = addr; | 224 | ucaa.ucaa_bulkout = addr; | |
225 | continue; | 225 | continue; | |
226 | } | 226 | } | |
227 | } | 227 | } | |
228 | aprint_error_dev(self, "unexpected endpoint\n"); | 228 | aprint_error_dev(self, "unexpected endpoint\n"); | |
229 | } | 229 | } | |
230 | if (uca.bulkin == -1) { | 230 | if (ucaa.ucaa_bulkin == -1) { | |
231 | aprint_error_dev(self, "Could not find data bulk in\n"); | 231 | aprint_error_dev(self, "Could not find data bulk in\n"); | |
232 | goto bad; | 232 | goto bad; | |
233 | } | 233 | } | |
234 | if (uca.bulkout == -1) { | 234 | if (ucaa.ucaa_bulkout == -1) { | |
235 | aprint_error_dev(self, "Could not find data bulk out\n"); | 235 | aprint_error_dev(self, "Could not find data bulk out\n"); | |
236 | goto bad; | 236 | goto bad; | |
237 | } | 237 | } | |
238 | 238 | |||
239 | DPRINTF(("ugensa: in=0x%x out=0x%x\n", uca.bulkin, uca.bulkout)); | 239 | DPRINTF(("ugensa: in=0x%x out=0x%x\n", ucaa.ucaa_bulkin, | |
240 | sc->sc_subdev = config_found_sm_loc(self, "ucombus", NULL, &uca, | 240 | ucaa.ucaa_bulkout)); | |
241 | sc->sc_subdev = config_found_sm_loc(self, "ucombus", NULL, &ucaa, | |||
241 | ucomprint, ucomsubmatch); | 242 | ucomprint, ucomsubmatch); | |
242 | 243 | |||
243 | if (!pmf_device_register(self, NULL, NULL)) | 244 | if (!pmf_device_register(self, NULL, NULL)) | |
244 | aprint_error_dev(self, "couldn't establish power handler\n"); | 245 | aprint_error_dev(self, "couldn't establish power handler\n"); | |
245 | return; | 246 | return; | |
246 | 247 | |||
247 | bad: | 248 | bad: | |
248 | DPRINTF(("ugensa_attach: ATTACH ERROR\n")); | 249 | DPRINTF(("ugensa_attach: ATTACH ERROR\n")); | |
249 | sc->sc_dying = 1; | 250 | sc->sc_dying = 1; | |
250 | return; | 251 | return; | |
251 | } | 252 | } | |
252 | 253 | |||
253 | void | 254 | void |
--- src/sys/dev/usb/uhmodem.c 2015/03/21 11:33:37 1.13.24.7
+++ src/sys/dev/usb/uhmodem.c 2016/04/16 13:22:00 1.13.24.8
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: uhmodem.c,v 1.13.24.7 2015/03/21 11:33:37 skrll Exp $ */ | 1 | /* $NetBSD: uhmodem.c,v 1.13.24.8 2016/04/16 13:22:00 skrll Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 2008 Yojiro UO <yuo@nui.org>. | 4 | * Copyright (c) 2008 Yojiro UO <yuo@nui.org>. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Permission to use, copy, modify, and distribute this software for any | 7 | * Permission to use, copy, modify, and distribute this software for any | |
8 | * purpose with or without fee is hereby granted, provided that the above | 8 | * purpose with or without fee is hereby granted, provided that the above | |
9 | * copyright notice and this permission notice appear in all copies. | 9 | * copyright notice and this permission notice appear in all copies. | |
10 | * | 10 | * | |
11 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | 11 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
12 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | 12 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
13 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | 13 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
14 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | 14 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
@@ -61,27 +61,27 @@ | @@ -61,27 +61,27 @@ | |||
61 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | 61 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
62 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 62 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
63 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | 63 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
64 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 64 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
65 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 65 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
66 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 66 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
67 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 67 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
68 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 68 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
69 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 69 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
70 | * POSSIBILITY OF SUCH DAMAGE. | 70 | * POSSIBILITY OF SUCH DAMAGE. | |
71 | */ | 71 | */ | |
72 | 72 | |||
73 | #include <sys/cdefs.h> | 73 | #include <sys/cdefs.h> | |
74 | __KERNEL_RCSID(0, "$NetBSD: uhmodem.c,v 1.13.24.7 2015/03/21 11:33:37 skrll Exp $"); | 74 | __KERNEL_RCSID(0, "$NetBSD: uhmodem.c,v 1.13.24.8 2016/04/16 13:22:00 skrll Exp $"); | |
75 | 75 | |||
76 | #include <sys/param.h> | 76 | #include <sys/param.h> | |
77 | #include <sys/systm.h> | 77 | #include <sys/systm.h> | |
78 | #include <sys/kernel.h> | 78 | #include <sys/kernel.h> | |
79 | #include <sys/kmem.h> | 79 | #include <sys/kmem.h> | |
80 | #include <sys/ioccom.h> | 80 | #include <sys/ioccom.h> | |
81 | #include <sys/fcntl.h> | 81 | #include <sys/fcntl.h> | |
82 | #include <sys/conf.h> | 82 | #include <sys/conf.h> | |
83 | #include <sys/tty.h> | 83 | #include <sys/tty.h> | |
84 | #include <sys/file.h> | 84 | #include <sys/file.h> | |
85 | #include <sys/select.h> | 85 | #include <sys/select.h> | |
86 | #include <sys/proc.h> | 86 | #include <sys/proc.h> | |
87 | #include <sys/device.h> | 87 | #include <sys/device.h> | |
@@ -188,27 +188,27 @@ uhmodem_match(device_t parent, cfdata_t | @@ -188,27 +188,27 @@ uhmodem_match(device_t parent, cfdata_t | |||
188 | } | 188 | } | |
189 | 189 | |||
190 | void | 190 | void | |
191 | uhmodem_attach(device_t parent, device_t self, void *aux) | 191 | uhmodem_attach(device_t parent, device_t self, void *aux) | |
192 | { | 192 | { | |
193 | struct uhmodem_softc *sc = device_private(self); | 193 | struct uhmodem_softc *sc = device_private(self); | |
194 | struct usbif_attach_arg *uiaa = aux; | 194 | struct usbif_attach_arg *uiaa = aux; | |
195 | struct usbd_device *dev = uiaa->uiaa_device; | 195 | struct usbd_device *dev = uiaa->uiaa_device; | |
196 | usb_config_descriptor_t *cdesc; | 196 | usb_config_descriptor_t *cdesc; | |
197 | usb_interface_descriptor_t *id; | 197 | usb_interface_descriptor_t *id; | |
198 | usb_endpoint_descriptor_t *ed; | 198 | usb_endpoint_descriptor_t *ed; | |
199 | char *devinfop; | 199 | char *devinfop; | |
200 | usbd_status err; | 200 | usbd_status err; | |
201 | struct ucom_attach_args uca; | 201 | struct ucom_attach_args ucaa; | |
202 | int i; | 202 | int i; | |
203 | int j; | 203 | int j; | |
204 | char comname[16]; | 204 | char comname[16]; | |
205 | 205 | |||
206 | aprint_naive("\n"); | 206 | aprint_naive("\n"); | |
207 | aprint_normal("\n"); | 207 | aprint_normal("\n"); | |
208 | 208 | |||
209 | devinfop = usbd_devinfo_alloc(dev, 0); | 209 | devinfop = usbd_devinfo_alloc(dev, 0); | |
210 | aprint_normal_dev(self, "%s\n", devinfop); | 210 | aprint_normal_dev(self, "%s\n", devinfop); | |
211 | usbd_devinfo_free(devinfop); | 211 | usbd_devinfo_free(devinfop); | |
212 | 212 | |||
213 | sc->sc_ubsa.sc_dev = self; | 213 | sc->sc_ubsa.sc_dev = self; | |
214 | sc->sc_ubsa.sc_udev = dev; | 214 | sc->sc_ubsa.sc_udev = dev; | |
@@ -273,105 +273,106 @@ uhmodem_attach(device_t parent, device_t | @@ -273,105 +273,106 @@ uhmodem_attach(device_t parent, device_t | |||
273 | if (i == 0){ | 273 | if (i == 0){ | |
274 | /* can not get main interface */ | 274 | /* can not get main interface */ | |
275 | sc->sc_ubsa.sc_dying = 1; | 275 | sc->sc_ubsa.sc_dying = 1; | |
276 | goto error; | 276 | goto error; | |
277 | } else | 277 | } else | |
278 | break; | 278 | break; | |
279 | } | 279 | } | |
280 | 280 | |||
281 | /* Find the endpoints */ | 281 | /* Find the endpoints */ | |
282 | id = usbd_get_interface_descriptor(sc->sc_ubsa.sc_iface[i]); | 282 | id = usbd_get_interface_descriptor(sc->sc_ubsa.sc_iface[i]); | |
283 | sc->sc_ubsa.sc_iface_number[i] = id->bInterfaceNumber; | 283 | sc->sc_ubsa.sc_iface_number[i] = id->bInterfaceNumber; | |
284 | 284 | |||
285 | /* initialize endpoints */ | 285 | /* initialize endpoints */ | |
286 | uca.bulkin = uca.bulkout = -1; | 286 | ucaa.ucaa_bulkin = ucaa.ucaa_bulkout = -1; | |
287 | 287 | |||
288 | for (j = 0; j < id->bNumEndpoints; j++) { | 288 | for (j = 0; j < id->bNumEndpoints; j++) { | |
289 | ed = usbd_interface2endpoint_descriptor( | 289 | ed = usbd_interface2endpoint_descriptor( | |
290 | sc->sc_ubsa.sc_iface[i], j); | 290 | sc->sc_ubsa.sc_iface[i], j); | |
291 | if (ed == NULL) { | 291 | if (ed == NULL) { | |
292 | aprint_error_dev(self, | 292 | aprint_error_dev(self, | |
293 | "no endpoint descriptor for %d " | 293 | "no endpoint descriptor for %d " | |
294 | "(interface: %d)\n", j, i); | 294 | "(interface: %d)\n", j, i); | |
295 | break; | 295 | break; | |
296 | } | 296 | } | |
297 | 297 | |||
298 | if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && | 298 | if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && | |
299 | UE_GET_XFERTYPE(ed->bmAttributes) == UE_INTERRUPT) { | 299 | UE_GET_XFERTYPE(ed->bmAttributes) == UE_INTERRUPT) { | |
300 | sc->sc_ubsa.sc_intr_number = ed->bEndpointAddress; | 300 | sc->sc_ubsa.sc_intr_number = ed->bEndpointAddress; | |
301 | sc->sc_ubsa.sc_isize = UGETW(ed->wMaxPacketSize); | 301 | sc->sc_ubsa.sc_isize = UGETW(ed->wMaxPacketSize); | |
302 | } else if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && | 302 | } else if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && | |
303 | UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) { | 303 | UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) { | |
304 | uca.bulkin = ed->bEndpointAddress; | 304 | ucaa.ucaa_bulkin = ed->bEndpointAddress; | |
305 | } else if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_OUT && | 305 | } else if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_OUT && | |
306 | UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) { | 306 | UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) { | |
307 | uca.bulkout = ed->bEndpointAddress; | 307 | ucaa.ucaa_bulkout = ed->bEndpointAddress; | |
308 | } | 308 | } | |
309 | } /* end of Endpoint loop */ | 309 | } /* end of Endpoint loop */ | |
310 | 310 | |||
311 | if (sc->sc_ubsa.sc_intr_number == -1) { | 311 | if (sc->sc_ubsa.sc_intr_number == -1) { | |
312 | aprint_error_dev(self, "HUAWEI E220 need to re-attach " | 312 | aprint_error_dev(self, "HUAWEI E220 need to re-attach " | |
313 | "to enable modem function\n"); | 313 | "to enable modem function\n"); | |
314 | if (i == 0) { | 314 | if (i == 0) { | |
315 | /* could not get intr for main tty */ | 315 | /* could not get intr for main tty */ | |
316 | sc->sc_ubsa.sc_dying = 1; | 316 | sc->sc_ubsa.sc_dying = 1; | |
317 | goto error; | 317 | goto error; | |
318 | } else | 318 | } else | |
319 | break; | 319 | break; | |
320 | } | 320 | } | |
321 | if (uca.bulkin == -1) { | 321 | if (ucaa.ucaa_bulkin == -1) { | |
322 | aprint_error_dev(self, | 322 | aprint_error_dev(self, | |
323 | "Could not find data bulk in\n"); | 323 | "Could not find data bulk in\n"); | |
324 | sc->sc_ubsa.sc_dying = 1; | 324 | sc->sc_ubsa.sc_dying = 1; | |
325 | goto error; | 325 | goto error; | |
326 | } | 326 | } | |
327 | 327 | |||
328 | if (uca.bulkout == -1) { | 328 | if (ucaa.ucaa_bulkout == -1) { | |
329 | aprint_error_dev(self, | 329 | aprint_error_dev(self, | |
330 | "Could not find data bulk out\n"); | 330 | "Could not find data bulk out\n"); | |
331 | sc->sc_ubsa.sc_dying = 1; | 331 | sc->sc_ubsa.sc_dying = 1; | |
332 | goto error; | 332 | goto error; | |
333 | } | 333 | } | |
334 | 334 | |||
335 | switch (i) { | 335 | switch (i) { | |
336 | case 0: | 336 | case 0: | |
337 | snprintf(comname, sizeof(comname), "modem"); | 337 | snprintf(comname, sizeof(comname), "modem"); | |
338 | break; | 338 | break; | |
339 | case 1: | 339 | case 1: | |
340 | snprintf(comname, sizeof(comname), "alt#1"); | 340 | snprintf(comname, sizeof(comname), "alt#1"); | |
341 | break; | 341 | break; | |
342 | case 2: | 342 | case 2: | |
343 | snprintf(comname, sizeof(comname), "alt#2"); | 343 | snprintf(comname, sizeof(comname), "alt#2"); | |
344 | break; | 344 | break; | |
345 | default: | 345 | default: | |
346 | snprintf(comname, sizeof(comname), "int#%d", i); | 346 | snprintf(comname, sizeof(comname), "int#%d", i); | |
347 | break; | 347 | break; | |
348 | } | 348 | } | |
349 | 349 | |||
350 | uca.portno = i; | 350 | ucaa.ucaa_portno = i; | |
351 | /* bulkin, bulkout set above */ | 351 | /* ucaa_bulkin, ucaa_bulkout set above */ | |
352 | uca.ibufsize = UHMODEMIBUFSIZE; | 352 | ucaa.ucaa_ibufsize = UHMODEMIBUFSIZE; | |
353 | uca.obufsize = UHMODEMOBUFSIZE; | 353 | ucaa.ucaa_obufsize = UHMODEMOBUFSIZE; | |
354 | uca.ibufsizepad = UHMODEMIBUFSIZE; | 354 | ucaa.ucaa_ibufsizepad = UHMODEMIBUFSIZE; | |
355 | uca.opkthdrlen = 0; | 355 | ucaa.ucaa_opkthdrlen = 0; | |
356 | uca.device = dev; | 356 | ucaa.ucaa_device = dev; | |
357 | uca.iface = sc->sc_ubsa.sc_iface[i]; | 357 | ucaa.ucaa_iface = sc->sc_ubsa.sc_iface[i]; | |
358 | uca.methods = &uhmodem_methods; | 358 | ucaa.ucaa_methods = &uhmodem_methods; | |
359 | uca.arg = &sc->sc_ubsa; | 359 | ucaa.ucaa_arg = &sc->sc_ubsa; | |
360 | uca.info = comname; | 360 | ucaa.ucaa_info = comname; | |
361 | DPRINTF(("uhmodem: int#=%d, in = 0x%x, out = 0x%x, intr = 0x%x\n", | 361 | DPRINTF(("uhmodem: int#=%d, in = 0x%x, out = 0x%x, intr = 0x%x\n", | |
362 | i, uca.bulkin, uca.bulkout, sc->sc_ubsa.sc_intr_number)); | 362 | i, ucaa.ucaa_bulkin, ucaa.ucaa_bulkout, | |
363 | sc->sc_ubsa.sc_intr_number)); | |||
363 | sc->sc_ubsa.sc_subdevs[i] = config_found_sm_loc(self, "ucombus", NULL, | 364 | sc->sc_ubsa.sc_subdevs[i] = config_found_sm_loc(self, "ucombus", NULL, | |
364 | &uca, ucomprint, ucomsubmatch); | 365 | &ucaa, ucomprint, ucomsubmatch); | |
365 | 366 | |||
366 | /* issue endpoint halt to each interface */ | 367 | /* issue endpoint halt to each interface */ | |
367 | err = uhmodem_endpointhalt(&sc->sc_ubsa, i); | 368 | err = uhmodem_endpointhalt(&sc->sc_ubsa, i); | |
368 | if (err) | 369 | if (err) | |
369 | aprint_error("%s: endpointhalt fail\n", __func__); | 370 | aprint_error("%s: endpointhalt fail\n", __func__); | |
370 | else | 371 | else | |
371 | usbd_delay_ms(sc->sc_ubsa.sc_udev, 50); | 372 | usbd_delay_ms(sc->sc_ubsa.sc_udev, 50); | |
372 | } /* end of Interface loop */ | 373 | } /* end of Interface loop */ | |
373 | 374 | |||
374 | usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_ubsa.sc_udev, | 375 | usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_ubsa.sc_udev, | |
375 | sc->sc_ubsa.sc_dev); | 376 | sc->sc_ubsa.sc_dev); | |
376 | 377 | |||
377 | return; | 378 | return; |
--- src/sys/dev/usb/uipaq.c 2015/03/21 11:33:37 1.19.14.6
+++ src/sys/dev/usb/uipaq.c 2016/04/16 13:22:00 1.19.14.7
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: uipaq.c,v 1.19.14.6 2015/03/21 11:33:37 skrll Exp $ */ | 1 | /* $NetBSD: uipaq.c,v 1.19.14.7 2016/04/16 13:22:00 skrll Exp $ */ | |
2 | /* $OpenBSD: uipaq.c,v 1.1 2005/06/17 23:50:33 deraadt Exp $ */ | 2 | /* $OpenBSD: uipaq.c,v 1.1 2005/06/17 23:50:33 deraadt Exp $ */ | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * Copyright (c) 2000-2005 The NetBSD Foundation, Inc. | 5 | * Copyright (c) 2000-2005 The NetBSD Foundation, Inc. | |
6 | * All rights reserved. | 6 | * All rights reserved. | |
7 | * | 7 | * | |
8 | * This code is derived from software contributed to The NetBSD Foundation | 8 | * This code is derived from software contributed to The NetBSD Foundation | |
9 | * by Lennart Augustsson (lennart@augustsson.net) at | 9 | * by Lennart Augustsson (lennart@augustsson.net) at | |
10 | * Carlstedt Research & Technology. | 10 | * Carlstedt Research & Technology. | |
11 | * | 11 | * | |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without | |
13 | * modification, are permitted provided that the following conditions | 13 | * modification, are permitted provided that the following conditions | |
14 | * are met: | 14 | * are met: | |
@@ -32,27 +32,27 @@ | @@ -32,27 +32,27 @@ | |||
32 | */ | 32 | */ | |
33 | 33 | |||
34 | /* | 34 | /* | |
35 | * iPAQ driver | 35 | * iPAQ driver | |
36 | * | 36 | * | |
37 | * 19 July 2003: Incorporated changes suggested by Sam Lawrance from | 37 | * 19 July 2003: Incorporated changes suggested by Sam Lawrance from | |
38 | * the uppc module | 38 | * the uppc module | |
39 | * | 39 | * | |
40 | * | 40 | * | |
41 | * Contact isis@cs.umd.edu if you have any questions/comments about this driver | 41 | * Contact isis@cs.umd.edu if you have any questions/comments about this driver | |
42 | */ | 42 | */ | |
43 | 43 | |||
44 | #include <sys/cdefs.h> | 44 | #include <sys/cdefs.h> | |
45 | __KERNEL_RCSID(0, "$NetBSD: uipaq.c,v 1.19.14.6 2015/03/21 11:33:37 skrll Exp $"); | 45 | __KERNEL_RCSID(0, "$NetBSD: uipaq.c,v 1.19.14.7 2016/04/16 13:22:00 skrll Exp $"); | |
46 | 46 | |||
47 | #include <sys/param.h> | 47 | #include <sys/param.h> | |
48 | #include <sys/systm.h> | 48 | #include <sys/systm.h> | |
49 | #include <sys/kernel.h> | 49 | #include <sys/kernel.h> | |
50 | #include <sys/device.h> | 50 | #include <sys/device.h> | |
51 | #include <sys/conf.h> | 51 | #include <sys/conf.h> | |
52 | #include <sys/tty.h> | 52 | #include <sys/tty.h> | |
53 | 53 | |||
54 | #include <dev/usb/usb.h> | 54 | #include <dev/usb/usb.h> | |
55 | 55 | |||
56 | #include <dev/usb/usbcdc.h> /*UCDC_* stuff */ | 56 | #include <dev/usb/usbcdc.h> /*UCDC_* stuff */ | |
57 | 57 | |||
58 | #include <dev/usb/usbdi.h> | 58 | #include <dev/usb/usbdi.h> | |
@@ -151,27 +151,27 @@ uipaq_match(device_t parent, cfdata_t ma | @@ -151,27 +151,27 @@ uipaq_match(device_t parent, cfdata_t ma | |||
151 | void | 151 | void | |
152 | uipaq_attach(device_t parent, device_t self, void *aux) | 152 | uipaq_attach(device_t parent, device_t self, void *aux) | |
153 | { | 153 | { | |
154 | struct uipaq_softc *sc = device_private(self); | 154 | struct uipaq_softc *sc = device_private(self); | |
155 | struct usb_attach_arg *uaa = aux; | 155 | struct usb_attach_arg *uaa = aux; | |
156 | struct usbd_device *dev = uaa->uaa_device; | 156 | struct usbd_device *dev = uaa->uaa_device; | |
157 | struct usbd_interface *iface; | 157 | struct usbd_interface *iface; | |
158 | usb_interface_descriptor_t *id; | 158 | usb_interface_descriptor_t *id; | |
159 | usb_endpoint_descriptor_t *ed; | 159 | usb_endpoint_descriptor_t *ed; | |
160 | char *devinfop; | 160 | char *devinfop; | |
161 | const char *devname = device_xname(self); | 161 | const char *devname = device_xname(self); | |
162 | int i; | 162 | int i; | |
163 | usbd_status err; | 163 | usbd_status err; | |
164 | struct ucom_attach_args uca; | 164 | struct ucom_attach_args ucaa; | |
165 | 165 | |||
166 | DPRINTFN(10,("\nuipaq_attach: sc=%p\n", sc)); | 166 | DPRINTFN(10,("\nuipaq_attach: sc=%p\n", sc)); | |
167 | 167 | |||
168 | sc->sc_dev = self; | 168 | sc->sc_dev = self; | |
169 | 169 | |||
170 | aprint_naive("\n"); | 170 | aprint_naive("\n"); | |
171 | aprint_normal("\n"); | 171 | aprint_normal("\n"); | |
172 | 172 | |||
173 | devinfop = usbd_devinfo_alloc(dev, 0); | 173 | devinfop = usbd_devinfo_alloc(dev, 0); | |
174 | aprint_normal_dev(self, "%s\n", devinfop); | 174 | aprint_normal_dev(self, "%s\n", devinfop); | |
175 | usbd_devinfo_free(devinfop); | 175 | usbd_devinfo_free(devinfop); | |
176 | 176 | |||
177 | /* Move the device into the configured state. */ | 177 | /* Move the device into the configured state. */ | |
@@ -186,70 +186,70 @@ uipaq_attach(device_t parent, device_t s | @@ -186,70 +186,70 @@ uipaq_attach(device_t parent, device_t s | |||
186 | if (err) { | 186 | if (err) { | |
187 | aprint_error("\n%s: failed to get interface, err=%s\n", | 187 | aprint_error("\n%s: failed to get interface, err=%s\n", | |
188 | devname, usbd_errstr(err)); | 188 | devname, usbd_errstr(err)); | |
189 | goto bad; | 189 | goto bad; | |
190 | } | 190 | } | |
191 | 191 | |||
192 | sc->sc_flags = uipaq_lookup(uaa->uaa_vendor, uaa->uaa_product)->uv_flags; | 192 | sc->sc_flags = uipaq_lookup(uaa->uaa_vendor, uaa->uaa_product)->uv_flags; | |
193 | 193 | |||
194 | id = usbd_get_interface_descriptor(iface); | 194 | id = usbd_get_interface_descriptor(iface); | |
195 | 195 | |||
196 | sc->sc_udev = dev; | 196 | sc->sc_udev = dev; | |
197 | sc->sc_iface = iface; | 197 | sc->sc_iface = iface; | |
198 | 198 | |||
199 | uca.ibufsize = UIPAQIBUFSIZE; | 199 | ucaa.ucaa_ibufsize = UIPAQIBUFSIZE; | |
200 | uca.obufsize = UIPAQOBUFSIZE; | 200 | ucaa.ucaa_obufsize = UIPAQOBUFSIZE; | |
201 | uca.ibufsizepad = UIPAQIBUFSIZE; | 201 | ucaa.ucaa_ibufsizepad = UIPAQIBUFSIZE; | |
202 | uca.opkthdrlen = 0; | 202 | ucaa.ucaa_opkthdrlen = 0; | |
203 | uca.device = dev; | 203 | ucaa.ucaa_device = dev; | |
204 | uca.iface = iface; | 204 | ucaa.ucaa_iface = iface; | |
205 | uca.methods = &uipaq_methods; | 205 | ucaa.ucaa_methods = &uipaq_methods; | |
206 | uca.arg = sc; | 206 | ucaa.ucaa_arg = sc; | |
207 | uca.portno = UCOM_UNK_PORTNO; | 207 | ucaa.ucaa_portno = UCOM_UNK_PORTNO; | |
208 | uca.info = "Generic"; | 208 | ucaa.ucaa_info = "Generic"; | |
209 | 209 | |||
210 | /* err = uipaq_init(sc); | 210 | /* err = uipaq_init(sc); | |
211 | if (err) { | 211 | if (err) { | |
212 | printf("%s: init failed, %s\n", device_xname(sc->sc_dev), | 212 | printf("%s: init failed, %s\n", device_xname(sc->sc_dev), | |
213 | usbd_errstr(err)); | 213 | usbd_errstr(err)); | |
214 | goto bad; | 214 | goto bad; | |
215 | }*/ | 215 | }*/ | |
216 | 216 | |||
217 | usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev, | 217 | usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev, | |
218 | sc->sc_dev); | 218 | sc->sc_dev); | |
219 | 219 | |||
220 | uca.bulkin = uca.bulkout = -1; | 220 | ucaa.ucaa_bulkin = ucaa.ucaa_bulkout = -1; | |
221 | for (i=0; i<id->bNumEndpoints; i++) { | 221 | for (i=0; i<id->bNumEndpoints; i++) { | |
222 | ed = usbd_interface2endpoint_descriptor(iface, i); | 222 | ed = usbd_interface2endpoint_descriptor(iface, i); | |
223 | if (ed == NULL) { | 223 | if (ed == NULL) { | |
224 | aprint_error_dev(self, | 224 | aprint_error_dev(self, | |
225 | "no endpoint descriptor for %d\n", i); | 225 | "no endpoint descriptor for %d\n", i); | |
226 | goto bad; | 226 | goto bad; | |
227 | } | 227 | } | |
228 | if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && | 228 | if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && | |
229 | (ed->bmAttributes & UE_XFERTYPE) == UE_BULK) { | 229 | (ed->bmAttributes & UE_XFERTYPE) == UE_BULK) { | |
230 | uca.bulkin = ed->bEndpointAddress; | 230 | ucaa.ucaa_bulkin = ed->bEndpointAddress; | |
231 | } else if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_OUT && | 231 | } else if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_OUT && | |
232 | (ed->bmAttributes & UE_XFERTYPE) == UE_BULK) { | 232 | (ed->bmAttributes & UE_XFERTYPE) == UE_BULK) { | |
233 | uca.bulkout = ed->bEndpointAddress; | 233 | ucaa.ucaa_bulkout = ed->bEndpointAddress; | |
234 | } | 234 | } | |
235 | } | 235 | } | |
236 | if (uca.bulkin == -1 || uca.bulkout == -1) { | 236 | if (ucaa.ucaa_bulkin == -1 || ucaa.ucaa_bulkout == -1) { | |
237 | aprint_error_dev(self, "no proper endpoints found (%d,%d) \n", | 237 | aprint_error_dev(self, "no proper endpoints found (%d,%d) \n", | |
238 | uca.bulkin, uca.bulkout); | 238 | ucaa.ucaa_bulkin, ucaa.ucaa_bulkout); | |
239 | return; | 239 | return; | |
240 | } | 240 | } | |
241 | 241 | |||
242 | sc->sc_subdev = config_found_sm_loc(self, "ucombus", NULL, &uca, | 242 | sc->sc_subdev = config_found_sm_loc(self, "ucombus", NULL, &ucaa, | |
243 | ucomprint, ucomsubmatch); | 243 | ucomprint, ucomsubmatch); | |
244 | 244 | |||
245 | return; | 245 | return; | |
246 | 246 | |||
247 | bad: | 247 | bad: | |
248 | DPRINTF(("uipaq_attach: ATTACH ERROR\n")); | 248 | DPRINTF(("uipaq_attach: ATTACH ERROR\n")); | |
249 | sc->sc_dying = 1; | 249 | sc->sc_dying = 1; | |
250 | return; | 250 | return; | |
251 | } | 251 | } | |
252 | 252 | |||
253 | 253 | |||
254 | void | 254 | void | |
255 | uipaq_dtr(struct uipaq_softc* sc, int onoff) | 255 | uipaq_dtr(struct uipaq_softc* sc, int onoff) |
--- src/sys/dev/usb/ukyopon.c 2015/09/29 11:38:29 1.16.16.5
+++ src/sys/dev/usb/ukyopon.c 2016/04/16 13:22:00 1.16.16.6
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: ukyopon.c,v 1.16.16.5 2015/09/29 11:38:29 skrll Exp $ */ | 1 | /* $NetBSD: ukyopon.c,v 1.16.16.6 2016/04/16 13:22:00 skrll Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1998, 2005 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 1998, 2005 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Lennart Augustsson (lennart@augustsson.net) at | 8 | * by Lennart Augustsson (lennart@augustsson.net) at | |
9 | * Carlstedt Research & Technology. | 9 | * Carlstedt Research & Technology. | |
10 | * | 10 | * | |
11 | * This code is derived from software contributed to The NetBSD Foundation | 11 | * This code is derived from software contributed to The NetBSD Foundation | |
12 | * by ITOH Yasufumi. | 12 | * by ITOH Yasufumi. | |
13 | * | 13 | * | |
14 | * Redistribution and use in source and binary forms, with or without | 14 | * Redistribution and use in source and binary forms, with or without | |
@@ -24,27 +24,27 @@ | @@ -24,27 +24,27 @@ | |||
24 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | 24 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
25 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 25 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
26 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | 26 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
27 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 27 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
28 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 28 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
29 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 29 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
30 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 30 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
31 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 31 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
32 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 32 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
33 | * POSSIBILITY OF SUCH DAMAGE. | 33 | * POSSIBILITY OF SUCH DAMAGE. | |
34 | */ | 34 | */ | |
35 | 35 | |||
36 | #include <sys/cdefs.h> | 36 | #include <sys/cdefs.h> | |
37 | __KERNEL_RCSID(0, "$NetBSD: ukyopon.c,v 1.16.16.5 2015/09/29 11:38:29 skrll Exp $"); | 37 | __KERNEL_RCSID(0, "$NetBSD: ukyopon.c,v 1.16.16.6 2016/04/16 13:22:00 skrll Exp $"); | |
38 | 38 | |||
39 | #include <sys/param.h> | 39 | #include <sys/param.h> | |
40 | #include <sys/systm.h> | 40 | #include <sys/systm.h> | |
41 | #include <sys/kernel.h> | 41 | #include <sys/kernel.h> | |
42 | #include <sys/ioctl.h> | 42 | #include <sys/ioctl.h> | |
43 | #include <sys/conf.h> | 43 | #include <sys/conf.h> | |
44 | #include <sys/tty.h> | 44 | #include <sys/tty.h> | |
45 | #include <sys/file.h> | 45 | #include <sys/file.h> | |
46 | #include <sys/select.h> | 46 | #include <sys/select.h> | |
47 | #include <sys/proc.h> | 47 | #include <sys/proc.h> | |
48 | #include <sys/vnode.h> | 48 | #include <sys/vnode.h> | |
49 | #include <sys/device.h> | 49 | #include <sys/device.h> | |
50 | #include <sys/poll.h> | 50 | #include <sys/poll.h> | |
@@ -112,35 +112,35 @@ ukyopon_match(device_t parent, cfdata_t | @@ -112,35 +112,35 @@ ukyopon_match(device_t parent, cfdata_t | |||
112 | uiaa->uiaa_product == USB_PRODUCT_KYOCERA_AHK3001V && | 112 | uiaa->uiaa_product == USB_PRODUCT_KYOCERA_AHK3001V && | |
113 | (uiaa->uiaa_ifaceno == UKYOPON_MODEM_IFACE_INDEX || | 113 | (uiaa->uiaa_ifaceno == UKYOPON_MODEM_IFACE_INDEX || | |
114 | uiaa->uiaa_ifaceno == UKYOPON_DATA_IFACE_INDEX)) | 114 | uiaa->uiaa_ifaceno == UKYOPON_DATA_IFACE_INDEX)) | |
115 | return (UMATCH_VENDOR_PRODUCT); | 115 | return (UMATCH_VENDOR_PRODUCT); | |
116 | 116 | |||
117 | return (UMATCH_NONE); | 117 | return (UMATCH_NONE); | |
118 | } | 118 | } | |
119 | 119 | |||
120 | void | 120 | void | |
121 | ukyopon_attach(device_t parent, device_t self, void *aux) | 121 | ukyopon_attach(device_t parent, device_t self, void *aux) | |
122 | { | 122 | { | |
123 | struct ukyopon_softc *sc = device_private(self); | 123 | struct ukyopon_softc *sc = device_private(self); | |
124 | struct usbif_attach_arg *uiaa = aux; | 124 | struct usbif_attach_arg *uiaa = aux; | |
125 | struct ucom_attach_args uca; | 125 | struct ucom_attach_args ucaa; | |
126 | 126 | |||
127 | uca.portno = (uiaa->uiaa_ifaceno == UKYOPON_MODEM_IFACE_INDEX) ? | 127 | ucaa.ucaa_portno = (uiaa->uiaa_ifaceno == UKYOPON_MODEM_IFACE_INDEX) ? | |
128 | UKYOPON_PORT_MODEM : UKYOPON_PORT_DATA; | 128 | UKYOPON_PORT_MODEM : UKYOPON_PORT_DATA; | |
129 | uca.methods = &ukyopon_methods; | 129 | ucaa.ucaa_methods = &ukyopon_methods; | |
130 | uca.info = (uiaa->uiaa_ifaceno == UKYOPON_MODEM_IFACE_INDEX) ? | 130 | ucaa.ucaa_info = (uiaa->uiaa_ifaceno == UKYOPON_MODEM_IFACE_INDEX) ? | |
131 | "modem port" : "data transfer port"; | 131 | "modem port" : "data transfer port"; | |
132 | 132 | |||
133 | if (umodem_common_attach(self, &sc->sc_umodem, uiaa, &uca)) | 133 | if (umodem_common_attach(self, &sc->sc_umodem, uiaa, &ucaa)) | |
134 | return; | 134 | return; | |
135 | return; | 135 | return; | |
136 | } | 136 | } | |
137 | 137 | |||
138 | Static void | 138 | Static void | |
139 | ukyopon_get_status(void *addr, int portno, u_char *lsr, u_char *msr) | 139 | ukyopon_get_status(void *addr, int portno, u_char *lsr, u_char *msr) | |
140 | { | 140 | { | |
141 | struct ukyopon_softc *sc = addr; | 141 | struct ukyopon_softc *sc = addr; | |
142 | 142 | |||
143 | /* | 143 | /* | |
144 | * The device doesn't set DCD (Data Carrier Detect) bit properly. | 144 | * The device doesn't set DCD (Data Carrier Detect) bit properly. | |
145 | * Assume DCD is always present. | 145 | * Assume DCD is always present. | |
146 | */ | 146 | */ |
--- src/sys/dev/usb/umcs.c 2015/09/29 11:38:29 1.8.2.5
+++ src/sys/dev/usb/umcs.c 2016/04/16 13:22:00 1.8.2.6
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: umcs.c,v 1.8.2.5 2015/09/29 11:38:29 skrll Exp $ */ | 1 | /* $NetBSD: umcs.c,v 1.8.2.6 2016/04/16 13:22:00 skrll Exp $ */ | |
2 | /* $FreeBSD: head/sys/dev/usb/serial/umcs.c 260559 2014-01-12 11:44:28Z hselasky $ */ | 2 | /* $FreeBSD: head/sys/dev/usb/serial/umcs.c 260559 2014-01-12 11:44:28Z hselasky $ */ | |
3 | 3 | |||
4 | /*- | 4 | /*- | |
5 | * Copyright (c) 2010 Lev Serebryakov <lev@FreeBSD.org>. | 5 | * Copyright (c) 2010 Lev Serebryakov <lev@FreeBSD.org>. | |
6 | * All rights reserved. | 6 | * All rights reserved. | |
7 | * | 7 | * | |
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without | |
9 | * modification, are permitted provided that the following conditions | 9 | * modification, are permitted provided that the following conditions | |
10 | * are met: | 10 | * are met: | |
11 | * 1. Redistributions of source code must retain the above copyright | 11 | * 1. Redistributions of source code must retain the above copyright | |
12 | * notice, this list of conditions and the following disclaimer. | 12 | * notice, this list of conditions and the following disclaimer. | |
13 | * 2. Redistributions in binary form must reproduce the above copyright | 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
14 | * notice, this list of conditions and the following disclaimer in the | 14 | * notice, this list of conditions and the following disclaimer in the | |
@@ -31,27 +31,27 @@ | @@ -31,27 +31,27 @@ | |||
31 | * This driver supports several multiport USB-to-RS232 serial adapters driven | 31 | * This driver supports several multiport USB-to-RS232 serial adapters driven | |
32 | * by MosChip mos7820 and mos7840, bridge chips. | 32 | * by MosChip mos7820 and mos7840, bridge chips. | |
33 | * The adapters are sold under many different brand names. | 33 | * The adapters are sold under many different brand names. | |
34 | * | 34 | * | |
35 | * Datasheets are available at MosChip www site at | 35 | * Datasheets are available at MosChip www site at | |
36 | * http://www.moschip.com. The datasheets don't contain full | 36 | * http://www.moschip.com. The datasheets don't contain full | |
37 | * programming information for the chip. | 37 | * programming information for the chip. | |
38 | * | 38 | * | |
39 | * It is nornal to have only two enabled ports in devices, based on | 39 | * It is nornal to have only two enabled ports in devices, based on | |
40 | * quad-port mos7840. | 40 | * quad-port mos7840. | |
41 | * | 41 | * | |
42 | */ | 42 | */ | |
43 | #include <sys/cdefs.h> | 43 | #include <sys/cdefs.h> | |
44 | __KERNEL_RCSID(0, "$NetBSD: umcs.c,v 1.8.2.5 2015/09/29 11:38:29 skrll Exp $"); | 44 | __KERNEL_RCSID(0, "$NetBSD: umcs.c,v 1.8.2.6 2016/04/16 13:22:00 skrll Exp $"); | |
45 | 45 | |||
46 | #include <sys/param.h> | 46 | #include <sys/param.h> | |
47 | #include <sys/systm.h> | 47 | #include <sys/systm.h> | |
48 | #include <sys/atomic.h> | 48 | #include <sys/atomic.h> | |
49 | #include <sys/kernel.h> | 49 | #include <sys/kernel.h> | |
50 | #include <sys/conf.h> | 50 | #include <sys/conf.h> | |
51 | #include <sys/tty.h> | 51 | #include <sys/tty.h> | |
52 | #include <sys/device.h> | 52 | #include <sys/device.h> | |
53 | #include <sys/kmem.h> | 53 | #include <sys/kmem.h> | |
54 | 54 | |||
55 | #include <dev/usb/usb.h> | 55 | #include <dev/usb/usb.h> | |
56 | #include <dev/usb/usbdi.h> | 56 | #include <dev/usb/usbdi.h> | |
57 | #include <dev/usb/usbdi_util.h> | 57 | #include <dev/usb/usbdi_util.h> | |
@@ -177,27 +177,27 @@ umcs7840_match(device_t dev, cfdata_t ma | @@ -177,27 +177,27 @@ umcs7840_match(device_t dev, cfdata_t ma | |||
177 | return umcs7840_lookup(uaa->uaa_vendor, uaa->uaa_product) != NULL ? | 177 | return umcs7840_lookup(uaa->uaa_vendor, uaa->uaa_product) != NULL ? | |
178 | UMATCH_VENDOR_PRODUCT : UMATCH_NONE; | 178 | UMATCH_VENDOR_PRODUCT : UMATCH_NONE; | |
179 | } | 179 | } | |
180 | 180 | |||
181 | static void | 181 | static void | |
182 | umcs7840_attach(device_t parent, device_t self, void *aux) | 182 | umcs7840_attach(device_t parent, device_t self, void *aux) | |
183 | { | 183 | { | |
184 | struct umcs7840_softc *sc = device_private(self); | 184 | struct umcs7840_softc *sc = device_private(self); | |
185 | struct usb_attach_arg *uaa = aux; | 185 | struct usb_attach_arg *uaa = aux; | |
186 | struct usbd_device *dev = uaa->uaa_device; | 186 | struct usbd_device *dev = uaa->uaa_device; | |
187 | usb_interface_descriptor_t *id; | 187 | usb_interface_descriptor_t *id; | |
188 | usb_endpoint_descriptor_t *ed; | 188 | usb_endpoint_descriptor_t *ed; | |
189 | char *devinfop; | 189 | char *devinfop; | |
190 | struct ucom_attach_args uca; | 190 | struct ucom_attach_args ucaa; | |
191 | int error, i, intr_addr; | 191 | int error, i, intr_addr; | |
192 | uint8_t data; | 192 | uint8_t data; | |
193 | 193 | |||
194 | sc->sc_dev = self; | 194 | sc->sc_dev = self; | |
195 | sc->sc_udev = uaa->uaa_device; | 195 | sc->sc_udev = uaa->uaa_device; | |
196 | 196 | |||
197 | if (usbd_set_config_index(sc->sc_udev, MCS7840_CONFIG_INDEX, 1) != 0) { | 197 | if (usbd_set_config_index(sc->sc_udev, MCS7840_CONFIG_INDEX, 1) != 0) { | |
198 | aprint_error(": could not set configuration no\n"); | 198 | aprint_error(": could not set configuration no\n"); | |
199 | return; | 199 | return; | |
200 | } | 200 | } | |
201 | 201 | |||
202 | /* get the first interface handle */ | 202 | /* get the first interface handle */ | |
203 | error = usbd_device2interface_handle(sc->sc_udev, MCS7840_IFACE_INDEX, | 203 | error = usbd_device2interface_handle(sc->sc_udev, MCS7840_IFACE_INDEX, | |
@@ -275,71 +275,71 @@ umcs7840_attach(device_t parent, device_ | @@ -275,71 +275,71 @@ umcs7840_attach(device_t parent, device_ | |||
275 | sc->sc_intr_buflen, umcs7840_intr, 100); | 275 | sc->sc_intr_buflen, umcs7840_intr, 100); | |
276 | if (error) { | 276 | if (error) { | |
277 | aprint_error_dev(self, "cannot open interrupt pipe " | 277 | aprint_error_dev(self, "cannot open interrupt pipe " | |
278 | "(addr %d)\n", intr_addr); | 278 | "(addr %d)\n", intr_addr); | |
279 | return; | 279 | return; | |
280 | } | 280 | } | |
281 | 281 | |||
282 | usb_init_task(&sc->sc_change_task, umcs7840_change_task, sc, | 282 | usb_init_task(&sc->sc_change_task, umcs7840_change_task, sc, | |
283 | USB_TASKQ_MPSAFE); | 283 | USB_TASKQ_MPSAFE); | |
284 | 284 | |||
285 | usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev, | 285 | usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev, | |
286 | sc->sc_dev); | 286 | sc->sc_dev); | |
287 | 287 | |||
288 | memset(&uca, 0, sizeof(uca)); | 288 | memset(&ucaa, 0, sizeof(ucaa)); | |
289 | uca.ibufsize = 256; | 289 | ucaa.ucaa_ibufsize = 256; | |
290 | uca.obufsize = 256; | 290 | ucaa.ucaa_obufsize = 256; | |
291 | uca.ibufsizepad = 256; | 291 | ucaa.ucaa_ibufsizepad = 256; | |
292 | uca.opkthdrlen = 0; | 292 | ucaa.ucaa_opkthdrlen = 0; | |
293 | uca.device = sc->sc_udev; | 293 | ucaa.ucaa_device = sc->sc_udev; | |
294 | uca.iface = sc->sc_iface; | 294 | ucaa.ucaa_iface = sc->sc_iface; | |
295 | uca.methods = &umcs7840_methods; | 295 | ucaa.ucaa_methods = &umcs7840_methods; | |
296 | uca.arg = sc; | 296 | ucaa.ucaa_arg = sc; | |
297 | 297 | |||
298 | for (i = 0; i < sc->sc_numports; i++) { | 298 | for (i = 0; i < sc->sc_numports; i++) { | |
299 | uca.bulkin = uca.bulkout = -1; | 299 | ucaa.ucaa_bulkin = ucaa.ucaa_bulkout = -1; | |
300 | 300 | |||
301 | /* | 301 | /* | |
302 | * On four port cards, endpoints are 0/1 for first, | 302 | * On four port cards, endpoints are 0/1 for first, | |
303 | * 2/3 for second, ... | 303 | * 2/3 for second, ... | |
304 | * On two port cards, they are 0/1 for first, 4/5 for second. | 304 | * On two port cards, they are 0/1 for first, 4/5 for second. | |
305 | * On single port, just 0/1 will be used. | 305 | * On single port, just 0/1 will be used. | |
306 | */ | 306 | */ | |
307 | int phyport = i * (sc->sc_numports == 2 ? 2 : 1); | 307 | int phyport = i * (sc->sc_numports == 2 ? 2 : 1); | |
308 | 308 | |||
309 | ed = usbd_interface2endpoint_descriptor(sc->sc_iface, | 309 | ed = usbd_interface2endpoint_descriptor(sc->sc_iface, | |
310 | phyport*2); | 310 | phyport*2); | |
311 | if (ed == NULL) { | 311 | if (ed == NULL) { | |
312 | aprint_error_dev(self, | 312 | aprint_error_dev(self, | |
313 | "no bulk in endpoint found for %d\n", i); | 313 | "no bulk in endpoint found for %d\n", i); | |
314 | return; | 314 | return; | |
315 | } | 315 | } | |
316 | uca.bulkin = ed->bEndpointAddress; | 316 | ucaa.ucaa_bulkin = ed->bEndpointAddress; | |
317 | 317 | |||
318 | ed = usbd_interface2endpoint_descriptor(sc->sc_iface, | 318 | ed = usbd_interface2endpoint_descriptor(sc->sc_iface, | |
319 | phyport*2 + 1); | 319 | phyport*2 + 1); | |
320 | if (ed == NULL) { | 320 | if (ed == NULL) { | |
321 | aprint_error_dev(self, | 321 | aprint_error_dev(self, | |
322 | "no bulk out endpoint found for %d\n", i); | 322 | "no bulk out endpoint found for %d\n", i); | |
323 | return; | 323 | return; | |
324 | } | 324 | } | |
325 | uca.bulkout = ed->bEndpointAddress; | 325 | ucaa.ucaa_bulkout = ed->bEndpointAddress; | |
326 | uca.portno = i; | 326 | ucaa.ucaa_portno = i; | |
327 | DPRINTF(("port %d physical port %d bulk-in %d bulk-out %d\n", | 327 | DPRINTF(("port %d physical port %d bulk-in %d bulk-out %d\n", | |
328 | i, phyport, uca.bulkin, uca.bulkout)); | 328 | i, phyport, ucaa.ucaa_bulkin, ucaa.ucaa_bulkout)); | |
329 | 329 | |||
330 | sc->sc_ports[i].sc_port_phys = phyport; | 330 | sc->sc_ports[i].sc_port_phys = phyport; | |
331 | sc->sc_ports[i].sc_port_ucom = | 331 | sc->sc_ports[i].sc_port_ucom = | |
332 | config_found_sm_loc(self, "ucombus", NULL, &uca, | 332 | config_found_sm_loc(self, "ucombus", NULL, &ucaa, | |
333 | ucomprint, ucomsubmatch); | 333 | ucomprint, ucomsubmatch); | |
334 | } | 334 | } | |
335 | } | 335 | } | |
336 | 336 | |||
337 | static int | 337 | static int | |
338 | umcs7840_get_reg(struct umcs7840_softc *sc, uint8_t reg, uint8_t *data) | 338 | umcs7840_get_reg(struct umcs7840_softc *sc, uint8_t reg, uint8_t *data) | |
339 | { | 339 | { | |
340 | usb_device_request_t req; | 340 | usb_device_request_t req; | |
341 | int err; | 341 | int err; | |
342 | 342 | |||
343 | req.bmRequestType = UT_READ_VENDOR_DEVICE; | 343 | req.bmRequestType = UT_READ_VENDOR_DEVICE; | |
344 | req.bRequest = MCS7840_RDREQ; | 344 | req.bRequest = MCS7840_RDREQ; | |
345 | USETW(req.wValue, 0); | 345 | USETW(req.wValue, 0); |
--- src/sys/dev/usb/umct.c 2015/12/27 12:09:59 1.32.24.10
+++ src/sys/dev/usb/umct.c 2016/04/16 13:22:00 1.32.24.11
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: umct.c,v 1.32.24.10 2015/12/27 12:09:59 skrll Exp $ */ | 1 | /* $NetBSD: umct.c,v 1.32.24.11 2016/04/16 13:22:00 skrll Exp $ */ | |
2 | /* | 2 | /* | |
3 | * Copyright (c) 2001 The NetBSD Foundation, Inc. | 3 | * Copyright (c) 2001 The NetBSD Foundation, Inc. | |
4 | * All rights reserved. | 4 | * All rights reserved. | |
5 | * | 5 | * | |
6 | * This code is derived from software contributed to The NetBSD Foundation | 6 | * This code is derived from software contributed to The NetBSD Foundation | |
7 | * by Ichiro FUKUHARA (ichiro@ichiro.org). | 7 | * by Ichiro FUKUHARA (ichiro@ichiro.org). | |
8 | * | 8 | * | |
9 | * Redistribution and use in source and binary forms, with or without | 9 | * Redistribution and use in source and binary forms, with or without | |
10 | * modification, are permitted provided that the following conditions | 10 | * modification, are permitted provided that the following conditions | |
11 | * are met: | 11 | * are met: | |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright | |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. | |
14 | * 2. Redistributions in binary form must reproduce the above copyright | 14 | * 2. Redistributions in binary form must reproduce the above copyright | |
@@ -25,27 +25,27 @@ | @@ -25,27 +25,27 @@ | |||
25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
26 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 26 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
28 | * POSSIBILITY OF SUCH DAMAGE. | 28 | * POSSIBILITY OF SUCH DAMAGE. | |
29 | */ | 29 | */ | |
30 | 30 | |||
31 | /* | 31 | /* | |
32 | * MCT USB-RS232 Interface Controller | 32 | * MCT USB-RS232 Interface Controller | |
33 | * http://www.mct.com.tw/prod/rs232.html | 33 | * http://www.mct.com.tw/prod/rs232.html | |
34 | * http://www.dlink.com/products/usb/dsbs25 | 34 | * http://www.dlink.com/products/usb/dsbs25 | |
35 | */ | 35 | */ | |
36 | 36 | |||
37 | #include <sys/cdefs.h> | 37 | #include <sys/cdefs.h> | |
38 | __KERNEL_RCSID(0, "$NetBSD: umct.c,v 1.32.24.10 2015/12/27 12:09:59 skrll Exp $"); | 38 | __KERNEL_RCSID(0, "$NetBSD: umct.c,v 1.32.24.11 2016/04/16 13:22:00 skrll Exp $"); | |
39 | 39 | |||
40 | #include <sys/param.h> | 40 | #include <sys/param.h> | |
41 | #include <sys/systm.h> | 41 | #include <sys/systm.h> | |
42 | #include <sys/kernel.h> | 42 | #include <sys/kernel.h> | |
43 | #include <sys/ioctl.h> | 43 | #include <sys/ioctl.h> | |
44 | #include <sys/conf.h> | 44 | #include <sys/conf.h> | |
45 | #include <sys/tty.h> | 45 | #include <sys/tty.h> | |
46 | #include <sys/file.h> | 46 | #include <sys/file.h> | |
47 | #include <sys/select.h> | 47 | #include <sys/select.h> | |
48 | #include <sys/proc.h> | 48 | #include <sys/proc.h> | |
49 | #include <sys/vnode.h> | 49 | #include <sys/vnode.h> | |
50 | #include <sys/device.h> | 50 | #include <sys/device.h> | |
51 | #include <sys/poll.h> | 51 | #include <sys/poll.h> | |
@@ -167,44 +167,44 @@ umct_match(device_t parent, cfdata_t mat | @@ -167,44 +167,44 @@ umct_match(device_t parent, cfdata_t mat | |||
167 | void | 167 | void | |
168 | umct_attach(device_t parent, device_t self, void *aux) | 168 | umct_attach(device_t parent, device_t self, void *aux) | |
169 | { | 169 | { | |
170 | struct umct_softc *sc = device_private(self); | 170 | struct umct_softc *sc = device_private(self); | |
171 | struct usb_attach_arg *uaa = aux; | 171 | struct usb_attach_arg *uaa = aux; | |
172 | struct usbd_device *dev = uaa->uaa_device; | 172 | struct usbd_device *dev = uaa->uaa_device; | |
173 | usb_config_descriptor_t *cdesc; | 173 | usb_config_descriptor_t *cdesc; | |
174 | usb_interface_descriptor_t *id; | 174 | usb_interface_descriptor_t *id; | |
175 | usb_endpoint_descriptor_t *ed; | 175 | usb_endpoint_descriptor_t *ed; | |
176 | 176 | |||
177 | char *devinfop; | 177 | char *devinfop; | |
178 | usbd_status err; | 178 | usbd_status err; | |
179 | int i; | 179 | int i; | |
180 | struct ucom_attach_args uca; | 180 | struct ucom_attach_args ucaa; | |
181 | 181 | |||
182 | sc->sc_dev = self; | 182 | sc->sc_dev = self; | |
183 | 183 | |||
184 | aprint_naive("\n"); | 184 | aprint_naive("\n"); | |
185 | aprint_normal("\n"); | 185 | aprint_normal("\n"); | |
186 | 186 | |||
187 | devinfop = usbd_devinfo_alloc(dev, 0); | 187 | devinfop = usbd_devinfo_alloc(dev, 0); | |
188 | aprint_normal_dev(self, "%s\n", devinfop); | 188 | aprint_normal_dev(self, "%s\n", devinfop); | |
189 | usbd_devinfo_free(devinfop); | 189 | usbd_devinfo_free(devinfop); | |
190 | 190 | |||
191 | sc->sc_udev = dev; | 191 | sc->sc_udev = dev; | |
192 | sc->sc_product = uaa->uaa_product; | 192 | sc->sc_product = uaa->uaa_product; | |
193 | 193 | |||
194 | DPRINTF(("\n\numct attach: sc=%p\n", sc)); | 194 | DPRINTF(("\n\numct attach: sc=%p\n", sc)); | |
195 | 195 | |||
196 | /* initialize endpoints */ | 196 | /* initialize endpoints */ | |
197 | uca.bulkin = uca.bulkout = -1; | 197 | ucaa.ucaa_bulkin = ucaa.ucaa_bulkout = -1; | |
198 | sc->sc_intr_number = -1; | 198 | sc->sc_intr_number = -1; | |
199 | sc->sc_intr_pipe = NULL; | 199 | sc->sc_intr_pipe = NULL; | |
200 | 200 | |||
201 | /* Move the device into the configured state. */ | 201 | /* Move the device into the configured state. */ | |
202 | err = usbd_set_config_index(dev, UMCT_CONFIG_INDEX, 1); | 202 | err = usbd_set_config_index(dev, UMCT_CONFIG_INDEX, 1); | |
203 | if (err) { | 203 | if (err) { | |
204 | aprint_error_dev(self, "failed to set configuration, err=%s\n", | 204 | aprint_error_dev(self, "failed to set configuration, err=%s\n", | |
205 | usbd_errstr(err)); | 205 | usbd_errstr(err)); | |
206 | sc->sc_dying = 1; | 206 | sc->sc_dying = 1; | |
207 | return; | 207 | return; | |
208 | } | 208 | } | |
209 | 209 | |||
210 | /* get the config descriptor */ | 210 | /* get the config descriptor */ | |
@@ -239,79 +239,79 @@ umct_attach(device_t parent, device_t se | @@ -239,79 +239,79 @@ umct_attach(device_t parent, device_t se | |||
239 | "no endpoint descriptor for %d\n", i); | 239 | "no endpoint descriptor for %d\n", i); | |
240 | sc->sc_dying = 1; | 240 | sc->sc_dying = 1; | |
241 | return; | 241 | return; | |
242 | } | 242 | } | |
243 | 243 | |||
244 | /* | 244 | /* | |
245 | * The Bulkin endpoint is marked as an interrupt. Since | 245 | * The Bulkin endpoint is marked as an interrupt. Since | |
246 | * we can't rely on the endpoint descriptor order, we'll | 246 | * we can't rely on the endpoint descriptor order, we'll | |
247 | * check the wMaxPacketSize field to differentiate. | 247 | * check the wMaxPacketSize field to differentiate. | |
248 | */ | 248 | */ | |
249 | if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && | 249 | if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && | |
250 | UE_GET_XFERTYPE(ed->bmAttributes) == UE_INTERRUPT && | 250 | UE_GET_XFERTYPE(ed->bmAttributes) == UE_INTERRUPT && | |
251 | UGETW(ed->wMaxPacketSize) != 0x2) { | 251 | UGETW(ed->wMaxPacketSize) != 0x2) { | |
252 | uca.bulkin = ed->bEndpointAddress; | 252 | ucaa.ucaa_bulkin = ed->bEndpointAddress; | |
253 | } else if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_OUT && | 253 | } else if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_OUT && | |
254 | UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) { | 254 | UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) { | |
255 | uca.bulkout = ed->bEndpointAddress; | 255 | ucaa.ucaa_bulkout = ed->bEndpointAddress; | |
256 | } else if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && | 256 | } else if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && | |
257 | UE_GET_XFERTYPE(ed->bmAttributes) == UE_INTERRUPT) { | 257 | UE_GET_XFERTYPE(ed->bmAttributes) == UE_INTERRUPT) { | |
258 | sc->sc_intr_number = ed->bEndpointAddress; | 258 | sc->sc_intr_number = ed->bEndpointAddress; | |
259 | sc->sc_isize = UGETW(ed->wMaxPacketSize); | 259 | sc->sc_isize = UGETW(ed->wMaxPacketSize); | |
260 | } | 260 | } | |
261 | } | 261 | } | |
262 | 262 | |||
263 | if (uca.bulkin == -1) { | 263 | if (ucaa.ucaa_bulkin == -1) { | |
264 | aprint_error_dev(self, "Could not find data bulk in\n"); | 264 | aprint_error_dev(self, "Could not find data bulk in\n"); | |
265 | sc->sc_dying = 1; | 265 | sc->sc_dying = 1; | |
266 | return; | 266 | return; | |
267 | } | 267 | } | |
268 | 268 | |||
269 | if (uca.bulkout == -1) { | 269 | if (ucaa.ucaa_bulkout == -1) { | |
270 | aprint_error_dev(self, "Could not find data bulk out\n"); | 270 | aprint_error_dev(self, "Could not find data bulk out\n"); | |
271 | sc->sc_dying = 1; | 271 | sc->sc_dying = 1; | |
272 | return; | 272 | return; | |
273 | } | 273 | } | |
274 | 274 | |||
275 | if (sc->sc_intr_number == -1) { | 275 | if (sc->sc_intr_number == -1) { | |
276 | aprint_error_dev(self, "Could not find interrupt in\n"); | 276 | aprint_error_dev(self, "Could not find interrupt in\n"); | |
277 | sc->sc_dying = 1; | 277 | sc->sc_dying = 1; | |
278 | return; | 278 | return; | |
279 | } | 279 | } | |
280 | 280 | |||
281 | sc->sc_dtr = sc->sc_rts = 0; | 281 | sc->sc_dtr = sc->sc_rts = 0; | |
282 | uca.portno = UCOM_UNK_PORTNO; | 282 | ucaa.ucaa_portno = UCOM_UNK_PORTNO; | |
283 | /* bulkin, bulkout set above */ | 283 | /* ucaa_bulkin, ucaa_bulkout set above */ | |
284 | uca.ibufsize = UMCTIBUFSIZE; | 284 | ucaa.ucaa_ibufsize = UMCTIBUFSIZE; | |
285 | if (sc->sc_product == USB_PRODUCT_MCT_SITECOM_USB232) | 285 | if (sc->sc_product == USB_PRODUCT_MCT_SITECOM_USB232) | |
286 | uca.obufsize = 16; /* device is broken */ | 286 | ucaa.ucaa_obufsize = 16; /* device is broken */ | |
287 | else | 287 | else | |
288 | uca.obufsize = UMCTOBUFSIZE; | 288 | ucaa.ucaa_obufsize = UMCTOBUFSIZE; | |
289 | uca.ibufsizepad = UMCTIBUFSIZE; | 289 | ucaa.ucaa_ibufsizepad = UMCTIBUFSIZE; | |
290 | uca.opkthdrlen = 0; | 290 | ucaa.ucaa_opkthdrlen = 0; | |
291 | uca.device = dev; | 291 | ucaa.ucaa_device = dev; | |
292 | uca.iface = sc->sc_iface; | 292 | ucaa.ucaa_iface = sc->sc_iface; | |
293 | uca.methods = &umct_methods; | 293 | ucaa.ucaa_methods = &umct_methods; | |
294 | uca.arg = sc; | 294 | ucaa.ucaa_arg = sc; | |
295 | uca.info = NULL; | 295 | ucaa.ucaa_info = NULL; | |
296 | 296 | |||
297 | umct_init(sc); | 297 | umct_init(sc); | |
298 | 298 | |||
299 | usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev, | 299 | usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev, | |
300 | sc->sc_dev); | 300 | sc->sc_dev); | |
301 | 301 | |||
302 | DPRINTF(("umct: in=0x%x out=0x%x intr=0x%x\n", | 302 | DPRINTF(("umct: in=0x%x out=0x%x intr=0x%x\n", | |
303 | uca.bulkin, uca.bulkout, sc->sc_intr_number )); | 303 | ucaa.ucaa_bulkin, ucaa.ucaa_bulkout, sc->sc_intr_number )); | |
304 | sc->sc_subdev = config_found_sm_loc(self, "ucombus", NULL, &uca, | 304 | sc->sc_subdev = config_found_sm_loc(self, "ucombus", NULL, &ucaa, | |
305 | ucomprint, ucomsubmatch); | 305 | ucomprint, ucomsubmatch); | |
306 | 306 | |||
307 | return; | 307 | return; | |
308 | } | 308 | } | |
309 | 309 | |||
310 | void | 310 | void | |
311 | umct_childdet(device_t self, device_t child) | 311 | umct_childdet(device_t self, device_t child) | |
312 | { | 312 | { | |
313 | struct umct_softc *sc = device_private(self); | 313 | struct umct_softc *sc = device_private(self); | |
314 | 314 | |||
315 | KASSERT(sc->sc_subdev == child); | 315 | KASSERT(sc->sc_subdev == child); | |
316 | sc->sc_subdev = NULL; | 316 | sc->sc_subdev = NULL; | |
317 | } | 317 | } |
--- src/sys/dev/usb/umodem.c 2015/09/22 12:06:01 1.66.4.5
+++ src/sys/dev/usb/umodem.c 2016/04/16 13:22:00 1.66.4.6
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: umodem.c,v 1.66.4.5 2015/09/22 12:06:01 skrll Exp $ */ | 1 | /* $NetBSD: umodem.c,v 1.66.4.6 2016/04/16 13:22:00 skrll Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1998 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 1998 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Lennart Augustsson (lennart@augustsson.net) at | 8 | * by Lennart Augustsson (lennart@augustsson.net) at | |
9 | * Carlstedt Research & Technology. | 9 | * Carlstedt Research & Technology. | |
10 | * | 10 | * | |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without | |
12 | * modification, are permitted provided that the following conditions | 12 | * modification, are permitted provided that the following conditions | |
13 | * are met: | 13 | * are met: | |
14 | * 1. Redistributions of source code must retain the above copyright | 14 | * 1. Redistributions of source code must retain the above copyright | |
@@ -34,27 +34,27 @@ | @@ -34,27 +34,27 @@ | |||
34 | * Comm Class spec: http://www.usb.org/developers/devclass_docs/usbccs10.pdf | 34 | * Comm Class spec: http://www.usb.org/developers/devclass_docs/usbccs10.pdf | |
35 | * http://www.usb.org/developers/devclass_docs/usbcdc11.pdf | 35 | * http://www.usb.org/developers/devclass_docs/usbcdc11.pdf | |
36 | */ | 36 | */ | |
37 | 37 | |||
38 | /* | 38 | /* | |
39 | * TODO: | 39 | * TODO: | |
40 | * - Add error recovery in various places; the big problem is what | 40 | * - Add error recovery in various places; the big problem is what | |
41 | * to do in a callback if there is an error. | 41 | * to do in a callback if there is an error. | |
42 | * - Implement a Call Device for modems without multiplexed commands. | 42 | * - Implement a Call Device for modems without multiplexed commands. | |
43 | * | 43 | * | |
44 | */ | 44 | */ | |
45 | 45 | |||
46 | #include <sys/cdefs.h> | 46 | #include <sys/cdefs.h> | |
47 | __KERNEL_RCSID(0, "$NetBSD: umodem.c,v 1.66.4.5 2015/09/22 12:06:01 skrll Exp $"); | 47 | __KERNEL_RCSID(0, "$NetBSD: umodem.c,v 1.66.4.6 2016/04/16 13:22:00 skrll Exp $"); | |
48 | 48 | |||
49 | #include <sys/param.h> | 49 | #include <sys/param.h> | |
50 | #include <sys/systm.h> | 50 | #include <sys/systm.h> | |
51 | #include <sys/kernel.h> | 51 | #include <sys/kernel.h> | |
52 | #include <sys/ioctl.h> | 52 | #include <sys/ioctl.h> | |
53 | #include <sys/conf.h> | 53 | #include <sys/conf.h> | |
54 | #include <sys/tty.h> | 54 | #include <sys/tty.h> | |
55 | #include <sys/file.h> | 55 | #include <sys/file.h> | |
56 | #include <sys/select.h> | 56 | #include <sys/select.h> | |
57 | #include <sys/proc.h> | 57 | #include <sys/proc.h> | |
58 | #include <sys/vnode.h> | 58 | #include <sys/vnode.h> | |
59 | #include <sys/device.h> | 59 | #include <sys/device.h> | |
60 | #include <sys/poll.h> | 60 | #include <sys/poll.h> | |
@@ -105,36 +105,36 @@ umodem_match(device_t parent, cfdata_t m | @@ -105,36 +105,36 @@ umodem_match(device_t parent, cfdata_t m | |||
105 | 105 | |||
106 | id = usbd_get_interface_descriptor(uiaa->uiaa_iface); | 106 | id = usbd_get_interface_descriptor(uiaa->uiaa_iface); | |
107 | if (umodem_get_caps(uiaa->uiaa_device, &cm, &acm, id) == -1) | 107 | if (umodem_get_caps(uiaa->uiaa_device, &cm, &acm, id) == -1) | |
108 | return UMATCH_NONE; | 108 | return UMATCH_NONE; | |
109 | 109 | |||
110 | return UMATCH_IFACECLASS_IFACESUBCLASS_IFACEPROTO; | 110 | return UMATCH_IFACECLASS_IFACESUBCLASS_IFACEPROTO; | |
111 | } | 111 | } | |
112 | // | 112 | // | |
113 | void | 113 | void | |
114 | umodem_attach(device_t parent, device_t self, void *aux) | 114 | umodem_attach(device_t parent, device_t self, void *aux) | |
115 | { | 115 | { | |
116 | struct umodem_softc *sc = device_private(self); | 116 | struct umodem_softc *sc = device_private(self); | |
117 | struct usbif_attach_arg *uiaa = aux; | 117 | struct usbif_attach_arg *uiaa = aux; | |
118 | struct ucom_attach_args uca; | 118 | struct ucom_attach_args ucaa; | |
119 | 119 | |||
120 | uca.portno = UCOM_UNK_PORTNO; | 120 | ucaa.ucaa_portno = UCOM_UNK_PORTNO; | |
121 | uca.methods = &umodem_methods; | 121 | ucaa.ucaa_methods = &umodem_methods; | |
122 | uca.info = NULL; | 122 | ucaa.ucaa_info = NULL; | |
123 | 123 | |||
124 | if (!pmf_device_register(self, NULL, NULL)) | 124 | if (!pmf_device_register(self, NULL, NULL)) | |
125 | aprint_error_dev(self, "couldn't establish power handler"); | 125 | aprint_error_dev(self, "couldn't establish power handler"); | |
126 | 126 | |||
127 | if (umodem_common_attach(self, sc, uiaa, &uca)) | 127 | if (umodem_common_attach(self, sc, uiaa, &ucaa)) | |
128 | return; | 128 | return; | |
129 | return; | 129 | return; | |
130 | } | 130 | } | |
131 | 131 | |||
132 | int | 132 | int | |
133 | umodem_activate(device_t self, enum devact act) | 133 | umodem_activate(device_t self, enum devact act) | |
134 | { | 134 | { | |
135 | struct umodem_softc *sc = device_private(self); | 135 | struct umodem_softc *sc = device_private(self); | |
136 | 136 | |||
137 | return umodem_common_activate(sc, act); | 137 | return umodem_common_activate(sc, act); | |
138 | } | 138 | } | |
139 | 139 | |||
140 | int | 140 | int |
--- src/sys/dev/usb/umodem_common.c 2015/03/21 11:33:37 1.22.38.5
+++ src/sys/dev/usb/umodem_common.c 2016/04/16 13:22:00 1.22.38.6
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: umodem_common.c,v 1.22.38.5 2015/03/21 11:33:37 skrll Exp $ */ | 1 | /* $NetBSD: umodem_common.c,v 1.22.38.6 2016/04/16 13:22:00 skrll Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1998 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 1998 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Lennart Augustsson (lennart@augustsson.net) at | 8 | * by Lennart Augustsson (lennart@augustsson.net) at | |
9 | * Carlstedt Research & Technology. | 9 | * Carlstedt Research & Technology. | |
10 | * | 10 | * | |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without | |
12 | * modification, are permitted provided that the following conditions | 12 | * modification, are permitted provided that the following conditions | |
13 | * are met: | 13 | * are met: | |
14 | * 1. Redistributions of source code must retain the above copyright | 14 | * 1. Redistributions of source code must retain the above copyright | |
@@ -34,27 +34,27 @@ | @@ -34,27 +34,27 @@ | |||
34 | * Comm Class spec: http://www.usb.org/developers/devclass_docs/usbccs10.pdf | 34 | * Comm Class spec: http://www.usb.org/developers/devclass_docs/usbccs10.pdf | |
35 | * http://www.usb.org/developers/devclass_docs/usbcdc11.pdf | 35 | * http://www.usb.org/developers/devclass_docs/usbcdc11.pdf | |
36 | */ | 36 | */ | |
37 | 37 | |||
38 | /* | 38 | /* | |
39 | * TODO: | 39 | * TODO: | |
40 | * - Add error recovery in various places; the big problem is what | 40 | * - Add error recovery in various places; the big problem is what | |
41 | * to do in a callback if there is an error. | 41 | * to do in a callback if there is an error. | |
42 | * - Implement a Call Device for modems without multiplexed commands. | 42 | * - Implement a Call Device for modems without multiplexed commands. | |
43 | * | 43 | * | |
44 | */ | 44 | */ | |
45 | 45 | |||
46 | #include <sys/cdefs.h> | 46 | #include <sys/cdefs.h> | |
47 | __KERNEL_RCSID(0, "$NetBSD: umodem_common.c,v 1.22.38.5 2015/03/21 11:33:37 skrll Exp $"); | 47 | __KERNEL_RCSID(0, "$NetBSD: umodem_common.c,v 1.22.38.6 2016/04/16 13:22:00 skrll Exp $"); | |
48 | 48 | |||
49 | #include <sys/param.h> | 49 | #include <sys/param.h> | |
50 | #include <sys/systm.h> | 50 | #include <sys/systm.h> | |
51 | #include <sys/kernel.h> | 51 | #include <sys/kernel.h> | |
52 | #include <sys/ioctl.h> | 52 | #include <sys/ioctl.h> | |
53 | #include <sys/conf.h> | 53 | #include <sys/conf.h> | |
54 | #include <sys/tty.h> | 54 | #include <sys/tty.h> | |
55 | #include <sys/file.h> | 55 | #include <sys/file.h> | |
56 | #include <sys/select.h> | 56 | #include <sys/select.h> | |
57 | #include <sys/proc.h> | 57 | #include <sys/proc.h> | |
58 | #include <sys/vnode.h> | 58 | #include <sys/vnode.h> | |
59 | #include <sys/device.h> | 59 | #include <sys/device.h> | |
60 | #include <sys/poll.h> | 60 | #include <sys/poll.h> | |
@@ -93,27 +93,27 @@ int umodemdebug = 0; | @@ -93,27 +93,27 @@ int umodemdebug = 0; | |||
93 | Static usbd_status umodem_set_comm_feature(struct umodem_softc *, | 93 | Static usbd_status umodem_set_comm_feature(struct umodem_softc *, | |
94 | int, int); | 94 | int, int); | |
95 | Static usbd_status umodem_set_line_coding(struct umodem_softc *, | 95 | Static usbd_status umodem_set_line_coding(struct umodem_softc *, | |
96 | usb_cdc_line_state_t *); | 96 | usb_cdc_line_state_t *); | |
97 | 97 | |||
98 | Static void umodem_dtr(struct umodem_softc *, int); | 98 | Static void umodem_dtr(struct umodem_softc *, int); | |
99 | Static void umodem_rts(struct umodem_softc *, int); | 99 | Static void umodem_rts(struct umodem_softc *, int); | |
100 | Static void umodem_break(struct umodem_softc *, int); | 100 | Static void umodem_break(struct umodem_softc *, int); | |
101 | Static void umodem_set_line_state(struct umodem_softc *); | 101 | Static void umodem_set_line_state(struct umodem_softc *); | |
102 | Static void umodem_intr(struct usbd_xfer *, void *, usbd_status); | 102 | Static void umodem_intr(struct usbd_xfer *, void *, usbd_status); | |
103 | 103 | |||
104 | int | 104 | int | |
105 | umodem_common_attach(device_t self, struct umodem_softc *sc, | 105 | umodem_common_attach(device_t self, struct umodem_softc *sc, | |
106 | struct usbif_attach_arg *uiaa, struct ucom_attach_args *uca) | 106 | struct usbif_attach_arg *uiaa, struct ucom_attach_args *ucaa) | |
107 | { | 107 | { | |
108 | struct usbd_device *dev = uiaa->uiaa_device; | 108 | struct usbd_device *dev = uiaa->uiaa_device; | |
109 | usb_interface_descriptor_t *id; | 109 | usb_interface_descriptor_t *id; | |
110 | usb_endpoint_descriptor_t *ed; | 110 | usb_endpoint_descriptor_t *ed; | |
111 | char *devinfop; | 111 | char *devinfop; | |
112 | usbd_status err; | 112 | usbd_status err; | |
113 | int data_ifcno; | 113 | int data_ifcno; | |
114 | int i; | 114 | int i; | |
115 | 115 | |||
116 | sc->sc_dev = self; | 116 | sc->sc_dev = self; | |
117 | sc->sc_udev = dev; | 117 | sc->sc_udev = dev; | |
118 | sc->sc_ctl_iface = uiaa->uiaa_iface; | 118 | sc->sc_ctl_iface = uiaa->uiaa_iface; | |
119 | 119 | |||
@@ -151,50 +151,50 @@ umodem_common_attach(device_t self, stru | @@ -151,50 +151,50 @@ umodem_common_attach(device_t self, stru | |||
151 | uiaa->uiaa_ifaces[i] = NULL; | 151 | uiaa->uiaa_ifaces[i] = NULL; | |
152 | } | 152 | } | |
153 | } | 153 | } | |
154 | } | 154 | } | |
155 | if (sc->sc_data_iface == NULL) { | 155 | if (sc->sc_data_iface == NULL) { | |
156 | aprint_error_dev(self, "no data interface\n"); | 156 | aprint_error_dev(self, "no data interface\n"); | |
157 | goto bad; | 157 | goto bad; | |
158 | } | 158 | } | |
159 | 159 | |||
160 | /* | 160 | /* | |
161 | * Find the bulk endpoints. | 161 | * Find the bulk endpoints. | |
162 | * Iterate over all endpoints in the data interface and take note. | 162 | * Iterate over all endpoints in the data interface and take note. | |
163 | */ | 163 | */ | |
164 | uca->bulkin = uca->bulkout = -1; | 164 | ucaa->ucaa_bulkin = ucaa->ucaa_bulkout = -1; | |
165 | 165 | |||
166 | id = usbd_get_interface_descriptor(sc->sc_data_iface); | 166 | id = usbd_get_interface_descriptor(sc->sc_data_iface); | |
167 | for (i = 0; i < id->bNumEndpoints; i++) { | 167 | for (i = 0; i < id->bNumEndpoints; i++) { | |
168 | ed = usbd_interface2endpoint_descriptor(sc->sc_data_iface, i); | 168 | ed = usbd_interface2endpoint_descriptor(sc->sc_data_iface, i); | |
169 | if (ed == NULL) { | 169 | if (ed == NULL) { | |
170 | aprint_error_dev(self, | 170 | aprint_error_dev(self, | |
171 | "no endpoint descriptor for %d\n)", i); | 171 | "no endpoint descriptor for %d\n)", i); | |
172 | goto bad; | 172 | goto bad; | |
173 | } | 173 | } | |
174 | if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && | 174 | if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && | |
175 | (ed->bmAttributes & UE_XFERTYPE) == UE_BULK) { | 175 | (ed->bmAttributes & UE_XFERTYPE) == UE_BULK) { | |
176 | uca->bulkin = ed->bEndpointAddress; | 176 | ucaa->ucaa_bulkin = ed->bEndpointAddress; | |
177 | } else if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_OUT && | 177 | } else if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_OUT && | |
178 | (ed->bmAttributes & UE_XFERTYPE) == UE_BULK) { | 178 | (ed->bmAttributes & UE_XFERTYPE) == UE_BULK) { | |
179 | uca->bulkout = ed->bEndpointAddress; | 179 | ucaa->ucaa_bulkout = ed->bEndpointAddress; | |
180 | } | 180 | } | |
181 | } | 181 | } | |
182 | 182 | |||
183 | if (uca->bulkin == -1) { | 183 | if (ucaa->ucaa_bulkin == -1) { | |
184 | aprint_error_dev(self, "Could not find data bulk in\n"); | 184 | aprint_error_dev(self, "Could not find data bulk in\n"); | |
185 | goto bad; | 185 | goto bad; | |
186 | } | 186 | } | |
187 | if (uca->bulkout == -1) { | 187 | if (ucaa->ucaa_bulkout == -1) { | |
188 | aprint_error_dev(self, "Could not find data bulk out\n"); | 188 | aprint_error_dev(self, "Could not find data bulk out\n"); | |
189 | goto bad; | 189 | goto bad; | |
190 | } | 190 | } | |
191 | 191 | |||
192 | if (usbd_get_quirks(sc->sc_udev)->uq_flags & UQ_ASSUME_CM_OVER_DATA) { | 192 | if (usbd_get_quirks(sc->sc_udev)->uq_flags & UQ_ASSUME_CM_OVER_DATA) { | |
193 | sc->sc_cm_over_data = 1; | 193 | sc->sc_cm_over_data = 1; | |
194 | } else { | 194 | } else { | |
195 | if (sc->sc_cm_cap & USB_CDC_CM_OVER_DATA) { | 195 | if (sc->sc_cm_cap & USB_CDC_CM_OVER_DATA) { | |
196 | if (sc->sc_acm_cap & USB_CDC_ACM_HAS_FEATURE) | 196 | if (sc->sc_acm_cap & USB_CDC_ACM_HAS_FEATURE) | |
197 | err = umodem_set_comm_feature(sc, | 197 | err = umodem_set_comm_feature(sc, | |
198 | UCDC_ABSTRACT_STATE, UCDC_DATA_MULTIPLEXED); | 198 | UCDC_ABSTRACT_STATE, UCDC_DATA_MULTIPLEXED); | |
199 | else | 199 | else | |
200 | err = 0; | 200 | err = 0; | |
@@ -224,40 +224,40 @@ umodem_common_attach(device_t self, stru | @@ -224,40 +224,40 @@ umodem_common_attach(device_t self, stru | |||
224 | if (ed == NULL) | 224 | if (ed == NULL) | |
225 | continue; | 225 | continue; | |
226 | 226 | |||
227 | if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && | 227 | if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && | |
228 | (ed->bmAttributes & UE_XFERTYPE) == UE_INTERRUPT) { | 228 | (ed->bmAttributes & UE_XFERTYPE) == UE_INTERRUPT) { | |
229 | aprint_error_dev(self, | 229 | aprint_error_dev(self, | |
230 | "status change notification available\n"); | 230 | "status change notification available\n"); | |
231 | sc->sc_ctl_notify = ed->bEndpointAddress; | 231 | sc->sc_ctl_notify = ed->bEndpointAddress; | |
232 | } | 232 | } | |
233 | } | 233 | } | |
234 | 234 | |||
235 | sc->sc_dtr = -1; | 235 | sc->sc_dtr = -1; | |
236 | 236 | |||
237 | /* bulkin, bulkout set above */ | 237 | /* ucaa_bulkin, ucaa_bulkout set above */ | |
238 | uca->ibufsize = UMODEMIBUFSIZE; | 238 | ucaa->ucaa_ibufsize = UMODEMIBUFSIZE; | |
239 | uca->obufsize = UMODEMOBUFSIZE; | 239 | ucaa->ucaa_obufsize = UMODEMOBUFSIZE; | |
240 | uca->ibufsizepad = UMODEMIBUFSIZE; | 240 | ucaa->ucaa_ibufsizepad = UMODEMIBUFSIZE; | |
241 | uca->opkthdrlen = 0; | 241 | ucaa->ucaa_opkthdrlen = 0; | |
242 | uca->device = sc->sc_udev; | 242 | ucaa->ucaa_device = sc->sc_udev; | |
243 | uca->iface = sc->sc_data_iface; | 243 | ucaa->ucaa_iface = sc->sc_data_iface; | |
244 | uca->arg = sc; | 244 | ucaa->ucaa_arg = sc; | |
245 | 245 | |||
246 | usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev, | 246 | usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev, | |
247 | sc->sc_dev); | 247 | sc->sc_dev); | |
248 | 248 | |||
249 | DPRINTF(("umodem_common_attach: sc=%p\n", sc)); | 249 | DPRINTF(("umodem_common_attach: sc=%p\n", sc)); | |
250 | sc->sc_subdev = config_found_sm_loc(self, "ucombus", NULL, uca, | 250 | sc->sc_subdev = config_found_sm_loc(self, "ucombus", NULL, ucaa, | |
251 | ucomprint, ucomsubmatch); | 251 | ucomprint, ucomsubmatch); | |
252 | 252 | |||
253 | return 0; | 253 | return 0; | |
254 | 254 | |||
255 | bad: | 255 | bad: | |
256 | sc->sc_dying = 1; | 256 | sc->sc_dying = 1; | |
257 | return 1; | 257 | return 1; | |
258 | } | 258 | } | |
259 | 259 | |||
260 | int | 260 | int | |
261 | umodem_open(void *addr, int portno) | 261 | umodem_open(void *addr, int portno) | |
262 | { | 262 | { | |
263 | struct umodem_softc *sc = addr; | 263 | struct umodem_softc *sc = addr; |
--- src/sys/dev/usb/uplcom.c 2015/12/27 12:09:59 1.74.4.10
+++ src/sys/dev/usb/uplcom.c 2016/04/16 13:22:00 1.74.4.11
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: uplcom.c,v 1.74.4.10 2015/12/27 12:09:59 skrll Exp $ */ | 1 | /* $NetBSD: uplcom.c,v 1.74.4.11 2016/04/16 13:22:00 skrll Exp $ */ | |
2 | /* | 2 | /* | |
3 | * Copyright (c) 2001 The NetBSD Foundation, Inc. | 3 | * Copyright (c) 2001 The NetBSD Foundation, Inc. | |
4 | * All rights reserved. | 4 | * All rights reserved. | |
5 | * | 5 | * | |
6 | * This code is derived from software contributed to The NetBSD Foundation | 6 | * This code is derived from software contributed to The NetBSD Foundation | |
7 | * by Ichiro FUKUHARA (ichiro@ichiro.org). | 7 | * by Ichiro FUKUHARA (ichiro@ichiro.org). | |
8 | * | 8 | * | |
9 | * Redistribution and use in source and binary forms, with or without | 9 | * Redistribution and use in source and binary forms, with or without | |
10 | * modification, are permitted provided that the following conditions | 10 | * modification, are permitted provided that the following conditions | |
11 | * are met: | 11 | * are met: | |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright | |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. | |
14 | * 2. Redistributions in binary form must reproduce the above copyright | 14 | * 2. Redistributions in binary form must reproduce the above copyright | |
@@ -24,27 +24,27 @@ | @@ -24,27 +24,27 @@ | |||
24 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 24 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
26 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 26 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
28 | * POSSIBILITY OF SUCH DAMAGE. | 28 | * POSSIBILITY OF SUCH DAMAGE. | |
29 | */ | 29 | */ | |
30 | 30 | |||
31 | /* | 31 | /* | |
32 | * General information: http://www.prolific.com.tw/fr_pl2303.htm | 32 | * General information: http://www.prolific.com.tw/fr_pl2303.htm | |
33 | * http://www.hitachi-hitec.com/jyouhou/prolific/2303.pdf | 33 | * http://www.hitachi-hitec.com/jyouhou/prolific/2303.pdf | |
34 | */ | 34 | */ | |
35 | 35 | |||
36 | #include <sys/cdefs.h> | 36 | #include <sys/cdefs.h> | |
37 | __KERNEL_RCSID(0, "$NetBSD: uplcom.c,v 1.74.4.10 2015/12/27 12:09:59 skrll Exp $"); | 37 | __KERNEL_RCSID(0, "$NetBSD: uplcom.c,v 1.74.4.11 2016/04/16 13:22:00 skrll Exp $"); | |
38 | 38 | |||
39 | #include <sys/param.h> | 39 | #include <sys/param.h> | |
40 | #include <sys/systm.h> | 40 | #include <sys/systm.h> | |
41 | #include <sys/kernel.h> | 41 | #include <sys/kernel.h> | |
42 | #include <sys/kmem.h> | 42 | #include <sys/kmem.h> | |
43 | #include <sys/ioctl.h> | 43 | #include <sys/ioctl.h> | |
44 | #include <sys/conf.h> | 44 | #include <sys/conf.h> | |
45 | #include <sys/tty.h> | 45 | #include <sys/tty.h> | |
46 | #include <sys/file.h> | 46 | #include <sys/file.h> | |
47 | #include <sys/select.h> | 47 | #include <sys/select.h> | |
48 | #include <sys/proc.h> | 48 | #include <sys/proc.h> | |
49 | #include <sys/device.h> | 49 | #include <sys/device.h> | |
50 | #include <sys/poll.h> | 50 | #include <sys/poll.h> | |
@@ -218,43 +218,43 @@ void | @@ -218,43 +218,43 @@ void | |||
218 | uplcom_attach(device_t parent, device_t self, void *aux) | 218 | uplcom_attach(device_t parent, device_t self, void *aux) | |
219 | { | 219 | { | |
220 | struct uplcom_softc *sc = device_private(self); | 220 | struct uplcom_softc *sc = device_private(self); | |
221 | struct usb_attach_arg *uaa = aux; | 221 | struct usb_attach_arg *uaa = aux; | |
222 | struct usbd_device *dev = uaa->uaa_device; | 222 | struct usbd_device *dev = uaa->uaa_device; | |
223 | usb_device_descriptor_t *ddesc; | 223 | usb_device_descriptor_t *ddesc; | |
224 | usb_config_descriptor_t *cdesc; | 224 | usb_config_descriptor_t *cdesc; | |
225 | usb_interface_descriptor_t *id; | 225 | usb_interface_descriptor_t *id; | |
226 | usb_endpoint_descriptor_t *ed; | 226 | usb_endpoint_descriptor_t *ed; | |
227 | char *devinfop; | 227 | char *devinfop; | |
228 | const char *devname = device_xname(self); | 228 | const char *devname = device_xname(self); | |
229 | usbd_status err; | 229 | usbd_status err; | |
230 | int i; | 230 | int i; | |
231 | struct ucom_attach_args uca; | 231 | struct ucom_attach_args ucaa; | |
232 | 232 | |||
233 | sc->sc_dev = self; | 233 | sc->sc_dev = self; | |
234 | 234 | |||
235 | aprint_naive("\n"); | 235 | aprint_naive("\n"); | |
236 | aprint_normal("\n"); | 236 | aprint_normal("\n"); | |
237 | 237 | |||
238 | devinfop = usbd_devinfo_alloc(dev, 0); | 238 | devinfop = usbd_devinfo_alloc(dev, 0); | |
239 | aprint_normal_dev(self, "%s\n", devinfop); | 239 | aprint_normal_dev(self, "%s\n", devinfop); | |
240 | usbd_devinfo_free(devinfop); | 240 | usbd_devinfo_free(devinfop); | |
241 | 241 | |||
242 | sc->sc_udev = dev; | 242 | sc->sc_udev = dev; | |
243 | 243 | |||
244 | DPRINTF(("\n\nuplcom attach: sc=%p\n", sc)); | 244 | DPRINTF(("\n\nuplcom attach: sc=%p\n", sc)); | |
245 | 245 | |||
246 | /* initialize endpoints */ | 246 | /* initialize endpoints */ | |
247 | uca.bulkin = uca.bulkout = -1; | 247 | ucaa.ucaa_bulkin = ucaa.ucaa_bulkout = -1; | |
248 | sc->sc_intr_number = -1; | 248 | sc->sc_intr_number = -1; | |
249 | sc->sc_intr_pipe = NULL; | 249 | sc->sc_intr_pipe = NULL; | |
250 | 250 | |||
251 | /* Move the device into the configured state. */ | 251 | /* Move the device into the configured state. */ | |
252 | err = usbd_set_config_index(dev, UPLCOM_CONFIG_INDEX, 1); | 252 | err = usbd_set_config_index(dev, UPLCOM_CONFIG_INDEX, 1); | |
253 | if (err) { | 253 | if (err) { | |
254 | aprint_error("\n%s: failed to set configuration, err=%s\n", | 254 | aprint_error("\n%s: failed to set configuration, err=%s\n", | |
255 | devname, usbd_errstr(err)); | 255 | devname, usbd_errstr(err)); | |
256 | sc->sc_dying = 1; | 256 | sc->sc_dying = 1; | |
257 | return; | 257 | return; | |
258 | } | 258 | } | |
259 | 259 | |||
260 | /* determine chip type */ | 260 | /* determine chip type */ | |
@@ -360,72 +360,72 @@ uplcom_attach(device_t parent, device_t | @@ -360,72 +360,72 @@ uplcom_attach(device_t parent, device_t | |||
360 | sc->sc_iface_number = id->bInterfaceNumber; | 360 | sc->sc_iface_number = id->bInterfaceNumber; | |
361 | 361 | |||
362 | for (i = 0; i < id->bNumEndpoints; i++) { | 362 | for (i = 0; i < id->bNumEndpoints; i++) { | |
363 | ed = usbd_interface2endpoint_descriptor(sc->sc_iface, i); | 363 | ed = usbd_interface2endpoint_descriptor(sc->sc_iface, i); | |
364 | if (ed == NULL) { | 364 | if (ed == NULL) { | |
365 | aprint_error_dev(self, | 365 | aprint_error_dev(self, | |
366 | "no endpoint descriptor for %d\n", i); | 366 | "no endpoint descriptor for %d\n", i); | |
367 | sc->sc_dying = 1; | 367 | sc->sc_dying = 1; | |
368 | return; | 368 | return; | |
369 | } | 369 | } | |
370 | 370 | |||
371 | if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && | 371 | if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && | |
372 | UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) { | 372 | UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) { | |
373 | uca.bulkin = ed->bEndpointAddress; | 373 | ucaa.ucaa_bulkin = ed->bEndpointAddress; | |
374 | } else if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_OUT && | 374 | } else if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_OUT && | |
375 | UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) { | 375 | UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) { | |
376 | uca.bulkout = ed->bEndpointAddress; | 376 | ucaa.ucaa_bulkout = ed->bEndpointAddress; | |
377 | } | 377 | } | |
378 | } | 378 | } | |
379 | 379 | |||
380 | if (uca.bulkin == -1) { | 380 | if (ucaa.ucaa_bulkin == -1) { | |
381 | aprint_error_dev(self, "Could not find data bulk in\n"); | 381 | aprint_error_dev(self, "Could not find data bulk in\n"); | |
382 | sc->sc_dying = 1; | 382 | sc->sc_dying = 1; | |
383 | return; | 383 | return; | |
384 | } | 384 | } | |
385 | 385 | |||
386 | if (uca.bulkout == -1) { | 386 | if (ucaa.ucaa_bulkout == -1) { | |
387 | aprint_error_dev(self, "Could not find data bulk out\n"); | 387 | aprint_error_dev(self, "Could not find data bulk out\n"); | |
388 | sc->sc_dying = 1; | 388 | sc->sc_dying = 1; | |
389 | return; | 389 | return; | |
390 | } | 390 | } | |
391 | 391 | |||
392 | sc->sc_dtr = sc->sc_rts = -1; | 392 | sc->sc_dtr = sc->sc_rts = -1; | |
393 | uca.portno = UCOM_UNK_PORTNO; | 393 | ucaa.ucaa_portno = UCOM_UNK_PORTNO; | |
394 | /* bulkin, bulkout set above */ | 394 | /* ucaa_bulkin, ucaa_bulkout set above */ | |
395 | uca.ibufsize = UPLCOMIBUFSIZE; | 395 | ucaa.ucaa_ibufsize = UPLCOMIBUFSIZE; | |
396 | uca.obufsize = UPLCOMOBUFSIZE; | 396 | ucaa.ucaa_obufsize = UPLCOMOBUFSIZE; | |
397 | uca.ibufsizepad = UPLCOMIBUFSIZE; | 397 | ucaa.ucaa_ibufsizepad = UPLCOMIBUFSIZE; | |
398 | uca.opkthdrlen = 0; | 398 | ucaa.ucaa_opkthdrlen = 0; | |
399 | uca.device = dev; | 399 | ucaa.ucaa_device = dev; | |
400 | uca.iface = sc->sc_iface; | 400 | ucaa.ucaa_iface = sc->sc_iface; | |
401 | uca.methods = &uplcom_methods; | 401 | ucaa.ucaa_methods = &uplcom_methods; | |
402 | uca.arg = sc; | 402 | ucaa.ucaa_arg = sc; | |
403 | uca.info = NULL; | 403 | ucaa.ucaa_info = NULL; | |
404 | 404 | |||
405 | err = uplcom_reset(sc); | 405 | err = uplcom_reset(sc); | |
406 | 406 | |||
407 | if (err) { | 407 | if (err) { | |
408 | aprint_error_dev(self, "reset failed, %s\n", usbd_errstr(err)); | 408 | aprint_error_dev(self, "reset failed, %s\n", usbd_errstr(err)); | |
409 | sc->sc_dying = 1; | 409 | sc->sc_dying = 1; | |
410 | return; | 410 | return; | |
411 | } | 411 | } | |
412 | 412 | |||
413 | usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev, | 413 | usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev, | |
414 | sc->sc_dev); | 414 | sc->sc_dev); | |
415 | 415 | |||
416 | DPRINTF(("uplcom: in=0x%x out=0x%x intr=0x%x\n", | 416 | DPRINTF(("uplcom: in=0x%x out=0x%x intr=0x%x\n", | |
417 | uca.bulkin, uca.bulkout, sc->sc_intr_number )); | 417 | ucaa.ucaa_bulkin, ucaa.ucaa_bulkout, sc->sc_intr_number )); | |
418 | sc->sc_subdev = config_found_sm_loc(self, "ucombus", NULL, &uca, | 418 | sc->sc_subdev = config_found_sm_loc(self, "ucombus", NULL, &ucaa, | |
419 | ucomprint, ucomsubmatch); | 419 | ucomprint, ucomsubmatch); | |
420 | 420 | |||
421 | if (!pmf_device_register(self, NULL, NULL)) | 421 | if (!pmf_device_register(self, NULL, NULL)) | |
422 | aprint_error_dev(self, "couldn't establish power handler\n"); | 422 | aprint_error_dev(self, "couldn't establish power handler\n"); | |
423 | 423 | |||
424 | return; | 424 | return; | |
425 | } | 425 | } | |
426 | 426 | |||
427 | void | 427 | void | |
428 | uplcom_childdet(device_t self, device_t child) | 428 | uplcom_childdet(device_t self, device_t child) | |
429 | { | 429 | { | |
430 | struct uplcom_softc *sc = device_private(self); | 430 | struct uplcom_softc *sc = device_private(self); | |
431 | 431 |
--- src/sys/dev/usb/usbdi.c 2016/03/25 08:32:57 1.162.2.45
+++ src/sys/dev/usb/usbdi.c 2016/04/16 13:22:00 1.162.2.46
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: usbdi.c,v 1.162.2.45 2016/03/25 08:32:57 skrll Exp $ */ | 1 | /* $NetBSD: usbdi.c,v 1.162.2.46 2016/04/16 13:22:00 skrll Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1998, 2012, 2015 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 1998, 2012, 2015 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Lennart Augustsson (lennart@augustsson.net) at | 8 | * by Lennart Augustsson (lennart@augustsson.net) at | |
9 | * Carlstedt Research & Technology, Matthew R. Green (mrg@eterna.com.au), | 9 | * Carlstedt Research & Technology, Matthew R. Green (mrg@eterna.com.au), | |
10 | * and Nick Hudson. | 10 | * and Nick Hudson. | |
11 | * | 11 | * | |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without | |
13 | * modification, are permitted provided that the following conditions | 13 | * modification, are permitted provided that the following conditions | |
14 | * are met: | 14 | * are met: | |
@@ -22,27 +22,27 @@ | @@ -22,27 +22,27 @@ | |||
22 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | 22 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
23 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 23 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
24 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | 24 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
31 | * POSSIBILITY OF SUCH DAMAGE. | 31 | * POSSIBILITY OF SUCH DAMAGE. | |
32 | */ | 32 | */ | |
33 | 33 | |||
34 | #include <sys/cdefs.h> | 34 | #include <sys/cdefs.h> | |
35 | __KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.162.2.45 2016/03/25 08:32:57 skrll Exp $"); | 35 | __KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.162.2.46 2016/04/16 13:22:00 skrll Exp $"); | |
36 | 36 | |||
37 | #ifdef _KERNEL_OPT | 37 | #ifdef _KERNEL_OPT | |
38 | #include "opt_usb.h" | 38 | #include "opt_usb.h" | |
39 | #include "opt_compat_netbsd.h" | 39 | #include "opt_compat_netbsd.h" | |
40 | #include "usb_dma.h" | 40 | #include "usb_dma.h" | |
41 | #endif | 41 | #endif | |
42 | 42 | |||
43 | #include <sys/param.h> | 43 | #include <sys/param.h> | |
44 | #include <sys/systm.h> | 44 | #include <sys/systm.h> | |
45 | #include <sys/kernel.h> | 45 | #include <sys/kernel.h> | |
46 | #include <sys/device.h> | 46 | #include <sys/device.h> | |
47 | #include <sys/kmem.h> | 47 | #include <sys/kmem.h> | |
48 | #include <sys/proc.h> | 48 | #include <sys/proc.h> | |
@@ -530,27 +530,28 @@ usbd_create_xfer(struct usbd_pipe *pipe, | @@ -530,27 +530,28 @@ usbd_create_xfer(struct usbd_pipe *pipe, | |||
530 | int err = xfer->ux_methods->upm_init(xfer); | 530 | int err = xfer->ux_methods->upm_init(xfer); | |
531 | if (err) { | 531 | if (err) { | |
532 | if (buf) | 532 | if (buf) | |
533 | usbd_free_buffer(xfer); | 533 | usbd_free_buffer(xfer); | |
534 | usbd_free_xfer(xfer); | 534 | usbd_free_xfer(xfer); | |
535 | return err; | 535 | return err; | |
536 | } | 536 | } | |
537 | } | 537 | } | |
538 | 538 | |||
539 | *xp = xfer; | 539 | *xp = xfer; | |
540 | return 0; | 540 | return 0; | |
541 | } | 541 | } | |
542 | 542 | |||
543 | void usbd_destroy_xfer(struct usbd_xfer *xfer) | 543 | void | |
544 | usbd_destroy_xfer(struct usbd_xfer *xfer) | |||
544 | { | 545 | { | |
545 | 546 | |||
546 | if (xfer->ux_methods->upm_fini) { | 547 | if (xfer->ux_methods->upm_fini) { | |
547 | xfer->ux_methods->upm_fini(xfer); | 548 | xfer->ux_methods->upm_fini(xfer); | |
548 | } | 549 | } | |
549 | 550 | |||
550 | usbd_free_xfer(xfer); | 551 | usbd_free_xfer(xfer); | |
551 | } | 552 | } | |
552 | 553 | |||
553 | void | 554 | void | |
554 | usbd_setup_xfer(struct usbd_xfer *xfer, void *priv, void *buffer, | 555 | usbd_setup_xfer(struct usbd_xfer *xfer, void *priv, void *buffer, | |
555 | uint32_t length, uint16_t flags, uint32_t timeout, usbd_callback callback) | 556 | uint32_t length, uint16_t flags, uint32_t timeout, usbd_callback callback) | |
556 | { | 557 | { |
--- src/sys/dev/usb/uslsa.c 2015/03/21 11:33:37 1.19.6.3
+++ src/sys/dev/usb/uslsa.c 2016/04/16 13:22:00 1.19.6.4
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: uslsa.c,v 1.19.6.3 2015/03/21 11:33:37 skrll Exp $ */ | 1 | /* $NetBSD: uslsa.c,v 1.19.6.4 2016/04/16 13:22:00 skrll Exp $ */ | |
2 | 2 | |||
3 | /* from ugensa.c */ | 3 | /* from ugensa.c */ | |
4 | 4 | |||
5 | /* | 5 | /* | |
6 | * Copyright (c) 2004, 2005 The NetBSD Foundation, Inc. | 6 | * Copyright (c) 2004, 2005 The NetBSD Foundation, Inc. | |
7 | * All rights reserved. | 7 | * All rights reserved. | |
8 | * | 8 | * | |
9 | * This code is derived from software contributed to The NetBSD Foundation | 9 | * This code is derived from software contributed to The NetBSD Foundation | |
10 | * by Roland C. Dowdeswell <elric@netbsd.org>. | 10 | * by Roland C. Dowdeswell <elric@netbsd.org>. | |
11 | * | 11 | * | |
12 | * Redistribution and use in source and binary forms, with or without | 12 | * Redistribution and use in source and binary forms, with or without | |
13 | * modification, are permitted provided that the following conditions | 13 | * modification, are permitted provided that the following conditions | |
14 | * are met: | 14 | * are met: | |
@@ -48,27 +48,27 @@ | @@ -48,27 +48,27 @@ | |||
48 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | 48 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
49 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | 49 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
50 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | 50 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | |
51 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | 51 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
52 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 52 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
53 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 53 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
54 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 54 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
55 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 55 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
56 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 56 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
57 | * | 57 | * | |
58 | */ | 58 | */ | |
59 | 59 | |||
60 | #include <sys/cdefs.h> | 60 | #include <sys/cdefs.h> | |
61 | __KERNEL_RCSID(0, "$NetBSD: uslsa.c,v 1.19.6.3 2015/03/21 11:33:37 skrll Exp $"); | 61 | __KERNEL_RCSID(0, "$NetBSD: uslsa.c,v 1.19.6.4 2016/04/16 13:22:00 skrll Exp $"); | |
62 | 62 | |||
63 | #include <sys/param.h> | 63 | #include <sys/param.h> | |
64 | #include <sys/systm.h> | 64 | #include <sys/systm.h> | |
65 | #include <sys/kernel.h> | 65 | #include <sys/kernel.h> | |
66 | #include <sys/device.h> | 66 | #include <sys/device.h> | |
67 | #include <sys/conf.h> | 67 | #include <sys/conf.h> | |
68 | #include <sys/tty.h> | 68 | #include <sys/tty.h> | |
69 | 69 | |||
70 | #include <dev/usb/usb.h> | 70 | #include <dev/usb/usb.h> | |
71 | 71 | |||
72 | #include <dev/usb/usbdi.h> | 72 | #include <dev/usb/usbdi.h> | |
73 | #include <dev/usb/usbdi_util.h> | 73 | #include <dev/usb/usbdi_util.h> | |
74 | #include <dev/usb/usbdevs.h> | 74 | #include <dev/usb/usbdevs.h> | |
@@ -161,91 +161,91 @@ uslsa_match(device_t parent, cfdata_t ma | @@ -161,91 +161,91 @@ uslsa_match(device_t parent, cfdata_t ma | |||
161 | } else { | 161 | } else { | |
162 | return UMATCH_NONE; | 162 | return UMATCH_NONE; | |
163 | } | 163 | } | |
164 | } | 164 | } | |
165 | 165 | |||
166 | static void | 166 | static void | |
167 | uslsa_attach(device_t parent, device_t self, void *aux) | 167 | uslsa_attach(device_t parent, device_t self, void *aux) | |
168 | { | 168 | { | |
169 | struct uslsa_softc *sc; | 169 | struct uslsa_softc *sc; | |
170 | const struct usbif_attach_arg *uiaa = aux; | 170 | const struct usbif_attach_arg *uiaa = aux; | |
171 | const usb_interface_descriptor_t *id; | 171 | const usb_interface_descriptor_t *id; | |
172 | const usb_endpoint_descriptor_t *ed; | 172 | const usb_endpoint_descriptor_t *ed; | |
173 | char *devinfop; | 173 | char *devinfop; | |
174 | struct ucom_attach_args uca; | 174 | struct ucom_attach_args ucaa; | |
175 | int i; | 175 | int i; | |
176 | 176 | |||
177 | sc = device_private(self); | 177 | sc = device_private(self); | |
178 | 178 | |||
179 | sc->sc_dev = self; | 179 | sc->sc_dev = self; | |
180 | sc->sc_udev = uiaa->uiaa_device; | 180 | sc->sc_udev = uiaa->uiaa_device; | |
181 | sc->sc_iface = uiaa->uiaa_iface; | 181 | sc->sc_iface = uiaa->uiaa_iface; | |
182 | 182 | |||
183 | aprint_naive("\n"); | 183 | aprint_naive("\n"); | |
184 | aprint_normal("\n"); | 184 | aprint_normal("\n"); | |
185 | 185 | |||
186 | devinfop = usbd_devinfo_alloc(sc->sc_udev, 0); | 186 | devinfop = usbd_devinfo_alloc(sc->sc_udev, 0); | |
187 | aprint_normal_dev(self, "%s\n", devinfop); | 187 | aprint_normal_dev(self, "%s\n", devinfop); | |
188 | usbd_devinfo_free(devinfop); | 188 | usbd_devinfo_free(devinfop); | |
189 | 189 | |||
190 | id = usbd_get_interface_descriptor(sc->sc_iface); | 190 | id = usbd_get_interface_descriptor(sc->sc_iface); | |
191 | 191 | |||
192 | sc->sc_ifnum = id->bInterfaceNumber; | 192 | sc->sc_ifnum = id->bInterfaceNumber; | |
193 | 193 | |||
194 | uca.info = "Silicon Labs CP210x"; | 194 | ucaa.ucaa_info = "Silicon Labs CP210x"; | |
195 | uca.portno = UCOM_UNK_PORTNO; | 195 | ucaa.ucaa_portno = UCOM_UNK_PORTNO; | |
196 | uca.ibufsize = USLSA_BUFSIZE; | 196 | ucaa.ucaa_ibufsize = USLSA_BUFSIZE; | |
197 | uca.obufsize = USLSA_BUFSIZE; | 197 | ucaa.ucaa_obufsize = USLSA_BUFSIZE; | |
198 | uca.ibufsizepad = USLSA_BUFSIZE; | 198 | ucaa.ucaa_ibufsizepad = USLSA_BUFSIZE; | |
199 | uca.opkthdrlen = 0; | 199 | ucaa.ucaa_opkthdrlen = 0; | |
200 | uca.device = sc->sc_udev; | 200 | ucaa.ucaa_device = sc->sc_udev; | |
201 | uca.iface = sc->sc_iface; | 201 | ucaa.ucaa_iface = sc->sc_iface; | |
202 | uca.methods = &uslsa_methods; | 202 | ucaa.ucaa_methods = &uslsa_methods; | |
203 | uca.arg = sc; | 203 | ucaa.ucaa_arg = sc; | |
204 | 204 | |||
205 | usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev, | 205 | usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev, | |
206 | sc->sc_dev); | 206 | sc->sc_dev); | |
207 | 207 | |||
208 | uca.bulkin = uca.bulkout = -1; | 208 | ucaa.ucaa_bulkin = ucaa.ucaa_bulkout = -1; | |
209 | for (i = 0; i < id->bNumEndpoints; i++) { | 209 | for (i = 0; i < id->bNumEndpoints; i++) { | |
210 | int addr, dir, attr; | 210 | int addr, dir, attr; | |
211 | 211 | |||
212 | ed = usbd_interface2endpoint_descriptor(sc->sc_iface, i); | 212 | ed = usbd_interface2endpoint_descriptor(sc->sc_iface, i); | |
213 | if (ed == NULL) { | 213 | if (ed == NULL) { | |
214 | aprint_error_dev(self, | 214 | aprint_error_dev(self, | |
215 | "could not read endpoint descriptor\n"); | 215 | "could not read endpoint descriptor\n"); | |
216 | sc->sc_dying = true; | 216 | sc->sc_dying = true; | |
217 | return; | 217 | return; | |
218 | } | 218 | } | |
219 | addr = ed->bEndpointAddress; | 219 | addr = ed->bEndpointAddress; | |
220 | dir = UE_GET_DIR(ed->bEndpointAddress); | 220 | dir = UE_GET_DIR(ed->bEndpointAddress); | |
221 | attr = ed->bmAttributes & UE_XFERTYPE; | 221 | attr = ed->bmAttributes & UE_XFERTYPE; | |
222 | if (dir == UE_DIR_IN && attr == UE_BULK) { | 222 | if (dir == UE_DIR_IN && attr == UE_BULK) { | |
223 | uca.bulkin = addr; | 223 | ucaa.ucaa_bulkin = addr; | |
224 | } else if (dir == UE_DIR_OUT && attr == UE_BULK) { | 224 | } else if (dir == UE_DIR_OUT && attr == UE_BULK) { | |
225 | uca.bulkout = addr; | 225 | ucaa.ucaa_bulkout = addr; | |
226 | } else { | 226 | } else { | |
227 | aprint_error_dev(self, "unexpected endpoint\n"); | 227 | aprint_error_dev(self, "unexpected endpoint\n"); | |
228 | } | 228 | } | |
229 | } | 229 | } | |
230 | aprint_debug_dev(sc->sc_dev, "EPs: in=%#x out=%#x\n", | 230 | aprint_debug_dev(sc->sc_dev, "EPs: in=%#x out=%#x\n", | |
231 | uca.bulkin, uca.bulkout); | 231 | ucaa.ucaa_bulkin, ucaa.ucaa_bulkout); | |
232 | if ((uca.bulkin == -1) || (uca.bulkout == -1)) { | 232 | if ((ucaa.ucaa_bulkin == -1) || (ucaa.ucaa_bulkout == -1)) { | |
233 | aprint_error_dev(self, "could not find endpoints\n"); | 233 | aprint_error_dev(self, "could not find endpoints\n"); | |
234 | sc->sc_dying = true; | 234 | sc->sc_dying = true; | |
235 | return; | 235 | return; | |
236 | } | 236 | } | |
237 | 237 | |||
238 | sc->sc_subdev = config_found_sm_loc(self, "ucombus", NULL, &uca, | 238 | sc->sc_subdev = config_found_sm_loc(self, "ucombus", NULL, &ucaa, | |
239 | ucomprint, ucomsubmatch); | 239 | ucomprint, ucomsubmatch); | |
240 | 240 | |||
241 | return; | 241 | return; | |
242 | } | 242 | } | |
243 | 243 | |||
244 | static int | 244 | static int | |
245 | uslsa_activate(device_t self, enum devact act) | 245 | uslsa_activate(device_t self, enum devact act) | |
246 | { | 246 | { | |
247 | struct uslsa_softc *sc = device_private(self); | 247 | struct uslsa_softc *sc = device_private(self); | |
248 | 248 | |||
249 | switch (act) { | 249 | switch (act) { | |
250 | case DVACT_DEACTIVATE: | 250 | case DVACT_DEACTIVATE: | |
251 | sc->sc_dying = true; | 251 | sc->sc_dying = true; |
--- src/sys/dev/usb/uvisor.c 2015/09/29 11:38:29 1.45.24.6
+++ src/sys/dev/usb/uvisor.c 2016/04/16 13:22:00 1.45.24.7
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: uvisor.c,v 1.45.24.6 2015/09/29 11:38:29 skrll Exp $ */ | 1 | /* $NetBSD: uvisor.c,v 1.45.24.7 2016/04/16 13:22:00 skrll Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 2000 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 2000 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Lennart Augustsson (lennart@augustsson.net) at | 8 | * by Lennart Augustsson (lennart@augustsson.net) at | |
9 | * Carlstedt Research & Technology. | 9 | * Carlstedt Research & Technology. | |
10 | * | 10 | * | |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without | |
12 | * modification, are permitted provided that the following conditions | 12 | * modification, are permitted provided that the following conditions | |
13 | * are met: | 13 | * are met: | |
14 | * 1. Redistributions of source code must retain the above copyright | 14 | * 1. Redistributions of source code must retain the above copyright | |
@@ -25,27 +25,27 @@ | @@ -25,27 +25,27 @@ | |||
25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
26 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 26 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
30 | * POSSIBILITY OF SUCH DAMAGE. | 30 | * POSSIBILITY OF SUCH DAMAGE. | |
31 | */ | 31 | */ | |
32 | 32 | |||
33 | /* | 33 | /* | |
34 | * Handspring Visor (Palmpilot compatible PDA) driver | 34 | * Handspring Visor (Palmpilot compatible PDA) driver | |
35 | */ | 35 | */ | |
36 | 36 | |||
37 | #include <sys/cdefs.h> | 37 | #include <sys/cdefs.h> | |
38 | __KERNEL_RCSID(0, "$NetBSD: uvisor.c,v 1.45.24.6 2015/09/29 11:38:29 skrll Exp $"); | 38 | __KERNEL_RCSID(0, "$NetBSD: uvisor.c,v 1.45.24.7 2016/04/16 13:22:00 skrll Exp $"); | |
39 | 39 | |||
40 | #include <sys/param.h> | 40 | #include <sys/param.h> | |
41 | #include <sys/systm.h> | 41 | #include <sys/systm.h> | |
42 | #include <sys/kernel.h> | 42 | #include <sys/kernel.h> | |
43 | #include <sys/device.h> | 43 | #include <sys/device.h> | |
44 | #include <sys/conf.h> | 44 | #include <sys/conf.h> | |
45 | #include <sys/tty.h> | 45 | #include <sys/tty.h> | |
46 | 46 | |||
47 | #include <dev/usb/usb.h> | 47 | #include <dev/usb/usb.h> | |
48 | 48 | |||
49 | #include <dev/usb/usbdi.h> | 49 | #include <dev/usb/usbdi.h> | |
50 | #include <dev/usb/usbdi_util.h> | 50 | #include <dev/usb/usbdi_util.h> | |
51 | #include <dev/usb/usbdevs.h> | 51 | #include <dev/usb/usbdevs.h> | |
@@ -215,27 +215,27 @@ uvisor_attach(device_t parent, device_t | @@ -215,27 +215,27 @@ uvisor_attach(device_t parent, device_t | |||
215 | { | 215 | { | |
216 | struct uvisor_softc *sc = device_private(self); | 216 | struct uvisor_softc *sc = device_private(self); | |
217 | struct usb_attach_arg *uaa = aux; | 217 | struct usb_attach_arg *uaa = aux; | |
218 | struct usbd_device *dev = uaa->uaa_device; | 218 | struct usbd_device *dev = uaa->uaa_device; | |
219 | struct usbd_interface *iface; | 219 | struct usbd_interface *iface; | |
220 | usb_interface_descriptor_t *id; | 220 | usb_interface_descriptor_t *id; | |
221 | struct uvisor_connection_info coninfo; | 221 | struct uvisor_connection_info coninfo; | |
222 | struct uvisor_palm_connection_info palmconinfo; | 222 | struct uvisor_palm_connection_info palmconinfo; | |
223 | usb_endpoint_descriptor_t *ed; | 223 | usb_endpoint_descriptor_t *ed; | |
224 | char *devinfop; | 224 | char *devinfop; | |
225 | const char *devname = device_xname(self); | 225 | const char *devname = device_xname(self); | |
226 | int i, j, hasin, hasout, port; | 226 | int i, j, hasin, hasout, port; | |
227 | usbd_status err; | 227 | usbd_status err; | |
228 | struct ucom_attach_args uca; | 228 | struct ucom_attach_args ucaa; | |
229 | 229 | |||
230 | DPRINTFN(10,("\nuvisor_attach: sc=%p\n", sc)); | 230 | DPRINTFN(10,("\nuvisor_attach: sc=%p\n", sc)); | |
231 | 231 | |||
232 | sc->sc_dev = self; | 232 | sc->sc_dev = self; | |
233 | 233 | |||
234 | aprint_naive("\n"); | 234 | aprint_naive("\n"); | |
235 | aprint_normal("\n"); | 235 | aprint_normal("\n"); | |
236 | 236 | |||
237 | devinfop = usbd_devinfo_alloc(dev, 0); | 237 | devinfop = usbd_devinfo_alloc(dev, 0); | |
238 | aprint_normal_dev(self, "%s\n", devinfop); | 238 | aprint_normal_dev(self, "%s\n", devinfop); | |
239 | usbd_devinfo_free(devinfop); | 239 | usbd_devinfo_free(devinfop); | |
240 | 240 | |||
241 | /* Move the device into the configured state. */ | 241 | /* Move the device into the configured state. */ | |
@@ -256,123 +256,123 @@ uvisor_attach(device_t parent, device_t | @@ -256,123 +256,123 @@ uvisor_attach(device_t parent, device_t | |||
256 | sc->sc_flags = uvisor_lookup(uaa->uaa_vendor, uaa->uaa_product)->uv_flags; | 256 | sc->sc_flags = uvisor_lookup(uaa->uaa_vendor, uaa->uaa_product)->uv_flags; | |
257 | 257 | |||
258 | if ((sc->sc_flags & (VISOR | PALM4)) == 0) { | 258 | if ((sc->sc_flags & (VISOR | PALM4)) == 0) { | |
259 | aprint_error_dev(self, | 259 | aprint_error_dev(self, | |
260 | "init failed, device type is neither visor nor palm\n"); | 260 | "init failed, device type is neither visor nor palm\n"); | |
261 | goto bad; | 261 | goto bad; | |
262 | } | 262 | } | |
263 | 263 | |||
264 | id = usbd_get_interface_descriptor(iface); | 264 | id = usbd_get_interface_descriptor(iface); | |
265 | 265 | |||
266 | sc->sc_udev = dev; | 266 | sc->sc_udev = dev; | |
267 | sc->sc_iface = iface; | 267 | sc->sc_iface = iface; | |
268 | 268 | |||
269 | uca.ibufsize = UVISORIBUFSIZE; | 269 | ucaa.ucaa_ibufsize = UVISORIBUFSIZE; | |
270 | uca.obufsize = UVISOROBUFSIZE; | 270 | ucaa.ucaa_obufsize = UVISOROBUFSIZE; | |
271 | uca.ibufsizepad = UVISORIBUFSIZE; | 271 | ucaa.ucaa_ibufsizepad = UVISORIBUFSIZE; | |
272 | uca.opkthdrlen = 0; | 272 | ucaa.ucaa_opkthdrlen = 0; | |
273 | uca.device = dev; | 273 | ucaa.ucaa_device = dev; | |
274 | uca.iface = iface; | 274 | ucaa.ucaa_iface = iface; | |
275 | uca.methods = &uvisor_methods; | 275 | ucaa.ucaa_methods = &uvisor_methods; | |
276 | uca.arg = sc; | 276 | ucaa.ucaa_arg = sc; | |
277 | 277 | |||
278 | err = uvisor_init(sc, &coninfo, &palmconinfo); | 278 | err = uvisor_init(sc, &coninfo, &palmconinfo); | |
279 | if (err) { | 279 | if (err) { | |
280 | aprint_error_dev(self, "init failed, %s\n", usbd_errstr(err)); | 280 | aprint_error_dev(self, "init failed, %s\n", usbd_errstr(err)); | |
281 | goto bad; | 281 | goto bad; | |
282 | } | 282 | } | |
283 | 283 | |||
284 | usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev, | 284 | usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev, | |
285 | sc->sc_dev); | 285 | sc->sc_dev); | |
286 | 286 | |||
287 | if (sc->sc_flags & VISOR) { | 287 | if (sc->sc_flags & VISOR) { | |
288 | sc->sc_numcon = UGETW(coninfo.num_ports); | 288 | sc->sc_numcon = UGETW(coninfo.num_ports); | |
289 | if (sc->sc_numcon > UVISOR_MAX_CONN) | 289 | if (sc->sc_numcon > UVISOR_MAX_CONN) | |
290 | sc->sc_numcon = UVISOR_MAX_CONN; | 290 | sc->sc_numcon = UVISOR_MAX_CONN; | |
291 | 291 | |||
292 | /* Attach a ucom for each connection. */ | 292 | /* Attach a ucom for each connection. */ | |
293 | for (i = 0; i < sc->sc_numcon; ++i) { | 293 | for (i = 0; i < sc->sc_numcon; ++i) { | |
294 | switch (coninfo.connections[i].port_function_id) { | 294 | switch (coninfo.connections[i].port_function_id) { | |
295 | case UVISOR_FUNCTION_GENERIC: | 295 | case UVISOR_FUNCTION_GENERIC: | |
296 | uca.info = "Generic"; | 296 | ucaa.ucaa_info = "Generic"; | |
297 | break; | 297 | break; | |
298 | case UVISOR_FUNCTION_DEBUGGER: | 298 | case UVISOR_FUNCTION_DEBUGGER: | |
299 | uca.info = "Debugger"; | 299 | ucaa.ucaa_info = "Debugger"; | |
300 | break; | 300 | break; | |
301 | case UVISOR_FUNCTION_HOTSYNC: | 301 | case UVISOR_FUNCTION_HOTSYNC: | |
302 | uca.info = "HotSync"; | 302 | ucaa.ucaa_info = "HotSync"; | |
303 | break; | 303 | break; | |
304 | case UVISOR_FUNCTION_REMOTE_FILE_SYS: | 304 | case UVISOR_FUNCTION_REMOTE_FILE_SYS: | |
305 | uca.info = "Remote File System"; | 305 | ucaa.ucaa_info = "Remote File System"; | |
306 | break; | 306 | break; | |
307 | default: | 307 | default: | |
308 | uca.info = "unknown"; | 308 | ucaa.ucaa_info = "unknown"; | |
309 | break; | 309 | break; | |
310 | } | 310 | } | |
311 | port = coninfo.connections[i].port; | 311 | port = coninfo.connections[i].port; | |
312 | uca.portno = port; | 312 | ucaa.ucaa_portno = port; | |
313 | uca.bulkin = port | UE_DIR_IN; | 313 | ucaa.ucaa_bulkin = port | UE_DIR_IN; | |
314 | uca.bulkout = port | UE_DIR_OUT; | 314 | ucaa.ucaa_bulkout = port | UE_DIR_OUT; | |
315 | /* Verify that endpoints exist. */ | 315 | /* Verify that endpoints exist. */ | |
316 | hasin = 0; | 316 | hasin = 0; | |
317 | hasout = 0; | 317 | hasout = 0; | |
318 | for (j = 0; j < id->bNumEndpoints; j++) { | 318 | for (j = 0; j < id->bNumEndpoints; j++) { | |
319 | ed = usbd_interface2endpoint_descriptor(iface, j); | 319 | ed = usbd_interface2endpoint_descriptor(iface, j); | |
320 | if (ed == NULL) | 320 | if (ed == NULL) | |
321 | break; | 321 | break; | |
322 | if (UE_GET_ADDR(ed->bEndpointAddress) == port && | 322 | if (UE_GET_ADDR(ed->bEndpointAddress) == port && | |
323 | (ed->bmAttributes & UE_XFERTYPE) == UE_BULK) { | 323 | (ed->bmAttributes & UE_XFERTYPE) == UE_BULK) { | |
324 | if (UE_GET_DIR(ed->bEndpointAddress) | 324 | if (UE_GET_DIR(ed->bEndpointAddress) | |
325 | == UE_DIR_IN) | 325 | == UE_DIR_IN) | |
326 | hasin++; | 326 | hasin++; | |
327 | else | 327 | else | |
328 | hasout++; | 328 | hasout++; | |
329 | } | 329 | } | |
330 | } | 330 | } | |
331 | if (hasin == 1 && hasout == 1) | 331 | if (hasin == 1 && hasout == 1) | |
332 | sc->sc_subdevs[i] = config_found_sm_loc(self, | 332 | sc->sc_subdevs[i] = config_found_sm_loc(self, | |
333 | "ucombus", NULL, &uca, | 333 | "ucombus", NULL, &ucaa, | |
334 | ucomprint, ucomsubmatch); | 334 | ucomprint, ucomsubmatch); | |
335 | else | 335 | else | |
336 | aprint_error_dev(self, | 336 | aprint_error_dev(self, | |
337 | "no proper endpoints for port %d (%d,%d)\n", | 337 | "no proper endpoints for port %d (%d,%d)\n", | |
338 | port, hasin, hasout); | 338 | port, hasin, hasout); | |
339 | } | 339 | } | |
340 | 340 | |||
341 | } else { | 341 | } else { | |
342 | sc->sc_numcon = palmconinfo.num_ports; | 342 | sc->sc_numcon = palmconinfo.num_ports; | |
343 | if (sc->sc_numcon > UVISOR_MAX_CONN) | 343 | if (sc->sc_numcon > UVISOR_MAX_CONN) | |
344 | sc->sc_numcon = UVISOR_MAX_CONN; | 344 | sc->sc_numcon = UVISOR_MAX_CONN; | |
345 | 345 | |||
346 | /* Attach a ucom for each connection. */ | 346 | /* Attach a ucom for each connection. */ | |
347 | for (i = 0; i < sc->sc_numcon; ++i) { | 347 | for (i = 0; i < sc->sc_numcon; ++i) { | |
348 | /* | 348 | /* | |
349 | * XXX this should copy out 4-char string from the | 349 | * XXX this should copy out 4-char string from the | |
350 | * XXX port_function_id, but where would the string go? | 350 | * XXX port_function_id, but where would the string go? | |
351 | * XXX uca.info is a const char *, not an array. | 351 | * XXX ucaa.ucaa_info is a const char *, not an array. | |
352 | */ | 352 | */ | |
353 | uca.info = "sync"; | 353 | ucaa.ucaa_info = "sync"; | |
354 | uca.portno = i; | 354 | ucaa.ucaa_portno = i; | |
355 | if (palmconinfo.endpoint_numbers_different) { | 355 | if (palmconinfo.endpoint_numbers_different) { | |
356 | port = palmconinfo.connections[i].end_point_info; | 356 | port = palmconinfo.connections[i].end_point_info; | |
357 | uca.bulkin = (port >> 4) | UE_DIR_IN; | 357 | ucaa.ucaa_bulkin = (port >> 4) | UE_DIR_IN; | |
358 | uca.bulkout = (port & 0xf) | UE_DIR_OUT; | 358 | ucaa.ucaa_bulkout = (port & 0xf) | UE_DIR_OUT; | |
359 | } else { | 359 | } else { | |
360 | port = palmconinfo.connections[i].port; | 360 | port = palmconinfo.connections[i].port; | |
361 | uca.bulkin = port | UE_DIR_IN; | 361 | ucaa.ucaa_bulkin = port | UE_DIR_IN; | |
362 | uca.bulkout = port | UE_DIR_OUT; | 362 | ucaa.ucaa_bulkout = port | UE_DIR_OUT; | |
363 | } | 363 | } | |
364 | sc->sc_subdevs[i] = config_found_sm_loc(self, "ucombus", | 364 | sc->sc_subdevs[i] = config_found_sm_loc(self, "ucombus", | |
365 | NULL, &uca, ucomprint, ucomsubmatch); | 365 | NULL, &ucaa, ucomprint, ucomsubmatch); | |
366 | 366 | |||
367 | 367 | |||
368 | } | 368 | } | |
369 | } | 369 | } | |
370 | 370 | |||
371 | return; | 371 | return; | |
372 | 372 | |||
373 | bad: | 373 | bad: | |
374 | DPRINTF(("uvisor_attach: ATTACH ERROR\n")); | 374 | DPRINTF(("uvisor_attach: ATTACH ERROR\n")); | |
375 | sc->sc_dying = 1; | 375 | sc->sc_dying = 1; | |
376 | return; | 376 | return; | |
377 | } | 377 | } | |
378 | 378 |
--- src/sys/dev/usb/uvscom.c 2015/03/21 11:33:37 1.28.16.6
+++ src/sys/dev/usb/uvscom.c 2016/04/16 13:22:00 1.28.16.7
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: uvscom.c,v 1.28.16.6 2015/03/21 11:33:37 skrll Exp $ */ | 1 | /* $NetBSD: uvscom.c,v 1.28.16.7 2016/04/16 13:22:00 skrll Exp $ */ | |
2 | /*- | 2 | /*- | |
3 | * Copyright (c) 2001-2002, Shunsuke Akiyama <akiyama@jp.FreeBSD.org>. | 3 | * Copyright (c) 2001-2002, Shunsuke Akiyama <akiyama@jp.FreeBSD.org>. | |
4 | * All rights reserved. | 4 | * All rights reserved. | |
5 | * | 5 | * | |
6 | * Redistribution and use in source and binary forms, with or without | 6 | * Redistribution and use in source and binary forms, with or without | |
7 | * modification, are permitted provided that the following conditions | 7 | * modification, are permitted provided that the following conditions | |
8 | * are met: | 8 | * are met: | |
9 | * 1. Redistributions of source code must retain the above copyright | 9 | * 1. Redistributions of source code must retain the above copyright | |
10 | * notice, this list of conditions and the following disclaimer. | 10 | * notice, this list of conditions and the following disclaimer. | |
11 | * 2. Redistributions in binary form must reproduce the above copyright | 11 | * 2. Redistributions in binary form must reproduce the above copyright | |
12 | * notice, this list of conditions and the following disclaimer in the | 12 | * notice, this list of conditions and the following disclaimer in the | |
13 | * documentation and/or other materials provided with the distribution. | 13 | * documentation and/or other materials provided with the distribution. | |
14 | * | 14 | * | |
@@ -25,27 +25,27 @@ | @@ -25,27 +25,27 @@ | |||
25 | * SUCH DAMAGE. | 25 | * SUCH DAMAGE. | |
26 | * | 26 | * | |
27 | * $FreeBSD: src/sys/dev/usb/uvscom.c,v 1.1 2002/03/18 18:23:39 joe Exp $ | 27 | * $FreeBSD: src/sys/dev/usb/uvscom.c,v 1.1 2002/03/18 18:23:39 joe Exp $ | |
28 | */ | 28 | */ | |
29 | 29 | |||
30 | /* | 30 | /* | |
31 | * uvscom: SUNTAC Slipper U VS-10U driver. | 31 | * uvscom: SUNTAC Slipper U VS-10U driver. | |
32 | * Slipper U is a PC card to USB converter for data communication card | 32 | * Slipper U is a PC card to USB converter for data communication card | |
33 | * adapter. It supports DDI Pocket's Air H" C@rd, C@rd H" 64, NTT's P-in, | 33 | * adapter. It supports DDI Pocket's Air H" C@rd, C@rd H" 64, NTT's P-in, | |
34 | * P-in m@ater and various data communication card adapters. | 34 | * P-in m@ater and various data communication card adapters. | |
35 | */ | 35 | */ | |
36 | 36 | |||
37 | #include <sys/cdefs.h> | 37 | #include <sys/cdefs.h> | |
38 | __KERNEL_RCSID(0, "$NetBSD: uvscom.c,v 1.28.16.6 2015/03/21 11:33:37 skrll Exp $"); | 38 | __KERNEL_RCSID(0, "$NetBSD: uvscom.c,v 1.28.16.7 2016/04/16 13:22:00 skrll Exp $"); | |
39 | 39 | |||
40 | #include <sys/param.h> | 40 | #include <sys/param.h> | |
41 | #include <sys/systm.h> | 41 | #include <sys/systm.h> | |
42 | #include <sys/kernel.h> | 42 | #include <sys/kernel.h> | |
43 | #include <sys/kmem.h> | 43 | #include <sys/kmem.h> | |
44 | #include <sys/fcntl.h> | 44 | #include <sys/fcntl.h> | |
45 | #include <sys/conf.h> | 45 | #include <sys/conf.h> | |
46 | #include <sys/tty.h> | 46 | #include <sys/tty.h> | |
47 | #include <sys/file.h> | 47 | #include <sys/file.h> | |
48 | #include <sys/ioctl.h> | 48 | #include <sys/ioctl.h> | |
49 | #include <sys/device.h> | 49 | #include <sys/device.h> | |
50 | #include <sys/proc.h> | 50 | #include <sys/proc.h> | |
51 | #include <sys/poll.h> | 51 | #include <sys/poll.h> | |
@@ -229,42 +229,42 @@ uvscom_match(device_t parent, cfdata_t m | @@ -229,42 +229,42 @@ uvscom_match(device_t parent, cfdata_t m | |||
229 | 229 | |||
230 | void | 230 | void | |
231 | uvscom_attach(device_t parent, device_t self, void *aux) | 231 | uvscom_attach(device_t parent, device_t self, void *aux) | |
232 | { | 232 | { | |
233 | struct uvscom_softc *sc = device_private(self); | 233 | struct uvscom_softc *sc = device_private(self); | |
234 | struct usb_attach_arg *uaa = aux; | 234 | struct usb_attach_arg *uaa = aux; | |
235 | struct usbd_device *dev = uaa->uaa_device; | 235 | struct usbd_device *dev = uaa->uaa_device; | |
236 | usb_config_descriptor_t *cdesc; | 236 | usb_config_descriptor_t *cdesc; | |
237 | usb_interface_descriptor_t *id; | 237 | usb_interface_descriptor_t *id; | |
238 | usb_endpoint_descriptor_t *ed; | 238 | usb_endpoint_descriptor_t *ed; | |
239 | char *devinfop; | 239 | char *devinfop; | |
240 | usbd_status err; | 240 | usbd_status err; | |
241 | int i; | 241 | int i; | |
242 | struct ucom_attach_args uca; | 242 | struct ucom_attach_args ucaa; | |
243 | 243 | |||
244 | aprint_naive("\n"); | 244 | aprint_naive("\n"); | |
245 | aprint_normal("\n"); | 245 | aprint_normal("\n"); | |
246 | 246 | |||
247 | devinfop = usbd_devinfo_alloc(dev, 0); | 247 | devinfop = usbd_devinfo_alloc(dev, 0); | |
248 | aprint_normal_dev(self, "%s\n", devinfop); | 248 | aprint_normal_dev(self, "%s\n", devinfop); | |
249 | usbd_devinfo_free(devinfop); | 249 | usbd_devinfo_free(devinfop); | |
250 | 250 | |||
251 | sc->sc_dev = self; | 251 | sc->sc_dev = self; | |
252 | sc->sc_udev = dev; | 252 | sc->sc_udev = dev; | |
253 | 253 | |||
254 | DPRINTF(("uvscom attach: sc = %p\n", sc)); | 254 | DPRINTF(("uvscom attach: sc = %p\n", sc)); | |
255 | 255 | |||
256 | /* initialize endpoints */ | 256 | /* initialize endpoints */ | |
257 | uca.bulkin = uca.bulkout = -1; | 257 | ucaa.ucaa_bulkin = ucaa.ucaa_bulkout = -1; | |
258 | sc->sc_intr_number = -1; | 258 | sc->sc_intr_number = -1; | |
259 | sc->sc_intr_pipe = NULL; | 259 | sc->sc_intr_pipe = NULL; | |
260 | 260 | |||
261 | /* Move the device into the configured state. */ | 261 | /* Move the device into the configured state. */ | |
262 | err = usbd_set_config_index(dev, UVSCOM_CONFIG_INDEX, 1); | 262 | err = usbd_set_config_index(dev, UVSCOM_CONFIG_INDEX, 1); | |
263 | if (err) { | 263 | if (err) { | |
264 | aprint_error_dev(self, "failed to set configuration, err=%s\n", | 264 | aprint_error_dev(self, "failed to set configuration, err=%s\n", | |
265 | usbd_errstr(err)); | 265 | usbd_errstr(err)); | |
266 | sc->sc_dying = 1; | 266 | sc->sc_dying = 1; | |
267 | return; | 267 | return; | |
268 | } | 268 | } | |
269 | 269 | |||
270 | /* get the config descriptor */ | 270 | /* get the config descriptor */ | |
@@ -292,85 +292,85 @@ uvscom_attach(device_t parent, device_t | @@ -292,85 +292,85 @@ uvscom_attach(device_t parent, device_t | |||
292 | 292 | |||
293 | /* Find endpoints */ | 293 | /* Find endpoints */ | |
294 | for (i = 0; i < id->bNumEndpoints; i++) { | 294 | for (i = 0; i < id->bNumEndpoints; i++) { | |
295 | ed = usbd_interface2endpoint_descriptor(sc->sc_iface, i); | 295 | ed = usbd_interface2endpoint_descriptor(sc->sc_iface, i); | |
296 | if (ed == NULL) { | 296 | if (ed == NULL) { | |
297 | aprint_error_dev(self, | 297 | aprint_error_dev(self, | |
298 | "no endpoint descriptor for %d\n", i); | 298 | "no endpoint descriptor for %d\n", i); | |
299 | sc->sc_dying = 1; | 299 | sc->sc_dying = 1; | |
300 | return; | 300 | return; | |
301 | } | 301 | } | |
302 | 302 | |||
303 | if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && | 303 | if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && | |
304 | UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) { | 304 | UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) { | |
305 | uca.bulkin = ed->bEndpointAddress; | 305 | ucaa.ucaa_bulkin = ed->bEndpointAddress; | |
306 | } else if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_OUT && | 306 | } else if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_OUT && | |
307 | UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) { | 307 | UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) { | |
308 | uca.bulkout = ed->bEndpointAddress; | 308 | ucaa.ucaa_bulkout = ed->bEndpointAddress; | |
309 | } else if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && | 309 | } else if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && | |
310 | UE_GET_XFERTYPE(ed->bmAttributes) == UE_INTERRUPT) { | 310 | UE_GET_XFERTYPE(ed->bmAttributes) == UE_INTERRUPT) { | |
311 | sc->sc_intr_number = ed->bEndpointAddress; | 311 | sc->sc_intr_number = ed->bEndpointAddress; | |
312 | sc->sc_isize = UGETW(ed->wMaxPacketSize); | 312 | sc->sc_isize = UGETW(ed->wMaxPacketSize); | |
313 | } | 313 | } | |
314 | } | 314 | } | |
315 | 315 | |||
316 | if (uca.bulkin == -1) { | 316 | if (ucaa.ucaa_bulkin == -1) { | |
317 | aprint_error_dev(self, "Could not find data bulk in\n"); | 317 | aprint_error_dev(self, "Could not find data bulk in\n"); | |
318 | sc->sc_dying = 1; | 318 | sc->sc_dying = 1; | |
319 | return; | 319 | return; | |
320 | } | 320 | } | |
321 | if (uca.bulkout == -1) { | 321 | if (ucaa.ucaa_bulkout == -1) { | |
322 | aprint_error_dev(self, "Could not find data bulk out\n"); | 322 | aprint_error_dev(self, "Could not find data bulk out\n"); | |
323 | sc->sc_dying = 1; | 323 | sc->sc_dying = 1; | |
324 | return; | 324 | return; | |
325 | } | 325 | } | |
326 | if (sc->sc_intr_number == -1) { | 326 | if (sc->sc_intr_number == -1) { | |
327 | aprint_error_dev(self, "Could not find interrupt in\n"); | 327 | aprint_error_dev(self, "Could not find interrupt in\n"); | |
328 | sc->sc_dying = 1; | 328 | sc->sc_dying = 1; | |
329 | return; | 329 | return; | |
330 | } | 330 | } | |
331 | 331 | |||
332 | sc->sc_dtr = sc->sc_rts = 0; | 332 | sc->sc_dtr = sc->sc_rts = 0; | |
333 | sc->sc_lcr = UVSCOM_LINE_INIT; | 333 | sc->sc_lcr = UVSCOM_LINE_INIT; | |
334 | 334 | |||
335 | uca.portno = UCOM_UNK_PORTNO; | 335 | ucaa.ucaa_portno = UCOM_UNK_PORTNO; | |
336 | /* bulkin, bulkout set above */ | 336 | /* ucaa_bulkin, ucaa_bulkout set above */ | |
337 | uca.ibufsize = UVSCOMIBUFSIZE; | 337 | ucaa.ucaa_ibufsize = UVSCOMIBUFSIZE; | |
338 | uca.obufsize = UVSCOMOBUFSIZE; | 338 | ucaa.ucaa_obufsize = UVSCOMOBUFSIZE; | |
339 | uca.ibufsizepad = UVSCOMIBUFSIZE; | 339 | ucaa.ucaa_ibufsizepad = UVSCOMIBUFSIZE; | |
340 | uca.opkthdrlen = 0; | 340 | ucaa.ucaa_opkthdrlen = 0; | |
341 | uca.device = dev; | 341 | ucaa.ucaa_device = dev; | |
342 | uca.iface = sc->sc_iface; | 342 | ucaa.ucaa_iface = sc->sc_iface; | |
343 | uca.methods = &uvscom_methods; | 343 | ucaa.ucaa_methods = &uvscom_methods; | |
344 | uca.arg = sc; | 344 | ucaa.ucaa_arg = sc; | |
345 | uca.info = NULL; | 345 | ucaa.ucaa_info = NULL; | |
346 | 346 | |||
347 | err = uvscom_reset(sc); | 347 | err = uvscom_reset(sc); | |
348 | 348 | |||
349 | if (err) { | 349 | if (err) { | |
350 | aprint_error_dev(self, "reset failed, %s\n", usbd_errstr(err)); | 350 | aprint_error_dev(self, "reset failed, %s\n", usbd_errstr(err)); | |
351 | sc->sc_dying = 1; | 351 | sc->sc_dying = 1; | |
352 | return; | 352 | return; | |
353 | } | 353 | } | |
354 | 354 | |||
355 | DPRINTF(("uvscom: in = 0x%x out = 0x%x intr = 0x%x\n", | 355 | DPRINTF(("uvscom: in = 0x%x out = 0x%x intr = 0x%x\n", | |
356 | uca.bulkin, uca.bulkout, sc->sc_intr_number)); | 356 | ucaa.ucaa_bulkin, ucaa.ucaa_bulkout, sc->sc_intr_number)); | |
357 | 357 | |||
358 | usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev, | 358 | usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev, | |
359 | sc->sc_dev); | 359 | sc->sc_dev); | |
360 | 360 | |||
361 | DPRINTF(("uplcom: in=0x%x out=0x%x intr=0x%x\n", | 361 | DPRINTF(("uplcom: in=0x%x out=0x%x intr=0x%x\n", | |
362 | uca.bulkin, uca.bulkout, sc->sc_intr_number )); | 362 | ucaa.ucaa_bulkin, ucaa.ucaa_bulkout, sc->sc_intr_number )); | |
363 | sc->sc_subdev = config_found_sm_loc(self, "ucombus", NULL, &uca, | 363 | sc->sc_subdev = config_found_sm_loc(self, "ucombus", NULL, &ucaa, | |
364 | ucomprint, ucomsubmatch); | 364 | ucomprint, ucomsubmatch); | |
365 | 365 | |||
366 | return; | 366 | return; | |
367 | } | 367 | } | |
368 | 368 | |||
369 | void | 369 | void | |
370 | uvscom_childdet(device_t self, device_t child) | 370 | uvscom_childdet(device_t self, device_t child) | |
371 | { | 371 | { | |
372 | struct uvscom_softc *sc = device_private(self); | 372 | struct uvscom_softc *sc = device_private(self); | |
373 | 373 | |||
374 | KASSERT(sc->sc_subdev == child); | 374 | KASSERT(sc->sc_subdev == child); | |
375 | sc->sc_subdev = NULL; | 375 | sc->sc_subdev = NULL; | |
376 | } | 376 | } |