patch-2.4.20 linux-2.4.20/drivers/usb/serial/keyspan.h

Next file: linux-2.4.20/drivers/usb/serial/keyspan_pda.c
Previous file: linux-2.4.20/drivers/usb/serial/keyspan.c
Back to the patch index
Back to the overall index

diff -urN linux-2.4.19/drivers/usb/serial/keyspan.h linux-2.4.20/drivers/usb/serial/keyspan.h
@@ -2,7 +2,7 @@
   Keyspan USB to Serial Converter driver
  
   (C) Copyright (C) 2000-2001
-      Hugh Blemings <hugh@misc.nu>
+      Hugh Blemings <hugh@blemings.org>
    
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -33,9 +33,8 @@
 #ifndef __LINUX_USB_SERIAL_KEYSPAN_H
 #define __LINUX_USB_SERIAL_KEYSPAN_H
 
-#include <linux/config.h>
 
-	/* Function prototypes for Keyspan serial converter */
+/* Function prototypes for Keyspan serial converter */
 static int  keyspan_open		(struct usb_serial_port *port,
 					 struct file *filp);
 static void keyspan_close		(struct usb_serial_port *port,
@@ -54,12 +53,7 @@
 static void keyspan_send_setup		(struct usb_serial_port *port,
 					 int reset_port);
 
-#if 0
-static void keyspan_write_bulk_callback (struct urb *urb);
-#endif
 
-//static void keyspan_usa26_read_int_callback  (struct urb *urb);
-//static void keyspan_usa28_read_int_callback  (struct urb *urb);
 static int  keyspan_chars_in_buffer 	(struct usb_serial_port *port);
 static int  keyspan_ioctl		(struct usb_serial_port *port,
 					 struct file *file,
@@ -72,12 +66,16 @@
 static int  keyspan_fake_startup	(struct usb_serial *serial);
 
 static int  keyspan_usa19_calc_baud	(u32 baud_rate, u32 baudclk, 
-					 u8 *rate_hi, u8 *rate_low, u8 *prescaler);
+					 u8 *rate_hi, u8 *rate_low,
+					 u8 *prescaler, int portnum);
 
 static int  keyspan_usa19w_calc_baud	(u32 baud_rate, u32 baudclk,
-					 u8 *rate_hi, u8 *rate_low, u8 *prescaler);
+					 u8 *rate_hi, u8 *rate_low,
+					 u8 *prescaler, int portnum);
 
-//static void keyspan_usa19_setup_urbs	(struct usb_serial *serial);
+static int  keyspan_usa28_calc_baud	(u32 baud_rate, u32 baudclk,
+					 u8 *rate_hi, u8 *rate_low,
+					 u8 *prescaler, int portnum);
 
 static int  keyspan_usa28_send_setup	(struct usb_serial *serial,
 					 struct usb_serial_port *port,
@@ -89,91 +87,102 @@
 					 struct usb_serial_port *port,
 					 int reset_port);
 
-	/* Functions from usbserial.c for ezusb firmware handling */
-extern int ezusb_set_reset (struct usb_serial *serial, unsigned char reset_bit);
-extern int ezusb_writememory (struct usb_serial *serial, int address, unsigned char *data, int length, __u8 bRequest);
 
-	/* Struct used for firmware - increased size of data section
-	   to allow Keyspan's 'C' firmware struct to be used unmodified */
+/* Struct used for firmware - increased size of data section
+   to allow Keyspan's 'C' firmware struct to be used unmodified */
 struct ezusb_hex_record {
 	__u16 address;
 	__u8 data_size;
 	__u8 data[64];
 };
-	/* Conditionally include firmware images, if they aren't
-	   included create a null pointer instead.  Current 
-	   firmware images aren't optimised to remove duplicate
-	   addresses in the image itself. */
+
+/* Conditionally include firmware images, if they aren't
+   included create a null pointer instead.  Current 
+   firmware images aren't optimised to remove duplicate
+   addresses in the image itself. */
 #ifdef CONFIG_USB_SERIAL_KEYSPAN_USA28
-        #include "keyspan_usa28_fw.h"
+	#include "keyspan_usa28_fw.h"
 #else
 	static const struct ezusb_hex_record *keyspan_usa28_firmware = NULL;
 #endif
 
 #ifdef CONFIG_USB_SERIAL_KEYSPAN_USA28X
-        #include "keyspan_usa28x_fw.h"
+	#include "keyspan_usa28x_fw.h"
 #else
 	static const struct ezusb_hex_record *keyspan_usa28x_firmware = NULL;
 #endif
 
 #ifdef CONFIG_USB_SERIAL_KEYSPAN_USA28XA
-        #include "keyspan_usa28xa_fw.h"
+	#include "keyspan_usa28xa_fw.h"
 #else
 	static const struct ezusb_hex_record *keyspan_usa28xa_firmware = NULL;
 #endif
 
 #ifdef CONFIG_USB_SERIAL_KEYSPAN_USA28XB
