kern/66779: NEW USB device: AH-K3001V

TOGAWA Satoshi toga at puyo.org
Mon May 17 15:40:14 PDT 2004


>Number:         66779
>Category:       kern
>Synopsis:       NEW USB device: AH-K3001V
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon May 17 15:40:08 PDT 2004
>Closed-Date:
>Last-Modified:
>Originator:     Togawa Satoshi
>Release:        FreeBSD 5.2-CURRENT i386
>Organization:
<organization of PR author (multiple lines)>
>Environment:
System: FreeBSD nayuki.vegalta.org 5.2-CURRENT FreeBSD 5.2-CURRENT #23: Sun May 16 22:24:46 JST 2004 togawa at nayuki.vegalta.org:/usr/obj/usr/src/sys/NAYUKI i386


	<machine, os, target, libraries (multiple lines)>
>Description:
	New USB device, Kyocera AH-K3001V (cellular phone in Japan) has
	released.

	Its bInterfaceSubClass is 0x88 (not UISUBCLASS_ABSTRACT_CONTROL_MODEL).
	But when ignoring bInterfaceSubClass, I can use this with umodem.ko.

>How-To-Repeat:
	1. kldload umodem.ko.
	2. connect AH-K3001V to USB port.

>Fix:
	Apply this patch. And when device is AH-K3001V, USB_MATCH in
	umodem.c returns UMATCH_VENDOR_PRODUCT.

--- usbdevs.orig	Thu May  6 04:39:24 2004
+++ usbdevs	Sat May 15 23:26:56 2004
@@ -112,6 +112,7 @@
 vendor CONNECTIX	0x0478	Connectix
 vendor KENSINGTON	0x047d	Kensington
 vendor LUCENT		0x047e	Lucent
+vendor KYOCERA		0x0482	Kyocera
 vendor STMICRO		0x0483	STMicroelectronics
 vendor YAMAHA		0x0499	YAMAHA
 vendor COMPAQ		0x049f	Compaq Computers
@@ -856,6 +857,9 @@
 product KYE NETSCROLL		0x0003	Genius NetScroll mouse
 product KYE FLIGHT2000		0x1004	Flight 2000 joystick
 product KYE VIVIDPRO		0x2001	ColorPage Vivid-Pro scanner
+
+/* Kyocera products */
+product KYOCERA MODEM		0x0203	Modem
 
 /* LaCie products */
 product LACIE HD		0xa601	Hard Disk
--- umodem.c.orig	Sat May 15 23:30:21 2004
+++ umodem.c	Sun May 16 00:16:41 2004
@@ -115,6 +115,16 @@
 #endif
 #define DPRINTF(x) DPRINTFN(0, x)
 
+Static const struct modem_quirk {
+	u_int16_t	vendor;
+	u_int16_t	product;
+	u_int8_t	interface;
+} modem_quirks[] = {
+	/* Kyocera AH-K3001V*/
+	{ USB_VENDOR_KYOCERA, USB_PRODUCT_KYOCERA_MODEM, 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
@@ -213,25 +223,43 @@
 {
 	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 ; modem_quirks[i].vendor != 0 ; i++) {
+		if (modem_quirks[i].vendor == UGETW(dd->idVendor) &&
+		    modem_quirks[i].product == UGETW(dd->idProduct) &&
+		    modem_quirks[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.h.orig	Sun May 16 01:35:41 2004
+++ usbdevs.h	Sun May 16 01:36:35 2004
@@ -1,4 +1,4 @@
-/* $FreeBSD: src/sys/dev/usb/usbdevs.h,v 1.184 2004/05/05 19:40:02 joe Exp $ */
+/* $FreeBSD$ */
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
@@ -119,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 */
 #define	USB_VENDOR_STMICRO	0x0483		/* STMicroelectronics */
 #define	USB_VENDOR_YAMAHA	0x0499		/* YAMAHA */
 #define	USB_VENDOR_COMPAQ	0x049f		/* Compaq Computers */
@@ -863,6 +864,9 @@
 #define	USB_PRODUCT_KYE_NETSCROLL	0x0003		/* Genius NetScroll mouse */
 #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_MODEM	0x0203		/* Modem */
 
 /* LaCie products */
 #define	USB_PRODUCT_LACIE_HD	0xa601		/* Hard Disk */
--- usbdevs_data.h.orig	Sun May 16 01:35:49 2004
+++ usbdevs_data.h	Sun May 16 01:36:35 2004
@@ -1,4 +1,4 @@
-/* $FreeBSD: src/sys/dev/usb/usbdevs_data.h,v 1.184 2004/05/05 19:40:03 joe Exp $ */
+/* $FreeBSD$ */
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
@@ -1744,6 +1744,12 @@
 	    "ColorPage Vivid-Pro scanner",
 	},
 	{
+	    USB_VENDOR_KYOCERA, USB_PRODUCT_KYOCERA_MODEM,
+	    0,
+	    "Kyocera",
+	    "Modem",
+	},
+	{
 	    USB_VENDOR_LACIE, USB_PRODUCT_LACIE_HD,
 	    0,
 	    "LaCie",
@@ -3679,6 +3685,12 @@
 	    USB_VENDOR_LUCENT, 0,
 	    USB_KNOWNDEV_NOPROD,
 	    "Lucent",
+	    NULL,
+	},
+	{
+	    USB_VENDOR_KYOCERA, 0,
+	    USB_KNOWNDEV_NOPROD,
+	    "Kyocera",
 	    NULL,
 	},
 	{


-- 
toga at puyo.org
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list