-vers(a, {-$OpenBSD: MAKEDEV.common,v 1.111 2020/07/06 06:11:26 dlg Exp $-})dnl
+vers(a, {-$OpenBSD: MAKEDEV.common,v 1.112 2021/01/23 05:08:33 thfr Exp $-})dnl
dnl
dnl Copyright (c) 2001-2006 Todd T. Fries <todd@OpenBSD.org>
dnl
target(usb, usb, 0, 1, 2, 3, 4, 5, 6, 7)dnl
target(usb, uhid, 0, 1, 2, 3, 4, 5, 6, 7)dnl
twrget(usb, fido, fido)dnl
+twrget(usb, ujoy, ujoy)dnl
target(usb, ulpt, 0, 1)dnl
target(usb, ugen, 0, 1, 2, 3, 4, 5, 6, 7)dnl
target(usb, ttyU, 0, 1, 2, 3)dnl
_mkdev(fido, fido, {-RMlist[${#RMlist[*]}]=";mkdir -p fido;rm -f" n=0
while [ $n -lt 4 ];do M fido/$n c major_fido_c $n 666;n=Add($n, 1);done
MKlist[${#MKlist[*]}]=";chmod 555 fido"-})dnl
+__devitem(ujoy, ujoy, ujoy/* nodes, ujoy)dnl
+_mkdev(ujoy, ujoy, {-RMlist[${#RMlist[*]}]=";mkdir -p ujoy;rm -f" n=0
+ while [ $n -lt 4 ];do M ujoy/$n c major_ujoy_c $n 444;n=Add($n, 1);done
+ MKlist[${#MKlist[*]}]=";chmod 555 ujoy"-})dnl
__devitem(ulpt, ulpt*, Printer devices)dnl
_mcdev({-ulpt-}, ulpt*, {-ulpt-}, {-major_ulpt_c-}, 600)dnl
__devitem(ttyU, ttyU*, USB serial ports,ucom)dnl
define(MACHINE,alpha)dnl
vers(__file__,
- {-$OpenBSD: MAKEDEV.md,v 1.76 2020/07/06 06:11:26 dlg Exp $-},
+ {-$OpenBSD: MAKEDEV.md,v 1.77 2021/01/23 05:08:33 thfr Exp $-},
etc.MACHINE)dnl
dnl
dnl Copyright (c) 2001-2006 Todd T. Fries <todd@OpenBSD.org>
_DEV(ugen, 48)
_DEV(uhid, 46)
_DEV(fido, 70)
+_DEV(ujoy, 72)
_DEV(ulpt, 47)
_DEV(usb, 45)
_TITLE(spec)
define(MACHINE,amd64)dnl
vers(__file__,
- {-$OpenBSD: MAKEDEV.md,v 1.76 2020/07/06 06:11:26 dlg Exp $-},
+ {-$OpenBSD: MAKEDEV.md,v 1.77 2021/01/23 05:08:33 thfr Exp $-},
etc.MACHINE)dnl
dnl
dnl Copyright (c) 2001-2006 Todd T. Fries <todd@OpenBSD.org>
_DEV(ugen, 63)
_DEV(uhid, 62)
_DEV(fido, 98)
+_DEV(ujoy, 100)
_DEV(ulpt, 64)
_DEV(usb, 61)
_TITLE(spec)
define(MACHINE,arm64)dnl
vers(__file__,
- {-$OpenBSD: MAKEDEV.md,v 1.10 2020/07/06 06:11:26 dlg Exp $-},
+ {-$OpenBSD: MAKEDEV.md,v 1.11 2021/01/23 05:08:33 thfr Exp $-},
etc.MACHINE)dnl
dnl
dnl Copyright (c) 2001-2006 Todd T. Fries <todd@OpenBSD.org>
_DEV(ugen, 63)
_DEV(uhid, 62)
_DEV(fido, 98)
+_DEV(ujoy, 100)
_DEV(ulpt, 64)
_DEV(usb, 61)
_TITLE(spec)
define(MACHINE,armv7)dnl
vers(__file__,
- {-$OpenBSD: MAKEDEV.md,v 1.18 2020/07/06 06:11:26 dlg Exp $-},
+ {-$OpenBSD: MAKEDEV.md,v 1.19 2021/01/23 05:08:33 thfr Exp $-},
etc.MACHINE)dnl
dnl
dnl Copyright (c) 2001-2004 Todd T. Fries <todd@OpenBSD.org>
_DEV(ugen, 70)
_DEV(uhid, 65)
_DEV(fido, 106)
+_DEV(ujoy, 108)
_DEV(ulpt, 66)
_DEV(usb, 64)
_TITLE(spec)
define(MACHINE,hppa)dnl
vers(__file__,
- {-$OpenBSD: MAKEDEV.md,v 1.65 2020/07/06 06:11:26 dlg Exp $-},
+ {-$OpenBSD: MAKEDEV.md,v 1.66 2021/01/23 05:08:33 thfr Exp $-},
etc.MACHINE)dnl
dnl
dnl Copyright (c) 2001-2006 Todd T. Fries <todd@OpenBSD.org>
_DEV(usb, 40)
_DEV(uhid, 41)
_DEV(fido, 61)
+_DEV(ujoy, 63)
_DEV(ugen, 42)
_DEV(ulpt, 43)
_DEV(ttyU, 45)
define(MACHINE,i386)dnl
vers(__file__,
- {-$OpenBSD: MAKEDEV.md,v 1.91 2020/07/06 06:11:27 dlg Exp $-},
+ {-$OpenBSD: MAKEDEV.md,v 1.92 2021/01/23 05:08:33 thfr Exp $-},
etc.MACHINE)dnl
dnl
dnl Copyright (c) 2001-2006 Todd T. Fries <todd@OpenBSD.org>
_DEV(ugen, 63)
_DEV(uhid, 62)
_DEV(fido, 98)
+_DEV(ujoy, 100)
_DEV(ulpt, 64)
_DEV(usb, 61)
_TITLE(spec)
define(MACHINE,landisk)dnl
vers(__file__,
- {-$OpenBSD: MAKEDEV.md,v 1.48 2020/07/06 06:11:27 dlg Exp $-},
+ {-$OpenBSD: MAKEDEV.md,v 1.49 2021/01/23 05:08:33 thfr Exp $-},
etc.MACHINE)dnl
dnl
dnl Copyright (c) 2001-2004 Todd T. Fries <todd@OpenBSD.org>
_DEV(ugen, 70)
_DEV(uhid, 65)
_DEV(fido, 106)
+_DEV(ujoy, 108)
_DEV(ulpt, 66)
_DEV(usb, 64)
_TITLE(spec)
define(MACHINE,loongson)dnl
vers(__file__,
- {-$OpenBSD: MAKEDEV.md,v 1.32 2020/07/06 06:11:27 dlg Exp $-},
+ {-$OpenBSD: MAKEDEV.md,v 1.33 2021/01/23 05:08:33 thfr Exp $-},
etc.MACHINE)dnl
dnl
dnl Copyright (c) 2001-2006 Todd T. Fries <todd@OpenBSD.org>
_DEV(ugen, 63)
_DEV(uhid, 62)
_DEV(fido, 88)
+_DEV(ujoy, 90)
_DEV(ulpt, 64)
_DEV(usb, 61)
_TITLE(spec)
define(MACHINE,macppc)dnl
vers(__file__,
- {-$OpenBSD: MAKEDEV.md,v 1.75 2020/07/06 06:11:27 dlg Exp $-},
+ {-$OpenBSD: MAKEDEV.md,v 1.76 2021/01/23 05:08:33 thfr Exp $-},
etc.MACHINE)dnl
dnl
dnl Copyright (c) 2001-2006 Todd T. Fries <todd@OpenBSD.org>
_DEV(ugen, 63)
_DEV(uhid, 62)
_DEV(fido, 90)
+_DEV(ujoy, 92)
_DEV(ulpt, 64)
_DEV(usb, 61)
_TITLE(spec)
define(MACHINE,octeon)dnl
vers(__file__,
- {-$OpenBSD: MAKEDEV.md,v 1.19 2020/07/06 06:11:27 dlg Exp $-},
+ {-$OpenBSD: MAKEDEV.md,v 1.20 2021/01/23 05:08:33 thfr Exp $-},
etc.MACHINE)dnl
dnl
dnl Copyright (c) 2001-2006 Todd T. Fries <todd@OpenBSD.org>
_DEV(usb, 61)
_DEV(uhid, 62)
_DEV(fido, 76)
+_DEV(ujoy, 78)
_TITLE(spec)
_DEV(au, 44)
_DEV(bio, 49)
define(MACHINE,powerpc64)dnl
vers(__file__,
- {-$OpenBSD: MAKEDEV.md,v 1.6 2020/10/24 21:10:41 kettenis Exp $-},
+ {-$OpenBSD: MAKEDEV.md,v 1.7 2021/01/23 05:08:33 thfr Exp $-},
etc.MACHINE)dnl
dnl
dnl Copyright (c) 2001-2006 Todd T. Fries <todd@OpenBSD.org>
_DEV(ugen, 49)
_DEV(uhid, 50)
_DEV(fido, 51)
+_DEV(ujoy, 94)
_DEV(ulpt, 65)
_DEV(usb, 48)
_TITLE(spec)
define(MACHINE,sgi)dnl
vers(__file__,
- {-$OpenBSD: MAKEDEV.md,v 1.54 2020/07/06 06:11:27 dlg Exp $-},
+ {-$OpenBSD: MAKEDEV.md,v 1.55 2021/01/23 05:08:33 thfr Exp $-},
etc.MACHINE)dnl
dnl
dnl Copyright (c) 2001-2006 Todd T. Fries <todd@OpenBSD.org>
_DEV(ugen, 63)
_DEV(uhid, 62)
_DEV(fido, 76)
+_DEV(ujoy, 78)
_DEV(ulpt, 64)
_DEV(usb, 61)
_TITLE(spec)
define(MACHINE,sparc64)dnl
vers(__file__,
- {-$OpenBSD: MAKEDEV.md,v 1.95 2020/07/22 14:04:37 deraadt Exp $-},
+ {-$OpenBSD: MAKEDEV.md,v 1.96 2021/01/23 05:08:33 thfr Exp $-},
etc.MACHINE)dnl
dnl
dnl Copyright (c) 2001-2006 Todd T. Fries <todd@OpenBSD.org>
_DEV(ugen, 92)
_DEV(uhid, 91)
_DEV(fido, 137)
+_DEV(ujoy, 139)
_DEV(ulpt, 93)
_DEV(usb, 90)
_TITLE(spec)
-# $OpenBSD: Makefile,v 1.790 2020/12/06 20:48:12 kettenis Exp $
+# $OpenBSD: Makefile,v 1.791 2021/01/23 05:08:34 thfr Exp $
MAN= aac.4 abcrtc.4 abl.4 ac97.4 acphy.4 acrtc.4 \
acpi.4 acpiac.4 acpials.4 acpiasus.4 acpibat.4 \
ubsec.4 ucom.4 uchcom.4 ucrcom.4 ucycom.4 ukspan.4 uslhcom.4 \
udav.4 udcf.4 udl.4 udp.4 udsbr.4 \
uftdi.4 ugen.4 ugl.4 ugold.4 uguru.4 uhci.4 uhid.4 uhidev.4 uipaq.4 \
- uk.4 ukbd.4 \
+ ujoy.4 uk.4 ukbd.4 \
ukphy.4 ulpt.4 umass.4 umb.4 umbg.4 umcs.4 umct.4 umidi.4 umodem.4 \
ums.4 umsm.4 umstc.4 umt.4 unix.4 uonerng.4 uow.4 uoaklux.4 uoakrh.4 \
uoakv.4 upd.4 upgt.4 upl.4 uplcom.4 ural.4 ure.4 url.4 urlphy.4 \
-.\" $OpenBSD: uhidev.4,v 1.12 2020/08/21 19:02:46 mglocker Exp $
+.\" $OpenBSD: uhidev.4,v 1.13 2021/01/23 05:08:34 thfr Exp $
.\" $NetBSD: uhidev.4,v 1.2 2001/12/29 03:06:41 augustss Exp $
.\"
.\" Copyright (c) 2001 The NetBSD Foundation, Inc.
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd $Mdocdate: August 21 2020 $
+.Dd $Mdocdate: January 23 2021 $
.Dt UHIDEV 4
.Os
.Sh NAME
.Cd "ucycom* at uhidev?"
.Cd "ugold* at uhidev?"
.Cd "uhid* at uhidev?"
+.Cd "ujoy* at uhidev?"
.Cd "ukbd* at uhidev?"
.Cd "ums* at uhidev?"
.Cd "umstc* at uhidev?"
.Xr ucycom 4 ,
.Xr ugold 4 ,
.Xr uhid 4 ,
+.Xr ujoy 4 ,
.Xr ukbd 4 ,
.Xr ums 4 ,
.Xr umstc 4 ,
--- /dev/null
+.\" $OpenBSD: ujoy.4,v 1.1 2021/01/23 05:08:34 thfr Exp $
+.\"
+.\" Copyright (c) 2020 Thomas Frohwein <thfr@openbsd.org>
+.\" Copyright (c) 2020 Bryan Steele <brynet@openbsd.org>
+.\"
+.\" Permission to use, copy, modify, and distribute this software for any
+.\" purpose with or without fee is hereby granted, provided that the above
+.\" copyright notice and this permission notice appear in all copies.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+.\"
+.Dd $Mdocdate: January 23 2021 $
+.Dt UJOY 4
+.Os
+.Sh NAME
+.Nm ujoy
+.Nd USB joystick/gamecontroller
+.Sh SYNOPSIS
+.Cd "ujoy* at uhidev?"
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for USB joysticks and other gamecontrollers.
+They are Human Interface Devices (HID) which can be accessed via the
+.Pa /dev/ujoy/N
+interface.
+.Pp
+The driver is compatible with the
+.Xr read 2 ,
+and a subset of
+.Xr ioctl 2
+operations of the generic
+.Xr uhid 4
+device.
+.Sh FILES
+.Bl -tag -width /dev/ujoy/* -compact
+.It Pa /dev/ujoy/*
+.El
+.Sh SEE ALSO
+.Xr uhid 4 ,
+.Xr uhidev 4 ,
+.Xr usb 4
+.Sh HISTORY
+The
+.Nm
+driver first appeared in
+.Ox 6.9 .
-.\" $OpenBSD: usb.4,v 1.203 2020/08/21 20:38:56 mglocker Exp $
+.\" $OpenBSD: usb.4,v 1.204 2021/01/23 05:08:34 thfr Exp $
.\" $NetBSD: usb.4,v 1.15 1999/07/29 14:20:32 augustss Exp $
.\"
.\" Copyright (c) 1999 The NetBSD Foundation, Inc.
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd $Mdocdate: August 21 2020 $
+.Dd $Mdocdate: January 23 2021 $
.Dt USB 4
.Os
.Sh NAME
Generic driver for Human Interface Devices
.It Xr uhidev 4
Base driver for all Human Interface Devices
+.It Xr ujoy 4
+USB joysticks/gamecontrollers
.It Xr ukbd 4
USB keyboards that follow the boot protocol
.It Xr ums 4
-/* $OpenBSD: conf.c,v 1.88 2020/07/06 04:32:25 dlg Exp $ */
+/* $OpenBSD: conf.c,v 1.89 2021/01/23 05:08:34 thfr Exp $ */
/* $NetBSD: conf.c,v 1.16 1996/10/18 21:26:57 cgd Exp $ */
/*-
#include "usb.h"
#include "uhid.h"
#include "fido.h"
+#include "ujoy.h"
#include "ugen.h"
#include "ulpt.h"
#include "ucom.h"
cdev_switch_init(NSWITCH,switch), /* 69: switch(4) control interface */
cdev_fido_init(NFIDO,fido), /* 70: FIDO/U2F security key */
cdev_pppx_init(NPPPX,pppac), /* 71: PPP Access Concentrator */
+ cdev_ujoy_init(NUJOY,ujoy), /* 72: USB joystick/gamecontroller */
};
int nchrdev = nitems(cdevsw);
-# $OpenBSD: GENERIC,v 1.266 2020/05/23 06:28:29 jsg Exp $
+# $OpenBSD: GENERIC,v 1.267 2021/01/23 05:08:34 thfr Exp $
#
# For further information on compiling OpenBSD kernels, see the config(8)
# man page.
ucom* at uslhcom?
uhid* at uhidev? # USB generic HID support
fido* at uhidev? # FIDO/U2F security key support
+ujoy* at uhidev? # USB joystick/gamecontroller support
upd* at uhidev? # USB Power Devices sensors
aue* at uhub? # ADMtek AN986 Pegasus Ethernet
#atu* at uhub? # Atmel AT76c50x based 802.11b
-/* $OpenBSD: conf.c,v 1.72 2020/10/07 13:37:33 jan Exp $ */
+/* $OpenBSD: conf.c,v 1.73 2021/01/23 05:08:34 thfr Exp $ */
/*
* Copyright (c) 1994, 1995 Charles M. Hannum. All rights reserved.
#include "usb.h"
#include "uhid.h"
#include "fido.h"
+#include "ujoy.h"
#include "ugen.h"
#include "ulpt.h"
#include "ucom.h"
cdev_switch_init(NSWITCH,switch), /* 97: switch(4) control interface */
cdev_fido_init(NFIDO,fido), /* 98: FIDO/U2F security keys */
cdev_pppx_init(NPPPX,pppac), /* 99: PPP Access Concentrator */
+ cdev_ujoy_init(NUJOY,ujoy), /* 100: USB joystick/gamecontroller */
};
int nchrdev = nitems(cdevsw);
-# $OpenBSD: GENERIC,v 1.495 2020/11/15 16:47:12 kettenis Exp $
+# $OpenBSD: GENERIC,v 1.496 2021/01/23 05:08:34 thfr Exp $
#
# For further information on compiling OpenBSD kernels, see the config(8)
# man page.
ucom* at uslhcom?
uhid* at uhidev? # USB generic HID support
fido* at uhidev? # FIDO/U2F security key support
+ujoy* at uhidev? # USB joystick/gamecontroller support
upd* at uhidev? # USB Power Devices sensors
umstc* at uhidev? # Microsoft Surface Type Cover
aue* at uhub? # ADMtek AN986 Pegasus Ethernet
-/* $OpenBSD: conf.c,v 1.55 2020/07/06 04:32:25 dlg Exp $ */
+/* $OpenBSD: conf.c,v 1.56 2021/01/23 05:08:34 thfr Exp $ */
/* $NetBSD: conf.c,v 1.10 2002/04/19 01:04:38 wiz Exp $ */
/*
#include "ugen.h"
#include "uhid.h"
#include "fido.h"
+#include "ujoy.h"
#include "ulpt.h"
/*
cdev_switch_init(NSWITCH,switch), /* 105: switch(4) control interface */
cdev_fido_init(NFIDO,fido), /* 106: FIDO/U2F security key */
cdev_pppx_init(NPPPX,pppac), /* 107: PPP Access Concentrator */
+ cdev_ujoy_init(NUJOY,ujoy), /* 108: USB joystick/gamecontroller */
};
int nblkdev = nitems(bdevsw);
-/* $OpenBSD: conf.c,v 1.16 2020/10/07 13:37:32 jan Exp $ */
+/* $OpenBSD: conf.c,v 1.17 2021/01/23 05:08:34 thfr Exp $ */
/*
* Copyright (c) 1994, 1995 Charles M. Hannum. All rights reserved.
#include "usb.h"
#include "uhid.h"
#include "fido.h"
+#include "ujoy.h"
#include "ugen.h"
#include "ulpt.h"
#include "ucom.h"
cdev_switch_init(NSWITCH,switch), /* 97: switch(4) control interface */
cdev_fido_init(NFIDO,fido), /* 98: FIDO/U2F security key */
cdev_pppx_init(NPPPX,pppac), /* 99: PPP Access Concentrator */
+ cdev_ujoy_init(NUJOY,ujoy), /* 100: USB joystick/gamecontroller */
};
int nchrdev = nitems(cdevsw);
-# $OpenBSD: GENERIC,v 1.183 2021/01/19 19:14:39 kettenis Exp $
+# $OpenBSD: GENERIC,v 1.184 2021/01/23 05:08:34 thfr Exp $
#
# GENERIC machine description file
#
ucom* at uslhcom?
uhid* at uhidev? # USB generic HID support
fido* at uhidev? # FIDO/U2F security key support
+ujoy* at uhidev? # USB joystick/gamecontroller support
upd* at uhidev? # USB Power Devices sensors
aue* at uhub? # ADMtek AN986 Pegasus Ethernet
atu* at uhub? # Atmel AT76c50x based 802.11b
-# $OpenBSD: GENERIC,v 1.132 2020/06/23 13:57:05 fcambus Exp $
+# $OpenBSD: GENERIC,v 1.133 2021/01/23 05:08:34 thfr Exp $
#
# For further information on compiling OpenBSD kernels, see the config(8)
# man page.
ucom* at uslhcom?
uhid* at uhidev? # USB generic HID support
fido* at uhidev? # FIDO/U2F security key support
+ujoy* at uhidev? # USB joystick/gamecontroller support
upd* at uhidev? # USB Power Devices sensors
aue* at uhub? # ADMtek AN986 Pegasus Ethernet
atu* at uhub? # Atmel AT76c50x based 802.11b
-# $OpenBSD: GENERIC,v 1.180 2019/12/17 13:08:55 reyk Exp $
+# $OpenBSD: GENERIC,v 1.181 2021/01/23 05:08:34 thfr Exp $
#
# For further information on compiling OpenBSD kernels, see the config(8)
# man page.
wskbd* at ukbd? mux 1
uhid* at uhidev? # USB generic HID support
fido* at uhidev? # FIDO/U2F security key support
+ujoy* at uhidev? # USB joystick/gamecontroller support
upd* at uhidev? # USB Power Devices sensors
aue* at uhub? # ADMtek AN986 Pegasus Ethernet
url* at uhub? # Realtek RTL8150L based adapters
-/* $OpenBSD: conf.c,v 1.70 2020/07/06 04:32:25 dlg Exp $ */
+/* $OpenBSD: conf.c,v 1.71 2021/01/23 05:08:35 thfr Exp $ */
/*-
* Copyright (c) 1991 The Regents of the University of California.
#include "usb.h"
#include "uhid.h"
#include "fido.h"
+#include "ujoy.h"
#include "ugen.h"
#include "ulpt.h"
#include "ucom.h"
cdev_switch_init(NSWITCH,switch), /* 60: switch(4) control interface */
cdev_fido_init(NFIDO,fido), /* 61: FIDO/U2F security key */
cdev_pppx_init(NPPPX,pppac), /* 62: PPP Access Concentrator */
+ cdev_ujoy_init(NUJOY,ujoy), /* 63: USB joystick/gamecontroller */
};
int nchrdev = nitems(cdevsw);
-# $OpenBSD: GENERIC,v 1.853 2020/09/12 15:01:05 mglocker Exp $
+# $OpenBSD: GENERIC,v 1.854 2021/01/23 05:08:35 thfr Exp $
#
# For further information on compiling OpenBSD kernels, see the config(8)
# man page.
ucom* at uticom?
uhid* at uhidev? # USB generic HID support
fido* at uhidev? # FIDO/U2F security key support
+ujoy* at uhidev? # USB joystick/gamecontroller support
upd* at uhidev? # USB Power Devices sensors
aue* at uhub? # ADMtek AN986 Pegasus Ethernet
atu* at uhub? # Atmel AT76c50x based 802.11b
-/* $OpenBSD: conf.c,v 1.170 2020/07/06 04:32:25 dlg Exp $ */
+/* $OpenBSD: conf.c,v 1.171 2021/01/23 05:08:35 thfr Exp $ */
/* $NetBSD: conf.c,v 1.75 1996/05/03 19:40:20 christos Exp $ */
/*
#include "usb.h"
#include "uhid.h"
#include "fido.h"
+#include "ujoy.h"
#include "ugen.h"
#include "ulpt.h"
#include "ucom.h"
cdev_switch_init(NSWITCH,switch), /* 97: switch(4) control interface */
cdev_fido_init(NFIDO,fido), /* 98: FIDO/U2F security key */
cdev_pppx_init(NPPPX,pppac), /* 99: PPP Access Concentrator */
+ cdev_ujoy_init(NUJOY,ujoy), /* 100: USB joystick/gamecontroller */
};
int nchrdev = nitems(cdevsw);
-# $OpenBSD: GENERIC,v 1.55 2019/12/17 13:08:55 reyk Exp $
+# $OpenBSD: GENERIC,v 1.56 2021/01/23 05:08:35 thfr Exp $
#
# For further information on compiling OpenBSD kernels, see the config(8)
# man page.
ucom* at uslhcom?
uhid* at uhidev? # USB generic HID support
fido* at uhidev? # FIDO/U2F security key support
+ujoy* at uhidev? # USB joystick/gamecontroller support
upd* at uhidev? # USB Power Devices sensors
aue* at uhub? # ADMtek AN986 Pegasus Ethernet
atu* at uhub? # Atmel AT76c50x based 802.11b
-/* $OpenBSD: conf.c,v 1.42 2020/07/06 04:32:25 dlg Exp $ */
+/* $OpenBSD: conf.c,v 1.43 2021/01/23 05:08:35 thfr Exp $ */
/*
* Copyright (c) 1994-1998 Mark Brinicombe.
#include "ugen.h"
#include "uhid.h"
#include "fido.h"
+#include "ujoy.h"
#include "ulpt.h"
/*
cdev_switch_init(NSWITCH,switch), /* 105: switch(4) control interface */
cdev_fido_init(NFIDO,fido), /* 106: FIDO/U2F security key */
cdev_pppx_init(NPPPX,pppac), /* 107: PPP Access Concentrator */
+ cdev_ujoy_init(NUJOY,ujoy), /* 108: USB joystick/gamecontroller */
};
int nblkdev = nitems(bdevsw);
-# $OpenBSD: GENERIC,v 1.62 2020/09/30 22:23:41 patrick Exp $
+# $OpenBSD: GENERIC,v 1.63 2021/01/23 05:08:35 thfr Exp $
#
# For further information on compiling OpenBSD kernels, see the config(8)
# man page.
ucom* at uslhcom?
uhid* at uhidev? # USB generic HID support
fido* at uhidev? # FIDO/U2F security key support
+ujoy* at uhidev? # USB joystick/gamecontroller support
upd* at uhidev? # USB Power Devices sensors
atu* at uhub? # Atmel AT76c50x based 802.11b
aue* at uhub? # ADMtek AN986 Pegasus Ethernet
-/* $OpenBSD: conf.c,v 1.29 2020/07/06 04:32:25 dlg Exp $ */
+/* $OpenBSD: conf.c,v 1.30 2021/01/23 05:08:35 thfr Exp $ */
/*
* Copyright (c) 1992, 1993
#include "usb.h"
#include "uhid.h"
#include "fido.h"
+#include "ujoy.h"
#include "ugen.h"
#include "ulpt.h"
#include "ucom.h"
cdev_drm_init(NDRM,drm), /* 87: drm */
cdev_fido_init(NFIDO,fido), /* 88: FIDO/U2F security key */
cdev_pppx_init(NPPPX,pppac), /* 89: PPP Access Concentrator */
+ cdev_ujoy_init(NUJOY,ujoy), /* 90: USB joystick/gamecontroller */
};
int nchrdev = nitems(cdevsw);
-# $OpenBSD: GENERIC,v 1.271 2020/01/24 04:44:14 krw Exp $g
+# $OpenBSD: GENERIC,v 1.272 2021/01/23 05:08:35 thfr Exp $g
#
# For further information on compiling OpenBSD kernels, see the config(8)
# man page.
ucom* at uslhcom?
uhid* at uhidev? # USB generic HID support
fido* at uhidev? # FIDO/U2F security key support
+ujoy* at uhidev? # USB joystick/gamecontroller support
upd* at uhidev? # USB Power Devices sensors
aue* at uhub? # ADMtek AN986 Pegasus Ethernet
atu* at uhub? # Atmel AT76c50x based 802.11b
-/* $OpenBSD: conf.c,v 1.72 2020/07/06 04:32:25 dlg Exp $ */
+/* $OpenBSD: conf.c,v 1.73 2021/01/23 05:08:35 thfr Exp $ */
/*
* Copyright (c) 1997 Per Fogelstrom
#include "usb.h"
#include "uhid.h"
#include "fido.h"
+#include "ujoy.h"
#include "ugen.h"
#include "ulpt.h"
#include "ucom.h"
cdev_switch_init(NSWITCH,switch), /* 89: switch(4) control interface */
cdev_fido_init(NFIDO,fido), /* 90: FIDO/U2F security key */
cdev_pppx_init(NPPPX,pppac), /* 91: PPP Access Concentrator */
+ cdev_ujoy_init(NUJOY,ujoy), /* 92: USB joystick/gamecontroller */
};
int nchrdev = nitems(cdevsw);
-# $OpenBSD: GENERIC,v 1.56 2020/10/25 10:33:31 visa Exp $
+# $OpenBSD: GENERIC,v 1.57 2021/01/23 05:08:36 thfr Exp $
#
# For further information on compiling OpenBSD kernels, see the config(8)
# man page.
ucom* at uslhcom?
uhid* at uhidev? # USB generic HID support
fido* at uhidev? # FIDO/U2F security key support
+ujoy* at uhidev? # USB joystick/gamecontroller support
upd* at uhidev? # USB Power Devices sensors
aue* at uhub? # ADMtek AN986 Pegasus Ethernet
atu* at uhub? # Atmel AT76c50x based 802.11b
-/* $OpenBSD: conf.c,v 1.25 2020/07/06 04:32:25 dlg Exp $ */
+/* $OpenBSD: conf.c,v 1.26 2021/01/23 05:08:36 thfr Exp $ */
/*
* Copyright (c) 1992, 1993
#include "usb.h"
#include "uhid.h"
#include "fido.h"
+#include "ujoy.h"
#include "ugen.h"
#include "ulpt.h"
#include "ucom.h"
cdev_switch_init(NSWITCH,switch), /* 75: switch(4) control interface */
cdev_fido_init(NFIDO,fido), /* 76: FIDO/U2F security key */
cdev_pppx_init(NPPPX,pppac), /* 77: PPP Access Concentrator */
+ cdev_ujoy_init(NUJOY,ujoy), /* 78: USB joystick/gamecontroller */
};
int nchrdev = nitems(cdevsw);
-# $OpenBSD: GENERIC,v 1.22 2020/11/16 19:04:57 kettenis Exp $
+# $OpenBSD: GENERIC,v 1.23 2021/01/23 05:08:36 thfr Exp $
#
# For further information on compiling OpenBSD kernels, see the config(8)
# man page.
ucom* at uslhcom?
uhid* at uhidev? # USB generic HID support
fido* at uhidev? # FIDO/U2F security key support
+ujoy* at uhidev? # USB joystick/gamecontroller support
upd* at uhidev? # USB Power Devices sensors
umstc* at uhidev? # Microsoft Surface Type Cover
aue* at uhub? # ADMtek AN986 Pegasus Ethernet
-/* $OpenBSD: conf.c,v 1.10 2020/10/24 21:06:56 kettenis Exp $ */
+/* $OpenBSD: conf.c,v 1.11 2021/01/23 05:08:36 thfr Exp $ */
/*-
* Copyright (c) 1991 The Regents of the University of California.
#include "drm.h"
#include "dt.h"
#include "fido.h"
+#include "ujoy.h"
#include "fuse.h"
#include "hotplug.h"
#include "ipmi.h"
#else
cdev_notdef(), /* 93 */
#endif
+ cdev_ujoy_init(NUJOY,ujoy), /* 94: USB joystick/gamecontroller */
};
int nchrdev = nitems(cdevsw);
-# $OpenBSD: GENERIC-IP27,v 1.66 2019/12/17 13:08:56 reyk Exp $
+# $OpenBSD: GENERIC-IP27,v 1.67 2021/01/23 05:08:36 thfr Exp $
#
# THIS KERNEL IS FOR Origin, Onyx, Fuel, Tezro (IP27, IP35) SYSTEMS ONLY.
#
ucom* at uslhcom?
uhid* at uhidev? # USB generic HID support
fido* at uhidev? # FIDO/U2F security key support
+ujoy* at uhidev? # USB joystick/gamecontroller support
atu* at uhub? # Atmel AT76c50x based 802.11b
aue* at uhub? # ADMtek AN986 Pegasus Ethernet
axe* at uhub? # ASIX Electronics AX88172 USB Ethernet
-# $OpenBSD: GENERIC-IP30,v 1.59 2019/12/17 13:08:56 reyk Exp $
+# $OpenBSD: GENERIC-IP30,v 1.60 2021/01/23 05:08:36 thfr Exp $
#
# THIS KERNEL IS FOR Octane and Octane 2 (IP30) SYSTEMS ONLY.
#
ucom* at uslhcom?
uhid* at uhidev? # USB generic HID support
fido* at uhidev? # FIDO/U2F security key support
+ujoy* at uhidev? # USB joystick/gamecontroller support
atu* at uhub? # Atmel AT76c50x based 802.11b
aue* at uhub? # ADMtek AN986 Pegasus Ethernet
axe* at uhub? # ASIX Electronics AX88172 USB Ethernet
-# $OpenBSD: GENERIC-IP32,v 1.50 2019/12/17 13:08:56 reyk Exp $
+# $OpenBSD: GENERIC-IP32,v 1.51 2021/01/23 05:08:36 thfr Exp $
#
# THIS KERNEL IS FOR O2 (IP32) SYSTEMS ONLY.
#
ucom* at uslhcom?
uhid* at uhidev? # USB generic HID support
fido* at uhidev? # FIDO/U2F security key support
+ujoy* at uhidev? # USB joystick/gamecontroller support
atu* at uhub? # Atmel AT76c50x based 802.11b
aue* at uhub? # ADMtek AN986 Pegasus Ethernet
axe* at uhub? # ASIX Electronics AX88172 USB Ethernet
-/* $OpenBSD: conf.c,v 1.43 2020/07/06 04:32:25 dlg Exp $ */
+/* $OpenBSD: conf.c,v 1.44 2021/01/23 05:08:36 thfr Exp $ */
/*
* Copyright (c) 1992, 1993
#include "usb.h"
#include "uhid.h"
#include "fido.h"
+#include "ujoy.h"
#include "ugen.h"
#include "ulpt.h"
#include "ucom.h"
cdev_switch_init(NSWITCH,switch), /* 75: switch(4) control interface */
cdev_fido_init(NFIDO,fido), /* 76: FIDO/U2F security key */
cdev_pppx_init(NPPPX,pppac), /* 77: PPP Access Concentrator */
+ cdev_ujoy_init(NUJOY,ujoy), /* 78: USB joystick/gamecontroller */
};
int nchrdev = nitems(cdevsw);
-# $OpenBSD: GENERIC,v 1.314 2019/12/17 13:08:56 reyk Exp $
+# $OpenBSD: GENERIC,v 1.315 2021/01/23 05:08:36 thfr Exp $
#
# For further information on compiling OpenBSD kernels, see the config(8)
# man page.
ucom* at umsm?
uhid* at uhidev? # USB generic HID support
fido* at uhidev? # FIDO/U2F security key support
+ujoy* at uhidev? # USB joystick/gamecontroller support
upd* at uhidev? # USB Power Devices sensors
aue* at uhub? # ADMtek AN986 Pegasus Ethernet
atu* at uhub? # Atmel AT76c50x based 802.11b
-/* $OpenBSD: conf.c,v 1.84 2020/07/06 04:32:25 dlg Exp $ */
+/* $OpenBSD: conf.c,v 1.85 2021/01/23 05:08:36 thfr Exp $ */
/* $NetBSD: conf.c,v 1.17 2001/03/26 12:33:26 lukem Exp $ */
/*
#include "usb.h"
#include "uhid.h"
#include "fido.h"
+#include "ujoy.h"
#include "ugen.h"
#include "ulpt.h"
#include "ucom.h"
cdev_switch_init(NSWITCH,switch), /* 136: switch(4) control interface */
cdev_fido_init(NFIDO,fido), /* 137: FIDO/U2F security key */
cdev_pppx_init(NPPPX,pppac), /* 138: PPP Access Concentrator */
+ cdev_ujoy_init(NUJOY,ujoy), /* 139: USB joystick/gamecontroller */
};
int nchrdev = nitems(cdevsw);
-# $OpenBSD: files.usb,v 1.143 2020/05/31 18:15:37 jcs Exp $
+# $OpenBSD: files.usb,v 1.144 2021/01/23 05:08:36 thfr Exp $
# $NetBSD: files.usb,v 1.16 2000/02/14 20:29:54 augustss Exp $
#
# Config file and device description for machine-independent USB code.
# Generic HID devices
device uhid: hid
attach uhid at uhidbus
-file dev/usb/uhid.c uhid | fido needs-flag
+file dev/usb/uhid.c uhid | fido | ujoy needs-flag
# FIDO/U2F security keys
device fido: hid
attach fido at uhidbus
file dev/usb/fido.c fido needs-flag
+# USB Joysticks/Gamecontrollers
+device ujoy: hid
+attach ujoy at uhidbus
+file dev/usb/ujoy.c ujoy needs-flag
+
# Keyboards
file dev/usb/ukbdmap.c hidkbd
device ukbd: hid, hidkbd, wskbddev
-/* $OpenBSD: uhid.c,v 1.81 2020/12/25 12:59:52 visa Exp $ */
+/* $OpenBSD: uhid.c,v 1.82 2021/01/23 05:08:36 thfr Exp $ */
/* $NetBSD: uhid.c,v 1.57 2003/03/11 16:44:00 augustss Exp $ */
/*
*/
#include "fido.h"
+#include "ujoy.h"
#include <sys/param.h>
#include <sys/systm.h>
#if NFIDO > 0
else if (cdev->d_open == fidoopen)
cd = &fido_cd;
+#endif
+#if NUJOY > 0
+ else if (cdev->d_open == ujoyopen)
+ cd = &ujoy_cd;
#endif
else
return (NULL);
-/* $OpenBSD: uhid.h,v 1.1 2019/12/17 13:08:54 reyk Exp $ */
+/* $OpenBSD: uhid.h,v 1.2 2021/01/23 05:08:36 thfr Exp $ */
/* $NetBSD: uhid.c,v 1.57 2003/03/11 16:44:00 augustss Exp $ */
/*
extern struct cfdriver uhid_cd;
extern struct cfdriver fido_cd;
+extern struct cfdriver ujoy_cd;
#define UHIDUNIT(dev) (minor(dev))
#define UHID_CHUNK 128 /* chunk size for read */
--- /dev/null
+/* $OpenBSD: ujoy.c,v 1.1 2021/01/23 05:08:36 thfr Exp $ */
+
+/*
+ * Copyright (c) 2021 Thomas Frohwein <thfr@openbsd.org>
+ * Copyright (c) 2021 Bryan Steele <brynet@openbsd.org>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/malloc.h>
+#include <sys/signalvar.h>
+#include <sys/device.h>
+#include <sys/ioctl.h>
+#include <sys/conf.h>
+#include <sys/tty.h>
+#include <sys/selinfo.h>
+#include <sys/proc.h>
+#include <sys/vnode.h>
+#include <sys/poll.h>
+#include <sys/fcntl.h>
+
+#include <dev/usb/usb.h>
+#include <dev/usb/usbhid.h>
+
+#include <dev/usb/usbdevs.h>
+#include <dev/usb/usbdi.h>
+#include <dev/usb/usbdi_util.h>
+
+#include <dev/usb/uhidev.h>
+#include <dev/usb/uhid.h>
+
+int ujoy_match(struct device *, void *, void *);
+
+struct cfdriver ujoy_cd = {
+ NULL, "ujoy", DV_DULL
+};
+
+const struct cfattach ujoy_ca = {
+ sizeof(struct uhid_softc),
+ ujoy_match,
+ uhid_attach,
+ uhid_detach,
+};
+
+/*
+ * XXX workaround:
+ *
+ * This is a copy of sys/dev/hid/hid.c:hid_is_collection(), synced up to the
+ * NetBSD version. Our current hid_is_collection() is not playing nice with
+ * all HID devices like the PS4 controller. But applying this version
+ * globally breaks other HID devices like ims(4) and imt(4). Until our global
+ * hid_is_collection() can't be fixed to play nice with all HID devices, we
+ * go for this dedicated ujoy(4) version.
+ */
+int
+ujoy_hid_is_collection(const void *desc, int size, uint8_t id, int32_t usage)
+{
+ struct hid_data *hd;
+ struct hid_item hi;
+ uint32_t coll_usage = ~0;
+
+ hd = hid_start_parse(desc, size, hid_input);
+ if (hd == NULL)
+ return (0);
+
+ while (hid_get_item(hd, &hi)) {
+ if (hi.kind == hid_collection &&
+ hi.collection == HCOLL_APPLICATION)
+ coll_usage = hi.usage;
+
+ if (hi.kind == hid_endcollection)
+ coll_usage = ~0;
+
+ if (hi.kind == hid_input &&
+ coll_usage == usage &&
+ hi.report_ID == id) {
+ hid_end_parse(hd);
+ return (1);
+ }
+ }
+ hid_end_parse(hd);
+
+ return (0);
+}
+
+int
+ujoy_match(struct device *parent, void *match, void *aux)
+{
+ struct uhidev_attach_arg *uha = (struct uhidev_attach_arg *)aux;
+ int size;
+ void *desc;
+ int ret = UMATCH_NONE;
+
+ if (uha->reportid == UHIDEV_CLAIM_ALLREPORTID)
+ return (ret);
+
+ /* Find the general usage page and gamecontroller collections */
+ uhidev_get_report_desc(uha->parent, &desc, &size);
+
+ if (ujoy_hid_is_collection(desc, size, uha->reportid,
+ HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_JOYSTICK)))
+ ret = UMATCH_IFACECLASS;
+
+ if (ujoy_hid_is_collection(desc, size, uha->reportid,
+ HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_GAME_PAD)))
+ ret = UMATCH_IFACECLASS;
+
+ return (ret);
+}
+
+int
+ujoyopen(dev_t dev, int flag, int mode, struct proc *p)
+{
+ /* Restrict ujoy devices to read operations */
+ if ((flag & FWRITE))
+ return (EPERM);
+ return (uhid_do_open(dev, flag, mode, p));
+}
+
+int
+ujoyioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p)
+{
+ switch (cmd) {
+ case FIONBIO:
+ case FIOASYNC:
+ case USB_GET_DEVICEINFO:
+ case USB_GET_REPORT:
+ case USB_GET_REPORT_DESC:
+ case USB_GET_REPORT_ID:
+ break;
+ default:
+ return (EPERM);
+ }
+
+ return (uhidioctl(dev, cmd, addr, flag, p));
+}
-/* $OpenBSD: conf.h,v 1.155 2020/07/06 04:11:26 dlg Exp $ */
+/* $OpenBSD: conf.h,v 1.156 2021/01/23 05:08:36 thfr Exp $ */
/* $NetBSD: conf.h,v 1.33 1996/05/03 20:03:32 christos Exp $ */
/*-
(dev_type_stop((*))) enodev, 0, dev_init(c,uhid,poll), \
(dev_type_mmap((*))) enodev, 0, 0, dev_init(c,uhid,kqfilter) }
+/* open, close, read, write, ioctl, poll, kqfilter */
+#define cdev_ujoy_init(c,n) { \
+ dev_init(c,n,open), dev_init(c,uhid,close), dev_init(c,uhid,read), \
+ dev_init(c,uhid,write), dev_init(c,ujoy,ioctl), \
+ (dev_type_stop((*))) enodev, 0, dev_init(c,uhid,poll), \
+ (dev_type_mmap((*))) enodev, 0, 0, dev_init(c,uhid,kqfilter) }
+
/* open, close, init */
#define cdev_pci_init(c,n) { \
dev_init(c,n,open), dev_init(c,n,close), (dev_type_read((*))) enodev, \
cdev_decl(ugen);
cdev_decl(uhid);
cdev_decl(fido);
+cdev_decl(ujoy);
cdev_decl(ucom);
cdev_decl(ulpt);
cdev_decl(urio);