Wireless CDMA cards for Verizon
Alexander Kurilovich
alexander_kurilovich at hotmail.com
Mon Jun 27 17:42:06 GMT 2005
Hi
Don't know why attachment couldn't go through.
So I put it in body:
Append to FILE: src/sys/dev/usb/usbdevs
vendor AIRPRIME 0x0f3d AirPrime, Incorporated
vendor NOVATEL 0x1410 Novatel
/* AirPrime products */
product AIRPRIME PC5220 0x0112 CDMA Wireless PC Card
/* Novatel products */
product NOVATEL PC620 0x1110 CDMA Wireless PC Card
Append to FILE: /etc/usbd.conf
device "Verizon wireless Airprime"
devname "ucom0"
vendor 0x0f3d
product 0x0112
#attach "/usr/sbin/pppctl /var/run/ppp/3g-ppp quit all;/usr/sbin/ppp
-auto 3g"
attach "/usr/sbin/ppp -auto 3g"
detach "/usr/sbin/pppctl /var/run/ppp/3g-ppp quit all"
device "Verizon wireless Novatel"
devname "ucom0"
vendor 0x1410
product 0x1110
#attach "/usr/sbin/pppctl /var/run/ppp/3g-ppp quit all;/usr/sbin/ppp
-auto 3g"
attach "/usr/sbin/ppp -auto 3g"
detach "/usr/sbin/pppctl /var/run/ppp/3g-ppp quit all"
Append to FILE: /etc/ppp/pppd.conf
3g:
set device /dev/ucom0
set speed 460800 # SPEED IS GOOD!
set phone \#777 # 1 refers to CID
# The chat script is a little bit different
set dial "ABORT BUSY ABORT NO\sCARRIER TIMEOUT 5 \
\"\" AT OK-AT-OK \
AT OK-AT-OK \\dATD\\T TIMEOUT 40 CONNECT"
enable dns
set authname wap
set authkey wap
accept PAP
set login
add default HISADDR
set ifaddr 10.0.0.1/0 10.0.0.2/0 0.0.0.0 0.0.0.0
disable ipv6cp
disable mppe
set reconnect 3 15
new FILE: src/sys/dev/usb/uveriz.c,v
#include <sys/cdefs.h>
__FBSDID("$FreeBSD: src/sys/dev/usb/uveriz.c,v 1.1 2005/06/08 12:44:09
akurilov Exp $");
#include "opt_uvscom.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
#include <sys/module.h>
#include <sys/fcntl.h>
#include <sys/conf.h>
#include <sys/tty.h>
#include <sys/file.h>
#if defined(__FreeBSD__)
#include <sys/bus.h>
#include <sys/ioccom.h>
#if __FreeBSD_version >= 500014
#include <sys/selinfo.h>
#else
#include <sys/select.h>
#endif
#else
#include <sys/ioctl.h>
#include <sys/device.h>
#endif
#include <sys/proc.h>
#include <sys/poll.h>
#include <sys/sysctl.h>
#include <sys/taskqueue.h>
#include <dev/usb/usb.h>
#include <dev/usb/usbcdc.h>
#include <dev/usb/usbdi.h>
#include <dev/usb/usbdi_util.h>
#include "usbdevs.h"
#include <dev/usb/usb_quirks.h>
#include <dev/usb/ucomvar.h>
/* */
#define uveriz_DEBUG 1
#ifdef uveriz_DEBUG
#define DPRINTF(x) if (uverizdebug) printf x
#define DPRINTFN(n,x) if (uverizdebug>(n)) printf x
int uverizdebug = 0;
#else
#define DPRINTF(x)
#define DPRINTFN(n,x)
#endif
struct uveriz_softc {
struct ucom_softc sc_ucom;
u_int16_t sc_flags;
};
#define UVERIZ_CONFIG_INDEX 0
#define UVERIZ_IFACE_INDEX 0
#define UVERIZ_MODVER 1
#define UVERIZ_BUFSIZE 1024
static const struct usb_devno uveriz_devs[] = {
{ USB_VENDOR_AIRPRIME, USB_PRODUCT_AIRPRIME_PC5220 },
{ USB_VENDOR_NOVATEL, USB_PRODUCT_NOVATEL_PC620 },
};
#define uveriz_lookup(v, p) usb_lookup(uveriz_devs, v, p)
Static void uveriz_close(void *, int);
struct ucom_callback uveriz_callback = {
NULL,
NULL,
NULL,
NULL,
NULL,
uveriz_close,
NULL,
NULL,
};
/*USB_DECLARE_DRIVER(uveriz);*/
Static device_probe_t uveriz_match;
Static device_attach_t uveriz_attach;
Static device_detach_t uveriz_detach;
Static device_method_t uveriz_methods[] = {
/* Device interface */
DEVMETHOD(device_probe, uveriz_match),
DEVMETHOD(device_attach, uveriz_attach),
DEVMETHOD(device_detach, uveriz_detach),
{ 0, 0 }
};
Static driver_t uveriz_driver = {
"ucom",
uveriz_methods,
sizeof (struct uveriz_softc)
};
DRIVER_MODULE(uveriz, uhub, uveriz_driver, ucom_devclass, usbd_driver_load,
0);
MODULE_DEPEND(uveriz, usb, 1, 1, 1);
MODULE_DEPEND(uveriz, ucom, UCOM_MINVER, UCOM_PREFVER, UCOM_MAXVER);
MODULE_VERSION(uveriz, UVERIZ_MODVER);
USB_MATCH(uveriz)
{
USB_MATCH_START(uveriz, uaa);
if (uaa->iface != NULL)
return (UMATCH_NONE);
DPRINTFN(20,("uveriz: vendor=0x%x, product=0x%x\n",
uaa->vendor, uaa->product));
return (uveriz_lookup(uaa->vendor, uaa->product) != NULL ?
UMATCH_VENDOR_PRODUCT : UMATCH_NONE);
}
USB_ATTACH(uveriz)
{
USB_ATTACH_START(uveriz, sc, uaa);
usbd_device_handle dev = uaa->device;
usbd_interface_handle iface;
usb_interface_descriptor_t *id;
usb_endpoint_descriptor_t *ed;
char *devinfo;
const char *devname;
int i;
usbd_status err;
struct ucom_softc *ucom;
devinfo = malloc(1024, M_USBDEV, M_WAITOK);
ucom = &sc->sc_ucom;
bzero(sc, sizeof (struct uveriz_softc));
usbd_devinfo(dev, 0, devinfo);
/*USB_ATTACH_SETUP;*/
ucom->sc_dev = self;
device_set_desc_copy(self, devinfo);
ucom->sc_udev = dev;
ucom->sc_iface = uaa->iface;
devname = USBDEVNAME(ucom->sc_dev);
printf("%s: %s\n", devname, devinfo);
DPRINTFN(10,("\nuveriz_attach: sc=%p\n", sc));
/* Move the device into the configured state. */
err = usbd_set_config_index(dev, UVERIZ_CONFIG_INDEX, 1);
if (err) {
printf("\n%s: failed to set configuration,
err=%s\n",
devname, usbd_errstr(err));
goto bad;
}
err = usbd_device2interface_handle(dev, UVERIZ_IFACE_INDEX,
&iface);
if (err) {
printf("\n%s: failed to get interface, err=%s\n",
devname, usbd_errstr(err));
goto bad;
}
printf("%s: %s\n", devname, devinfo);
/*sc->sc_flags = uveriz_lookup(uaa->vendor,
uaa->product)->uv_flags;*/
id = usbd_get_interface_descriptor(iface);
ucom->sc_udev = dev;
ucom->sc_iface = iface;
ucom->sc_bulkin_no = ucom->sc_bulkout_no = -1;
for (i = 0; i < id->bNumEndpoints; i++) {
int addr, dir, attr;
ed = usbd_interface2endpoint_descriptor(iface, i);
if (ed == NULL) {
printf("%s: could not read endpoint
descriptor"
": %s\n", devname,
usbd_errstr(err));
goto bad;
}
addr = ed->bEndpointAddress;
dir = UE_GET_DIR(ed->bEndpointAddress);
attr = ed->bmAttributes & UE_XFERTYPE;
if (dir == UE_DIR_IN && attr == UE_BULK)
ucom->sc_bulkin_no = addr;
else if (dir == UE_DIR_OUT && attr == UE_BULK)
ucom->sc_bulkout_no = addr;
else if (attr == UE_INTERRUPT) {
printf("interrupt\n");
}
else {
printf("%s: unexpected endpoint(%d
%d)\n", devname, dir, attr);
goto bad;
}
}
if (ucom->sc_bulkin_no == -1) {
printf("%s: Could not find data bulk in\n",
USBDEVNAME(ucom->sc_dev));
goto bad;
}
if (ucom->sc_bulkout_no == -1) {
printf("%s: Could not find data bulk out\n",
USBDEVNAME(ucom->sc_dev));
goto bad;
}
ucom->sc_parent = sc;
ucom->sc_portno = UCOM_UNK_PORTNO;
/* bulkin, bulkout set above */
ucom->sc_ibufsize = UVERIZ_BUFSIZE;
ucom->sc_obufsize = UVERIZ_BUFSIZE;
ucom->sc_ibufsizepad = UVERIZ_BUFSIZE;
ucom->sc_opkthdrlen = 0;
ucom->sc_callback = &uveriz_callback;
if (err) {
printf("%s: init failed, %s\n",
USBDEVNAME(ucom->sc_dev),
usbd_errstr(err));
goto bad;
}
usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, ucom->sc_udev,
USBDEV(ucom->sc_dev));
DPRINTF(("uveriz: in=0x%x out=0x%x\n", ucom->sc_bulkin_no,
ucom->sc_bulkout_no));
ucom_attach(&sc->sc_ucom);
USB_ATTACH_SUCCESS_RETURN;
bad:
DPRINTF(("uveriz_attach: ATTACH ERROR\n"));
ucom->sc_dying = 1;
USB_ATTACH_ERROR_RETURN;
}
/*
int
uveriz_activate(device_ptr_t self, enum devact act)
{
struct uveriz_softc *sc = (struct uveriz_softc *)self;
int rv = 0;
switch (act) {
case DVACT_ACTIVATE:
return (EOPNOTSUPP);
break;
case DVACT_DEACTIVATE:
sc->sc_dying = 1;
if (sc->sc_subdev)
rv = config_deactivate(sc->sc_subdev);
break;
}
return (rv);
}*/
USB_DETACH(uveriz)
{
USB_DETACH_START(uveriz, sc);
int rv = 0;
DPRINTF(("uveriz_detach: sc=%p\n", sc));
sc->sc_ucom.sc_dying = 1;
rv = ucom_detach(&sc->sc_ucom);
usbd_add_drv_event(USB_EVENT_DRIVER_DETACH, sc->sc_ucom.sc_udev,
USBDEV(sc->sc_ucom.sc_dev));
return (rv);
}
void
uveriz_close(void *addr, int portno)
{
/*struct uvisor_softc *sc = addr;
usb_device_request_t req;
struct uveriz_connection_info coninfo;
int actlen;
if (sc->sc_ucom.sc_dying)
return;
req.bmRequestType = UT_READ_VENDOR_ENDPOINT;
req.bRequest = UVISOR_CLOSE_NOTIFICATION;
USETW(req.wValue, 0);
USETW(req.wIndex, 0);
USETW(req.wLength, UVISOR_CONNECTION_INFO_SIZE);
(void)usbd_do_request_flags(sc->sc_ucom.sc_udev, &req, &coninfo,
USBD_SHORT_XFER_OK,
&actlen,
USBD_DEFAULT_TIMEOUT);*/
}
Best regards.
Alexander Kurilovich
_____
From: Alexander Kurilovich [mailto:alexander_kurilovich at hotmail.com]
Sent: Friday, June 24, 2005 3:34 PM
To: 'freebsd-hackers at freebsd.org'
Subject: Wireless CDMA cards for Verizon
Hi
I've implemented 2 PCMCI wireless CDMA-3G cards from Verizon. I use them via
'ppp' using 'ucom'.
It might be helpful for somebody. Code, ppp.conf and usbd.conf in attached
file.
Alexander Kurilovich
More information about the freebsd-hackers
mailing list