summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/alpha/alpha/conf.c4
-rw-r--r--sys/arch/alpha/conf/GENERIC3
-rw-r--r--sys/arch/amd64/amd64/conf.c4
-rw-r--r--sys/arch/amd64/conf/GENERIC3
-rw-r--r--sys/arch/arm/arm/conf.c4
-rw-r--r--sys/arch/arm64/arm64/conf.c4
-rw-r--r--sys/arch/arm64/conf/GENERIC3
-rw-r--r--sys/arch/armv7/conf/GENERIC3
-rw-r--r--sys/arch/hppa/conf/GENERIC3
-rw-r--r--sys/arch/hppa/hppa/conf.c4
-rw-r--r--sys/arch/i386/conf/GENERIC3
-rw-r--r--sys/arch/i386/i386/conf.c4
-rw-r--r--sys/arch/landisk/conf/GENERIC3
-rw-r--r--sys/arch/landisk/landisk/conf.c4
-rw-r--r--sys/arch/loongson/conf/GENERIC3
-rw-r--r--sys/arch/loongson/loongson/conf.c4
-rw-r--r--sys/arch/macppc/conf/GENERIC3
-rw-r--r--sys/arch/macppc/macppc/conf.c4
-rw-r--r--sys/arch/octeon/conf/GENERIC3
-rw-r--r--sys/arch/octeon/octeon/conf.c4
-rw-r--r--sys/arch/powerpc64/conf/GENERIC3
-rw-r--r--sys/arch/powerpc64/powerpc64/conf.c4
-rw-r--r--sys/arch/sgi/conf/GENERIC-IP273
-rw-r--r--sys/arch/sgi/conf/GENERIC-IP303
-rw-r--r--sys/arch/sgi/conf/GENERIC-IP323
-rw-r--r--sys/arch/sgi/sgi/conf.c4
-rw-r--r--sys/arch/sparc64/conf/GENERIC3
-rw-r--r--sys/arch/sparc64/sparc64/conf.c4
-rw-r--r--sys/dev/usb/files.usb9
-rw-r--r--sys/dev/usb/uhid.c7
-rw-r--r--sys/dev/usb/uhid.h3
-rw-r--r--sys/dev/usb/ujoy.c149
-rw-r--r--sys/sys/conf.h10
33 files changed, 242 insertions, 33 deletions
diff --git a/sys/arch/alpha/alpha/conf.c b/sys/arch/alpha/alpha/conf.c
index ff6a835c8de..d3f2667e1ab 100644
--- a/sys/arch/alpha/alpha/conf.c
+++ b/sys/arch/alpha/alpha/conf.c
@@ -1,4 +1,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 $ */
/*-
@@ -113,6 +113,7 @@ cdev_decl(cy);
#include "usb.h"
#include "uhid.h"
#include "fido.h"
+#include "ujoy.h"
#include "ugen.h"
#include "ulpt.h"
#include "ucom.h"
@@ -207,6 +208,7 @@ struct cdevsw cdevsw[] =
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);
diff --git a/sys/arch/alpha/conf/GENERIC b/sys/arch/alpha/conf/GENERIC
index 48648e98e41..05953f8e7cb 100644
--- a/sys/arch/alpha/conf/GENERIC
+++ b/sys/arch/alpha/conf/GENERIC
@@ -1,4 +1,4 @@
-# $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.
@@ -107,6 +107,7 @@ uslhcom* at uhidev? # Silicon Labs CP2110 USB HID UART
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
diff --git a/sys/arch/amd64/amd64/conf.c b/sys/arch/amd64/amd64/conf.c
index b8f9fa911eb..3005c0b8a3b 100644
--- a/sys/arch/amd64/amd64/conf.c
+++ b/sys/arch/amd64/amd64/conf.c
@@ -1,4 +1,4 @@
-/* $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.
@@ -139,6 +139,7 @@ cdev_decl(cy);
#include "usb.h"
#include "uhid.h"
#include "fido.h"
+#include "ujoy.h"
#include "ugen.h"
#include "ulpt.h"
#include "ucom.h"
@@ -288,6 +289,7 @@ struct cdevsw cdevsw[] =
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);
diff --git a/sys/arch/amd64/conf/GENERIC b/sys/arch/amd64/conf/GENERIC
index 45b3a9b6e66..ffa1b4a497c 100644
--- a/sys/arch/amd64/conf/GENERIC
+++ b/sys/arch/amd64/conf/GENERIC
@@ -1,4 +1,4 @@
-# $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.
@@ -286,6 +286,7 @@ uslhcom* at uhidev? # Silicon Labs CP2110 USB HID UART
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
diff --git a/sys/arch/arm/arm/conf.c b/sys/arch/arm/arm/conf.c
index 3821d526cc6..747c42aed4a 100644
--- a/sys/arch/arm/arm/conf.c
+++ b/sys/arch/arm/arm/conf.c
@@ -1,4 +1,4 @@
-/* $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 $ */
/*
@@ -126,6 +126,7 @@ cdev_decl(pci);
#include "ugen.h"
#include "uhid.h"
#include "fido.h"
+#include "ujoy.h"
#include "ulpt.h"
/*
@@ -383,6 +384,7 @@ struct cdevsw cdevsw[] = {
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);
diff --git a/sys/arch/arm64/arm64/conf.c b/sys/arch/arm64/arm64/conf.c
index d6bf29bbab9..2f3504b9d12 100644
--- a/sys/arch/arm64/arm64/conf.c
+++ b/sys/arch/arm64/arm64/conf.c
@@ -1,4 +1,4 @@
-/* $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.
@@ -110,6 +110,7 @@ cdev_decl(spkr);
#include "usb.h"
#include "uhid.h"
#include "fido.h"
+#include "ujoy.h"
#include "ugen.h"
#include "ulpt.h"
#include "ucom.h"
@@ -248,6 +249,7 @@ struct cdevsw cdevsw[] =
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);
diff --git a/sys/arch/arm64/conf/GENERIC b/sys/arch/arm64/conf/GENERIC
index f6f45a23aa7..adefc8ffea9 100644
--- a/sys/arch/arm64/conf/GENERIC
+++ b/sys/arch/arm64/conf/GENERIC
@@ -1,4 +1,4 @@
-# $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
#
@@ -369,6 +369,7 @@ uslhcom* at uhidev? # Silicon Labs CP2110 USB HID UART
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
diff --git a/sys/arch/armv7/conf/GENERIC b/sys/arch/armv7/conf/GENERIC
index d440ffd902b..13124411dc1 100644
--- a/sys/arch/armv7/conf/GENERIC
+++ b/sys/arch/armv7/conf/GENERIC
@@ -1,4 +1,4 @@
-# $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.
@@ -321,6 +321,7 @@ uslhcom* at uhidev? # Silicon Labs CP2110 USB HID UART
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
diff --git a/sys/arch/hppa/conf/GENERIC b/sys/arch/hppa/conf/GENERIC
index d1fb312f04c..d95e5a8977b 100644
--- a/sys/arch/hppa/conf/GENERIC
+++ b/sys/arch/hppa/conf/GENERIC
@@ -1,4 +1,4 @@
-# $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.
@@ -111,6 +111,7 @@ ukbd* at uhidev? # USB keyboard
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
diff --git a/sys/arch/hppa/hppa/conf.c b/sys/arch/hppa/hppa/conf.c
index ddf72299e9c..4d7a12bac26 100644
--- a/sys/arch/hppa/hppa/conf.c
+++ b/sys/arch/hppa/hppa/conf.c
@@ -1,4 +1,4 @@
-/* $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.
@@ -114,6 +114,7 @@ cdev_decl(pci);
#include "usb.h"
#include "uhid.h"
#include "fido.h"
+#include "ujoy.h"
#include "ugen.h"
#include "ulpt.h"
#include "ucom.h"
@@ -191,6 +192,7 @@ struct cdevsw cdevsw[] =
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);
diff --git a/sys/arch/i386/conf/GENERIC b/sys/arch/i386/conf/GENERIC
index 8b54e5d0f62..c167a2f8011 100644
--- a/sys/arch/i386/conf/GENERIC
+++ b/sys/arch/i386/conf/GENERIC
@@ -1,4 +1,4 @@
-# $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.
@@ -284,6 +284,7 @@ uticom* at uhub? # TI serial
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
diff --git a/sys/arch/i386/i386/conf.c b/sys/arch/i386/i386/conf.c
index 6912d9cc781..788792c4fa2 100644
--- a/sys/arch/i386/i386/conf.c
+++ b/sys/arch/i386/i386/conf.c
@@ -1,4 +1,4 @@
-/* $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 $ */
/*
@@ -140,6 +140,7 @@ cdev_decl(cy);
#include "usb.h"
#include "uhid.h"
#include "fido.h"
+#include "ujoy.h"
#include "ugen.h"
#include "ulpt.h"
#include "ucom.h"
@@ -288,6 +289,7 @@ struct cdevsw cdevsw[] =
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);
diff --git a/sys/arch/landisk/conf/GENERIC b/sys/arch/landisk/conf/GENERIC
index 0c59680830a..120aa0a108d 100644
--- a/sys/arch/landisk/conf/GENERIC
+++ b/sys/arch/landisk/conf/GENERIC
@@ -1,4 +1,4 @@
-# $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.
@@ -137,6 +137,7 @@ uslhcom* at uhidev? # Silicon Labs CP2110 USB HID UART
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
diff --git a/sys/arch/landisk/landisk/conf.c b/sys/arch/landisk/landisk/conf.c
index b23ef6f4b6b..45cfbd31e32 100644
--- a/sys/arch/landisk/landisk/conf.c
+++ b/sys/arch/landisk/landisk/conf.c
@@ -1,4 +1,4 @@
-/* $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.
@@ -116,6 +116,7 @@ cdev_decl(pci);
#include "ugen.h"
#include "uhid.h"
#include "fido.h"
+#include "ujoy.h"
#include "ulpt.h"
/*
@@ -357,6 +358,7 @@ struct cdevsw cdevsw[] = {
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);
diff --git a/sys/arch/loongson/conf/GENERIC b/sys/arch/loongson/conf/GENERIC
index d8a84c570b8..4e8d826142b 100644
--- a/sys/arch/loongson/conf/GENERIC
+++ b/sys/arch/loongson/conf/GENERIC
@@ -1,4 +1,4 @@
-# $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.
@@ -164,6 +164,7 @@ uslhcom* at uhidev? # Silicon Labs CP2110 USB HID UART
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
diff --git a/sys/arch/loongson/loongson/conf.c b/sys/arch/loongson/loongson/conf.c
index 7ea9243382e..0520e67cac1 100644
--- a/sys/arch/loongson/loongson/conf.c
+++ b/sys/arch/loongson/loongson/conf.c
@@ -1,4 +1,4 @@
-/* $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
@@ -123,6 +123,7 @@ cdev_decl(pci);
#include "usb.h"
#include "uhid.h"
#include "fido.h"
+#include "ujoy.h"
#include "ugen.h"
#include "ulpt.h"
#include "ucom.h"
@@ -228,6 +229,7 @@ struct cdevsw cdevsw[] =
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);
diff --git a/sys/arch/macppc/conf/GENERIC b/sys/arch/macppc/conf/GENERIC
index 7f33c756d24..46cd7397286 100644
--- a/sys/arch/macppc/conf/GENERIC
+++ b/sys/arch/macppc/conf/GENERIC
@@ -1,4 +1,4 @@
-# $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.
@@ -260,6 +260,7 @@ uslhcom* at uhidev? # Silicon Labs CP2110 USB HID UART
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
diff --git a/sys/arch/macppc/macppc/conf.c b/sys/arch/macppc/macppc/conf.c
index a7c0ef70971..6a67a394fe4 100644
--- a/sys/arch/macppc/macppc/conf.c
+++ b/sys/arch/macppc/macppc/conf.c
@@ -1,4 +1,4 @@
-/* $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
@@ -98,6 +98,7 @@ cdev_decl(com);
#include "usb.h"
#include "uhid.h"
#include "fido.h"
+#include "ujoy.h"
#include "ugen.h"
#include "ulpt.h"
#include "ucom.h"
@@ -231,6 +232,7 @@ struct cdevsw cdevsw[] = {
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);
diff --git a/sys/arch/octeon/conf/GENERIC b/sys/arch/octeon/conf/GENERIC
index 63142e6667c..e5f407d7e9a 100644
--- a/sys/arch/octeon/conf/GENERIC
+++ b/sys/arch/octeon/conf/GENERIC
@@ -1,4 +1,4 @@
-# $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.
@@ -156,6 +156,7 @@ uslhcom* at uhidev? # Silicon Labs CP2110 USB HID UART
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
diff --git a/sys/arch/octeon/octeon/conf.c b/sys/arch/octeon/octeon/conf.c
index 51608cb7e32..b8a40b0ea08 100644
--- a/sys/arch/octeon/octeon/conf.c
+++ b/sys/arch/octeon/octeon/conf.c
@@ -1,4 +1,4 @@
-/* $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
@@ -136,6 +136,7 @@ cdev_decl(pci);
#include "usb.h"
#include "uhid.h"
#include "fido.h"
+#include "ujoy.h"
#include "ugen.h"
#include "ulpt.h"
#include "ucom.h"
@@ -235,6 +236,7 @@ struct cdevsw cdevsw[] =
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);
diff --git a/sys/arch/powerpc64/conf/GENERIC b/sys/arch/powerpc64/conf/GENERIC
index d874b1e308a..75e26260d84 100644
--- a/sys/arch/powerpc64/conf/GENERIC
+++ b/sys/arch/powerpc64/conf/GENERIC
@@ -1,4 +1,4 @@
-# $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.
@@ -126,6 +126,7 @@ uslhcom* at uhidev? # Silicon Labs CP2110 USB HID UART
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
diff --git a/sys/arch/powerpc64/powerpc64/conf.c b/sys/arch/powerpc64/powerpc64/conf.c
index 060e7501cd1..4f6b805b142 100644
--- a/sys/arch/powerpc64/powerpc64/conf.c
+++ b/sys/arch/powerpc64/powerpc64/conf.c
@@ -1,4 +1,4 @@
-/* $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.
@@ -64,6 +64,7 @@ cdev_decl(com);
#include "drm.h"
#include "dt.h"
#include "fido.h"
+#include "ujoy.h"
#include "fuse.h"
#include "hotplug.h"
#include "ipmi.h"
@@ -203,6 +204,7 @@ struct cdevsw cdevsw[] =
#else
cdev_notdef(), /* 93 */
#endif
+ cdev_ujoy_init(NUJOY,ujoy), /* 94: USB joystick/gamecontroller */
};
int nchrdev = nitems(cdevsw);
diff --git a/sys/arch/sgi/conf/GENERIC-IP27 b/sys/arch/sgi/conf/GENERIC-IP27
index af6d1b4f057..889a921dd8f 100644
--- a/sys/arch/sgi/conf/GENERIC-IP27
+++ b/sys/arch/sgi/conf/GENERIC-IP27
@@ -1,4 +1,4 @@
-# $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.
#
@@ -128,6 +128,7 @@ uslhcom* at uhidev? # Silicon Labs CP2110 USB HID UART
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
diff --git a/sys/arch/sgi/conf/GENERIC-IP30 b/sys/arch/sgi/conf/GENERIC-IP30
index 071d7babf95..bd90d34945b 100644
--- a/sys/arch/sgi/conf/GENERIC-IP30
+++ b/sys/arch/sgi/conf/GENERIC-IP30
@@ -1,4 +1,4 @@
-# $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.
#
@@ -119,6 +119,7 @@ uslhcom* at uhidev? # Silicon Labs CP2110 USB HID UART
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
diff --git a/sys/arch/sgi/conf/GENERIC-IP32 b/sys/arch/sgi/conf/GENERIC-IP32
index 4595a4eb60c..d4c0d64019a 100644
--- a/sys/arch/sgi/conf/GENERIC-IP32
+++ b/sys/arch/sgi/conf/GENERIC-IP32
@@ -1,4 +1,4 @@
-# $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.
#
@@ -111,6 +111,7 @@ uslhcom* at uhidev? # Silicon Labs CP2110 USB HID UART
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
diff --git a/sys/arch/sgi/sgi/conf.c b/sys/arch/sgi/sgi/conf.c
index bb9d2ef6d88..b6ee44c1688 100644
--- a/sys/arch/sgi/sgi/conf.c
+++ b/sys/arch/sgi/sgi/conf.c
@@ -1,4 +1,4 @@
-/* $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
@@ -122,6 +122,7 @@ cdev_decl(pci);
#include "usb.h"
#include "uhid.h"
#include "fido.h"
+#include "ujoy.h"
#include "ugen.h"
#include "ulpt.h"
#include "ucom.h"
@@ -215,6 +216,7 @@ struct cdevsw cdevsw[] =
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);
diff --git a/sys/arch/sparc64/conf/GENERIC b/sys/arch/sparc64/conf/GENERIC
index 92c2157cde0..e29faa8181a 100644
--- a/sys/arch/sparc64/conf/GENERIC
+++ b/sys/arch/sparc64/conf/GENERIC
@@ -1,4 +1,4 @@
-# $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.
@@ -224,6 +224,7 @@ umsm* at uhub? # Qualcomm MSM EVDO
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
diff --git a/sys/arch/sparc64/sparc64/conf.c b/sys/arch/sparc64/sparc64/conf.c
index 49c31ac84c3..6e7df9247dd 100644
--- a/sys/arch/sparc64/sparc64/conf.c
+++ b/sys/arch/sparc64/sparc64/conf.c
@@ -1,4 +1,4 @@
-/* $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 $ */
/*
@@ -104,6 +104,7 @@ cdev_decl(pci);
#include "usb.h"
#include "uhid.h"
#include "fido.h"
+#include "ujoy.h"
#include "ugen.h"
#include "ulpt.h"
#include "ucom.h"
@@ -297,6 +298,7 @@ struct cdevsw cdevsw[] =
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);
diff --git a/sys/dev/usb/files.usb b/sys/dev/usb/files.usb
index 1d673cf635d..ff94bf8765b 100644
--- a/sys/dev/usb/files.usb
+++ b/sys/dev/usb/files.usb
@@ -1,4 +1,4 @@
-# $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.
@@ -74,13 +74,18 @@ file dev/usb/uhidev.c uhidev
# 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
diff --git a/sys/dev/usb/uhid.c b/sys/dev/usb/uhid.c
index f43eaa13a13..bf3cd166380 100644
--- a/sys/dev/usb/uhid.c
+++ b/sys/dev/usb/uhid.c
@@ -1,4 +1,4 @@
-/* $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 $ */
/*
@@ -36,6 +36,7 @@
*/
#include "fido.h"
+#include "ujoy.h"
#include <sys/param.h>
#include <sys/systm.h>
@@ -97,6 +98,10 @@ uhid_lookup(dev_t dev)
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);
if (UHIDUNIT(dev) < cd->cd_ndevs)
diff --git a/sys/dev/usb/uhid.h b/sys/dev/usb/uhid.h
index 9b46dfc344f..e54454612ac 100644
--- a/sys/dev/usb/uhid.h
+++ b/sys/dev/usb/uhid.h
@@ -1,4 +1,4 @@
-/* $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 $ */
/*
@@ -48,6 +48,7 @@ struct uhid_softc {
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 */
diff --git a/sys/dev/usb/ujoy.c b/sys/dev/usb/ujoy.c
new file mode 100644
index 00000000000..18a35d737b9
--- /dev/null
+++ b/sys/dev/usb/ujoy.c
@@ -0,0 +1,149 @@
+/* $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));
+}
diff --git a/sys/sys/conf.h b/sys/sys/conf.h
index 7478aa7b825..5783e5244d2 100644
--- a/sys/sys/conf.h
+++ b/sys/sys/conf.h
@@ -1,4 +1,4 @@
-/* $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 $ */
/*-
@@ -383,6 +383,13 @@ extern struct cdevsw cdevsw[];
(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, \
@@ -624,6 +631,7 @@ cdev_decl(usb);
cdev_decl(ugen);
cdev_decl(uhid);
cdev_decl(fido);
+cdev_decl(ujoy);
cdev_decl(ucom);
cdev_decl(ulpt);
cdev_decl(urio);