DragonFly BSD
DragonFly submit List (threaded) for 2004-07
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

PATCH: adding usbdevice + umodem handling


From: Ulf Lilleengen <lulf@xxxxxxxxxxxx>
Date: Mon, 5 Jul 2004 18:14:32 +0000

These patches comes from http://people.freebsd.org/~hmp/dragonfly/freebsd-mfc/ 
Nr. 2284 and 2285. This adds support for kyocera in the umodem driver and adds it to the usbdevice list ( I'm not sure if i should update usbdevs.h and usbdevs_data.h but I'm attaching them nonetheless)

- Ulf Lilleengen
--- umodem.c.orig	2004-07-03 10:50:01.000000000 +0000
+++ umodem.c	2004-07-03 12:07:12.000000000 +0000
@@ -117,6 +117,16 @@
 #endif
 #define DPRINTF(x) DPRINTFN(0, x)
 
+static const struct umodem_product {
+	u_int16_t		vendor;
+	u_int16_t		product;
+	u_int8_t			interface;
+} umodem_products[] = {
+	/* Kyocera AH-K3001V */
+	{ USB_VENDOR_KYOCERA, USB_PRODUCT_KYOCERA_AHK3001V, 0 },
+	{ 0, 0, 0},
+};
+
 /*
  * These are the maximum number of bytes transferred per frame.
  * If some really high speed devices should use this driver they
@@ -215,25 +225,42 @@
 {
 	USB_MATCH_START(umodem, uaa);
 	usb_interface_descriptor_t *id;
-	int cm, acm;
+	usb_device_descriptor_t		*dd;
+	int cm, acm, i, ret;
 
 	if (uaa->iface == NULL)
 		return (UMATCH_NONE);
 
 	id = usbd_get_interface_descriptor(uaa->iface);
-	if (id == NULL ||
-	    id->bInterfaceClass != UICLASS_CDC ||
-	    id->bInterfaceSubClass != UISUBCLASS_ABSTRACT_CONTROL_MODEL ||
-	    id->bInterfaceProtocol != UIPROTO_CDC_AT)
+	dd = usbd_get_device_descriptor(uaa->device);
+	if( id == NULL || dd == NULL )
 		return (UMATCH_NONE);
 
+	ret = UMATCH_NONE;
+	for( i = 0; umodem_products[i].vendor != 0; i++ ) {
+		if(	umodem_products[i].vendor == UGETW(dd->idVendor) &&
+				umodem_products[i].product == UGETW(dd->idProduct) &&
+				umodem_products[i].interface == id->bInterfaceNumber) {
+					ret = UMATCH_VENDOR_PRODUCT;
+					break;
+		}
+	}
+
+	if( ret == UMATCH_NONE &&
+			id->bInterfaceClass == UICLASS_CDC &&
+			id->bInterfaceSubClass == UISUBCLASS_ABSTRACT_CONTROL_MODEL &&
+			id->bInterfaceProtocol == UIPROTO_CDC_AT)
+				ret = UMATCH_IFACECLASS_IFACESUBCLASS_IFACEPROTO;
+	if( ret == UMATCH_NONE )
+		return (ret);
+
 	umodem_get_caps(uaa->device, &cm, &acm);
 	if (!(cm & USB_CDC_CM_DOES_CM) ||
 	    !(cm & USB_CDC_CM_OVER_DATA) ||
 	    !(acm & USB_CDC_ACM_HAS_LINE))
 		return (UMATCH_NONE);
 
-	return (UMATCH_IFACECLASS_IFACESUBCLASS_IFACEPROTO);
+	return ret;
 }
 
 USB_ATTACH(umodem)
--- usbdevs.orig	2004-07-03 11:03:15.000000000 +0000
+++ usbdevs	2004-07-03 11:05:16.000000000 +0000
@@ -113,6 +113,7 @@
 vendor CONNECTIX	0x0478	Connectix
 vendor KENSINGTON	0x047d	Kensington
 vendor LUCENT		0x047e	Lucent
+vendor KYOCERA		0x0482	Kyocera Corp.
 vendor STMICRO		0x0483	STMicroelectronics
 vendor YAMAHA		0x0499	YAMAHA
 vendor COMPAQ		0x049f	Compaq Computers
@@ -815,6 +816,9 @@
 product KYE FLIGHT2000		0x1004	Flight 2000 joystick
 product KYE VIVIDPRO		0x2001	ColorPage Vivid-Pro scanner
 
+/* Kyocera products */
+product KYOCERA AHK3001V	0x203		AH-K3001V
+
 /* LaCie products */
 product LACIE HD		0xa601	Hard Disk
 product LACIE CDRW		0xa602	CD R/W