-        #include "keyspan_usa28xb_fw.h"
+	#include "keyspan_usa28xb_fw.h"
 #else
 	static const struct ezusb_hex_record *keyspan_usa28xb_firmware = NULL;
 #endif
 
 #ifdef CONFIG_USB_SERIAL_KEYSPAN_USA19
-        #include "keyspan_usa19_fw.h"
+	#include "keyspan_usa19_fw.h"
 #else
 	static const struct ezusb_hex_record *keyspan_usa19_firmware = NULL;
 #endif
 
+#ifdef CONFIG_USB_SERIAL_KEYSPAN_USA19QI
+	#include "keyspan_usa19qi_fw.h"
+#else
+	static const struct ezusb_hex_record *keyspan_usa19qi_firmware = NULL;
+#endif
+
+#ifdef CONFIG_USB_SERIAL_KEYSPAN_USA19QW
+	#include "keyspan_usa19qw_fw.h"
+#else
+	static const struct ezusb_hex_record *keyspan_usa19qw_firmware = NULL;
+#endif
+
 #ifdef CONFIG_USB_SERIAL_KEYSPAN_USA18X
-        #include "keyspan_usa18x_fw.h"
+	#include "keyspan_usa18x_fw.h"
 #else
 	static const struct ezusb_hex_record *keyspan_usa18x_firmware = NULL;
 #endif
 
 #ifdef CONFIG_USB_SERIAL_KEYSPAN_USA19W
-        #include "keyspan_usa19w_fw.h"
+	#include "keyspan_usa19w_fw.h"
 #else
 	static const struct ezusb_hex_record *keyspan_usa19w_firmware = NULL;
 #endif
 
 #ifdef CONFIG_USB_SERIAL_KEYSPAN_USA49W
-        #include "keyspan_usa49w_fw.h"
+	#include "keyspan_usa49w_fw.h"
 #else
 	static const struct ezusb_hex_record *keyspan_usa49w_firmware = NULL;
 #endif
-	
-	/* Values used for baud rate calculation - device specific */
+
+/* Values used for baud rate calculation - device specific */
 #define	KEYSPAN_INVALID_BAUD_RATE		(-1)
 #define	KEYSPAN_BAUD_RATE_OK			(0)
 #define	KEYSPAN_USA18X_BAUDCLK			(12000000L)	/* a guess */
 #define	KEYSPAN_USA19_BAUDCLK			(12000000L)
 #define	KEYSPAN_USA19W_BAUDCLK			(24000000L)
+#define	KEYSPAN_USA28_BAUDCLK			(1843200L)
 #define	KEYSPAN_USA28X_BAUDCLK			(12000000L)
 #define	KEYSPAN_USA49W_BAUDCLK			(48000000L)
 
-	/* Some constants used to characterise each device. 
-	   There is a four port device due later in the year,
-	   we allow for it now in the following */
+/* Some constants used to characterise each device.  */
 #define		KEYSPAN_MAX_NUM_PORTS		(4)
 #define		KEYSPAN_MAX_FLIPS		(2)
-	
-	/* Device info for the Keyspan serial converter, used
-	   by the overall usb-serial probe function */
+
+/* Device info for the Keyspan serial converter, used
+   by the overall usb-serial probe function */
 #define KEYSPAN_VENDOR_ID			(0x06cd)
 
-	/* Product IDs for the eight products supported, pre-renumeration */
+/* Product IDs for the products supported, pre-renumeration */
 #define	keyspan_usa18x_pre_product_id		0x0105
 #define	keyspan_usa19_pre_product_id		0x0103
+#define	keyspan_usa19qi_pre_product_id		0x010b
+#define	keyspan_usa19qw_pre_product_id		0x0118
 #define	keyspan_usa19w_pre_product_id		0x0106
 #define	keyspan_usa28_pre_product_id		0x0101
 #define	keyspan_usa28x_pre_product_id		0x0102
@@ -181,11 +190,13 @@
 #define	keyspan_usa28xb_pre_product_id		0x0113
 #define	keyspan_usa49w_pre_product_id		0x0109
 
-	/* Product IDs post-renumeration.  Note that the 28x and 28xb
-	   have the same id's post-renumeration but behave identically
-	   so it's not an issue. */
+/* Product IDs post-renumeration.  Note that the 28x and 28xb
+   have the same id's post-renumeration but behave identically
+   so it's not an issue. */
 #define	keyspan_usa18x_product_id		0x0112
 #define	keyspan_usa19_product_id		0x0107
+#define	keyspan_usa19qi_product_id		0x010c
+#define	keyspan_usa19qw_product_id		0x0119
 #define	keyspan_usa19w_product_id		0x0108
 #define	keyspan_usa28_product_id		0x010f
 #define	keyspan_usa28x_product_id		0x0110
@@ -194,10 +205,10 @@
 #define	keyspan_usa49w_product_id		0x010a
 
 
