Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys remove xboxcontroller; use the uhidev driver instead
details: https://anonhg.NetBSD.org/src/rev/43ed9bb0d013
branches: trunk
changeset: 767784:43ed9bb0d013
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Sat Jul 30 12:19:12 2011 +0000
description:
remove xboxcontroller; use the uhidev driver instead
diffstat:
sys/arch/i386/conf/ALL | 8 +-
sys/arch/i386/conf/XBOX | 6 +-
sys/dev/usb/files.usb | 7 +-
sys/dev/usb/xboxcontroller.c | 339 -------------------------------------------
4 files changed, 4 insertions(+), 356 deletions(-)
diffs (truncated from 413 to 300 lines):
diff -r 2210d5c7971e -r 43ed9bb0d013 sys/arch/i386/conf/ALL
--- a/sys/arch/i386/conf/ALL Sat Jul 30 12:15:44 2011 +0000
+++ b/sys/arch/i386/conf/ALL Sat Jul 30 12:19:12 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.315 2011/07/23 21:12:58 jakllsch Exp $
+# $NetBSD: ALL,v 1.316 2011/07/30 12:19:12 jmcneill Exp $
# From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
#
# ALL machine description file
@@ -17,7 +17,7 @@
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
-#ident "ALL-$Revision: 1.315 $"
+#ident "ALL-$Revision: 1.316 $"
maxusers 64 # estimated number of users
@@ -1343,10 +1343,6 @@
udsbr* at uhub? port ?
radio* at udsbr?
-# XBOX controller
-xboxcontroller* at uhub? port ?
-wsmouse* at xboxcontroller? mux 0
-
# USB Generic driver
ugen* at uhub? port ?
diff -r 2210d5c7971e -r 43ed9bb0d013 sys/arch/i386/conf/XBOX
--- a/sys/arch/i386/conf/XBOX Sat Jul 30 12:15:44 2011 +0000
+++ b/sys/arch/i386/conf/XBOX Sat Jul 30 12:19:12 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: XBOX,v 1.26 2011/05/28 13:01:50 ryo Exp $
+# $NetBSD: XBOX,v 1.27 2011/07/30 12:19:12 jmcneill Exp $
#
# XBOX -- A basic Microsoft XBox kernel config file.
#
@@ -238,10 +238,6 @@
uvscom* at uhub? port ? # SUNTAC Slipper U VS-10U serial adapter
ucom* at uvscom? portno ?
-# Xbox Controller
-xboxcontroller* at uhub? port ? configuration ?
-wsmouse* at xboxcontroller? mux 0
-
# USB Generic driver
ugen* at uhub? port ?
diff -r 2210d5c7971e -r 43ed9bb0d013 sys/dev/usb/files.usb
--- a/sys/dev/usb/files.usb Sat Jul 30 12:15:44 2011 +0000
+++ b/sys/dev/usb/files.usb Sat Jul 30 12:19:12 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.usb,v 1.112 2011/07/23 20:52:15 jakllsch Exp $
+# $NetBSD: files.usb,v 1.113 2011/07/30 12:19:12 jmcneill Exp $
#
# Config file and device description for machine-independent USB code.
# Included by ports that need it. Ports that use it must provide
@@ -373,11 +373,6 @@
attach utoppy at usbdevif
file dev/usb/utoppy.c utoppy
-# Microsoft Xbox controller (gamepad)
-device xboxcontroller: wsmousedev
-attach xboxcontroller at usbdevif
-file dev/usb/xboxcontroller.c xboxcontroller
-
# Zydas ZD1211
device zyd: ether, ifnet, arp, wlan, firmload
attach zyd at usbdevif
diff -r 2210d5c7971e -r 43ed9bb0d013 sys/dev/usb/xboxcontroller.c
--- a/sys/dev/usb/xboxcontroller.c Sat Jul 30 12:15:44 2011 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,339 +0,0 @@
-/* $NetBSD: xboxcontroller.c,v 1.14 2010/11/04 01:58:07 dyoung Exp $ */
-
-/*-
- * Copyright (c) 2007 Jared D. McNeill <jmcneill%invisible.ca@localhost>
- * All rights reserved.
- *
- * 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.
- *
- * 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: xboxcontroller.c,v 1.14 2010/11/04 01:58:07 dyoung Exp $");
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/device.h>
-#include <sys/malloc.h>
-
-#include <sys/bus.h>
-
-#include <dev/wscons/wsconsio.h>
-#include <dev/wscons/wsmousevar.h>
-
-#include <dev/usb/usb.h>
-#include <dev/usb/usbdi.h>
-#include <dev/usb/usbdi_util.h>
-#include <dev/usb/usbdevs.h>
-
-#define XBOX_CONTROLLER_BUFSZ 32
-
-struct xboxcontroller_softc {
- device_t sc_dev;
-
- usbd_device_handle sc_udev;
- usbd_interface_handle sc_iface;
- int sc_ed;
- usbd_pipe_handle sc_ep;
- unsigned char *sc_buf;
-
- int sc_drvmode;
-#define XBOX_CONTROLLER_MODE_MOUSE 1
-#define XBOX_CONTROLLER_MODE_JOYSTICK 2
-
- device_t sc_wsmousedev;
- char sc_enabled;
- char sc_dying;
-};
-
-static void xboxcontroller_intr(usbd_xfer_handle, usbd_private_handle,
- usbd_status);
-
-static int xboxcontroller_wsmouse_enable(void *);
-static int xboxcontroller_wsmouse_ioctl(void *, u_long, void *, int,
- struct lwp *);
-static void xboxcontroller_wsmouse_disable(void *);
-
-static const struct wsmouse_accessops xboxcontroller_accessops = {
- xboxcontroller_wsmouse_enable,
- xboxcontroller_wsmouse_ioctl,
- xboxcontroller_wsmouse_disable
-};
-
-int xboxcontroller_match(device_t, cfdata_t, void *);
-void xboxcontroller_attach(device_t, device_t, void *);
-void xboxcontroller_childdet(device_t, device_t);
-int xboxcontroller_detach(device_t, int);
-int xboxcontroller_activate(device_t, enum devact);
-extern struct cfdriver xboxcontroller_cd;
-CFATTACH_DECL2_NEW(xboxcontroller, sizeof(struct xboxcontroller_softc),
- xboxcontroller_match, xboxcontroller_attach, xboxcontroller_detach,
- xboxcontroller_activate, NULL, xboxcontroller_childdet);
-
-int
-xboxcontroller_match(device_t parent, cfdata_t match, void *aux)
-{
- struct usb_attach_arg *uaa = aux;
-
- if (uaa->vendor == USB_VENDOR_MICROSOFT) {
- switch (uaa->product) {
- case USB_PRODUCT_MICROSOFT_XBOX_CONTROLLER_S10:
- case USB_PRODUCT_MICROSOFT_XBOX_CONTROLLER_S12:
- return UMATCH_VENDOR_PRODUCT;
- }
- }
-
- return UMATCH_NONE;
-}
-
-void
-xboxcontroller_attach(device_t parent, device_t self, void *aux)
-{
- struct xboxcontroller_softc *sc = device_private(self);
- struct usb_attach_arg *uaa = aux;
- usbd_device_handle dev = uaa->device;
- usbd_status err;
- struct wsmousedev_attach_args waa;
- usb_endpoint_descriptor_t *ed;
- char *devinfo;
-
- sc->sc_dev = self;
-
- aprint_naive("\n");
- aprint_normal("\n");
-
- devinfo = usbd_devinfo_alloc(dev, 0);
- aprint_normal_dev(self, "%s\n", devinfo);
- usbd_devinfo_free(devinfo);
-
- sc->sc_drvmode = XBOX_CONTROLLER_MODE_MOUSE;
-
- sc->sc_enabled = sc->sc_dying = 0;
- sc->sc_ep = NULL;
- sc->sc_udev = dev;
- err = usbd_set_config_no(dev, 1, 1);
- if (err) {
- aprint_error_dev(self, "setting config no failed: %s\n",
- usbd_errstr(err));
- sc->sc_dying = 1;
- return;
- }
- err = usbd_device2interface_handle(dev, 0, &sc->sc_iface);
- if (err) {
- aprint_error_dev(self, "failed to get interface: %s\n",
- usbd_errstr(err));
- sc->sc_dying = 1;
- return;
- }
-
- ed = usbd_interface2endpoint_descriptor(sc->sc_iface, 0);
- if (ed == NULL) {
- aprint_error_dev(sc->sc_dev, "couldn't get ep 0\n");
- sc->sc_dying = 1;
- return;
- }
- sc->sc_ed = ed->bEndpointAddress;
-
- usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev,
- sc->sc_dev);
-
- waa.accessops = &xboxcontroller_accessops;
- waa.accesscookie = sc;
-
- sc->sc_wsmousedev = config_found_ia(self, "wsmousedev", &waa,
- wsmousedevprint);
-
- return;
-}
-
-void
-xboxcontroller_childdet(device_t self, device_t child)
-{
- struct xboxcontroller_softc *sc = device_private(self);
-
- KASSERT(sc->sc_wsmousedev == child);
- sc->sc_wsmousedev = NULL;
-}
-
-int
-xboxcontroller_detach(device_t self, int flags)
-{
- struct xboxcontroller_softc *sc = device_private(self);
- int rv;
-
- rv = 0;
-
- if (sc->sc_ep != NULL) {
- usbd_abort_pipe(sc->sc_ep);
- usbd_close_pipe(sc->sc_ep);
- sc->sc_ep = NULL;
- }
-
- sc->sc_dying = 1;
-
- if (sc->sc_wsmousedev != NULL)
- rv = config_detach(sc->sc_wsmousedev, flags);
-
- return rv;
-}
-
-int
-xboxcontroller_activate(device_t self, enum devact act)
-{
- struct xboxcontroller_softc *sc = device_private(self);
-
- switch (act) {
- case DVACT_DEACTIVATE:
- sc->sc_dying = 1;
- return 0;
- default:
- return EOPNOTSUPP;
- }
-}
-
-static void
-xboxcontroller_intr(usbd_xfer_handle xfer, usbd_private_handle priv,
- usbd_status status)
-{
- struct xboxcontroller_softc *sc;
- unsigned char *data;
- int16_t x, y;
- char btnmask;
- uint32_t len;
- int s;
-
- sc = (struct xboxcontroller_softc *)priv;
- data = sc->sc_buf;
-
- usbd_get_xfer_status(xfer, NULL, NULL, &len, NULL);
Home |
Main Index |
Thread Index |
Old Index