FreeBSD/Linux Kernel Cross Reference
sys/dev/usb/uyap.c
1 /* $NetBSD: uyap.c,v 1.6 2002/07/11 21:14:37 augustss Exp $ */
2
3 /*
4 * Copyright (c) 2000 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Lennart Augustsson <lennart@augustsson.net>.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. All advertising materials mentioning features or use of this software
19 * must display the following acknowledgement:
20 * This product includes software developed by the NetBSD
21 * Foundation, Inc. and its contributors.
22 * 4. Neither the name of The NetBSD Foundation nor the names of its
23 * contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 * POSSIBILITY OF SUCH DAMAGE.
37 */
38
39 #include <sys/cdefs.h>
40 __KERNEL_RCSID(0, "$NetBSD: uyap.c,v 1.6 2002/07/11 21:14:37 augustss Exp $");
41
42 #include <sys/param.h>
43 #include <sys/systm.h>
44 #include <sys/kernel.h>
45 #include <sys/device.h>
46 #include <sys/conf.h>
47 #include <sys/tty.h>
48
49 #include <dev/usb/usb.h>
50 #include <dev/usb/usbdi.h>
51 #include <dev/usb/usbdevs.h>
52
53 #include <dev/usb/ezload.h>
54
55 const struct ezdata uyap_firmware[] = {
56 #include "dev/usb/uyap_firmware.h"
57 };
58 const struct ezdata *uyap_firmwares[] = { uyap_firmware, NULL };
59
60 struct uyap_softc {
61 USBBASEDEVICE sc_dev; /* base device */
62 };
63
64 USB_DECLARE_DRIVER(uyap);
65
66 USB_MATCH(uyap)
67 {
68 USB_MATCH_START(uyap, uaa);
69
70 if (uaa->iface != NULL)
71 return (UMATCH_NONE);
72
73 /* Match the boot device. */
74 if (uaa->vendor == USB_VENDOR_SILICONPORTALS &&
75 uaa->product == USB_PRODUCT_SILICONPORTALS_YAPPH_NF)
76 return (UMATCH_VENDOR_PRODUCT);
77
78 return (UMATCH_NONE);
79 }
80
81 USB_ATTACH(uyap)
82 {
83 USB_ATTACH_START(uyap, sc, uaa);
84 usbd_device_handle dev = uaa->device;
85 usbd_status err;
86 char devinfo[1024];
87
88 usbd_devinfo(dev, 0, devinfo);
89 USB_ATTACH_SETUP;
90 printf("%s: %s\n", USBDEVNAME(sc->sc_dev), devinfo);
91 printf("%s: downloading firmware\n", USBDEVNAME(sc->sc_dev));
92
93 err = ezload_downloads_and_reset(dev, uyap_firmwares);
94 if (err) {
95 printf("%s: download ezdata error: %s\n",
96 USBDEVNAME(sc->sc_dev), usbd_errstr(err));
97 USB_ATTACH_ERROR_RETURN;
98 }
99
100 printf("%s: firmware download complete, disconnecting.\n",
101 USBDEVNAME(sc->sc_dev));
102 USB_ATTACH_SUCCESS_RETURN;
103 }
104
105 USB_DETACH(uyap)
106 {
107 /*USB_DETACH_START(uyap, sc);*/
108
109 return (0);
110 }
111
112 int
113 uyap_activate(device_ptr_t self, enum devact act)
114 {
115 return 0;
116 }
Cache object: 62d90de2326c0bb3012f24065f53ffd8
|