-typedef struct {
+struct keyspan_device_details {
 	/* product ID value */
 	int	product_id;
-	
+
 	enum	{msg_usa26, msg_usa28, msg_usa49} msg_format;
 
 		/* Number of physical ports */
@@ -219,137 +230,190 @@
 		/* Input acknowledge endpoints */
 	int	inack_endpoints[KEYSPAN_MAX_NUM_PORTS];
 
-		/* Output control endpoints */	
+		/* Output control endpoints */
 	int	outcont_endpoints[KEYSPAN_MAX_NUM_PORTS];
 
 		/* Endpoint used for input status */
 	int	instat_endpoint;
 
 		/* Endpoint used for global control functions */
-	int	glocont_endpoint;	
-	
+	int	glocont_endpoint;
+
 	int	(*calculate_baud_rate) (u32 baud_rate, u32 baudclk,
-			u8 *rate_hi, u8 *rate_low, u8 *prescaler);
+			u8 *rate_hi, u8 *rate_low, u8 *prescaler, int portnum);
 	u32	baudclk;
+}; 
+
+/* Now for each device type we setup the device detail
+   structure with the appropriate information (provided
+   in Keyspan's documentation) */
+
+static const struct keyspan_device_details usa18x_device_details = {
+	product_id:		keyspan_usa18x_product_id,
+	msg_format:		msg_usa26,
+	num_ports:		1,
+	indat_endp_flip:	0,
+	outdat_endp_flip:	1,
+	indat_endpoints:	{0x81},
+	outdat_endpoints:	{0x01},
+	inack_endpoints:	{0x85},
+	outcont_endpoints:	{0x05},
+	instat_endpoint:	0x87,
+	glocont_endpoint:	0x07,
+	calculate_baud_rate:	keyspan_usa19w_calc_baud,
+	baudclk:		KEYSPAN_USA18X_BAUDCLK,
+};
+
+static const struct keyspan_device_details usa19_device_details = {
+	product_id:		keyspan_usa19_product_id,
+	msg_format:		msg_usa28,
+	num_ports:		1,
+	indat_endp_flip:	1,
+	outdat_endp_flip:	1,
+	indat_endpoints:	{0x81},
+	outdat_endpoints:	{0x01},
+	inack_endpoints:	{0x83},
+	outcont_endpoints:	{0x03},
+	instat_endpoint:	0x84,
+	glocont_endpoint:	-1,
+	calculate_baud_rate:	keyspan_usa19_calc_baud,
+	baudclk:		KEYSPAN_USA19_BAUDCLK,
+};
+
+static const struct keyspan_device_details usa19qi_device_details = {
+	product_id:		keyspan_usa19qi_product_id,
+	msg_format:		msg_usa28,
+	num_ports:		1,
+	indat_endp_flip:	1,
+	outdat_endp_flip:	1,
+	indat_endpoints:	{0x81},
+	outdat_endpoints:	{0x01},
+	inack_endpoints:	{0x83},
+	outcont_endpoints:	{0x03},
+	instat_endpoint:	0x84,
+	glocont_endpoint:	-1,
+	calculate_baud_rate:	keyspan_usa28_calc_baud,
+	baudclk:		KEYSPAN_USA19_BAUDCLK,
+};
+
+static const struct keyspan_device_details usa19qw_device_details = {
+	product_id:		keyspan_usa19qw_product_id,
+	msg_format:		msg_usa26,
+	num_ports:		1,
+	indat_endp_flip:	0,
+	outdat_endp_flip:	1,
+	indat_endpoints:	{0x81},
+	outdat_endpoints:	{0x01},
+	inack_endpoints:	{0x85},
+	outcont_endpoints:	{0x05},
+	instat_endpoint:	0x87,
+	glocont_endpoint:	0x07,
+	calculate_baud_rate:	keyspan_usa19w_calc_baud,
+	baudclk:		KEYSPAN_USA19W_BAUDCLK,
+};
+
+static const struct keyspan_device_details usa19w_device_details = {
+	product_id:		keyspan_usa19w_product_id,
+	msg_format:		msg_usa26,
+	num_ports:		1,
+	indat_endp_flip:	0,
+	outdat_endp_flip:	1,
+	indat_endpoints:	{0x81},
+	outdat_endpoints:	{0x01},
+	inack_endpoints:	{0x85},
+	outcont_endpoints:	{0x05},
+	instat_endpoint:	0x87,
+	glocont_endpoint:	0x07,
+	calculate_baud_rate:	keyspan_usa19w_calc_baud,
+	baudclk:		KEYSPAN_USA19W_BAUDCLK,
+};
+
+static const struct keyspan_device_details usa28_device_details = {
+	product_id:		keyspan_usa28_product_id,
+	msg_format:		msg_usa28,
+	num_ports:		2,
+	indat_endp_flip:	1,
+	outdat_endp_flip:	1,
+	indat_endpoints:	{0x81, 0x83},
+	outdat_endpoints:	{0x01, 0x03},
+	inack_endpoints:	{0x85, 0x86},
+	outcont_endpoints:	{0x05, 0x06},
+	instat_endpoint:	0x87,
+	glocont_endpoint:	0x07,
+	calculate_baud_rate:	keyspan_usa28_calc_baud,
+	baudclk:		KEYSPAN_USA28_BAUDCLK,		
+};
 
