aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/usb/input
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/usb/input')
-rw-r--r--sys/dev/usb/input/uhid.c25
-rw-r--r--sys/dev/usb/input/uhid_snes.c26
2 files changed, 45 insertions, 6 deletions
diff --git a/sys/dev/usb/input/uhid.c b/sys/dev/usb/input/uhid.c
index 97f9b1c8edea..1cad7af222ac 100644
--- a/sys/dev/usb/input/uhid.c
+++ b/sys/dev/usb/input/uhid.c
@@ -550,13 +550,30 @@ uhid_ioctl(struct usb_fifo *fifo, u_long cmd, void *addr,
{
struct uhid_softc *sc = usb_fifo_softc(fifo);
struct usb_gen_descriptor *ugd;
+#ifdef COMPAT_FREEBSD32
+ struct usb_gen_descriptor local_ugd;
+ struct usb_gen_descriptor32 *ugd32 = NULL;
+#endif
uint32_t size;
int error = 0;
uint8_t id;
+ ugd = addr;
+#ifdef COMPAT_FREEBSD32
+ switch (cmd) {
+ case USB_GET_REPORT_DESC32:
+ case USB_GET_REPORT32:
+ case USB_SET_REPORT32:
+ ugd32 = addr;
+ ugd = &local_ugd;
+ usb_gen_descriptor_from32(ugd, ugd32);
+ cmd = _IOC_NEWTYPE(cmd, struct usb_gen_descriptor);
+ break;
+ }
+#endif
+
switch (cmd) {
case USB_GET_REPORT_DESC:
- ugd = addr;
if (sc->sc_repdesc_size > ugd->ugd_maxlen) {
size = ugd->ugd_maxlen;
} else {
@@ -596,7 +613,6 @@ uhid_ioctl(struct usb_fifo *fifo, u_long cmd, void *addr,
error = EPERM;
break;
}
- ugd = addr;
switch (ugd->ugd_report_type) {
case UHID_INPUT_REPORT:
size = sc->sc_isize;
@@ -624,7 +640,6 @@ uhid_ioctl(struct usb_fifo *fifo, u_long cmd, void *addr,
error = EPERM;
break;
}
- ugd = addr;
switch (ugd->ugd_report_type) {
case UHID_INPUT_REPORT:
size = sc->sc_isize;
@@ -655,6 +670,10 @@ uhid_ioctl(struct usb_fifo *fifo, u_long cmd, void *addr,
error = ENOIOCTL;
break;
}
+#ifdef COMPAT_FREEBSD32
+ if (ugd32 != NULL)
+ update_usb_gen_descriptor32(ugd32, ugd);
+#endif
return (error);
}
diff --git a/sys/dev/usb/input/uhid_snes.c b/sys/dev/usb/input/uhid_snes.c
index 181e38eba7b1..9bce3d10941f 100644
--- a/sys/dev/usb/input/uhid_snes.c
+++ b/sys/dev/usb/input/uhid_snes.c
@@ -281,13 +281,30 @@ uhid_snes_ioctl(struct usb_fifo *fifo, u_long cmd, void *data, int fflags)
{
struct uhid_snes_softc *sc = usb_fifo_softc(fifo);
struct usb_gen_descriptor *ugd;
+#ifdef COMPAT_FREEBSD32
+ struct usb_gen_descriptor local_ugd;
+ struct usb_gen_descriptor32 *ugd32 = NULL;
+#endif
uint32_t size;
int error = 0;
uint8_t id;
+ ugd = data;
+#ifdef COMPAT_FREEBSD32
+ switch (cmd) {
+ case USB_GET_REPORT_DESC32:
+ case USB_GET_REPORT32:
+ case USB_SET_REPORT32:
+ ugd32 = data;
+ ugd = &local_ugd;
+ usb_gen_descriptor_from32(ugd, ugd32);
+ cmd = _IOC_NEWTYPE(cmd, struct usb_gen_descriptor);
+ break;
+ }
+#endif
+
switch (cmd) {
case USB_GET_REPORT_DESC:
- ugd = data;
if (sc->sc_repdesc_size > ugd->ugd_maxlen) {
size = ugd->ugd_maxlen;
} else {
@@ -328,7 +345,6 @@ uhid_snes_ioctl(struct usb_fifo *fifo, u_long cmd, void *data, int fflags)
error = EPERM;
break;
}
- ugd = data;
switch (ugd->ugd_report_type) {
case UHID_INPUT_REPORT:
size = sc->sc_isize;
@@ -356,7 +372,6 @@ uhid_snes_ioctl(struct usb_fifo *fifo, u_long cmd, void *data, int fflags)
error = EPERM;
break;
}
- ugd = data;
switch (ugd->ugd_report_type) {
case UHID_INPUT_REPORT:
size = sc->sc_isize;
@@ -388,6 +403,11 @@ uhid_snes_ioctl(struct usb_fifo *fifo, u_long cmd, void *data, int fflags)
error = EINVAL;
break;
}
+
+#ifdef COMPAT_FREEBSD32
+ if (ugd32 != NULL)
+ update_usb_gen_descriptor32(ugd32, ugd);
+#endif
return (error);
}