--- usbdevs.h.orig	2004-07-03 11:09:38.000000000 +0000
+++ usbdevs.h	2004-07-03 11:13:12.000000000 +0000
@@ -1,4 +1,6 @@
 /*
+ *	$DragonFly$
+ *
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  */
@@ -38,9 +40,9 @@
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/dev/usb/usbdevs.h,v 1.157 2003/12/19 12:21:11 sanpei Exp $
- * $DragonFly: src/sys/bus/usb/usbdevs.h,v 1.5 2003/12/30 01:01:44 dillon Exp $
- */
+ * $FreeBSD: src/sys/dev/usb/usbdevs,v 1.11.2.50 2003/12/22 07:52:56 sanpei Exp $
+ * $DragonFly: src/sys/bus/usb/usbdevs,v 1.5 2003/12/30 01:01:44 dillon Exp $
+$FreeBSD: src/sys/dev/usb/usbdevs,v 1.149 2003/12/19 12:19:12 sanpei Exp $
 
 /*
  * List of known USB vendors
@@ -117,6 +119,7 @@
 #define	USB_VENDOR_CONNECTIX	0x0478		/* Connectix */
 #define	USB_VENDOR_KENSINGTON	0x047d		/* Kensington */
 #define	USB_VENDOR_LUCENT	0x047e		/* Lucent */
+#define	USB_VENDOR_KYOCERA	0x0482		/* Kyocera Corp. */
 #define	USB_VENDOR_STMICRO	0x0483		/* STMicroelectronics */
 #define	USB_VENDOR_YAMAHA	0x0499		/* YAMAHA */
 #define	USB_VENDOR_COMPAQ	0x049f		/* Compaq Computers */
@@ -819,6 +822,9 @@
 #define	USB_PRODUCT_KYE_FLIGHT2000	0x1004		/* Flight 2000 joystick */
 #define	USB_PRODUCT_KYE_VIVIDPRO	0x2001		/* ColorPage Vivid-Pro scanner */
 
+/* Kyocera products */
+#define	USB_PRODUCT_KYOCERA_AHK3001V	0x203		/* AH-K3001V */
+
 /* LaCie products */
 #define	USB_PRODUCT_LACIE_HD	0xa601		/* Hard Disk */
 #define	USB_PRODUCT_LACIE_CDRW	0xa602		/* CD R/W */
--- usbdevs_data.h.orig	2004-07-03 11:10:30.000000000 +0000
+++ usbdevs_data.h	2004-07-03 11:13:12.000000000 +0000
@@ -1,4 +1,6 @@
 /*
+ *	$DragonFly$
+ *
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  */
@@ -38,9 +40,9 @@
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/dev/usb/usbdevs,v 1.149 2003/12/19 12:19:12 sanpei Exp $
- * $DragonFly: src/sys/bus/usb/usbdevs_data.h,v 1.5 2003/12/30 01:01:44 dillon Exp $
- */
+ * $FreeBSD: src/sys/dev/usb/usbdevs,v 1.11.2.50 2003/12/22 07:52:56 sanpei Exp $
+ * $DragonFly: src/sys/bus/usb/usbdevs,v 1.5 2003/12/30 01:01:44 dillon Exp $
+$FreeBSD: src/sys/dev/usb/usbdevs,v 1.149 2003/12/19 12:19:12 sanpei Exp $
 
 /*
  * List of known USB vendors
@@ -1634,6 +1636,12 @@
 	    "ColorPage Vivid-Pro scanner",
 	},
 	{
+	    USB_VENDOR_KYOCERA, USB_PRODUCT_KYOCERA_AHK3001V,
+	    0,
+	    "Kyocera Corp.",
+	    "AH-K3001V",
+	},
+	{
 	    USB_VENDOR_LACIE, USB_PRODUCT_LACIE_HD,
 	    0,
 	    "LaCie",
@@ -3470,6 +3478,12 @@
 	    NULL,
 	},
 	{
+	    USB_VENDOR_KYOCERA, 0,
+	    USB_KNOWNDEV_NOPROD,
+	    "Kyocera Corp.",
+	    NULL,
+	},
+	{
 	    USB_VENDOR_STMICRO, 0,
 	    USB_KNOWNDEV_NOPROD,
 	    "STMicroelectronics",


[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]