-} keyspan_device_details; 
+static const struct keyspan_device_details usa28x_device_details = {
+	product_id:		keyspan_usa28x_product_id,
+	msg_format:		msg_usa26,
+	num_ports:		2,
+	indat_endp_flip:	0,
+	outdat_endp_flip:	1,
+	indat_endpoints:	{0x81, 0x83},
+	outdat_endpoints:	{0x01, 0x03},
+	inack_endpoints:	{0x85, 0x86},
+	outcont_endpoints:	{0x05, 0x06},
+	instat_endpoint:	0x87,
+	glocont_endpoint:	0x07,
+	calculate_baud_rate:	keyspan_usa19w_calc_baud,
+	baudclk:		KEYSPAN_USA28X_BAUDCLK,
+};
 
-	/* Now for each device type we setup the device detail
-	   structure with the appropriate information (provided
-	   in Keyspan's documentation) */
-
-static const keyspan_device_details usa18x_device_details = {
-	keyspan_usa18x_product_id,	/* product ID */
-       	msg_usa26, 			/* msg type*/
-	1,				/* num ports */
-	0,				/* indat endpoint flip */
-	1,				/* outdat endpoint flip */
-  	{0x81},				/* per port indat */
-  	{0x01},				/* per port outdat */
-	{0x85},				/* per port inack */
-	{0x05},				/* per port outcont */
-	0x87,				/* instat endpoint */
-	0x07,				/* glocont endpoint */
-	keyspan_usa19w_calc_baud,	/* calc baud rate */
-	KEYSPAN_USA18X_BAUDCLK		/* base baud clock */
-};
-
-static const keyspan_device_details usa19_device_details = {
-	keyspan_usa19_product_id,	/* product ID */
-       	msg_usa28, 			/* msg type*/
-	1,				/* num ports */
-	1,				/* indat endpoint flip */
-	1,				/* outdat endpoint flip */
-  	{0x81},				/* per port indat */
-  	{0x01},				/* per port outdat */
-	{0x83},				/* per port inack */
-	{0x03},				/* per port outcont */
-	0x84,				/* instat endpoint */
-	-1,				/* glocont endpoint */
-	keyspan_usa19_calc_baud,	/* calc baud rate */
-	KEYSPAN_USA19_BAUDCLK		/* base baud clock */
-};
-
-static const keyspan_device_details usa19w_device_details = {
-	keyspan_usa19w_product_id,	/* product ID */
-       	msg_usa26, 			/* msg type*/
-	1,				/* num ports */
-	0,				/* indat endpoint flip */
-	1,				/* outdat endpoint flip */
-  	{0x81},				/* per port indat */
-  	{0x01},				/* per port outdat */
-	{0x85},				/* per port inack */
-	{0x05},				/* per port outcont */
-	0x87,				/* instat endpoint */
-	0x07,				/* glocont endpoint */
-	keyspan_usa19w_calc_baud,	/* calc baud rate */
-	KEYSPAN_USA19W_BAUDCLK		/* base baud clock */
-};
-
-static const keyspan_device_details usa28x_device_details = {
-	keyspan_usa28x_product_id,	/* product ID */
-       	msg_usa26, 			/* msg type*/
-	2,				/* num ports */
-	0,				/* indat endpoint flip */
-	1,				/* outdat endpoint flip */
-  	{0x81, 0x83},			/* per port indat */
-  	{0x01, 0x03},			/* per port outdat */
-	{0x85, 0x86},			/* per port inack */
-	{0x05, 0x06},			/* per port outcont */
-	0x87,				/* instat endpoint */
-	0x07,				/* glocont endpoint */
-	keyspan_usa19w_calc_baud,	/* calc baud rate */
-	KEYSPAN_USA28X_BAUDCLK
-};
-
-static const keyspan_device_details usa28xa_device_details = {
-	keyspan_usa28xa_product_id,	/* product ID */
-       	msg_usa26, 			/* msg type*/
-	2,				/* num ports */
-	0,				/* indat endpoint flip */
-	1,				/* outdat endpoint flip */
-  	{0x81, 0x83},			/* per port indat */
-  	{0x01, 0x03},			/* per port outdat */
-	{0x85, 0x86},			/* per port inack */
-	{0x05, 0x06},			/* per port outcont */
-	0x87,				/* instat endpoint */
-	0x07,				/* glocont endpoint */
-	keyspan_usa19w_calc_baud,	/* calc baud rate */
-	KEYSPAN_USA28X_BAUDCLK
-};
-
-	/* We don't need a separate entry for the usa28xb as it appears as a 28x anyway */
-
-static const keyspan_device_details usa49w_device_details = {
-	keyspan_usa49w_product_id,	/* product ID */
-       	msg_usa49, 			/* msg type*/
-	4,				/* num ports */
-	0,				/* indat endpoint flip */
-	0,				/* outdat endpoint flip */
-  	{ 0x81, 0x82, 0x83, 0x84},	/* per port indat */
-  	{ 0x01, 0x02, 0x03, 0x04},	/* per port outdat */
-	{-1, -1, -1, -1},		/* per port inack */
-	{-1, -1, -1, -1},		/* per port outcont */
-	0x87,				/* instat endpoint */
-	0x07,				/* glocont endpoint */
-	keyspan_usa19w_calc_baud,	/* calc baud rate */
-	KEYSPAN_USA49W_BAUDCLK
+static const struct keyspan_device_details usa28xa_device_details = {
+	product_id:		keyspan_usa28xa_product_id,
+	msg_format:		msg_usa26,
+	num_ports:		2,
+	indat_endp_flip:	0,
+	outdat_endp_flip:	1,
+	indat_endpoints:	{0x81, 0x83},
+	outdat_endpoints:	{0x01, 0x03},
+	inack_endpoints:	{0x85, 0x86},
+	outcont_endpoints:	{0x05, 0x06},
+	instat_endpoint:	0x87,
+	glocont_endpoint:	0x07,
+	calculate_baud_rate:	keyspan_usa19w_calc_baud,
+	baudclk:		KEYSPAN_USA28X_BAUDCLK,
+};
+
+/* We don't need a separate entry for the usa28xb as it appears as a 28x anyway */
+
+static const struct keyspan_device_details usa49w_device_details = {
+	product_id:		keyspan_usa49w_product_id,
+	msg_format:		msg_usa49,
+	num_ports:		4,
+	indat_endp_flip:	0,
+	outdat_endp_flip:	0,
+	indat_endpoints:	{0x81, 0x82, 0x83, 0x84},
+	outdat_endpoints:	{0x01, 0x02, 0x03, 0x04},
+	inack_endpoints:	{-1, -1, -1, -1},
+	outcont_endpoints:	{-1, -1, -1, -1},
+	instat_endpoint:	0x87,
+	glocont_endpoint:	0x07,
+	calculate_baud_rate:	keyspan_usa19w_calc_baud,
+	baudclk:		KEYSPAN_USA49W_BAUDCLK,
 };
 
-static const keyspan_device_details *keyspan_devices[] = {
+static const struct keyspan_device_details *keyspan_devices[] = {
 	&usa18x_device_details,
 	&usa19_device_details,
+	&usa19qi_device_details,
+	&usa19qw_device_details,
 	&usa19w_device_details,
+	&usa28_device_details,
 	&usa28x_device_details,
 	&usa28xa_device_details,
+	/* 28xb not required as it renumerates as a 28x */
 	&usa49w_device_details,
-	NULL
+	NULL,
 };
 
 static __devinitdata struct usb_device_id keyspan_ids_combined[] = {
 	{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa18x_pre_product_id) },
 	{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19_pre_product_id) },
 	{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19w_pre_product_id) },
