1 /* $NetBSD: uyap.c,v 1.15 2009/03/09 15:59:33 uebayasi Exp $ */
4 * Copyright (c) 2000 The NetBSD Foundation, Inc.
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Lennart Augustsson <lennart@augustsson.net>.
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
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.
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
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
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
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
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
29 * POSSIBILITY OF SUCH DAMAGE.
32 #include <sys/cdefs.h>
33 __KERNEL_RCSID(0, "$NetBSD: uyap.c,v 1.15 2009/03/09 15:59:33 uebayasi Exp $");
35 #include <sys/param.h>
36 #include <sys/systm.h>
37 #include <sys/kernel.h>
38 #include <sys/device.h>
41 #include <dev/usb/usb.h>
42 #include <dev/usb/usbdi.h>
43 #include <dev/usb/usbdevs.h>
45 #include <dev/usb/ezload.h>
47 const struct ezdata uyap_firmware
[] = {
48 #include "dev/usb/uyap_firmware.h"
50 const struct ezdata
*uyap_firmwares
[] = { uyap_firmware
, NULL
};
53 USBBASEDEVICE sc_dev
; /* base device */
56 USB_DECLARE_DRIVER(uyap
);
60 USB_MATCH_START(uyap
, uaa
);
62 /* Match the boot device. */
63 if (uaa
->vendor
== USB_VENDOR_SILICONPORTALS
&&
64 uaa
->product
== USB_PRODUCT_SILICONPORTALS_YAPPH_NF
)
65 return (UMATCH_VENDOR_PRODUCT
);
72 USB_ATTACH_START(uyap
, sc
, uaa
);
73 usbd_device_handle dev
= uaa
->device
;
82 devinfop
= usbd_devinfo_alloc(dev
, 0);
83 aprint_normal_dev(self
, "%s\n", devinfop
);
84 usbd_devinfo_free(devinfop
);
86 aprint_verbose_dev(self
, "downloading firmware\n");
88 err
= ezload_downloads_and_reset(dev
, uyap_firmwares
);
90 aprint_error_dev(self
, "download ezdata error: %s\n",
92 USB_ATTACH_ERROR_RETURN
;
95 aprint_verbose_dev(self
,
96 "firmware download complete, disconnecting.\n");
97 USB_ATTACH_SUCCESS_RETURN
;
102 /*USB_DETACH_START(uyap, sc);*/
108 uyap_activate(device_ptr_t self
, enum devact act
)