diff options
-rw-r--r-- | share/man/man4/Makefile | 4 | ||||
-rw-r--r-- | share/man/man4/umsm.4 | 95 | ||||
-rw-r--r-- | share/man/man4/usb.4 | 5 | ||||
-rw-r--r-- | sys/dev/usb/files.usb | 7 | ||||
-rw-r--r-- | sys/dev/usb/umsm.c | 190 |
5 files changed, 297 insertions, 4 deletions
diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index a204ee9c3f2..42d255f395c 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.346 2006/03/08 17:45:19 grange Exp $ +# $OpenBSD: Makefile,v 1.347 2006/03/24 10:31:21 jsg Exp $ MAN= aac.4 ac97.4 acphy.4 acpi.4 acpihpet.4 acpitimer.4 \ adc.4 addcom.4 admcts.4 admlc.4 admtemp.4 \ @@ -38,7 +38,7 @@ MAN= aac.4 ac97.4 acphy.4 acpi.4 acpihpet.4 acpitimer.4 \ tlphy.4 tqphy.4 trm.4 trunk.4 tsl.4 tty.4 tun.4 twe.4 txp.4 \ txphy.4 uaudio.4 ubsa.4 ubsec.4 ubt.4 ucom.4 udav.4 udp.4 udsbr.4 \ ueagle.4 uftdi.4 ugen.4 uhci.4 uhid.4 uhidev.4 uipaq.4 uk.4 ukbd.4 \ - ukphy.4 ulpt.4 umass.4 umct.4 umidi.4 umodem.4 ums.4 \ + ukphy.4 ulpt.4 umass.4 umct.4 umidi.4 umodem.4 ums.4 umsm.4 \ unix.4 upl.4 uplcom.4 urio.4 url.4 urlphy.4 usb.4 \ uscanner.4 usscanner.4 uvisor.4 uvscom.4 uyap.4 vga.4 vgafb.4 vge.4 \ viaenv.4 viapm.4 viasio.4 vic.4 vlan.4 vnd.4 vr.4 watchdog.4 wb.4 \ diff --git a/share/man/man4/umsm.4 b/share/man/man4/umsm.4 new file mode 100644 index 00000000000..ded6c56e449 --- /dev/null +++ b/share/man/man4/umsm.4 @@ -0,0 +1,95 @@ +.\" $OpenBSD: umsm.4,v 1.1 2006/03/24 10:31:21 jsg Exp $ +.\" +.\" Copyright (c) 2006 Jonathan Gray <jsg@openbsd.org> +.\" +.\" Permission to use, copy, modify, and distribute this software for any +.\" purpose with or without fee is hereby granted, provided that the above +.\" copyright notice and this permission notice appear in all copies. +.\" +.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +.\" +.Dd March 24, 2006 +.Dt UMSM 4 +.Os +.Sh NAME +.Nm umsm +.Nd Qualcomm MSM EVDO modem driver +.Sh SYNOPSIS +.Cd "umsm* at uhub?" +.Cd "ucom* at uplcom?" +.Sh DESCRIPTION +The +.Nm +driver supports Qualcomm MSM based EVDO adapters. Typically +these are actually CardBus cards that incorporate a USB controller +with the actual device attached to it. +.Pp +The following devices known to work with the +.Nm +driver: +.Bd -literal -offset indent +Kyocera KPC650 +.Ed +.Pp +Devices suspected of being compatible are: +.Bd -literal -offset indent +Audiovox PC5740 +AirPrime PC5220 +Novatel Merlin V620 +Sierra Wireless AirCard 580 +.Ed +.Sh EXAMPLES +An example +.Pa /etc/ppp/ppp.conf +configuration for Verizon Wireless might look something like the below, +see +.Xr ppp 8 +for more information. +.Bd -literal -offset indent +default: + set device /dev/cuaU0 + set speed 230400 + set dial "ABORT BUSY ABORT NO\\\\sCARRIER TIMEOUT 5 \\ + \\"\\" AT OK-AT-OK ATE1Q0s7=60 OK \\\\dATDT\\\\T TIMEOUT 40 CONNECT" + set phone "#777" + set login + set authname 4517654321@vzw3g.com + set authkey vzw + set timeout 120 + set ifaddr 10.0.0.1/0 10.0.0.2/0 255.255.255.0 0.0.0.0 + add default HISADDR + enable dns +.Ed +.Pp +In this example the phone number is (451) 765-4321, replace this with +the number issued for the card or your phone's number if a handset is being +used. +.Sh SEE ALSO +.Xr ucom 4 , +.Xr uhub 4 , +.Xr usb 4 , +.Xr ppp 8 +.Sh HISTORY +The +.Nm +device driver first appeared in +.Ox 4.0 . +.Sh AUTHORS +.An -nosplit +The +.Nm +driver was written by +.An Jonathan Gray +.Aq jsg@openbsd.org +.Sh CAVEATS +For Verizon Wireless and possibly other services cards require a +one time activation before they will work, +.Nm +does not currently support this. +.Pp diff --git a/share/man/man4/usb.4 b/share/man/man4/usb.4 index 25379418f7f..8584f4d56aa 100644 --- a/share/man/man4/usb.4 +++ b/share/man/man4/usb.4 @@ -1,4 +1,4 @@ -.\" $OpenBSD: usb.4,v 1.53 2005/12/20 21:47:57 jmc Exp $ +.\" $OpenBSD: usb.4,v 1.54 2006/03/24 10:31:22 jsg Exp $ .\" $NetBSD: usb.4,v 1.15 1999/07/29 14:20:32 augustss Exp $ .\" .\" Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -171,6 +171,8 @@ MCT USB-RS232 serial adapters. Modems. .It Xr uplcom 4 Prolific PL-2303 serial adapters. +.It Xr umsm 4 +Qualcomm MSM EVDO modems .It Xr uvscom 4 SUNTAC Slipper U VS-10U serial adapters. .El @@ -555,6 +557,7 @@ Human Interface Devices .Xr umidi 4 , .Xr umodem 4 , .Xr ums 4 , +.Xr umsm 4 , .Xr upl 4 , .Xr uplcom 4 , .Xr ural 4 , diff --git a/sys/dev/usb/files.usb b/sys/dev/usb/files.usb index d5c5e9ef96a..d45f26d2bce 100644 --- a/sys/dev/usb/files.usb +++ b/sys/dev/usb/files.usb @@ -1,4 +1,4 @@ -# $OpenBSD: files.usb,v 1.50 2005/09/29 01:18:32 deraadt Exp $ +# $OpenBSD: files.usb,v 1.51 2006/03/24 10:31:22 jsg Exp $ # $NetBSD: files.usb,v 1.16 2000/02/14 20:29:54 augustss Exp $ # # Config file and device description for machine-independent USB code. @@ -202,6 +202,11 @@ device uipaq: ucombus attach uipaq at uhub file dev/usb/uipaq.c uipaq +# Qualcomm MSM EVDO +device umsm: ucombus +attach umsm at uhub +file dev/usb/umsm.c umsm + # Scanners # Generic scanner support device uscanner diff --git a/sys/dev/usb/umsm.c b/sys/dev/usb/umsm.c new file mode 100644 index 00000000000..c0d65e6e340 --- /dev/null +++ b/sys/dev/usb/umsm.c @@ -0,0 +1,190 @@ +/* $OpenBSD: umsm.c,v 1.1 2006/03/24 10:31:22 jsg Exp $ */ + +/* + * Copyright (c) 2006 Jonathan Gray <jsg@openbsd.org> + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/* Driver for Qualcomm MSM EVDO devices */ + +#include <sys/param.h> +#include <sys/systm.h> +#include <sys/kernel.h> +#include <sys/device.h> +#include <sys/conf.h> +#include <sys/tty.h> + +#include <dev/usb/usb.h> +#include <dev/usb/usbdi.h> +#include <dev/usb/usbdi_util.h> +#include <dev/usb/usbdevs.h> +#include <dev/usb/ucomvar.h> + +#define UMSMBUFSZ 2048 +#define UMSM_CONFIG_NO 0 +#define UMSM_IFACE_NO 0 + +struct umsm_softc { + USBBASEDEVICE sc_dev; + usbd_device_handle sc_udev; + usbd_interface_handle sc_iface; + device_ptr_t sc_subdev; + u_char sc_dying; +}; + +struct ucom_methods umsm_methods = { + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, +}; + +static const struct usb_devno umsm_devs[] = { + { USB_VENDOR_AUDIOVOX, USB_PRODUCT_AUDIOVOX_PC5740 }, + { USB_VENDOR_AIRPRIME, USB_PRODUCT_AIRPRIME_PC5220 }, + { USB_VENDOR_KYOCERA2, USB_PRODUCT_KYOCERA2_KPC650 }, + { USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_MERLINV620 }, + { USB_VENDOR_SIERRA, USB_PRODUCT_SIERRA_AIRCARD_580 }, +}; + +USB_DECLARE_DRIVER(umsm); + +USB_MATCH(umsm) +{ + USB_MATCH_START(umsm, uaa); + + if (uaa->iface != NULL) + return UMATCH_NONE; + + return (usb_lookup(umsm_devs, uaa->vendor, uaa->product) != NULL) ? + UMATCH_VENDOR_PRODUCT : UMATCH_NONE; +} + +USB_ATTACH(umsm) +{ + USB_ATTACH_START(umsm, sc, uaa); + struct ucom_attach_args uca; + usb_interface_descriptor_t *id; + usb_endpoint_descriptor_t *ed; + usbd_status error; + char *devinfop; + int i; + + bzero(&uca, sizeof(uca)); + sc->sc_udev = uaa->device; + devinfop = usbd_devinfo_alloc(uaa->device, 0); + USB_ATTACH_SETUP; + printf("%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop); + usbd_devinfo_free(devinfop); + + if (usbd_set_config_index(sc->sc_udev, UMSM_CONFIG_NO, 1) != 0) { + printf("%s: could not set configuration no\n", + USBDEVNAME(sc->sc_dev)); + sc->sc_dying = 1; + USB_ATTACH_ERROR_RETURN; + } + + /* get the first interface handle */ + error = usbd_device2interface_handle(sc->sc_udev, UMSM_IFACE_NO, + &sc->sc_iface); + if (error != 0) { + printf("%s: could not get interface handle\n", + USBDEVNAME(sc->sc_dev)); + sc->sc_dying = 1; + USB_ATTACH_ERROR_RETURN; + } + + id = usbd_get_interface_descriptor(sc->sc_iface); + + uca.bulkin = uca.bulkout = -1; + for (i = 0; i < id->bNumEndpoints; i++) { + ed = usbd_interface2endpoint_descriptor(sc->sc_iface, i); + if (ed == NULL) { + printf("%s: no endpoint descriptor found for %d\n", + USBDEVNAME(sc->sc_dev), i); + sc->sc_dying = 1; + USB_ATTACH_ERROR_RETURN; + } + + if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN && + UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) + uca.bulkin = ed->bEndpointAddress; + else if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_OUT && + UE_GET_XFERTYPE(ed->bmAttributes) == UE_BULK) + uca.bulkout = ed->bEndpointAddress; + } + if (uca.bulkin == -1 || uca.bulkout == -1) { + printf("%s: missing endpoint\n", USBDEVNAME(sc->sc_dev)); + sc->sc_dying = 1; + USB_ATTACH_ERROR_RETURN; + } + + /* We need to force size as some devices lie */ + uca.ibufsize = UMSMBUFSZ; + uca.obufsize = UMSMBUFSZ; + uca.ibufsizepad = UMSMBUFSZ; + uca.opkthdrlen = 0; + uca.device = sc->sc_udev; + uca.iface = sc->sc_iface; + uca.methods = &umsm_methods; + uca.arg = sc; + uca.info = NULL; + + usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev, + USBDEV(sc->sc_dev)); + + sc->sc_subdev = config_found_sm(self, &uca, ucomprint, ucomsubmatch); + + USB_ATTACH_SUCCESS_RETURN; +} + +USB_DETACH(umsm) +{ + USB_DETACH_START(umsm, sc); + int rv = 0; + + sc->sc_dying = 1; + if (sc->sc_subdev != NULL) { + rv = config_detach(sc->sc_subdev, flags); + sc->sc_subdev = NULL; + } + + usbd_add_drv_event(USB_EVENT_DRIVER_DETACH, sc->sc_udev, + USBDEV(sc->sc_dev)); + + return (rv); +} + +int +umsm_activate(device_ptr_t self, enum devact act) +{ + struct umsm_softc *sc = (struct umsm_softc *)self; + int rv = 0; + + switch (act) { + case DVACT_ACTIVATE: + return (EOPNOTSUPP); + + case DVACT_DEACTIVATE: + if (sc->sc_subdev != NULL) + rv = config_deactivate(sc->sc_subdev); + sc->sc_dying = 1; + break; + } + return (rv); +} |