+	{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19qi_pre_product_id) },
+	{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19qw_pre_product_id) },
 	{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28_pre_product_id) },
 	{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28x_pre_product_id) },
 	{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28xa_pre_product_id) },
@@ -358,6 +422,8 @@
 	{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa18x_product_id) },
 	{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19_product_id) },
 	{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19w_product_id) },
+	{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19qi_product_id) },
+	{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19qw_product_id) },
 	{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28_product_id) },
 	{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28x_product_id) },
 	{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28xa_product_id) },
@@ -368,224 +434,58 @@
 
 MODULE_DEVICE_TABLE(usb, keyspan_ids_combined);
 
-/* Eventually, we will not need separate id tables for each USB
-   ID pattern.  But, for now, it looks like we need slightly different
-   behavior for each match. */
-
-static __devinitdata struct usb_device_id keyspan_usa18x_pre_ids[] = {
+/* usb_device_id table for the pre-firmware download keyspan devices */
+static struct usb_device_id keyspan_pre_ids[] = {
 	{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa18x_pre_product_id) },
-	{ }	/* Terminating entry */
-};
-
-static __devinitdata struct usb_device_id keyspan_usa19_pre_ids[] = {
 	{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19_pre_product_id) },
-	{ } /* Terminating entry */
-};
-
-static __devinitdata struct usb_device_id keyspan_usa19w_pre_ids[] = {
+	{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19qi_pre_product_id) },
+	{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19qw_pre_product_id) },
 	{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19w_pre_product_id) },
-	{ } /* Terminating entry */
-};
-
-static __devinitdata struct usb_device_id keyspan_usa28_pre_ids[] = {
 	{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28_pre_product_id) },
-	{ } /* Terminating entry */
-};
-
-static __devinitdata struct usb_device_id keyspan_usa28x_pre_ids[] = {
 	{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28x_pre_product_id) },
-	{ } /* Terminating entry */
-};
-
-static __devinitdata struct usb_device_id keyspan_usa28xa_pre_ids[] = {
 	{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28xa_pre_product_id) },
-	{ } /* Terminating entry */
-};
-
-static __devinitdata struct usb_device_id keyspan_usa28xb_pre_ids[] = {
 	{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28xb_pre_product_id) },
-	{ } /* Terminating entry */
-};
-
-static __devinitdata struct usb_device_id keyspan_usa49w_pre_ids[] = {
 	{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa49w_pre_product_id) },
 	{ } /* Terminating entry */
 };
 
