The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/dev/usb/usb_quirks.c

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*      $NetBSD: usb_quirks.c,v 1.50 2004/06/23 02:30:52 mycroft Exp $  */
    2 
    3 /*-
    4  * Copyright (c) 1998 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) at
    9  * Carlstedt Research & Technology.
   10  *
   11  * Redistribution and use in source and binary forms, with or without
   12  * modification, are permitted provided that the following conditions
   13  * are met:
   14  * 1. Redistributions of source code must retain the above copyright
   15  *    notice, this list of conditions and the following disclaimer.
   16  * 2. Redistributions in binary form must reproduce the above copyright
   17  *    notice, this list of conditions and the following disclaimer in the
   18  *    documentation and/or other materials provided with the distribution.
   19  * 3. All advertising materials mentioning features or use of this software
   20  *    must display the following acknowledgement:
   21  *        This product includes software developed by the NetBSD
   22  *        Foundation, Inc. and its contributors.
   23  * 4. Neither the name of The NetBSD Foundation nor the names of its
   24  *    contributors may be used to endorse or promote products derived
   25  *    from this software without specific prior written permission.
   26  *
   27  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
   28  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
   29  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
   30  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
   31  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
   32  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
   33  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
   34  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
   35  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   36  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   37  * POSSIBILITY OF SUCH DAMAGE.
   38  */
   39 
   40 #include <sys/cdefs.h>
   41 __FBSDID("$FreeBSD: releng/7.3/sys/dev/usb/usb_quirks.c 191830 2009-05-05 16:37:33Z remko $");
   42 
   43 #include <sys/param.h>
   44 #include <sys/systm.h>
   45 
   46 #include <dev/usb/usb.h>
   47 
   48 #include "usbdevs.h"
   49 #include <dev/usb/usb_quirks.h>
   50 
   51 #ifdef USB_DEBUG
   52 extern int usbdebug;
   53 #endif
   54 
   55 #define ANY 0xffff
   56 
   57 static const struct usbd_quirk_entry {
   58         u_int16_t idVendor;
   59         u_int16_t idProduct;
   60         u_int16_t bcdDevice;
   61         struct usbd_quirks quirks;
   62 } usb_quirks[] = {
   63  { USB_VENDOR_INSIDEOUT, USB_PRODUCT_INSIDEOUT_EDGEPORT4,
   64                                                     0x094, { UQ_SWAP_UNICODE}},
   65  { USB_VENDOR_DALLAS, USB_PRODUCT_DALLAS_J6502,     0x0a2, { UQ_BAD_ADC }},
   66  { USB_VENDOR_DALLAS, USB_PRODUCT_DALLAS_J6502,     0x0a2, { UQ_AU_NO_XU }},
   67  { USB_VENDOR_ALTEC, USB_PRODUCT_ALTEC_ADA70,       0x103, { UQ_BAD_ADC }},
   68  { USB_VENDOR_ALTEC, USB_PRODUCT_ALTEC_ASC495,      0x000, { UQ_BAD_AUDIO }},
   69  { USB_VENDOR_QTRONIX, USB_PRODUCT_QTRONIX_980N,    0x110, { UQ_SPUR_BUT_UP }},
   70  { USB_VENDOR_ALCOR2, USB_PRODUCT_ALCOR2_KBD_HUB,   0x001, { UQ_SPUR_BUT_UP }},
   71  { USB_VENDOR_MCT, USB_PRODUCT_MCT_HUB0100,         0x102, { UQ_BUS_POWERED }},
   72  { USB_VENDOR_MCT, USB_PRODUCT_MCT_USB232,          0x102, { UQ_BUS_POWERED }},
   73  { USB_VENDOR_TI, USB_PRODUCT_TI_UTUSB41,           0x110, { UQ_POWER_CLAIM }},
   74  { USB_VENDOR_TELEX, USB_PRODUCT_TELEX_MIC1,        0x009, { UQ_AU_NO_FRAC }},
   75  { USB_VENDOR_SILICONPORTALS, USB_PRODUCT_SILICONPORTALS_YAPPHONE,
   76                                                     0x100, { UQ_AU_INP_ASYNC }},
   77  { USB_VENDOR_LOGITECH, USB_PRODUCT_LOGITECH_UN53B, ANY, { UQ_NO_STRINGS }},
   78  /* XXX These should have a revision number, but I don't know what they are. */
   79  { USB_VENDOR_HP, USB_PRODUCT_HP_895C,              ANY,   { UQ_BROKEN_BIDIR }},
   80  { USB_VENDOR_HP, USB_PRODUCT_HP_880C,              ANY,   { UQ_BROKEN_BIDIR }},
   81  { USB_VENDOR_HP, USB_PRODUCT_HP_815C,              ANY,   { UQ_BROKEN_BIDIR }},
   82  { USB_VENDOR_HP, USB_PRODUCT_HP_810C,              ANY,   { UQ_BROKEN_BIDIR }},
   83  { USB_VENDOR_HP, USB_PRODUCT_HP_830C,              ANY,   { UQ_BROKEN_BIDIR }},
   84  { USB_VENDOR_HP, USB_PRODUCT_HP_1220C,             ANY,   { UQ_BROKEN_BIDIR }},
   85  { USB_VENDOR_XEROX, USB_PRODUCT_XEROX_WCM15,       ANY,   { UQ_BROKEN_BIDIR }},
   86  /* MS keyboards do weird things */
   87  { USB_VENDOR_MICROSOFT, USB_PRODUCT_MICROSOFT_WLNOTEBOOK,
   88    ANY, { UQ_MS_BAD_CLASS | UQ_MS_LEADING_BYTE }},
   89  { USB_VENDOR_MICROSOFT, USB_PRODUCT_MICROSOFT_WLNOTEBOOK2,
   90    ANY, { UQ_MS_BAD_CLASS | UQ_MS_LEADING_BYTE }},
   91  { USB_VENDOR_MICROSOFT, USB_PRODUCT_MICROSOFT_WLINTELLIMOUSE,
   92    ANY, { UQ_MS_LEADING_BYTE }},
   93  { USB_VENDOR_SONY, USB_PRODUCT_SONY_RF_RECEIVER,
   94    ANY,{ UQ_MS_BAD_CLASS }},
   95 
   96  /* Devices which should be ignored by uhid */
   97  { USB_VENDOR_APC, USB_PRODUCT_APC_UPS,
   98         ANY, { UQ_HID_IGNORE }},
   99  { USB_VENDOR_BELKIN, USB_PRODUCT_BELKIN_F6C550AVR,
  100         ANY, { UQ_HID_IGNORE }},
  101  { USB_VENDOR_CYBERPOWER, USB_PRODUCT_CYBERPOWER_1500CAVRLCD,
  102         ANY, { UQ_HID_IGNORE }},
  103  { USB_VENDOR_DELORME, USB_PRODUCT_DELORME_EARTHMATE,
  104         ANY, { UQ_HID_IGNORE }},
  105  { USB_VENDOR_ITUNERNET, USB_PRODUCT_ITUNERNET_USBLCD2X20,
  106         ANY, { UQ_HID_IGNORE }},
  107  { USB_VENDOR_MGE, USB_PRODUCT_MGE_UPS1,
  108         ANY, { UQ_HID_IGNORE }},
  109  { USB_VENDOR_MGE, USB_PRODUCT_MGE_UPS2,
  110         ANY, { UQ_HID_IGNORE }},
  111  { USB_VENDOR_APPLE, USB_PRODUCT_APPLE_IPHONE,
  112         ANY, { UQ_HID_IGNORE }},
  113  { USB_VENDOR_APPLE, USB_PRODUCT_APPLE_IPHONE_3G,
  114         ANY, { UQ_HID_IGNORE }},
  115 
  116  /* Devices which should be ignored by both ukbd and uhid */
  117  { USB_VENDOR_CYPRESS, USB_PRODUCT_CYPRESS_WISPY1A,
  118         ANY, { UQ_KBD_IGNORE }},
  119  { USB_VENDOR_METAGEEK, USB_PRODUCT_METAGEEK_WISPY1B,
  120         ANY, { UQ_KBD_IGNORE }},
  121  { USB_VENDOR_METAGEEK, USB_PRODUCT_METAGEEK_WISPY24X,
  122         ANY, { UQ_KBD_IGNORE }},
  123  { 0, 0, 0, { 0 } }
  124 };
  125 
  126 const struct usbd_quirks usbd_no_quirk = { 0 };
  127 
  128 const struct usbd_quirks *
  129 usbd_find_quirk(usb_device_descriptor_t *d)
  130 {
  131         const struct usbd_quirk_entry *t;
  132         u_int16_t vendor = UGETW(d->idVendor);
  133         u_int16_t product = UGETW(d->idProduct);
  134         u_int16_t revision = UGETW(d->bcdDevice);
  135 
  136         for (t = usb_quirks; t->idVendor != 0; t++) {
  137                 if (t->idVendor  == vendor &&
  138                     t->idProduct == product &&
  139                     (t->bcdDevice == ANY || t->bcdDevice == revision))
  140                         break;
  141         }
  142 #ifdef USB_DEBUG
  143         if (usbdebug && t->quirks.uq_flags)
  144                 printf("usbd_find_quirk 0x%04x/0x%04x/%x: %d\n",
  145                           UGETW(d->idVendor), UGETW(d->idProduct),
  146                           UGETW(d->bcdDevice), t->quirks.uq_flags);
  147 #endif
  148         return (&t->quirks);
  149 }

Cache object: 158a7112d3c17e4edd33385aa6a227df


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.