Deleted Added
full compact
uhid.c (222051) uhid.c (223486)
1/* $NetBSD: uhid.c,v 1.46 2001/11/13 06:24:55 lukem Exp $ */
2
3/* Also already merged from NetBSD:
4 * $NetBSD: uhid.c,v 1.54 2002/09/23 05:51:21 simonb Exp $
5 */
6
7#include <sys/cdefs.h>
1/* $NetBSD: uhid.c,v 1.46 2001/11/13 06:24:55 lukem Exp $ */
2
3/* Also already merged from NetBSD:
4 * $NetBSD: uhid.c,v 1.54 2002/09/23 05:51:21 simonb Exp $
5 */
6
7#include <sys/cdefs.h>
8__FBSDID("$FreeBSD: head/sys/dev/usb/input/uhid.c 222051 2011-05-18 07:40:12Z avg $");
8__FBSDID("$FreeBSD: head/sys/dev/usb/input/uhid.c 223486 2011-06-24 02:30:02Z hselasky $");
9
10/*-
11 * Copyright (c) 1998 The NetBSD Foundation, Inc.
12 * All rights reserved.
13 *
14 * This code is derived from software contributed to The NetBSD Foundation
15 * by Lennart Augustsson (lennart@augustsson.net) at
16 * Carlstedt Research & Technology.

--- 585 unchanged lines hidden (view full) ---

602
603 default:
604 error = EINVAL;
605 break;
606 }
607 return (error);
608}
609
9
10/*-
11 * Copyright (c) 1998 The NetBSD Foundation, Inc.
12 * All rights reserved.
13 *
14 * This code is derived from software contributed to The NetBSD Foundation
15 * by Lennart Augustsson (lennart@augustsson.net) at
16 * Carlstedt Research & Technology.

--- 585 unchanged lines hidden (view full) ---

602
603 default:
604 error = EINVAL;
605 break;
606 }
607 return (error);
608}
609
610static const STRUCT_USB_HOST_ID uhid_devs[] = {
611 /* generic HID class */
612 {USB_IFACE_CLASS(UICLASS_HID),},
613 /* the Xbox 360 gamepad doesn't use the HID class */
614 {USB_IFACE_CLASS(UICLASS_VENDOR),
615 USB_IFACE_SUBCLASS(UISUBCLASS_XBOX360_CONTROLLER),
616 USB_IFACE_PROTOCOL(UIPROTO_XBOX360_GAMEPAD),},
617};
618
610static int
611uhid_probe(device_t dev)
612{
613 struct usb_attach_arg *uaa = device_get_ivars(dev);
619static int
620uhid_probe(device_t dev)
621{
622 struct usb_attach_arg *uaa = device_get_ivars(dev);
623 int error;
614
615 DPRINTFN(11, "\n");
616
624
625 DPRINTFN(11, "\n");
626
617 if (uaa->usb_mode != USB_MODE_HOST) {
627 if (uaa->usb_mode != USB_MODE_HOST)
618 return (ENXIO);
628 return (ENXIO);
619 }
620 if (uaa->info.bInterfaceClass != UICLASS_HID) {
621
629
622 /* the Xbox 360 gamepad doesn't use the HID class */
630 error = usbd_lookup_id_by_uaa(uhid_devs, sizeof(uhid_devs), uaa);
631 if (error)
632 return (error);
623
633
624 if ((uaa->info.bInterfaceClass != UICLASS_VENDOR) ||
625 (uaa->info.bInterfaceSubClass != UISUBCLASS_XBOX360_CONTROLLER) ||
626 (uaa->info.bInterfaceProtocol != UIPROTO_XBOX360_GAMEPAD)) {
627 return (ENXIO);
628 }
629 }
630 if (usb_test_quirk(uaa, UQ_HID_IGNORE)) {
634 if (usb_test_quirk(uaa, UQ_HID_IGNORE))
631 return (ENXIO);
635 return (ENXIO);
632 }
636
633 return (BUS_PROBE_GENERIC);
634}
635
636static int
637uhid_attach(device_t dev)
638{
639 struct usb_attach_arg *uaa = device_get_ivars(dev);
640 struct uhid_softc *sc = device_get_softc(dev);

--- 159 unchanged lines hidden ---
637 return (BUS_PROBE_GENERIC);
638}
639
640static int
641uhid_attach(device_t dev)
642{
643 struct usb_attach_arg *uaa = device_get_ivars(dev);
644 struct uhid_softc *sc = device_get_softc(dev);

--- 159 unchanged lines hidden ---