-static __devinitdata struct usb_device_id keyspan_usa18x_ids[] = {
+static struct usb_device_id keyspan_1port_ids[] = {
 	{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa18x_product_id) },
-	{ } /* Terminating entry */
-};
-
-static __devinitdata struct usb_device_id keyspan_usa19_ids[] = {
 	{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19_product_id) },
-	{ } /* Terminating entry */
-};
-
-static __devinitdata struct usb_device_id keyspan_usa19w_ids[] = {
+	{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19qi_product_id) },
+	{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19qw_product_id) },
 	{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19w_product_id) },
 	{ } /* Terminating entry */
 };
 
-static __devinitdata struct usb_device_id keyspan_usa28_ids[] = {
+static struct usb_device_id keyspan_2port_ids[] = {
 	{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28_product_id) },
-	{ } /* Terminating entry */
-};
-
-static __devinitdata struct usb_device_id keyspan_usa28x_ids[] = {
 	{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28x_product_id) },
-	{ } /* Terminating entry */
-};
-
-static __devinitdata struct usb_device_id keyspan_usa28xa_ids[] = {
 	{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28xa_product_id) },
 	{ } /* Terminating entry */
 };
 
-static __devinitdata struct usb_device_id keyspan_usa49w_ids[] = {
+static struct usb_device_id keyspan_4port_ids[] = {
 	{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa49w_product_id) },
 	{ } /* Terminating entry */
 };
 
