[BACK]Return to uyap.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / sys / dev / usb

Annotation of src/sys/dev/usb/uyap.c, Revision 1.8

1.8     ! augustss    1: /*     $NetBSD: uyap.c,v 1.7 2004/04/23 17:25:27 itojun Exp $  */
1.1       augustss    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:  */
1.5       lukem      38:
                     39: #include <sys/cdefs.h>
1.8     ! augustss   40: __KERNEL_RCSID(0, "$NetBSD: uyap.c,v 1.7 2004/04/23 17:25:27 itojun Exp $");
1.1       augustss   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:
1.3       jdolecek   55: const struct ezdata uyap_firmware[] = {
1.1       augustss   56: #include "dev/usb/uyap_firmware.h"
                     57: };
1.3       jdolecek   58: const struct ezdata *uyap_firmwares[] = { uyap_firmware, NULL };
1.1       augustss   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);
1.6       augustss   69:
1.1       augustss   70:        if (uaa->iface != NULL)
                     71:                return (UMATCH_NONE);
                     72:
                     73:        /* Match the boot device. */
1.4       augustss   74:        if (uaa->vendor == USB_VENDOR_SILICONPORTALS &&
                     75:            uaa->product == USB_PRODUCT_SILICONPORTALS_YAPPH_NF)
1.1       augustss   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;
1.8     ! augustss   86:        char *devinfop;
1.6       augustss   87:
1.8     ! augustss   88:        devinfop = usbd_devinfo_alloc(dev, 0);
1.1       augustss   89:        USB_ATTACH_SETUP;
1.8     ! augustss   90:        printf("%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop);
        !            91:        usbd_devinfo_free(devinfop);
        !            92:
1.2       augustss   93:        printf("%s: downloading firmware\n", USBDEVNAME(sc->sc_dev));
1.1       augustss   94:
                     95:        err = ezload_downloads_and_reset(dev, uyap_firmwares);
                     96:        if (err) {
                     97:                printf("%s: download ezdata error: %s\n",
                     98:                       USBDEVNAME(sc->sc_dev), usbd_errstr(err));
                     99:                USB_ATTACH_ERROR_RETURN;
                    100:        }
1.6       augustss  101:
1.1       augustss  102:        printf("%s: firmware download complete, disconnecting.\n",
                    103:               USBDEVNAME(sc->sc_dev));
                    104:        USB_ATTACH_SUCCESS_RETURN;
                    105: }
                    106:
                    107: USB_DETACH(uyap)
                    108: {
                    109:        /*USB_DETACH_START(uyap, sc);*/
                    110:
                    111:        return (0);
                    112: }
                    113:
                    114: int
                    115: uyap_activate(device_ptr_t self, enum devact act)
                    116: {
                    117:        return 0;
                    118: }

CVSweb <webmaster@jp.NetBSD.org>