summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authoritohy <itohy@NetBSD.org>2005-04-15 17:18:18 +0000
committeritohy <itohy@NetBSD.org>2005-04-15 17:18:18 +0000
commit0ee992857f7b17b6cc8d9dadcf669c2cb99e7594 (patch)
treeef882f2ba93041cd2e53c37b47d5d3519cbfae68 /sys/dev
parent9f184f48a4d302995cfa9f6175b2ecacbfd3542a (diff)
ukyopon(4): Kyocera AIR-EDGE PHONE driver
Close NetBSD PR #25954 in a different way.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/DEVNAMES4
-rw-r--r--sys/dev/usb/Makefile4
-rw-r--r--sys/dev/usb/files.usb7
-rw-r--r--sys/dev/usb/ukyopon.c196
-rw-r--r--sys/dev/usb/ukyopon.h58
5 files changed, 265 insertions, 4 deletions
diff --git a/sys/dev/DEVNAMES b/sys/dev/DEVNAMES
index 7ffeff1a1c8..ebbd186f019 100644
--- a/sys/dev/DEVNAMES
+++ b/sys/dev/DEVNAMES
@@ -1,4 +1,4 @@
-# $NetBSD: DEVNAMES,v 1.177 2005/04/03 11:40:09 jdolecek Exp $
+# $NetBSD: DEVNAMES,v 1.178 2005/04/15 17:18:18 itohy Exp $
#
# This file contains all used device names and defined attributes in
# alphabetical order. New devices added to the system somewhere should first
@@ -1229,11 +1229,13 @@ uk MI
ukbd MI
ukphy MI
ukphy_subr MI Attribute
+ukyopon MI
ulpt MI
umass MI
umct MI
umidi MI
umodem MI
+umodem_common MI Attribute
ums MI
uninorth macppc
univ_pci MI Attribute
diff --git a/sys/dev/usb/Makefile b/sys/dev/usb/Makefile
index c149403ea76..689b5971bc5 100644
--- a/sys/dev/usb/Makefile
+++ b/sys/dev/usb/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.5 2002/04/12 17:56:14 heinz Exp $
+# $NetBSD: Makefile,v 1.6 2005/04/15 17:18:18 itohy Exp $
# use 'make -f Makefile.usbdevs' to make usbdevs.h and usbdevs_data.h
# _after_ you committed usbdevs. See comment in Makefile.usbdevs
@@ -6,6 +6,6 @@
INCSDIR= /usr/include/dev/usb
# Only install includes which are used by userland
-INCS= urio.h usb.h usbhid.h
+INCS= ukyopon.h urio.h usb.h usbhid.h
.include <bsd.kinc.mk>
diff --git a/sys/dev/usb/files.usb b/sys/dev/usb/files.usb
index 50415c85604..7a497ebb26a 100644
--- a/sys/dev/usb/files.usb
+++ b/sys/dev/usb/files.usb
@@ -1,4 +1,4 @@
-# $NetBSD: files.usb,v 1.59 2005/04/15 14:14:09 itohy Exp $
+# $NetBSD: files.usb,v 1.60 2005/04/15 17:18:18 itohy Exp $
#
# Config file and device description for machine-independent USB code.
# Included by ports that need it. Ports that use it must provide
@@ -226,6 +226,11 @@ device ubsa: ucombus
attach ubsa at uhub
file dev/usb/ubsa.c ubsa
+# Kyocera AIR-EDGE PHONE
+device ukyopon: ucombus, umodem_common
+attach ukyopon at uhub
+file dev/usb/ukyopon.c ukyopon
+
# Scanners
# Generic scanner support
diff --git a/sys/dev/usb/ukyopon.c b/sys/dev/usb/ukyopon.c
new file mode 100644
index 00000000000..278a51191c0
--- /dev/null
+++ b/sys/dev/usb/ukyopon.c
@@ -0,0 +1,196 @@
+/* $NetBSD: ukyopon.c,v 1.1 2005/04/15 17:18:18 itohy Exp $ */
+
+/*
+ * Copyright (c) 1998, 2005 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Lennart Augustsson (lennart@augustsson.net) at
+ * Carlstedt Research & Technology.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by ITOH Yasufumi.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: ukyopon.c,v 1.1 2005/04/15 17:18:18 itohy Exp $");
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/ioctl.h>
+#include <sys/conf.h>
+#include <sys/tty.h>
+#include <sys/file.h>
+#include <sys/select.h>
+#include <sys/proc.h>
+#include <sys/vnode.h>
+#include <sys/device.h>
+#include <sys/poll.h>
+
+#include <machine/bus.h>
+
+#include <dev/usb/usb.h>
+#include <dev/usb/usbcdc.h>
+
+#include <dev/usb/usbdi.h>
+#include <dev/usb/usbdi_util.h>
+#include <dev/usb/usbdivar.h>
+#include <dev/usb/usbdevs.h>
+#include <dev/usb/usb_quirks.h>
+
+#include <dev/usb/usbdevs.h>
+#include <dev/usb/ucomvar.h>
+#include <dev/usb/umodemvar.h>
+#include <dev/usb/ukyopon.h>
+
+#ifdef UKYOPON_DEBUG
+#define DPRINTFN(n, x) if (ukyopondebug > (n)) logprintf x
+int ukyopondebug = 0;
+#else
+#define DPRINTFN(n, x)
+#endif
+#define DPRINTF(x) DPRINTFN(0, x)
+
+struct ukyopon_softc {
+ /* generic umodem device */
+ struct umodem_softc sc_umodem;
+
+ /* ukyopon addition */
+ enum ukyopon_port sc_porttype;
+};
+
+#define UKYOPON_MODEM_IFACE_INDEX 0
+#define UKYOPON_DATA_IFACE_INDEX 3
+
+Static int ukyopon_ioctl(void *, int, u_long, caddr_t, int, usb_proc_ptr);
+
+Static struct ucom_methods ukyopon_methods = {
+ umodem_get_status,
+ umodem_set,
+ umodem_param,
+ ukyopon_ioctl,
+ umodem_open,
+ umodem_close,
+ NULL,
+ NULL,
+};
+
+USB_DECLARE_DRIVER(ukyopon);
+
+USB_MATCH(ukyopon)
+{
+ USB_MATCH_START(ukyopon, uaa);
+ usb_device_descriptor_t *dd;
+ usb_interface_descriptor_t *id;
+
+ if (uaa->iface == NULL)
+ return (UMATCH_NONE);
+
+ id = usbd_get_interface_descriptor(uaa->iface);
+ dd = usbd_get_device_descriptor(uaa->device);
+ if (id == NULL || dd == NULL)
+ return (UMATCH_NONE);
+
+ if (UGETW(dd->idVendor) == USB_VENDOR_KYOCERA &&
+ UGETW(dd->idProduct) == USB_PRODUCT_KYOCERA_AHK3001V &&
+ (uaa->ifaceno == UKYOPON_MODEM_IFACE_INDEX ||
+ uaa->ifaceno == UKYOPON_DATA_IFACE_INDEX))
+ return (UMATCH_VENDOR_PRODUCT);
+
+ return (UMATCH_NONE);
+}
+
+USB_ATTACH(ukyopon)
+{
+ USB_ATTACH_START(ukyopon, sc, uaa);
+ struct ucom_attach_args uca;
+
+ sc->sc_porttype = (uaa->ifaceno == UKYOPON_MODEM_IFACE_INDEX) ?
+ UKYOPON_PORT_MODEM : UKYOPON_PORT_DATA;
+
+ uca.portno = UCOM_UNK_PORTNO;
+ uca.methods = &ukyopon_methods;
+ uca.info = (uaa->ifaceno == UKYOPON_MODEM_IFACE_INDEX) ?
+ "modem port" : "data transfer port";
+
+ if (umodem_common_attach(self, &sc->sc_umodem, uaa, &uca))
+ USB_ATTACH_ERROR_RETURN;
+ USB_ATTACH_SUCCESS_RETURN;
+}
+
+Static int
+ukyopon_ioctl(void *addr, int portno, u_long cmd, caddr_t data, int flag,
+ usb_proc_ptr p)
+{
+ struct ukyopon_softc *sc = addr;
+ struct ukyopon_identify *arg_id = (void*)data;
+ int error = 0;
+
+ switch (cmd) {
+ case UKYOPON_IDENTIFY:
+ strncpy(arg_id->ui_name, UKYOPON_NAME, sizeof arg_id->ui_name);
+ arg_id->ui_busno =
+ USBDEVUNIT(*(device_ptr_t)sc->sc_umodem.sc_udev->bus->usbctl);
+ arg_id->ui_address = sc->sc_umodem.sc_udev->address;
+ arg_id->ui_model = UKYOPON_MODEL_UNKNOWN;
+ arg_id->ui_porttype = sc->sc_porttype;
+ break;
+
+ default:
+ error = umodem_ioctl(addr, portno, cmd, data, flag, p);
+ break;
+ }
+
+ return (error);
+}
+
+#ifdef __strong_alias
+__strong_alias(ukyopon_activate,umodem_common_activate)
+#else
+int
+ukyopon_activate(device_ptr_t self, enum devact act)
+{
+ struct ukyopon_softc *sc = (struct ukyopon_softc *)self;
+
+ return umodem_common_activate(&sc->sc_umodem, act);
+}
+#endif
+
+USB_DETACH(ukyopon)
+{
+ USB_DETACH_START(ukyopon, sc);
+#ifdef __FreeBSD__
+ int flags = 0;
+#endif
+
+ return umodem_common_detach(&sc->sc_umodem, flags);
+}
diff --git a/sys/dev/usb/ukyopon.h b/sys/dev/usb/ukyopon.h
new file mode 100644
index 00000000000..b885f135631
--- /dev/null
+++ b/sys/dev/usb/ukyopon.h
@@ -0,0 +1,58 @@
+/* $NetBSD: ukyopon.h,v 1.1 2005/04/15 17:18:18 itohy Exp $ */
+
+/*-
+ * Copyright (c) 2005 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by ITOH Yasufumi.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+struct ukyopon_identify {
+ char ui_name[16]; /* driver name */
+
+ int ui_busno; /* usb bus number */
+ uint8_t ui_address; /* device address */
+
+ enum ukyopon_model {
+ UKYOPON_MODEL_UNKNOWN
+ /* , UKYOPON_MODEL_AHK3001V, ... */
+ } ui_model; /* possibly future use */
+ enum ukyopon_port {
+ UKYOPON_PORT_UNKNOWN,
+ UKYOPON_PORT_MODEM, /* modem port */
+ UKYOPON_PORT_DATA /* data transfer port */
+ } ui_porttype; /* port type */
+ int ui_rsvd1, ui_rsvd2;
+};
+
+#define UKYOPON_NAME "ukyopon"
+#define UKYOPON_IDENTIFY _IOR ('U', 210, struct ukyopon_identify)