-    /* Structs for the devices, pre and post renumeration. */
-static struct usb_serial_device_type keyspan_usa18x_pre_device = {
-	name:			"Keyspan USA18X - (without firmware)",
-	id_table:		keyspan_usa18x_pre_ids,
-	needs_interrupt_in:	DONT_CARE,
-	needs_bulk_in:		DONT_CARE,
-	needs_bulk_out:		DONT_CARE,
-	num_interrupt_in:	NUM_DONT_CARE,
-	num_bulk_in:		NUM_DONT_CARE,
-	num_bulk_out:		NUM_DONT_CARE,
-	num_ports:		1,
-	startup:		keyspan_fake_startup	
-};
-
-static struct usb_serial_device_type keyspan_usa19_pre_device = {
-	name:			"Keyspan USA19 - (without firmware)",
-	id_table:		keyspan_usa19_pre_ids,
-	needs_interrupt_in:	DONT_CARE,
-	needs_bulk_in:		DONT_CARE,
-	needs_bulk_out:		DONT_CARE,
-	num_interrupt_in:	NUM_DONT_CARE,
-	num_bulk_in:		NUM_DONT_CARE,
-	num_bulk_out:		NUM_DONT_CARE,
-	num_ports:		1,
-	startup:		keyspan_fake_startup	
-};
-
-
-static struct usb_serial_device_type keyspan_usa19w_pre_device = {
-	name:			"Keyspan USA19W - (without firmware)",
-	id_table:		keyspan_usa19w_pre_ids,
-	needs_interrupt_in:	DONT_CARE,
-	needs_bulk_in:		DONT_CARE,
-	needs_bulk_out:		DONT_CARE,
-	num_interrupt_in:	NUM_DONT_CARE,
-	num_bulk_in:		NUM_DONT_CARE,
-	num_bulk_out:		NUM_DONT_CARE,
-	num_ports:		1,
-	startup:		keyspan_fake_startup	
-};
-
-
-static struct usb_serial_device_type keyspan_usa28_pre_device = {
-	name:			"Keyspan USA28 - (without firmware)",
-	id_table:		keyspan_usa28_pre_ids,
-	needs_interrupt_in:	DONT_CARE,
-	needs_bulk_in:		DONT_CARE,
-	needs_bulk_out:		DONT_CARE,
-	num_interrupt_in:	NUM_DONT_CARE,
-	num_bulk_in:		NUM_DONT_CARE,
-	num_bulk_out:		NUM_DONT_CARE,
-	num_ports:		2,
-	startup:		keyspan_fake_startup	
-};
-
-static struct usb_serial_device_type keyspan_usa28x_pre_device = {
-	name:			"Keyspan USA28X - (without firmware)",
-	id_table:		keyspan_usa28x_pre_ids,
-	needs_interrupt_in:	DONT_CARE,
-	needs_bulk_in:		DONT_CARE,
-	needs_bulk_out:		DONT_CARE,
-	num_interrupt_in:	NUM_DONT_CARE,
-	num_bulk_in:		NUM_DONT_CARE,
-	num_bulk_out:		NUM_DONT_CARE,
-	num_ports:		2,
-	startup:		keyspan_fake_startup	
-};
-
-static struct usb_serial_device_type keyspan_usa28xa_pre_device = {
-	name:			"Keyspan USA28XA - (without firmware)",
-	id_table:		keyspan_usa28xa_pre_ids,
-	needs_interrupt_in:	DONT_CARE,
-	needs_bulk_in:		DONT_CARE,
-	needs_bulk_out:		DONT_CARE,
+/* Structs for the devices, pre and post renumeration. */
+static struct usb_serial_device_type keyspan_pre_device = {
+	owner:			THIS_MODULE,
+	name:			"Keyspan - (without firmware)",
+	id_table:		keyspan_pre_ids,
 	num_interrupt_in:	NUM_DONT_CARE,
 	num_bulk_in:		NUM_DONT_CARE,
 	num_bulk_out:		NUM_DONT_CARE,
-	num_ports:		2,
-	startup:		keyspan_fake_startup	
-};
-
-static struct usb_serial_device_type keyspan_usa28xb_pre_device = {
-	name:			"Keyspan USA28XB - (without firmware)",
-	id_table:		keyspan_usa28xb_pre_ids,
-	needs_interrupt_in:	DONT_CARE,
-	needs_bulk_in:		DONT_CARE,
-	needs_bulk_out:		DONT_CARE,
-	num_interrupt_in:	NUM_DONT_CARE,
-	num_bulk_in:		NUM_DONT_CARE,
-	num_bulk_out:		NUM_DONT_CARE,
-	num_ports:		2,
-	startup:		keyspan_fake_startup	
-};
-
-static struct usb_serial_device_type keyspan_usa49w_pre_device = {
-	name:			"Keyspan USA49W - (without firmware)",
-	id_table:		keyspan_usa49w_pre_ids,
-	needs_interrupt_in:	DONT_CARE,
-	needs_bulk_in:		DONT_CARE,
-	needs_bulk_out:		DONT_CARE,
-	num_interrupt_in:	NUM_DONT_CARE,
-	num_bulk_in:		NUM_DONT_CARE,
-	num_bulk_out:		NUM_DONT_CARE,
-	num_ports:		4,
-	startup:		keyspan_fake_startup	
-};
-
-static struct usb_serial_device_type keyspan_usa18x_device = {
-	name:			"Keyspan USA18X",
-	id_table:		keyspan_usa18x_ids,
-	needs_interrupt_in:	DONT_CARE,	
-	needs_bulk_in:		MUST_HAVE,
-	needs_bulk_out:		MUST_HAVE,
-	num_interrupt_in:	NUM_DONT_CARE,
-	num_bulk_in:		3,
-	num_bulk_out:		4,
 	num_ports:		1,
-	open:			keyspan_open,
-	close:			keyspan_close,
-	write:			keyspan_write,
-	write_room:		keyspan_write_room,
-	//write_bulk_callback: 	Not used - we define our own herbs
-	//read_int_callback:	keyspan_usa26_read_int_callback,
-	chars_in_buffer:	keyspan_chars_in_buffer,
-	throttle:		keyspan_rx_throttle,
-	unthrottle:		keyspan_rx_unthrottle,
-	ioctl:			keyspan_ioctl,
-	set_termios:		keyspan_set_termios,
-	break_ctl:		keyspan_break_ctl,
-	startup:		keyspan_startup,
-	shutdown:		keyspan_shutdown,
+	startup:		keyspan_fake_startup,
 };
 
-static struct usb_serial_device_type keyspan_usa19_device = {
-	name:			"Keyspan USA19",
-	id_table:		keyspan_usa19_ids,
-	needs_interrupt_in:	DONT_CARE,	
-	needs_bulk_in:		MUST_HAVE,
-	needs_bulk_out:		MUST_HAVE,
+static struct usb_serial_device_type keyspan_1port_device = {
+	owner:			THIS_MODULE,
+	name:			"Keyspan 1 port adapter",
+	id_table:		keyspan_1port_ids,
 	num_interrupt_in:	NUM_DONT_CARE,
 	num_bulk_in:		3,
 	num_bulk_out:		4,
@@ -594,8 +494,6 @@
 	close:			keyspan_close,
 	write:			keyspan_write,
 	write_room:		keyspan_write_room,
-//	write_bulk_callback: 	keyspan_write_bulk_callback,
-//	read_int_callback:	keyspan_usa28_read_int_callback,
 	chars_in_buffer:	keyspan_chars_in_buffer,
 	throttle:		keyspan_rx_throttle,
 	unthrottle:		keyspan_rx_unthrottle,
@@ -606,85 +504,10 @@
 	shutdown:		keyspan_shutdown,
 };
 
-
-static struct usb_serial_device_type keyspan_usa19w_device = {
-	name:			"Keyspan USA19W",
-	id_table:		keyspan_usa19w_ids,
-	needs_interrupt_in:	DONT_CARE,	
-	needs_bulk_in:		MUST_HAVE,
-	needs_bulk_out:		MUST_HAVE,
-	num_interrupt_in:	NUM_DONT_CARE,
-	num_bulk_in:		3,
-	num_bulk_out:		4,
-	num_ports:		1,
-	open:			keyspan_open,
-	close:			keyspan_close,
-	write:			keyspan_write,
-	write_room:		keyspan_write_room,
-	//write_bulk_callback: 	Not used - we define our own herbs
-	//read_int_callback:	keyspan_usa26_read_int_callback,
-	chars_in_buffer:	keyspan_chars_in_buffer,
-	throttle:		keyspan_rx_throttle,
-	unthrottle:		keyspan_rx_unthrottle,
-	ioctl:			keyspan_ioctl,
-	set_termios:		keyspan_set_termios,
-	break_ctl:		keyspan_break_ctl,
-	startup:		keyspan_startup,
-	shutdown:		keyspan_shutdown,
-};
-
-
-static struct usb_serial_device_type keyspan_usa28_device = {
-	name:			"Keyspan USA28",
-	id_table:		keyspan_usa28_ids,
-	needs_interrupt_in:	DONT_CARE,	
-	needs_bulk_in:		DONT_CARE,
-	needs_bulk_out:		DONT_CARE,
-	num_interrupt_in:	NUM_DONT_CARE,
-	num_bulk_in:		NUM_DONT_CARE,
-	num_bulk_out:		NUM_DONT_CARE,
-	num_ports:		2,
-	open:			keyspan_open,
-	close:			keyspan_close,
-	throttle:		keyspan_rx_throttle,
-	unthrottle:		keyspan_rx_unthrottle,
-	set_termios:		keyspan_set_termios,
-};
-
-
-static struct usb_serial_device_type keyspan_usa28x_device = {
-	name:			"Keyspan USA28X/XB",
-	id_table:		keyspan_usa28x_ids,
-	needs_interrupt_in:	DONT_CARE,	
-	needs_bulk_in:		DONT_CARE,
-	needs_bulk_out:		DONT_CARE,
-	num_interrupt_in:	NUM_DONT_CARE,
-	num_bulk_in:		NUM_DONT_CARE,
-	num_bulk_out:		NUM_DONT_CARE,
-	num_ports:		2,
-	open:			keyspan_open,
-	close:			keyspan_close,
-	write:			keyspan_write,
-	write_room:		keyspan_write_room,
-//	write_bulk_callback: 	keyspan_write_bulk_callback,
-//	read_int_callback:	keyspan_usa26_read_int_callback,
-	chars_in_buffer:	keyspan_chars_in_buffer,
-	throttle:		keyspan_rx_throttle,
-	unthrottle:		keyspan_rx_unthrottle,
-	ioctl:			keyspan_ioctl,
-	set_termios:		keyspan_set_termios,
-	break_ctl:		keyspan_break_ctl,
-	startup:		keyspan_startup,
-	shutdown:		keyspan_shutdown,
-
-};
-
-static struct usb_serial_device_type keyspan_usa28xa_device = {
-	name:			"Keyspan USA28XA",
-	id_table:		keyspan_usa28xa_ids,
-	needs_interrupt_in:	DONT_CARE,	
-	needs_bulk_in:		DONT_CARE,
-	needs_bulk_out:		DONT_CARE,
+static struct usb_serial_device_type keyspan_2port_device = {
+	owner:			THIS_MODULE,
+	name:			"Keyspan 2 port adapter",
+	id_table:		keyspan_2port_ids,
 	num_interrupt_in:	NUM_DONT_CARE,
 	num_bulk_in:		NUM_DONT_CARE,
 	num_bulk_out:		NUM_DONT_CARE,
@@ -693,8 +516,6 @@
 	close:			keyspan_close,
 	write:			keyspan_write,
 	write_room:		keyspan_write_room,
-//	write_bulk_callback: 	keyspan_write_bulk_callback,
-//	read_int_callback:	keyspan_usa26_read_int_callback,
 	chars_in_buffer:	keyspan_chars_in_buffer,
 	throttle:		keyspan_rx_throttle,
 	unthrottle:		keyspan_rx_unthrottle,
@@ -703,15 +524,12 @@
 	break_ctl:		keyspan_break_ctl,
 	startup:		keyspan_startup,
 	shutdown:		keyspan_shutdown,
-
 };
 
-static struct usb_serial_device_type keyspan_usa49w_device = {
-	name:			"Keyspan USA49W",
-	id_table:		keyspan_usa49w_ids,
-	needs_interrupt_in:	DONT_CARE,	
-	needs_bulk_in:		MUST_HAVE,
-	needs_bulk_out:		MUST_HAVE,
+static struct usb_serial_device_type keyspan_4port_device = {
+	owner:			THIS_MODULE,
+	name:			"Keyspan 4 port adapter",
+	id_table:		keyspan_4port_ids,
 	num_interrupt_in:	NUM_DONT_CARE,
 	num_bulk_in:		5,
 	num_bulk_out:		5,
@@ -720,8 +538,6 @@
 	close:			keyspan_close,
 	write:			keyspan_write,
 	write_room:		keyspan_write_room,
-	//write_bulk_callback: 	Not used - we define our own herbs
-	//read_int_callback:	keyspan_usa26_read_int_callback,
 	chars_in_buffer:	keyspan_chars_in_buffer,
 	throttle:		keyspan_rx_throttle,
 	unthrottle:		keyspan_rx_unthrottle,
@@ -732,5 +548,4 @@
 	shutdown:		keyspan_shutdown,
 };
 
-
 #endif

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)