linux-user: Implement special usbfs ioctls.

Userspace submits a USB Request Buffer to the kernel, optionally
discards it, and finally reaps the URB.  Thunk buffers from target
to host and back.

Tested by running an i386 scanner driver on ARMv7 and by running
the PowerPC lsusb utility on x86_64.  The discardurb ioctl is
not exercised in these tests.

Signed-off-by: Cortland Tölva <cst@tolva.net>
Message-Id: <20181008163521.17341-4-cst@tolva.net>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
This commit is contained in:
Cortland Tölva 2018-10-08 09:35:21 -07:00 committed by Laurent Vivier
parent 6c753a63ed
commit a133367ec1
4 changed files with 209 additions and 0 deletions

View file

@ -143,6 +143,14 @@
IOCTL(USBDEVFS_SETCONFIGURATION, IOC_W, MK_PTR(TYPE_INT))
IOCTL(USBDEVFS_GETDRIVER, IOC_R,
MK_PTR(MK_STRUCT(STRUCT_usbdevfs_getdriver)))
IOCTL_SPECIAL(USBDEVFS_SUBMITURB, IOC_W, do_ioctl_usbdevfs_submiturb,
MK_PTR(MK_STRUCT(STRUCT_usbdevfs_urb)))
IOCTL_SPECIAL(USBDEVFS_DISCARDURB, IOC_RW, do_ioctl_usbdevfs_discardurb,
MK_PTR(MK_STRUCT(STRUCT_usbdevfs_urb)))
IOCTL_SPECIAL(USBDEVFS_REAPURB, IOC_R, do_ioctl_usbdevfs_reapurb,
MK_PTR(TYPE_PTRVOID))
IOCTL_SPECIAL(USBDEVFS_REAPURBNDELAY, IOC_R, do_ioctl_usbdevfs_reapurb,
MK_PTR(TYPE_PTRVOID))
IOCTL(USBDEVFS_DISCSIGNAL, IOC_W,
MK_PTR(MK_STRUCT(STRUCT_usbdevfs_disconnectsignal)))
IOCTL(USBDEVFS_CLAIMINTERFACE, IOC_W, MK_PTR(TYPE_INT))