ukyopon(4): Kyocera AIR-EDGE PHONE driver

Close NetBSD PR #25954 in a different way.
This commit is contained in:
itohy 2005-04-15 17:18:18 +00:00
parent 9f184f48a4
commit 0ee992857f
9 changed files with 421 additions and 8 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: mi,v 1.776 2005/04/04 20:38:24 christos Exp $
# $NetBSD: mi,v 1.777 2005/04/15 17:18:19 itohy Exp $
./etc/mtree/set.comp comp-sys-root
./usr/bin/addr2line comp-debug-bin bfd
./usr/bin/ar comp-util-bin bfd
@ -450,6 +450,7 @@
./usr/include/dev/tc/tcdsvar.h comp-obsolete obsolete
./usr/include/dev/tc/tcreg.h comp-obsolete obsolete
./usr/include/dev/tc/tcvar.h comp-obsolete obsolete
./usr/include/dev/usb/ukyopon.h comp-c-include
./usr/include/dev/usb/urio.h comp-c-include
./usr/include/dev/usb/usb.h comp-c-include
./usr/include/dev/usb/usbcdc.h comp-obsolete obsolete

View File

@ -1,4 +1,4 @@
# $NetBSD: mi,v 1.778 2005/04/12 14:47:08 jwise Exp $
# $NetBSD: mi,v 1.779 2005/04/15 17:18:19 itohy Exp $
./etc/mtree/set.man man-sys-root
./usr/share/info/am-utils.info man-amd-info info
./usr/share/info/as.info man-computil-info bfd,info
@ -1281,6 +1281,7 @@
./usr/share/man/cat4/uk.0 man-sys-catman .cat
./usr/share/man/cat4/ukbd.0 man-sys-catman .cat
./usr/share/man/cat4/ukphy.0 man-sys-catman .cat
./usr/share/man/cat4/ukyopon.0 man-sys-catman .cat
./usr/share/man/cat4/ulpt.0 man-sys-catman .cat
./usr/share/man/cat4/umass.0 man-sys-catman .cat
./usr/share/man/cat4/umct.0 man-sys-catman .cat
@ -3491,6 +3492,7 @@
./usr/share/man/man4/uk.4 man-sys-man .man
./usr/share/man/man4/ukbd.4 man-sys-man .man
./usr/share/man/man4/ukphy.4 man-sys-man .man
./usr/share/man/man4/ukyopon.4 man-sys-man .man
./usr/share/man/man4/ulpt.4 man-sys-man .man
./usr/share/man/man4/umass.4 man-sys-man .man
./usr/share/man/man4/umct.4 man-sys-man .man

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.353 2005/04/03 11:56:29 jdolecek Exp $
# $NetBSD: Makefile,v 1.354 2005/04/15 17:18:18 itohy Exp $
# @(#)Makefile 8.1 (Berkeley) 6/18/93
MAN= aac.4 acardide.4 aceride.4 acphy.4 adc.4 adv.4 \
@ -45,7 +45,7 @@ MAN= aac.4 acardide.4 aceride.4 acphy.4 adc.4 adv.4 \
# USB devices
MAN+= uaudio.4 ubsa.4 ucom.4 udsbr.4 uftdi.4 ugen.4 uhid.4 \
uhidev.4 uirda.4 ukbd.4 ulpt.4 \
uhidev.4 uirda.4 ukbd.4 ukyopon.4 ulpt.4 \
umass.4 umct.4 umidi.4 umodem.4 ums.4 uplcom.4 urio.4 usb.4 \
uscanner.4 usscanner.4 ustir.4 uvisor.4 uvscom.4 uyap.4 \
aue.4 atu.4 axe.4 cdce.4 cue.4 kue.4 upl.4 url.4 udav.4 \

149
share/man/man4/ukyopon.4 Normal file
View File

@ -0,0 +1,149 @@
.\" $NetBSD: ukyopon.4,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.
.\"
.Dd April 15, 2005
.Dt UKYOPON 4
.Os
.Sh NAME
.Nm ukyopon
.Nd Kyocera AIR-EDGE PHONE support
.Sh SYNOPSIS
.Cd "ukyopon* at uhub?"
.Cd "ucom* at ukyopon?"
.Pp
.In dev/usb/ukyopon.h
.Sh DESCRIPTION
The
.Nm
driver provides support for Kyocera AIR-EDGE PHONE AH-K3001V.
.Pp
Two units of this driver attach to an AIR-EDGE PHONE:
the modem port and the data transfer port.
The modem port is compatible to
.Xr umodem 4 ,
and can be used for dialup connections.
The data transfer port is for reading and writing internal storage
of AIR-EDGE PHONE.
.Pp
Each of the device is accessed through the
.Xr ucom 4
driver which makes it behave like a
.Xr tty 4 .
.Sh IOCTLS
The following
.Xr ioctl 2
calls apply to the
.Nm
device:
.Pp
.Bl -tag -width XXXXXX
.It Dv UKYOPON_IDENTIFY Fa struct ukyopon_identify
Read, from the kernel, the identification information of the device,
useful to assure that the opened device node is
a modem or a data transfer port of
.Nm
device.
.Bd -literal
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
} 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"
.Ed
.Pp
The
.Va ui_name
field contains the driver signature, and has the string
.Dv UKYOPON_NAME .
.Pp
The
.Va ui_busno
field contains the
.Xr usb 4
bus number to which the device is connected;
the
.Va ui_address
field contains the address of the device in the bus.
These fields are useful to identify the physical device
from the file descriptor.
.Pp
The
.Va ui_porttype
field contains the type of device:
.Dv UKYOPON_PORT_MODEM
means the device is associated to the modem port, and
.Dv UKYOPON_PORT_DATA
means the device is associated to the data transfer port.
.Pp
Other fields are reserved for future extension and cleared to zeros.
.El
.Pp
In addition,
.Nm
devices accept all
.Xr ioctl 2
calls that
.Xr umodem 4
accepts.
.Sh SEE ALSO
.Xr tty 4 ,
.Xr ucom 4 ,
.Xr umodem 4 ,
.Xr usb 4
.Sh HISTORY
The
.Nm
driver
appeared in
.Nx 1.6.3 .
.Sh NOTES
.Dq Kyopon
is a widely-used nickname of Kyocera AIR-EDGE PHONE.
.Sh BUGS
This driver currently supports only the first two ports,
and the third port is not supported.

View File

@ -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

View File

@ -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>

View File

@ -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

196
sys/dev/usb/ukyopon.c Normal file
View File

@ -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);
}

58
sys/dev/usb/ukyopon.h Normal file
View File

@ -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)