From owner-freebsd-hackers@FreeBSD.ORG Mon Jun 27 17:42:06 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 21CAB16A41C for ; Mon, 27 Jun 2005 17:42:06 +0000 (GMT) (envelope-from alexander_kurilovich@hotmail.com) Received: from hotmail.com (bay13-dav3.bay13.hotmail.com [64.4.31.177]) by mx1.FreeBSD.org (Postfix) with ESMTP id D41FC43D1F for ; Mon, 27 Jun 2005 17:42:05 +0000 (GMT) (envelope-from alexander_kurilovich@hotmail.com) Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Mon, 27 Jun 2005 10:42:05 -0700 Message-ID: Received: from 66.174.76.201 by BAY13-DAV3.phx.gbl with DAV; Mon, 27 Jun 2005 17:42:05 +0000 X-Originating-IP: [66.174.76.201] X-Originating-Email: [alexander_kurilovich@hotmail.com] X-Sender: alexander_kurilovich@hotmail.com From: "Alexander Kurilovich" To: Date: Mon, 27 Jun 2005 13:40:40 -0400 MIME-Version: 1.0 X-Mailer: Microsoft Office Outlook, Build 11.0.6353 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527 Thread-Index: AcV486knGyLVIKQhQfGrgRQByAo9VwBosyPQ In-Reply-To: X-OriginalArrivalTime: 27 Jun 2005 17:42:05.0764 (UTC) FILETIME=[88C42840:01C57B3F] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: RE: Wireless CDMA cards for Verizon X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Jun 2005 17:42:06 -0000 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 __FBSDID("$FreeBSD: src/sys/dev/usb/uveriz.c,v 1.1 2005/06/08 12:44:09 akurilov Exp $"); #include "opt_uvscom.h" #include #include #include #include #include #include #include #include #include #if defined(__FreeBSD__) #include #include #if __FreeBSD_version >= 500014 #include #else #include #endif #else #include #include #endif #include #include #include #include #include #include #include #include #include "usbdevs.h" #include #include /* */ #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@hotmail.com] Sent: Friday, June 24, 2005 3:34 PM To: 'freebsd-hackers@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