LCOV - code coverage report
Current view: top level - dev/usb - uftdi.c (source / functions) Hit Total Coverage
Test: 6.4 Lines: 0 278 0.0 %
Date: 2018-10-19 03:25:38 Functions: 0 12 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*      $OpenBSD: uftdi.c,v 1.75 2016/12/12 04:35:04 jsg Exp $  */
       2             : /*      $NetBSD: uftdi.c,v 1.14 2003/02/23 04:20:07 simonb Exp $        */
       3             : 
       4             : /*
       5             :  * Copyright (c) 2000 The NetBSD Foundation, Inc.
       6             :  * All rights reserved.
       7             :  *
       8             :  * This code is derived from software contributed to The NetBSD Foundation
       9             :  * by Lennart Augustsson (lennart@augustsson.net).
      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             :  *
      20             :  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
      21             :  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
      22             :  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
      23             :  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
      24             :  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
      25             :  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
      26             :  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
      27             :  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
      28             :  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
      29             :  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
      30             :  * POSSIBILITY OF SUCH DAMAGE.
      31             :  */
      32             : 
      33             : /*
      34             :  * FTDI FT8U100AX serial adapter driver
      35             :  */
      36             : 
      37             : /*
      38             :  * XXX This driver will not support multiple serial ports.
      39             :  * XXX The ucom layer needs to be extended first.
      40             :  */
      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             : 
      51             : #include <dev/usb/usbdi.h>
      52             : #include <dev/usb/usbdi_util.h>
      53             : #include <dev/usb/usbdevs.h>
      54             : 
      55             : #include <dev/usb/ucomvar.h>
      56             : 
      57             : #include <dev/usb/uftdireg.h>
      58             : 
      59             : #ifdef UFTDI_DEBUG
      60             : #define DPRINTF(x)      do { if (uftdidebug) printf x; } while (0)
      61             : #define DPRINTFN(n,x)   do { if (uftdidebug>(n)) printf x; } while (0)
      62             : int uftdidebug = 0;
      63             : #else
      64             : #define DPRINTF(x)
      65             : #define DPRINTFN(n,x)
      66             : #endif
      67             : 
      68             : /*
      69             :  * These are the maximum number of bytes transferred per frame.
      70             :  * The output buffer size cannot be increased due to the size encoding.
      71             :  */
      72             : #define UFTDIIBUFSIZE 64
      73             : #define UFTDIOBUFSIZE 64
      74             : 
      75             : struct uftdi_softc {
      76             :         struct device            sc_dev;                /* base device */
      77             :         struct usbd_device      *sc_udev;       /* device */
      78             :         struct usbd_interface   *sc_iface;      /* interface */
      79             : 
      80             :         enum uftdi_type          sc_type;
      81             :         u_int                    sc_hdrlen;
      82             : 
      83             :         u_char                   sc_msr;
      84             :         u_char                   sc_lsr;
      85             : 
      86             :         struct device           *sc_subdev;
      87             : 
      88             :         u_int                    last_lcr;
      89             : };
      90             : 
      91             : void    uftdi_get_status(void *, int portno, u_char *lsr, u_char *msr);
      92             : void    uftdi_set(void *, int, int, int);
      93             : int     uftdi_param(void *, int, struct termios *);
      94             : int     uftdi_open(void *sc, int portno);
      95             : void    uftdi_read(void *sc, int portno, u_char **ptr,
      96             :                            u_int32_t *count);
      97             : void    uftdi_write(void *sc, int portno, u_char *to, u_char *from,
      98             :                             u_int32_t *count);
      99             : void    uftdi_break(void *sc, int portno, int onoff);
     100             : int     uftdi_8u232am_getrate(speed_t speed, int *rate);
     101             : int     uftdi_2232h_getrate(speed_t speed, int *rate);
     102             : 
     103             : struct ucom_methods uftdi_methods = {
     104             :         uftdi_get_status,
     105             :         uftdi_set,
     106             :         uftdi_param,
     107             :         NULL,
     108             :         uftdi_open,
     109             :         NULL,
     110             :         uftdi_read,
     111             :         uftdi_write,
     112             : };
     113             : 
     114             : int uftdi_match(struct device *, void *, void *);
     115             : void uftdi_attach(struct device *, struct device *, void *);
     116             : int uftdi_detach(struct device *, int);
     117             : 
     118             : struct cfdriver uftdi_cd = {
     119             :         NULL, "uftdi", DV_DULL
     120             : };
     121             : 
     122             : const struct cfattach uftdi_ca = {
     123             :         sizeof(struct uftdi_softc), uftdi_match, uftdi_attach, uftdi_detach
     124             : };
     125             : 
     126             : static const struct usb_devno uftdi_devs[] = {
     127             :         { USB_VENDOR_ALTI2, USB_PRODUCT_ALTI2_NEPTUNE3 },
     128             :         { USB_VENDOR_ANALOGDEVICES, USB_PRODUCT_ANALOGDEVICES_GNICE },
     129             :         { USB_VENDOR_ANALOGDEVICES, USB_PRODUCT_ANALOGDEVICES_GNICEPLUS },
     130             :         { USB_VENDOR_ATMEL, USB_PRODUCT_ATMEL_STK541 },
     131             :         { USB_VENDOR_BAYER, USB_PRODUCT_BAYER_CONTOUR },
     132             :         { USB_VENDOR_BBELECTR, USB_PRODUCT_BBELECTR_232USB9M },
     133             :         { USB_VENDOR_BBELECTR, USB_PRODUCT_BBELECTR_485USB9F2W },
     134             :         { USB_VENDOR_BBELECTR, USB_PRODUCT_BBELECTR_485USB9F4W },
     135             :         { USB_VENDOR_BBELECTR, USB_PRODUCT_BBELECTR_485USBTB_2W },
     136             :         { USB_VENDOR_BBELECTR, USB_PRODUCT_BBELECTR_485USBTB_4W },
     137             :         { USB_VENDOR_BBELECTR, USB_PRODUCT_BBELECTR_TTL3USB9M },
     138             :         { USB_VENDOR_BBELECTR, USB_PRODUCT_BBELECTR_TTL5USB9M },
     139             :         { USB_VENDOR_BBELECTR, USB_PRODUCT_BBELECTR_USO9ML2 },
     140             :         { USB_VENDOR_BBELECTR, USB_PRODUCT_BBELECTR_USO9ML2DR },
     141             :         { USB_VENDOR_BBELECTR, USB_PRODUCT_BBELECTR_USO9ML2DR2 },
     142             :         { USB_VENDOR_BBELECTR, USB_PRODUCT_BBELECTR_USOPTL4 },
     143             :         { USB_VENDOR_BBELECTR, USB_PRODUCT_BBELECTR_USOPTL4DR },
     144             :         { USB_VENDOR_BBELECTR, USB_PRODUCT_BBELECTR_USOPTL4DR2 },
     145             :         { USB_VENDOR_BBELECTR, USB_PRODUCT_BBELECTR_USOTL4 },
     146             :         { USB_VENDOR_BBELECTR, USB_PRODUCT_BBELECTR_USPTL4 },
     147             :         { USB_VENDOR_BBELECTR, USB_PRODUCT_BBELECTR_USTL4 },
     148             :         { USB_VENDOR_BBELECTR, USB_PRODUCT_BBELECTR_ZZ_PROG1 },
     149             :         { USB_VENDOR_DRESDENELEC, USB_PRODUCT_DRESDENELEC_STB },
     150             :         { USB_VENDOR_DRESDENELEC, USB_PRODUCT_DRESDENELEC_WHT },
     151             :         { USB_VENDOR_ELEKTOR, USB_PRODUCT_ELEKTOR_FT323R },
     152             :         { USB_VENDOR_EVOLUTION, USB_PRODUCT_EVOLUTION_ER1 },
     153             :         { USB_VENDOR_EVOLUTION, USB_PRODUCT_EVOLUTION_RCM4_1 },
     154             :         { USB_VENDOR_EVOLUTION, USB_PRODUCT_EVOLUTION_RCM4_2 },
     155             :         { USB_VENDOR_FALCOM, USB_PRODUCT_FALCOM_SAMBA },
     156             :         { USB_VENDOR_FALCOM, USB_PRODUCT_FALCOM_TWIST },
     157             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_ACCESSO },
     158             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_ACG_HFDUAL },
     159             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_ACTROBOTS },
     160             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_ACTZWAVE },
     161             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_AMC232 },
     162             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_ARTEMIS },
     163             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_ASK_RDR4X7_1 },
     164             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_ASK_RDR4X7_2 },
     165             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_ASK_RDR4X7_3 },
     166             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_ASK_RDR4X7_4 },
     167             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_ASK_RDR4X7_5 },
     168             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_ASK_RDR4X7_6 },
     169             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_ASK_RDR4X7_7 },
     170             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_ASK_RDR4X7_8 },
     171             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_ATK16 },
     172             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_ATK16C },
     173             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_ATK16HR },
     174             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_ATK16HRC },
     175             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_ATK16IC },
     176             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_BCS_SE923 },
     177             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_CANDAPTER },
     178             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_CANUSB },
     179             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_CCS_ICDU20 },
     180             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_CCS_ICDU40 },
     181             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_CCS_ICDU64 },
     182             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_CCS_LOAD_N_GO },
     183             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_CCS_MACHX },
     184             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_CCS_PRIME8 },
     185             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_CHAMELEON },
     186             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_COASTAL_TNCX },
     187             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_DGQG },
     188             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_DMX4ALL },
     189             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_DUSB },
     190             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_ECLO_1WIRE },
     191             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_ECO_PRO },
     192             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_EISCOU },
     193             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_ELV_ALC8500 },
     194             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_ELV_CLI7000 },
     195             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_ELV_CSI8 },
     196             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_ELV_EM1000DL },
     197             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_ELV_EM1010PC },
     198             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_ELV_FEM },
     199             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_ELV_FHZ1000PC },
     200             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_ELV_FHZ1300PC },
     201             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_ELV_FM3RX },
     202             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_ELV_FS20SIG },
     203             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_ELV_HS485 },
     204             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_ELV_KL100 },
     205             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_ELV_MSM1 },
     206             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_ELV_PCD200 },
     207             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_ELV_PCK100 },
     208             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_ELV_PPS7330 },
     209             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_ELV_RFP500 },
     210             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_ELV_T1100 },
     211             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_ELV_TFD128 },
     212             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_ELV_TFM100 },
     213             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_ELV_TWS550 },
     214             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_ELV_UAD7 },
     215             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_ELV_UAD8 },
     216             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_ELV_UDF77 },
     217             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_ELV_UIO88 },
     218             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_ELV_ULA200 },
     219             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_ELV_UM100 },
     220             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_ELV_UMS100 },
     221             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_ELV_UO100 },
     222             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_ELV_UR100 },
     223             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_ELV_USI2 },
     224             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_ELV_USR },
     225             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_ELV_UTP8 },
     226             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_ELV_WS300PC },
     227             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_ELV_WS444PC },
     228             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_ELV_WS500 },
     229             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_ELV_WS550 },
     230             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_ELV_WS777 },
     231             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_ELV_WS888 },
     232             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_FISCO },
     233             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_FT232RL },
     234             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_FT232_1 },
     235             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_FT232_3 },
     236             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_FT232_4 },
     237             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_FT232_5 },
     238             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_FT232_6 },
     239             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_FT4232H },
     240             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_FTX },
     241             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_GAMMASCOUT },
     242             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_GUDE_1 },
     243             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_GUDE_2 },
     244             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_GUDE_3 },
     245             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_GUDE_4 },
     246             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_GUDE_5 },
     247             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_GUDE_6 },
     248             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_GUDE_7 },
     249             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_GUDE_8 },
     250             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_GUDE_9 },
     251             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_GUDE_A },
     252             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_GUDE_B },
     253             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_HO820 },
     254             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_HO870 },
     255             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_IBS_1 },
     256             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_IBS_APP70 },
     257             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_IBS_PCMCIA },
     258             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_IBS_PEDO },
     259             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_IBS_PICPRO },
     260             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_IBS_PK1 },
     261             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_IBS_RS232MON },
     262             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_IBS_US485 },
     263             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_IPLUS },
     264             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_IPLUS2 },
     265             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_JTAGCABLEII },
     266             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_LCD_CFA_547 },
     267             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_LCD_CFA_631 },
     268             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_LCD_CFA_632 },
     269             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_LCD_CFA_633 },
     270             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_LCD_CFA_634 },
     271             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_LCD_CFA_635 },
     272             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_LCD_CFA_640 },
     273             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_LCD_CFA_642 },
     274             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_LCD_LK202_24 },
     275             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_LCD_LK204_24 },
     276             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_LCD_MTXO },
     277             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_LCD_MX200 },
     278             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_LINX_1 },
     279             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_LINX_2 },
     280             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_LINX_3 },
     281             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_LINX_MASTER2 },
     282             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_LM3S_DEVEL },
     283             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_LM3S_EVAL },
     284             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_LOCOBUFFER },
     285             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_MATRIX_2 },
     286             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_MATRIX_3 },
     287             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_MHAM_DB9 },
     288             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_MHAM_IC },
     289             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_MHAM_KW },
     290             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_MHAM_RS232 },
     291             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_MHAM_Y6 },
     292             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_MHAM_Y8 },
     293             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_MHAM_Y9 },
     294             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_MHAM_YS },
     295             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_MJS_SIRIUS_PC_1 },
     296             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_MJS_SIRIUS_PC_2 },
     297             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_NXTCAM },
     298             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_OCEANIC },
     299             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_OOCDLINK },
     300             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_OPENDCC },
     301             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_OPENDCC_GATEWAY },
     302             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_OPENDCC_SNIFFER },
     303             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_OPENDCC_THROTTLE },
     304             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_OPENPORT_13M },
     305             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_OPENPORT_13S },
     306             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_OPENPORT_13U },
     307             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_OPENRD },
     308             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_PCDJ_DAC2 },
     309             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_PIEGROUP_IR },
     310             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_PROTEGO_1 },
     311             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_PROTEGO_3 },
     312             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_PROTEGO_4 },
     313             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_PROTEGO_R200 },
     314             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_PYRAMID },
     315             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_R2000KU_RNG },
     316             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_RELAIS },
     317             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_REU_TINY },
     318             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_SCS_0 },
     319             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_SCS_1 },
     320             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_SCS_2 },
     321             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_SCS_3 },
     322             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_SCS_4 },
     323             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_SCS_5 },
     324             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_SCS_6 },
     325             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_SCS_7 },
     326             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_SEMC_DSS20 },
     327             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_SERIAL_2232C },
     328             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_SERIAL_2232L },
     329             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_SERIAL_232BM },
     330             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_SERIAL_8U100AX },
     331             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_SERIAL_8U232AM },
     332             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_SERIAL_8U232AM4 },
     333             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_SPROG_II },
     334             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_SUUNTO },
     335             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_TERATRONIK_D2XX },
     336             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_TERATRONIK_VCP },
     337             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_THORLABS },
     338             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_TIRA1 },
     339             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_TNCX },
     340             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_TURTELIZER_JTAG },
     341             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_UNICOM },
     342             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_UOPTBR },
     343             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_USBSERIAL },
     344             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_USBUIRT },
     345             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_USBX_707 },
     346             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_VNHC },
     347             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_WESTREX_777 },
     348             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_WESTREX_8900F },
     349             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_XSENS_1 },
     350             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_XSENS_2 },
     351             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_XSENS_3 },
     352             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_XSENS_4 },
     353             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_XSENS_5 },
     354             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_XSENS_6 },
     355             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_XSENS_7 },
     356             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_XSENS_8 },
     357             :         { USB_VENDOR_FTDI, USB_PRODUCT_FTDI_YEI_SC31 },
     358             :         { USB_VENDOR_GNOTOMETRICS, USB_PRODUCT_GNOTOMETRICS_AURICAL },
     359             :         { USB_VENDOR_ICOM, USB_PRODUCT_ICOM_ID1 },
     360             :         { USB_VENDOR_ICOM, USB_PRODUCT_ICOM_RP2000VR },
     361             :         { USB_VENDOR_ICOM, USB_PRODUCT_ICOM_RP2000VT },
     362             :         { USB_VENDOR_ICOM, USB_PRODUCT_ICOM_RP2C1 },
     363             :         { USB_VENDOR_ICOM, USB_PRODUCT_ICOM_RP2C2 },
     364             :         { USB_VENDOR_ICOM, USB_PRODUCT_ICOM_RP2D },
     365             :         { USB_VENDOR_ICOM, USB_PRODUCT_ICOM_RP2VR },
     366             :         { USB_VENDOR_ICOM, USB_PRODUCT_ICOM_RP2VT },
     367             :         { USB_VENDOR_ICOM, USB_PRODUCT_ICOM_RP4000VR },
     368             :         { USB_VENDOR_ICOM, USB_PRODUCT_ICOM_RP4000VT },
     369             :         { USB_VENDOR_IDTECH, USB_PRODUCT_IDTECH_SERIAL },
     370             :         { USB_VENDOR_INTERBIO, USB_PRODUCT_INTERBIO_IOBOARD },
     371             :         { USB_VENDOR_INTERBIO, USB_PRODUCT_INTERBIO_MINIIOBOARD },
     372             :         { USB_VENDOR_INTERBIO, USB_PRODUCT_INTERBIO_MINIIOBOARD2 },
     373             :         { USB_VENDOR_INTREPIDCS, USB_PRODUCT_INTREPIDCS_NEOVI },
     374             :         { USB_VENDOR_INTREPIDCS, USB_PRODUCT_INTREPIDCS_VALUECAN },
     375             :         { USB_VENDOR_IODATA, USB_PRODUCT_IODATA_FT232R },
     376             :         { USB_VENDOR_JETI, USB_PRODUCT_JETI_SPC1201 },
     377             :         { USB_VENDOR_KOBIL, USB_PRODUCT_KOBIL_B1 },
     378             :         { USB_VENDOR_KOBIL, USB_PRODUCT_KOBIL_KAAN },
     379             :         { USB_VENDOR_LARSENBRUSGAARD, USB_PRODUCT_LARSENBRUSGAARD_ALTITRACK },
     380             :         { USB_VENDOR_MARVELL, USB_PRODUCT_MARVELL_SHEEVAPLUG },
     381             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0100 },
     382             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0101 },
     383             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0102 },
     384             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0103 },
     385             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0104 },
     386             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0105 },
     387             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0106 },
     388             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0107 },
     389             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0108 },
     390             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0109 },
     391             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_010A },
     392             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_010B },
     393             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_010C },
     394             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_010D },
     395             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_010E },
     396             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_010F },
     397             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0110 },
     398             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0111 },
     399             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0112 },
     400             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0113 },
     401             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0114 },
     402             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0115 },
     403             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0116 },
     404             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0117 },
     405             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0118 },
     406             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0119 },
     407             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_011A },
     408             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_011B },
     409             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_011C },
     410             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_011D },
     411             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_011E },
     412             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_011F },
     413             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0120 },
     414             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0121 },
     415             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0122 },
     416             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0123 },
     417             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0124 },
     418             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0125 },
     419             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0126 },
     420             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0127 },
     421             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0128 },
     422             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0129 },
     423             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_012A },
     424             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_012B },
     425             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_012C },
     426             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_012D },
     427             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_012E },
     428             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_012F },
     429             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0130 },
     430             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0131 },
     431             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0132 },
     432             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0133 },
     433             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0134 },
     434             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0135 },
     435             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0136 },
     436             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0137 },
     437             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0138 },
     438             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0139 },
     439             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_013A },
     440             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_013B },
     441             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_013C },
     442             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_013D },
     443             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_013E },
     444             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_013F },
     445             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0140 },
     446             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0141 },
     447             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0142 },
     448             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0143 },
     449             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0144 },
     450             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0145 },
     451             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0146 },
     452             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0147 },
     453             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0148 },
     454             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0149 },
     455             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_014A },
     456             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_014B },
     457             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_014C },
     458             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_014D },
     459             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_014E },
     460             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_014F },
     461             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0150 },
     462             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0151 },
     463             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0152 },
     464             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0153 },
     465             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0154 },
     466             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0155 },
     467             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0156 },
     468             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0157 },
     469             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0158 },
     470             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0159 },
     471             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_015A },
     472             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_015B },
     473             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_015C },
     474             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_015D },
     475             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_015E },
     476             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_015F },
     477             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0160 },
     478             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0161 },
     479             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0162 },
     480             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0163 },
     481             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0164 },
     482             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0165 },
     483             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0166 },
     484             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0167 },
     485             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0168 },
     486             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0169 },
     487             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_016A },
     488             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_016B },
     489             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_016C },
     490             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_016D },
     491             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_016E },
     492             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_016F },
     493             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0170 },
     494             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0171 },
     495             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0172 },
     496             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0173 },
     497             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0174 },
     498             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0175 },
     499             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0176 },
     500             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0177 },
     501             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0178 },
     502             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0179 },
     503             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_017A },
     504             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_017B },
     505             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_017C },
     506             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_017D },
     507             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_017E },
     508             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_017F },
     509             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0180 },
     510             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0181 },
     511             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0182 },
     512             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0183 },
     513             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0184 },
     514             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0185 },
     515             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0186 },
     516             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0187 },
     517             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0188 },
     518             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0189 },
     519             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_018A },
     520             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_018B },
     521             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_018C },
     522             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_018D },
     523             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_018E },
     524             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_018F },
     525             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0190 },
     526             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0191 },
     527             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0192 },
     528             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0193 },
     529             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0194 },
     530             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0195 },
     531             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0196 },
     532             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0197 },
     533             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0198 },
     534             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_0199 },
     535             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_019A },
     536             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_019B },
     537             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_019C },
     538             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_019D },
     539             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_019E },
     540             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_019F },
     541             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01A0 },
     542             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01A1 },
     543             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01A2 },
     544             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01A3 },
     545             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01A4 },
     546             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01A5 },
     547             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01A6 },
     548             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01A7 },
     549             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01A8 },
     550             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01A9 },
     551             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01AA },
     552             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01AB },
     553             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01AC },
     554             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01AD },
     555             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01AE },
     556             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01AF },
     557             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01B0 },
     558             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01B1 },
     559             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01B2 },
     560             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01B3 },
     561             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01B4 },
     562             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01B5 },
     563             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01B6 },
     564             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01B7 },
     565             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01B8 },
     566             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01B9 },
     567             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01BA },
     568             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01BB },
     569             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01BC },
     570             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01BD },
     571             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01BE },
     572             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01BF },
     573             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01C0 },
     574             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01C1 },
     575             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01C2 },
     576             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01C3 },
     577             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01C4 },
     578             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01C5 },
     579             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01C6 },
     580             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01C7 },
     581             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01C8 },
     582             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01C9 },
     583             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01CA },
     584             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01CB },
     585             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01CC },
     586             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01CD },
     587             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01CE },
     588             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01CF },
     589             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01D0 },
     590             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01D1 },
     591             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01D2 },
     592             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01D3 },
     593             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01D4 },
     594             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01D5 },
     595             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01D6 },
     596             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01D7 },
     597             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01D8 },
     598             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01D9 },
     599             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01DA },
     600             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01DB },
     601             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01DC },
     602             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01DD },
     603             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01DE },
     604             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01DF },
     605             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01E0 },
     606             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01E1 },
     607             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01E2 },
     608             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01E3 },
     609             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01E4 },
     610             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01E5 },
     611             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01E6 },
     612             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01E7 },
     613             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01E8 },
     614             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01E9 },
     615             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01EA },
     616             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01EB },
     617             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01EC },
     618             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01ED },
     619             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01EE },
     620             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01EF },
     621             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01F0 },
     622             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01F1 },
     623             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01F2 },
     624             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01F3 },
     625             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01F4 },
     626             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01F5 },
     627             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01F6 },
     628             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01F7 },
     629             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01F8 },
     630             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01F9 },
     631             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01FA },
     632             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01FB },
     633             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01FC },
     634             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01FD },
     635             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01FE },
     636             :         { USB_VENDOR_MATRIXORB, USB_PRODUCT_MATRIXORB_LCD_01FF },
     637             :         { USB_VENDOR_MECANIQUE, USB_PRODUCT_MECANIQUE_TELLSTICK },
     638             :         { USB_VENDOR_MELCO, USB_PRODUCT_MELCO_PCOPRS1 },
     639             :         { USB_VENDOR_MOBILITY, USB_PRODUCT_MOBILITY_ED200H },
     640             :         { USB_VENDOR_OCT, USB_PRODUCT_OCT_US2308 },
     641             :         { USB_VENDOR_PAPOUCH, USB_PRODUCT_PAPOUCH_AD4USB },
     642             :         { USB_VENDOR_PAPOUCH, USB_PRODUCT_PAPOUCH_AP485_1 },
     643             :         { USB_VENDOR_PAPOUCH, USB_PRODUCT_PAPOUCH_AP485_2 },
     644             :         { USB_VENDOR_PAPOUCH, USB_PRODUCT_PAPOUCH_DRAK5 },
     645             :         { USB_VENDOR_PAPOUCH, USB_PRODUCT_PAPOUCH_DRAK6 },
     646             :         { USB_VENDOR_PAPOUCH, USB_PRODUCT_PAPOUCH_GOLIATH_MSR },
     647             :         { USB_VENDOR_PAPOUCH, USB_PRODUCT_PAPOUCH_GOLIATH_MUX },
     648             :         { USB_VENDOR_PAPOUCH, USB_PRODUCT_PAPOUCH_IRAMP },
     649             :         { USB_VENDOR_PAPOUCH, USB_PRODUCT_PAPOUCH_LEC },
     650             :         { USB_VENDOR_PAPOUCH, USB_PRODUCT_PAPOUCH_MUC },
     651             :         { USB_VENDOR_PAPOUCH, USB_PRODUCT_PAPOUCH_QUIDO101 },
     652             :         { USB_VENDOR_PAPOUCH, USB_PRODUCT_PAPOUCH_QUIDO216 },
     653             :         { USB_VENDOR_PAPOUCH, USB_PRODUCT_PAPOUCH_QUIDO22 },
     654             :         { USB_VENDOR_PAPOUCH, USB_PRODUCT_PAPOUCH_QUIDO303 },
     655             :         { USB_VENDOR_PAPOUCH, USB_PRODUCT_PAPOUCH_QUIDO332 },
     656             :         { USB_VENDOR_PAPOUCH, USB_PRODUCT_PAPOUCH_QUIDO44 },
     657             :         { USB_VENDOR_PAPOUCH, USB_PRODUCT_PAPOUCH_QUIDO603 },
     658             :         { USB_VENDOR_PAPOUCH, USB_PRODUCT_PAPOUCH_QUIDO88 },
     659             :         { USB_VENDOR_PAPOUCH, USB_PRODUCT_PAPOUCH_SB232 },
     660             :         { USB_VENDOR_PAPOUCH, USB_PRODUCT_PAPOUCH_SB422_1 },
     661             :         { USB_VENDOR_PAPOUCH, USB_PRODUCT_PAPOUCH_SB422_2 },
     662             :         { USB_VENDOR_PAPOUCH, USB_PRODUCT_PAPOUCH_SB485C },
     663             :         { USB_VENDOR_PAPOUCH, USB_PRODUCT_PAPOUCH_SB485S },
     664             :         { USB_VENDOR_PAPOUCH, USB_PRODUCT_PAPOUCH_SB485_1 },
     665             :         { USB_VENDOR_PAPOUCH, USB_PRODUCT_PAPOUCH_SB485_2 },
     666             :         { USB_VENDOR_PAPOUCH, USB_PRODUCT_PAPOUCH_SERIAL },
     667             :         { USB_VENDOR_PAPOUCH, USB_PRODUCT_PAPOUCH_SIMUKEY },
     668             :         { USB_VENDOR_PAPOUCH, USB_PRODUCT_PAPOUCH_STAVOVY },
     669             :         { USB_VENDOR_PAPOUCH, USB_PRODUCT_PAPOUCH_TMU },
     670             :         { USB_VENDOR_POSIFLEX, USB_PRODUCT_POSIFLEX_PP7000_1 },
     671             :         { USB_VENDOR_POSIFLEX, USB_PRODUCT_POSIFLEX_PP7000_2 },
     672             :         { USB_VENDOR_RATOC, USB_PRODUCT_RATOC_REXUSB60F },
     673             :         { USB_VENDOR_RTSYSTEMS, USB_PRODUCT_RTSYSTEMS_CT57B },
     674             :         { USB_VENDOR_SACOM, USB_PRODUCT_SACOM_USB485BL },
     675             :         { USB_VENDOR_SEALEVEL, USB_PRODUCT_SEALEVEL_2101 },
     676             :         { USB_VENDOR_SEALEVEL, USB_PRODUCT_SEALEVEL_2102 },
     677             :         { USB_VENDOR_SEALEVEL, USB_PRODUCT_SEALEVEL_2103 },
     678             :         { USB_VENDOR_SEALEVEL, USB_PRODUCT_SEALEVEL_2104 },
     679             :         { USB_VENDOR_SEALEVEL, USB_PRODUCT_SEALEVEL_2106 },
     680             :         { USB_VENDOR_SEALEVEL, USB_PRODUCT_SEALEVEL_2201_1 },
     681             :         { USB_VENDOR_SEALEVEL, USB_PRODUCT_SEALEVEL_2201_2 },
     682             :         { USB_VENDOR_SEALEVEL, USB_PRODUCT_SEALEVEL_2202_1 },
     683             :         { USB_VENDOR_SEALEVEL, USB_PRODUCT_SEALEVEL_2202_2 },
     684             :         { USB_VENDOR_SEALEVEL, USB_PRODUCT_SEALEVEL_2203_1 },
     685             :         { USB_VENDOR_SEALEVEL, USB_PRODUCT_SEALEVEL_2203_2 },
     686             :         { USB_VENDOR_SEALEVEL, USB_PRODUCT_SEALEVEL_2401_1 },
     687             :         { USB_VENDOR_SEALEVEL, USB_PRODUCT_SEALEVEL_2401_2 },
     688             :         { USB_VENDOR_SEALEVEL, USB_PRODUCT_SEALEVEL_2401_3 },
     689             :         { USB_VENDOR_SEALEVEL, USB_PRODUCT_SEALEVEL_2401_4 },
     690             :         { USB_VENDOR_SEALEVEL, USB_PRODUCT_SEALEVEL_2402_1 },
     691             :         { USB_VENDOR_SEALEVEL, USB_PRODUCT_SEALEVEL_2402_2 },
     692             :         { USB_VENDOR_SEALEVEL, USB_PRODUCT_SEALEVEL_2402_3 },
     693             :         { USB_VENDOR_SEALEVEL, USB_PRODUCT_SEALEVEL_2402_4 },
     694             :         { USB_VENDOR_SEALEVEL, USB_PRODUCT_SEALEVEL_2403_1 },
     695             :         { USB_VENDOR_SEALEVEL, USB_PRODUCT_SEALEVEL_2403_2 },
     696             :         { USB_VENDOR_SEALEVEL, USB_PRODUCT_SEALEVEL_2403_3 },
     697             :         { USB_VENDOR_SEALEVEL, USB_PRODUCT_SEALEVEL_2403_4 },
     698             :         { USB_VENDOR_SEALEVEL, USB_PRODUCT_SEALEVEL_2801_1 },
     699             :         { USB_VENDOR_SEALEVEL, USB_PRODUCT_SEALEVEL_2801_2 },
     700             :         { USB_VENDOR_SEALEVEL, USB_PRODUCT_SEALEVEL_2801_3 },
     701             :         { USB_VENDOR_SEALEVEL, USB_PRODUCT_SEALEVEL_2801_4 },
     702             :         { USB_VENDOR_SEALEVEL, USB_PRODUCT_SEALEVEL_2801_5 },
     703             :         { USB_VENDOR_SEALEVEL, USB_PRODUCT_SEALEVEL_2801_6 },
     704             :         { USB_VENDOR_SEALEVEL, USB_PRODUCT_SEALEVEL_2801_7 },
     705             :         { USB_VENDOR_SEALEVEL, USB_PRODUCT_SEALEVEL_2801_8 },
     706             :         { USB_VENDOR_SEALEVEL, USB_PRODUCT_SEALEVEL_2802_1 },
     707             :         { USB_VENDOR_SEALEVEL, USB_PRODUCT_SEALEVEL_2802_2 },
     708             :         { USB_VENDOR_SEALEVEL, USB_PRODUCT_SEALEVEL_2802_3 },
     709             :         { USB_VENDOR_SEALEVEL, USB_PRODUCT_SEALEVEL_2802_4 },
     710             :         { USB_VENDOR_SEALEVEL, USB_PRODUCT_SEALEVEL_2802_5 },
     711             :         { USB_VENDOR_SEALEVEL, USB_PRODUCT_SEALEVEL_2802_6 },
     712             :         { USB_VENDOR_SEALEVEL, USB_PRODUCT_SEALEVEL_2802_7 },
     713             :         { USB_VENDOR_SEALEVEL, USB_PRODUCT_SEALEVEL_2802_8 },
     714             :         { USB_VENDOR_SEALEVEL, USB_PRODUCT_SEALEVEL_2803_1 },
     715             :         { USB_VENDOR_SEALEVEL, USB_PRODUCT_SEALEVEL_2803_2 },
     716             :         { USB_VENDOR_SEALEVEL, USB_PRODUCT_SEALEVEL_2803_3 },
     717             :         { USB_VENDOR_SEALEVEL, USB_PRODUCT_SEALEVEL_2803_4 },
     718             :         { USB_VENDOR_SEALEVEL, USB_PRODUCT_SEALEVEL_2803_5 },
     719             :         { USB_VENDOR_SEALEVEL, USB_PRODUCT_SEALEVEL_2803_6 },
     720             :         { USB_VENDOR_SEALEVEL, USB_PRODUCT_SEALEVEL_2803_7 },
     721             :         { USB_VENDOR_SEALEVEL, USB_PRODUCT_SEALEVEL_2803_8 },
     722             :         { USB_VENDOR_STOLLMANN, USB_PRODUCT_STOLLMANN_ISDN_TA_USBA },
     723             :         { USB_VENDOR_TESTO, USB_PRODUCT_TESTO_174 },
     724             :         { USB_VENDOR_TESTO, USB_PRODUCT_TESTO_175 },
     725             :         { USB_VENDOR_TESTO, USB_PRODUCT_TESTO_330 },
     726             :         { USB_VENDOR_TESTO, USB_PRODUCT_TESTO_435 },
     727             :         { USB_VENDOR_TESTO, USB_PRODUCT_TESTO_556 },
     728             :         { USB_VENDOR_TESTO, USB_PRODUCT_TESTO_580 },
     729             :         { USB_VENDOR_TESTO, USB_PRODUCT_TESTO_845 },
     730             :         { USB_VENDOR_TESTO, USB_PRODUCT_TESTO_SERIAL_1 },
     731             :         { USB_VENDOR_TESTO, USB_PRODUCT_TESTO_SERIAL_2 },
     732             :         { USB_VENDOR_TESTO, USB_PRODUCT_TESTO_SERVICE },
     733             :         { USB_VENDOR_THURLBY, USB_PRODUCT_THURLBY_QL355P },
     734             :         { USB_VENDOR_TML, USB_PRODUCT_TML_SERIAL },
     735             :         { USB_VENDOR_UNKNOWN5, USB_PRODUCT_UNKNOWN5_NF_RIC }
     736             : };
     737             : 
     738             : int
     739           0 : uftdi_match(struct device *parent, void *match, void *aux)
     740             : {
     741           0 :         struct usb_attach_arg *uaa = aux;
     742             : 
     743           0 :         if (uaa->iface == NULL || uaa->configno != 1)
     744           0 :                 return (UMATCH_NONE);
     745             : 
     746           0 :         if (usb_lookup(uftdi_devs, uaa->vendor, uaa->product) == NULL)
     747           0 :                 return (UMATCH_NONE);
     748             : 
     749             :         /* JTAG on USB interface 0 */
     750           0 :         if (uaa->vendor == USB_VENDOR_FTDI &&
     751           0 :             uaa->product == USB_PRODUCT_FTDI_OPENRD &&
     752           0 :             uaa->ifaceno == 0)
     753           0 :                 return (UMATCH_NONE);
     754             : 
     755           0 :         return (UMATCH_VENDOR_PRODUCT_CONF_IFACE);
     756           0 : }
     757             : 
     758             : void
     759           0 : uftdi_attach(struct device *parent, struct device *self, void *aux)
     760             : {
     761           0 :         struct uftdi_softc *sc = (struct uftdi_softc *)self;
     762           0 :         struct usb_attach_arg *uaa = aux;
     763             :         usb_interface_descriptor_t *id;
     764             :         usb_endpoint_descriptor_t *ed;
     765           0 :         char *devname = sc->sc_dev.dv_xname;
     766           0 :         struct ucom_attach_args uca;
     767             :         int i;
     768             : 
     769           0 :         sc->sc_udev = uaa->device;
     770           0 :         sc->sc_iface = uaa->iface;
     771             : 
     772           0 :         if (uaa->release < 0x0200) {
     773           0 :                 sc->sc_type = UFTDI_TYPE_SIO;
     774           0 :                 sc->sc_hdrlen = 1;
     775           0 :         } else if (uaa->release == 0x0700  || uaa->release == 0x0800) {
     776           0 :                 sc->sc_type = UFTDI_TYPE_2232H;
     777           0 :                 sc->sc_hdrlen = 0;
     778           0 :         } else {
     779           0 :                 sc->sc_type = UFTDI_TYPE_8U232AM;
     780           0 :                 sc->sc_hdrlen = 0;
     781             :         }
     782             : 
     783           0 :         uca.bulkin = uca.bulkout = -1;
     784           0 :         id = usbd_get_interface_descriptor(sc->sc_iface);
     785           0 :         for (i = 0; i < id->bNumEndpoints; i++) {
     786             :                 int addr, dir, attr;
     787           0 :                 ed = usbd_interface2endpoint_descriptor(sc->sc_iface, i);
     788           0 :                 if (ed == NULL) {
     789           0 :                         printf("%s: could not read endpoint descriptor\n",
     790             :                             devname);
     791           0 :                         goto bad;
     792             :                 }
     793             : 
     794           0 :                 addr = ed->bEndpointAddress;
     795           0 :                 dir = UE_GET_DIR(ed->bEndpointAddress);
     796           0 :                 attr = ed->bmAttributes & UE_XFERTYPE;
     797           0 :                 if (dir == UE_DIR_IN && attr == UE_BULK) {
     798           0 :                         uca.bulkin = addr;
     799           0 :                         uca.ibufsize = (UGETW(ed->wMaxPacketSize) > 0) ?
     800             :                             UGETW(ed->wMaxPacketSize) : UFTDIIBUFSIZE;
     801           0 :                 } else if (dir == UE_DIR_OUT && attr == UE_BULK) {
     802           0 :                         uca.bulkout = addr;
     803           0 :                         uca.obufsize = (UGETW(ed->wMaxPacketSize) > 0) ?
     804             :                             UGETW(ed->wMaxPacketSize) : UFTDIOBUFSIZE;
     805           0 :                         uca.obufsize-= sc->sc_hdrlen;
     806             :                 } else {
     807           0 :                         printf("%s: unexpected endpoint\n", devname);
     808           0 :                         goto bad;
     809             :                 }
     810           0 :         }
     811           0 :         if (uca.bulkin == -1) {
     812           0 :                 printf("%s: Could not find data bulk in\n",
     813             :                        sc->sc_dev.dv_xname);
     814           0 :                 goto bad;
     815             :         }
     816           0 :         if (uca.bulkout == -1) {
     817           0 :                 printf("%s: Could not find data bulk out\n",
     818             :                        sc->sc_dev.dv_xname);
     819           0 :                 goto bad;
     820             :         }
     821             : 
     822           0 :         if (uaa->iface == NULL)
     823           0 :                 uca.portno = FTDI_PIT_SIOA;
     824             :         else
     825           0 :                 uca.portno = FTDI_PIT_SIOA + id->bInterfaceNumber;
     826             :         /* bulkin, bulkout set above */
     827           0 :         uca.ibufsizepad = uca.ibufsize;
     828           0 :         uca.opkthdrlen = sc->sc_hdrlen;
     829           0 :         uca.device = sc->sc_udev;
     830           0 :         uca.iface = sc->sc_iface;
     831           0 :         uca.methods = &uftdi_methods;
     832           0 :         uca.arg = sc;
     833           0 :         uca.info = NULL;
     834             : 
     835             :         DPRINTF(("uftdi: in=0x%x out=0x%x\n", uca.bulkin, uca.bulkout));
     836           0 :         sc->sc_subdev = config_found_sm(self, &uca, ucomprint, ucomsubmatch);
     837             : 
     838           0 :         return;
     839             : 
     840             : bad:
     841             :         DPRINTF(("uftdi_attach: ATTACH ERROR\n"));
     842           0 :         usbd_deactivate(sc->sc_udev);
     843           0 : }
     844             : 
     845             : int
     846           0 : uftdi_detach(struct device *self, int flags)
     847             : {
     848           0 :         struct uftdi_softc *sc = (struct uftdi_softc *)self;
     849             : 
     850             :         DPRINTF(("uftdi_detach: sc=%p flags=%d\n", sc, flags));
     851           0 :         if (sc->sc_subdev != NULL) {
     852           0 :                 config_detach(sc->sc_subdev, flags);
     853           0 :                 sc->sc_subdev = NULL;
     854           0 :         }
     855             : 
     856           0 :         return (0);
     857             : }
     858             : 
     859             : int
     860           0 : uftdi_open(void *vsc, int portno)
     861             : {
     862           0 :         struct uftdi_softc *sc = vsc;
     863           0 :         usb_device_request_t req;
     864             :         usbd_status err;
     865           0 :         struct termios t;
     866             : 
     867             :         DPRINTF(("uftdi_open: sc=%p\n", sc));
     868             : 
     869           0 :         if (usbd_is_dying(sc->sc_udev))
     870           0 :                 return (EIO);
     871             : 
     872             :         /* Perform a full reset on the device */
     873           0 :         req.bmRequestType = UT_WRITE_VENDOR_DEVICE;
     874           0 :         req.bRequest = FTDI_SIO_RESET;
     875           0 :         USETW(req.wValue, FTDI_SIO_RESET_SIO);
     876           0 :         USETW(req.wIndex, portno);
     877           0 :         USETW(req.wLength, 0);
     878           0 :         err = usbd_do_request(sc->sc_udev, &req, NULL);
     879           0 :         if (err)
     880           0 :                 return (EIO);
     881             : 
     882             :         /* Set 9600 baud, 2 stop bits, no parity, 8 bits */
     883           0 :         t.c_ospeed = 9600;
     884           0 :         t.c_cflag = CSTOPB | CS8;
     885           0 :         (void)uftdi_param(sc, portno, &t);
     886             : 
     887             :         /* Turn on RTS/CTS flow control */
     888           0 :         req.bmRequestType = UT_WRITE_VENDOR_DEVICE;
     889           0 :         req.bRequest = FTDI_SIO_SET_FLOW_CTRL;
     890           0 :         USETW(req.wValue, 0);
     891           0 :         USETW2(req.wIndex, FTDI_SIO_RTS_CTS_HS, portno);
     892           0 :         USETW(req.wLength, 0);
     893           0 :         err = usbd_do_request(sc->sc_udev, &req, NULL);
     894           0 :         if (err)
     895           0 :                 return (EIO);
     896             : 
     897           0 :         return (0);
     898           0 : }
     899             : 
     900             : void
     901           0 : uftdi_read(void *vsc, int portno, u_char **ptr, u_int32_t *count)
     902             : {
     903           0 :         struct uftdi_softc *sc = vsc;
     904             :         u_char msr, lsr;
     905             : 
     906             :         DPRINTFN(15,("uftdi_read: sc=%p, port=%d count=%d\n", sc, portno,
     907             :                      *count));
     908             : 
     909           0 :         msr = FTDI_GET_MSR(*ptr);
     910           0 :         lsr = FTDI_GET_LSR(*ptr);
     911             : 
     912             : #ifdef UFTDI_DEBUG
     913             :         if (*count != 2)
     914             :                 DPRINTFN(10,("uftdi_read: sc=%p, port=%d count=%d data[0]="
     915             :                             "0x%02x\n", sc, portno, *count, (*ptr)[2]));
     916             : #endif
     917             : 
     918           0 :         if (sc->sc_msr != msr ||
     919           0 :             (sc->sc_lsr & FTDI_LSR_MASK) != (lsr & FTDI_LSR_MASK)) {
     920             :                 DPRINTF(("uftdi_read: status change msr=0x%02x(0x%02x) "
     921             :                          "lsr=0x%02x(0x%02x)\n", msr, sc->sc_msr,
     922             :                          lsr, sc->sc_lsr));
     923           0 :                 sc->sc_msr = msr;
     924           0 :                 sc->sc_lsr = lsr;
     925           0 :                 ucom_status_change((struct ucom_softc *)sc->sc_subdev);
     926           0 :         }
     927             : 
     928             :         /* Pick up status and adjust data part. */
     929           0 :         *ptr += 2;
     930           0 :         *count -= 2;
     931           0 : }
     932             : 
     933             : void
     934           0 : uftdi_write(void *vsc, int portno, u_char *to, u_char *from, u_int32_t *count)
     935             : {
     936           0 :         struct uftdi_softc *sc = vsc;
     937             : 
     938             :         DPRINTFN(10,("uftdi_write: sc=%p, port=%d count=%u data[0]=0x%02x\n",
     939             :                      vsc, portno, *count, from[0]));
     940             : 
     941             :         /* Make length tag and copy data */
     942           0 :         if (sc->sc_hdrlen > 0)
     943           0 :                 *to = FTDI_OUT_TAG(*count, portno);
     944             : 
     945           0 :         memcpy(to + sc->sc_hdrlen, from, *count);
     946           0 :         *count += sc->sc_hdrlen;
     947           0 : }
     948             : 
     949             : void
     950           0 : uftdi_set(void *vsc, int portno, int reg, int onoff)
     951             : {
     952           0 :         struct uftdi_softc *sc = vsc;
     953           0 :         usb_device_request_t req;
     954             :         int ctl;
     955             : 
     956             :         DPRINTF(("uftdi_set: sc=%p, port=%d reg=%d onoff=%d\n", vsc, portno,
     957             :                  reg, onoff));
     958             : 
     959           0 :         switch (reg) {
     960             :         case UCOM_SET_DTR:
     961           0 :                 ctl = onoff ? FTDI_SIO_SET_DTR_HIGH : FTDI_SIO_SET_DTR_LOW;
     962           0 :                 break;
     963             :         case UCOM_SET_RTS:
     964           0 :                 ctl = onoff ? FTDI_SIO_SET_RTS_HIGH : FTDI_SIO_SET_RTS_LOW;
     965           0 :                 break;
     966             :         case UCOM_SET_BREAK:
     967           0 :                 uftdi_break(sc, portno, onoff);
     968           0 :                 return;
     969             :         default:
     970           0 :                 return;
     971             :         }
     972           0 :         req.bmRequestType = UT_WRITE_VENDOR_DEVICE;
     973           0 :         req.bRequest = FTDI_SIO_MODEM_CTRL;
     974           0 :         USETW(req.wValue, ctl);
     975           0 :         USETW(req.wIndex, portno);
     976           0 :         USETW(req.wLength, 0);
     977             :         DPRINTFN(2,("uftdi_set: reqtype=0x%02x req=0x%02x value=0x%04x "
     978             :                     "index=0x%04x len=%d\n", req.bmRequestType, req.bRequest,
     979             :                     UGETW(req.wValue), UGETW(req.wIndex), UGETW(req.wLength)));
     980           0 :         (void)usbd_do_request(sc->sc_udev, &req, NULL);
     981           0 : }
     982             : 
     983             : int
     984           0 : uftdi_param(void *vsc, int portno, struct termios *t)
     985             : {
     986           0 :         struct uftdi_softc *sc = vsc;
     987           0 :         usb_device_request_t req;
     988             :         usbd_status err;
     989           0 :         int rate, data, flow;
     990             : 
     991             :         DPRINTF(("uftdi_param: sc=%p\n", sc));
     992             : 
     993           0 :         if (usbd_is_dying(sc->sc_udev))
     994           0 :                 return (EIO);
     995             : 
     996           0 :         switch (sc->sc_type) {
     997             :         case UFTDI_TYPE_SIO:
     998           0 :                 switch (t->c_ospeed) {
     999           0 :                 case 300: rate = ftdi_sio_b300; break;
    1000           0 :                 case 600: rate = ftdi_sio_b600; break;
    1001           0 :                 case 1200: rate = ftdi_sio_b1200; break;
    1002           0 :                 case 2400: rate = ftdi_sio_b2400; break;
    1003           0 :                 case 4800: rate = ftdi_sio_b4800; break;
    1004           0 :                 case 9600: rate = ftdi_sio_b9600; break;
    1005           0 :                 case 19200: rate = ftdi_sio_b19200; break;
    1006           0 :                 case 38400: rate = ftdi_sio_b38400; break;
    1007           0 :                 case 57600: rate = ftdi_sio_b57600; break;
    1008           0 :                 case 115200: rate = ftdi_sio_b115200; break;
    1009             :                 default:
    1010           0 :                         return (EINVAL);
    1011             :                 }
    1012             :                 break;
    1013             : 
    1014             :         case UFTDI_TYPE_8U232AM:
    1015           0 :                 if (uftdi_8u232am_getrate(t->c_ospeed, &rate) == -1)
    1016           0 :                         return (EINVAL);
    1017             :                 break;
    1018             :         case UFTDI_TYPE_2232H:
    1019           0 :                 if (uftdi_2232h_getrate(t->c_ospeed, &rate) == -1)
    1020           0 :                          return (EINVAL);
    1021             :                 break;
    1022             :         }
    1023           0 :         req.bmRequestType = UT_WRITE_VENDOR_DEVICE;
    1024           0 :         req.bRequest = FTDI_SIO_SET_BAUD_RATE;
    1025           0 :         USETW(req.wValue, rate);
    1026           0 :         USETW(req.wIndex, ((rate >> 8) & 0xFF00) | portno);
    1027           0 :         USETW(req.wLength, 0);
    1028             :         DPRINTFN(2,("uftdi_param: reqtype=0x%02x req=0x%02x value=0x%04x "
    1029             :                     "index=0x%04x len=%d\n", req.bmRequestType, req.bRequest,
    1030             :                     UGETW(req.wValue), UGETW(req.wIndex), UGETW(req.wLength)));
    1031           0 :         err = usbd_do_request(sc->sc_udev, &req, NULL);
    1032           0 :         if (err)
    1033           0 :                 return (EIO);
    1034             : 
    1035           0 :         if (ISSET(t->c_cflag, CSTOPB))
    1036           0 :                 data = FTDI_SIO_SET_DATA_STOP_BITS_2;
    1037             :         else
    1038             :                 data = FTDI_SIO_SET_DATA_STOP_BITS_1;
    1039           0 :         if (ISSET(t->c_cflag, PARENB)) {
    1040           0 :                 if (ISSET(t->c_cflag, PARODD))
    1041           0 :                         data |= FTDI_SIO_SET_DATA_PARITY_ODD;
    1042             :                 else
    1043           0 :                         data |= FTDI_SIO_SET_DATA_PARITY_EVEN;
    1044             :         } else
    1045             :                 data |= FTDI_SIO_SET_DATA_PARITY_NONE;
    1046           0 :         switch (ISSET(t->c_cflag, CSIZE)) {
    1047             :         case CS5:
    1048           0 :                 data |= FTDI_SIO_SET_DATA_BITS(5);
    1049           0 :                 break;
    1050             :         case CS6:
    1051           0 :                 data |= FTDI_SIO_SET_DATA_BITS(6);
    1052           0 :                 break;
    1053             :         case CS7:
    1054           0 :                 data |= FTDI_SIO_SET_DATA_BITS(7);
    1055           0 :                 break;
    1056             :         case CS8:
    1057           0 :                 data |= FTDI_SIO_SET_DATA_BITS(8);
    1058           0 :                 break;
    1059             :         }
    1060           0 :         sc->last_lcr = data;
    1061             : 
    1062           0 :         req.bmRequestType = UT_WRITE_VENDOR_DEVICE;
    1063           0 :         req.bRequest = FTDI_SIO_SET_DATA;
    1064           0 :         USETW(req.wValue, data);
    1065           0 :         USETW(req.wIndex, portno);
    1066           0 :         USETW(req.wLength, 0);
    1067             :         DPRINTFN(2,("uftdi_param: reqtype=0x%02x req=0x%02x value=0x%04x "
    1068             :                     "index=0x%04x len=%d\n", req.bmRequestType, req.bRequest,
    1069             :                     UGETW(req.wValue), UGETW(req.wIndex), UGETW(req.wLength)));
    1070           0 :         err = usbd_do_request(sc->sc_udev, &req, NULL);
    1071           0 :         if (err)
    1072           0 :                 return (EIO);
    1073             : 
    1074           0 :         if (ISSET(t->c_cflag, CRTSCTS)) {
    1075             :                 flow = FTDI_SIO_RTS_CTS_HS;
    1076           0 :                 USETW(req.wValue, 0);
    1077           0 :         } else if (ISSET(t->c_iflag, IXON|IXOFF)) {
    1078             :                 flow = FTDI_SIO_XON_XOFF_HS;
    1079           0 :                 USETW2(req.wValue, t->c_cc[VSTOP], t->c_cc[VSTART]);
    1080           0 :         } else {
    1081             :                 flow = FTDI_SIO_DISABLE_FLOW_CTRL;
    1082           0 :                 USETW(req.wValue, 0);
    1083             :         }
    1084           0 :         req.bmRequestType = UT_WRITE_VENDOR_DEVICE;
    1085           0 :         req.bRequest = FTDI_SIO_SET_FLOW_CTRL;
    1086           0 :         USETW2(req.wIndex, flow, portno);
    1087           0 :         USETW(req.wLength, 0);
    1088           0 :         err = usbd_do_request(sc->sc_udev, &req, NULL);
    1089           0 :         if (err)
    1090           0 :                 return (EIO);
    1091             : 
    1092           0 :         return (0);
    1093           0 : }
    1094             : 
    1095             : void
    1096           0 : uftdi_get_status(void *vsc, int portno, u_char *lsr, u_char *msr)
    1097             : {
    1098           0 :         struct uftdi_softc *sc = vsc;
    1099             : 
    1100             :         DPRINTF(("uftdi_status: msr=0x%02x lsr=0x%02x\n",
    1101             :                  sc->sc_msr, sc->sc_lsr));
    1102             : 
    1103           0 :         if (msr != NULL)
    1104           0 :                 *msr = sc->sc_msr;
    1105           0 :         if (lsr != NULL)
    1106           0 :                 *lsr = sc->sc_lsr;
    1107           0 : }
    1108             : 
    1109             : void
    1110           0 : uftdi_break(void *vsc, int portno, int onoff)
    1111             : {
    1112           0 :         struct uftdi_softc *sc = vsc;
    1113           0 :         usb_device_request_t req;
    1114             :         int data;
    1115             : 
    1116             :         DPRINTF(("uftdi_break: sc=%p, port=%d onoff=%d\n", vsc, portno,
    1117             :                   onoff));
    1118             : 
    1119           0 :         if (onoff) {
    1120           0 :                 data = sc->last_lcr | FTDI_SIO_SET_BREAK;
    1121           0 :         } else {
    1122             :                 data = sc->last_lcr;
    1123             :         }
    1124             : 
    1125           0 :         req.bmRequestType = UT_WRITE_VENDOR_DEVICE;
    1126           0 :         req.bRequest = FTDI_SIO_SET_DATA;
    1127           0 :         USETW(req.wValue, data);
    1128           0 :         USETW(req.wIndex, portno);
    1129           0 :         USETW(req.wLength, 0);
    1130           0 :         (void)usbd_do_request(sc->sc_udev, &req, NULL);
    1131           0 : }
    1132             : 
    1133             : int
    1134           0 : uftdi_8u232am_getrate(speed_t speed, int *rate)
    1135             : {
    1136             :         /* Table of the nearest even powers-of-2 for values 0..15. */
    1137             :         static const unsigned char roundoff[16] = {
    1138             :                 0, 2, 2, 4,  4,  4,  8,  8,
    1139             :                 8, 8, 8, 8, 16, 16, 16, 16,
    1140             :         };
    1141             : 
    1142             :         unsigned int d, freq;
    1143             :         int result;
    1144             : 
    1145           0 :         if (speed <= 0)
    1146           0 :                 return (-1);
    1147             : 
    1148             :         /* Special cases for 2M and 3M. */
    1149           0 :         if (speed >= 3000000 * 100 / 103 &&
    1150           0 :             speed <= 3000000 * 100 / 97) {
    1151             :                 result = 0;
    1152           0 :                 goto done;
    1153             :         }
    1154           0 :         if (speed >= 2000000 * 100 / 103 &&
    1155           0 :             speed <= 2000000 * 100 / 97) {
    1156             :                 result = 1;
    1157           0 :                 goto done;
    1158             :         }
    1159             : 
    1160           0 :         d = (FTDI_8U232AM_FREQ << 4) / speed;
    1161           0 :         d = (d & ~15) + roundoff[d & 15];
    1162             : 
    1163           0 :         if (d < FTDI_8U232AM_MIN_DIV)
    1164           0 :                 d = FTDI_8U232AM_MIN_DIV;
    1165           0 :         else if (d > FTDI_8U232AM_MAX_DIV)
    1166           0 :                 d = FTDI_8U232AM_MAX_DIV;
    1167             : 
    1168             :         /* 
    1169             :          * Calculate the frequency needed for d to exactly divide down
    1170             :          * to our target speed, and check that the actual frequency is
    1171             :          * within 3% of this.
    1172             :          */
    1173           0 :         freq = speed * d;
    1174           0 :         if (freq < (quad_t)(FTDI_8U232AM_FREQ << 4) * 100 / 103 ||
    1175           0 :             freq > (quad_t)(FTDI_8U232AM_FREQ << 4) * 100 / 97)
    1176           0 :                 return (-1);
    1177             : 
    1178             :         /* 
    1179             :          * Pack the divisor into the resultant value.  The lower
    1180             :          * 14-bits hold the integral part, while the upper 2 bits
    1181             :          * encode the fractional component: either 0, 0.5, 0.25, or
    1182             :          * 0.125.
    1183             :          */
    1184           0 :         result = d >> 4;
    1185           0 :         if (d & 8)
    1186           0 :                 result |= 0x4000;
    1187           0 :         else if (d & 4)
    1188           0 :                 result |= 0x8000;
    1189           0 :         else if (d & 2)
    1190           0 :                 result |= 0xc000;
    1191             : 
    1192             : done:
    1193           0 :         *rate = result;
    1194           0 :         return (0);
    1195           0 : }
    1196             : 
    1197             : int
    1198           0 : uftdi_2232h_getrate(speed_t speed, int *rate)
    1199             : {
    1200           0 :         char sub[8] = {0, 3, 2, 4, 1, 5, 6, 7};
    1201           0 :         int n = (FTDI_2232H_FREQ << 3) / speed;
    1202           0 :         int s = n & 7;
    1203           0 :         int result = (n >> 3) | (sub[s] << 14);
    1204             :         int resultspeed, accuracy;
    1205             : 
    1206             :         /* Special cases */
    1207           0 :         if (result == 1)
    1208           0 :                 result = 0;
    1209           0 :         else if (result == 0x4001)
    1210           0 :                 result = 1;
    1211             : 
    1212             :         /* Check if resulting baud rate is within 3%. */
    1213           0 :         if (result == 0)
    1214             :                 goto done;
    1215           0 :         resultspeed = (FTDI_2232H_FREQ << 3) /
    1216           0 :             (((result & 0x00003FFF) << 3) | s);
    1217           0 :         accuracy = (abs(speed - resultspeed) * 100) / speed;
    1218           0 :         if (accuracy > 3)
    1219           0 :                 return -1;
    1220             : 
    1221             : done:
    1222           0 :         result|= 0x00020000; /* Set this bit to turn off a divide by 2.5 */
    1223           0 :         *rate = result;
    1224           0 :         return 0;
    1225           0 : }

Generated by: LCOV version 1.13