diff options
Diffstat (limited to 'sys/dev/usb/input/uhid_snes.c')
-rw-r--r-- | sys/dev/usb/input/uhid_snes.c | 26 |
1 files changed, 23 insertions, 3 deletions
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); } |