From owner-p4-projects@FreeBSD.ORG Thu Jul 5 00:51:47 2007 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 3F19F16A46C; Thu, 5 Jul 2007 00:51:47 +0000 (UTC) X-Original-To: perforce@FreeBSD.org Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 10BCA16A468 for ; Thu, 5 Jul 2007 00:51:47 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41]) by mx1.freebsd.org (Postfix) with ESMTP id 0121F13C46A for ; Thu, 5 Jul 2007 00:51:47 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.8/8.13.8) with ESMTP id l650pkqg067988 for ; Thu, 5 Jul 2007 00:51:46 GMT (envelope-from rpaulo@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.8/8.13.8/Submit) id l650pkam067985 for perforce@freebsd.org; Thu, 5 Jul 2007 00:51:46 GMT (envelope-from rpaulo@FreeBSD.org) Date: Thu, 5 Jul 2007 00:51:46 GMT Message-Id: <200707050051.l650pkam067985@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to rpaulo@FreeBSD.org using -f From: Rui Paulo To: Perforce Change Reviews Cc: Subject: PERFORCE change 122895 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Jul 2007 00:51:47 -0000 http://perforce.freebsd.org/chv.cgi?CH=122895 Change 122895 by rpaulo@rpaulo_epsilon on 2007/07/05 00:51:41 Backout previous. Affected files ... .. //depot/projects/soc2007/rpaulo-macbook/dev/usb/atp.c#5 edit Differences ... ==== //depot/projects/soc2007/rpaulo-macbook/dev/usb/atp.c#5 (text+ko) ==== @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $P4: //depot/projects/soc2007/rpaulo-macbook/dev/usb/atp.c#4 $ + * $P4: //depot/projects/soc2007/rpaulo-macbook/dev/usb/atp.c#5 $ */ #include @@ -71,10 +71,6 @@ static int atp_attach(device_t); static int atp_detach(device_t); -static int atp_enable(device_t); -static int atp_disable(device_t); -static void atp_intr(usbd_xfer_handle, usbd_private_handle, usbd_status); - /* * char device interface. */ @@ -97,19 +93,7 @@ struct atp_softc { device_t sc_dev; - int sc_enabled; - - u_char *sc_ibuf; - int sc_isize; - usbd_interface_handle sc_iface; /* interface */ - usbd_pipe_handle sc_intrpipe; /* interrupt pipe */ - int sc_ep_addr; - - mousehw_t hw; - mousemode_t mode; - mousestatus_t status; - struct cdev *dev; /* specfs */ }; static device_method_t atp_methods[] = { @@ -185,116 +169,17 @@ static int atp_attach(device_t self) { - struct atp_softc *sc = device_get_softc(self); - struct usb_attach_arg *uaa = device_get_ivars(self); - usbd_interface_handle iface = uaa->iface; - usb_interface_descriptor_t *id; - usb_endpoint_descriptor_t *ed; - usbd_status err; - int size; - void *desc; - uint32_t flags; - - - struct hid_location a; - - sc->sc_dev = self; - - id = usbd_get_interface_descriptor(iface); - ed = usbd_interface2endpoint_descriptor(iface, 0); - if (!ed) { - printf("%s: could not read endpoint descriptor\n", - device_get_nameunit(sc->sc_dev)); - return (ENXIO); - } - - if (UE_GET_DIR(ed->bEndpointAddress) != UE_DIR_IN || - UE_GET_XFERTYPE(ed->bmAttributes) != UE_INTERRUPT) { - printf("%s: unexpected endpoint\n", - device_get_nameunit(sc->sc_dev)); - return (ENXIO); - } - - err = usbd_read_report_desc(uaa->iface, &desc, &size, M_TEMP); - if (err) - return (ENXIO); - - hid_locate(desc, size, 1, hid_input, &a, &flags); - - /* Equal to ums(4). */ - sc->hw.iftype = MOUSE_IF_USB; - sc->hw.type = MOUSE_MOUSE; - sc->hw.model = MOUSE_MODEL_GENERIC; - sc->hw.hwid = 0; - sc->mode.protocol = MOUSE_PROTO_MSC; - sc->mode.rate = -1; - sc->mode.resolution = MOUSE_RES_UNKNOWN; - sc->mode.accelfactor = 0; - sc->mode.level = 0; - sc->mode.packetsize = MOUSE_MSC_PACKETSIZE; - sc->mode.syncmask[0] = MOUSE_MSC_SYNCMASK; - sc->mode.syncmask[1] = MOUSE_MSC_SYNC; - - sc->dev = make_dev(&atp_cdevsw, device_get_unit(self), - UID_ROOT, GID_OPERATOR, - 0644, "atp%d", device_get_unit(self)); - - return 0; } static int atp_detach(device_t self) { - struct atp_softc *sc = device_get_softc(self); - destroy_dev(sc->dev); - return 0; } -static void -atp_intr(usbd_xfer_handle xfer, usbd_private_handle addr, usbd_status status) -{ - - -} - -static int -atp_enable(device_t self) -{ - struct atp_softc *sc = device_get_softc(self); - usbd_status err; - - sc->sc_enabled = 1; - - err = usbd_open_pipe_intr(sc->sc_iface, sc->sc_ep_addr, - USBD_SHORT_XFER_OK, &sc->sc_intrpipe, sc, - sc->sc_ibuf, sc->sc_isize, atp_intr, - USBD_DEFAULT_INTERVAL); - if (err) { - device_printf(self, "usb_open_pipe_intr failed with error=%d\n", - err); - sc->sc_enabled = 0; - return (EIO); - } - - return (0); -} - -static int -atp_disable(device_t self) -{ - struct atp_softc *sc = device_get_softc(self); - - /* Disable interrupts. */ - usbd_abort_pipe(sc->sc_intrpipe); - usbd_close_pipe(sc->sc_intrpipe); - - sc->sc_enabled = 0; -} - static int atp_open(struct cdev *dev, int flag, int fmt, struct thread *p) {