Home | History | Annotate | Line # | Download | only in usb
usb_quirks.c revision 1.34
      1  1.34  augustss /*	$NetBSD: usb_quirks.c,v 1.34 2000/12/28 11:56:23 augustss Exp $	*/
      2  1.19  augustss /*	$FreeBSD: src/sys/dev/usb/usb_quirks.c,v 1.13 1999/11/17 22:33:47 n_hibma Exp $	*/
      3   1.1  augustss 
      4   1.1  augustss /*
      5   1.1  augustss  * Copyright (c) 1998 The NetBSD Foundation, Inc.
      6   1.1  augustss  * All rights reserved.
      7   1.1  augustss  *
      8   1.2  augustss  * This code is derived from software contributed to The NetBSD Foundation
      9  1.26  augustss  * by Lennart Augustsson (lennart (at) augustsson.net) at
     10   1.2  augustss  * Carlstedt Research & Technology.
     11   1.1  augustss  *
     12   1.1  augustss  * Redistribution and use in source and binary forms, with or without
     13   1.1  augustss  * modification, are permitted provided that the following conditions
     14   1.1  augustss  * are met:
     15   1.1  augustss  * 1. Redistributions of source code must retain the above copyright
     16   1.1  augustss  *    notice, this list of conditions and the following disclaimer.
     17   1.1  augustss  * 2. Redistributions in binary form must reproduce the above copyright
     18   1.1  augustss  *    notice, this list of conditions and the following disclaimer in the
     19   1.1  augustss  *    documentation and/or other materials provided with the distribution.
     20   1.1  augustss  * 3. All advertising materials mentioning features or use of this software
     21   1.1  augustss  *    must display the following acknowledgement:
     22   1.1  augustss  *        This product includes software developed by the NetBSD
     23   1.1  augustss  *        Foundation, Inc. and its contributors.
     24   1.1  augustss  * 4. Neither the name of The NetBSD Foundation nor the names of its
     25   1.1  augustss  *    contributors may be used to endorse or promote products derived
     26   1.1  augustss  *    from this software without specific prior written permission.
     27   1.1  augustss  *
     28   1.1  augustss  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     29   1.1  augustss  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     30   1.1  augustss  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     31   1.1  augustss  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     32   1.1  augustss  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     33   1.1  augustss  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     34   1.1  augustss  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     35   1.1  augustss  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     36   1.1  augustss  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     37   1.1  augustss  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     38   1.1  augustss  * POSSIBILITY OF SUCH DAMAGE.
     39   1.1  augustss  */
     40   1.1  augustss 
     41   1.1  augustss #include <sys/param.h>
     42   1.1  augustss #include <sys/systm.h>
     43   1.8  augustss 
     44   1.1  augustss #include <dev/usb/usb.h>
     45   1.1  augustss 
     46   1.1  augustss #include <dev/usb/usbdevs.h>
     47   1.1  augustss #include <dev/usb/usb_quirks.h>
     48   1.1  augustss 
     49   1.7  augustss #ifdef USB_DEBUG
     50   1.7  augustss extern int usbdebug;
     51   1.7  augustss #endif
     52   1.7  augustss 
     53  1.24  augustss Static struct usbd_quirk_entry {
     54   1.1  augustss 	u_int16_t idVendor;
     55   1.1  augustss 	u_int16_t idProduct;
     56   1.1  augustss 	u_int16_t bcdDevice;
     57   1.1  augustss 	struct usbd_quirks quirks;
     58  1.15  augustss } usb_quirks[] = {
     59  1.14  augustss  { USB_VENDOR_KYE, USB_PRODUCT_KYE_NICHE,	    0x100, { UQ_NO_SET_PROTO}},
     60  1.29  explorer  { USB_VENDOR_INSIDEOUT, USB_PRODUCT_INSIDEOUT_EDGEPORT4,
     61   1.1  augustss    						    0x094, { UQ_SWAP_UNICODE}},
     62   1.3  augustss  { USB_VENDOR_BTC, USB_PRODUCT_BTC_BTC7932,	    0x100, { UQ_NO_STRINGS }},
     63  1.21  augustss  { USB_VENDOR_ADS, USB_PRODUCT_ADS_UBS10BT,	    0x002, { UQ_NO_STRINGS }},
     64   1.6  augustss  { USB_VENDOR_PERACOM, USB_PRODUCT_PERACOM_SERIAL1, 0x101, { UQ_NO_STRINGS }},
     65  1.23  augustss  { USB_VENDOR_WACOM, USB_PRODUCT_WACOM_CT0405U,     0x101, { UQ_NO_STRINGS }},
     66  1.14  augustss  { USB_VENDOR_DALLAS, USB_PRODUCT_DALLAS_J6502,	    0x0a2, { UQ_BAD_ADC }},
     67  1.34  augustss  { USB_VENDOR_DALLAS, USB_PRODUCT_DALLAS_J6502,	    0x0a2, { UQ_AU_NO_XU }},
     68  1.22  augustss  { USB_VENDOR_ALTEC, USB_PRODUCT_ALTEC_ADA70,	    0x103, { UQ_BAD_ADC }},
     69  1.17  augustss  { USB_VENDOR_ALTEC, USB_PRODUCT_ALTEC_ASC495,      0x000, { UQ_BAD_AUDIO }},
     70  1.18  augustss  { USB_VENDOR_QTRONIX, USB_PRODUCT_QTRONIX_980N,    0x110, { UQ_SPUR_BUT_UP }},
     71  1.28  augustss  { USB_VENDOR_ALCOR2, USB_PRODUCT_ALCOR2_KBD_HUB,   0x001, { UQ_SPUR_BUT_UP }},
     72  1.25  augustss  { USB_VENDOR_MCT, USB_PRODUCT_MCT_HUB0100,         0x102, { UQ_BUS_POWERED }},
     73  1.25  augustss  { USB_VENDOR_MCT, USB_PRODUCT_MCT_USB232,          0x102, { UQ_BUS_POWERED }},
     74  1.29  explorer  { USB_VENDOR_METRICOM, USB_PRODUCT_METRICOM_RICOCHET_GS,
     75  1.33  augustss 						    0x100, { UQ_NO_STRINGS }},
     76  1.31  augustss  { USB_VENDOR_TI, USB_PRODUCT_TI_UTUSB41,	    0x110, { UQ_POWER_CLAIM }},
     77  1.32  augustss  { USB_VENDOR_ACERP, USB_PRODUCT_ACERP_ACERSCAN_320U,
     78  1.32  augustss 						    0x000, { UQ_NO_STRINGS }},
     79  1.34  augustss  { USB_VENDOR_TELEX, USB_PRODUCT_TELEX_MIC1,	    0x009, { UQ_AU_NO_FRAC }},
     80  1.34  augustss  { USB_VENDOR_SILICONPORTALS, USB_PRODUCT_SILICONPORTALS_YAPPHONE,
     81  1.34  augustss    						    0x100, { UQ_AU_INP_ASYNC }},
     82   1.1  augustss  { 0, 0, 0, { 0 } }
     83   1.1  augustss };
     84   1.1  augustss 
     85   1.1  augustss struct usbd_quirks usbd_no_quirk = { 0 };
     86   1.1  augustss 
     87   1.1  augustss struct usbd_quirks *
     88  1.27  augustss usbd_find_quirk(usb_device_descriptor_t *d)
     89   1.1  augustss {
     90   1.1  augustss 	struct usbd_quirk_entry *t;
     91   1.1  augustss 
     92  1.15  augustss 	for (t = usb_quirks; t->idVendor != 0; t++) {
     93   1.1  augustss 		if (t->idVendor  == UGETW(d->idVendor) &&
     94   1.1  augustss 		    t->idProduct == UGETW(d->idProduct) &&
     95   1.1  augustss 		    t->bcdDevice == UGETW(d->bcdDevice))
     96   1.1  augustss 			break;
     97   1.1  augustss 	}
     98   1.1  augustss #ifdef USB_DEBUG
     99   1.1  augustss 	if (usbdebug && t->quirks.uq_flags)
    100  1.12  augustss 		logprintf("usbd_find_quirk 0x%04x/0x%04x/%x: %d\n",
    101  1.12  augustss 			  UGETW(d->idVendor), UGETW(d->idProduct),
    102  1.12  augustss 			  UGETW(d->bcdDevice), t->quirks.uq_flags);
    103   1.1  augustss #endif
    104   1.1  augustss 	return (&t->quirks);
    105   1.1  augustss }
    106