summaryrefslogtreecommitdiff
path: root/drivers/usb/host
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2015-11-08 23:48:05 -0700
committerSimon Glass <sjg@chromium.org>2015-11-19 20:27:52 -0700
commitb70a3fea947b28c1368063048c494389d030233b (patch)
tree5bb6501eae2332832711044e1b858cc5265bfe0f /drivers/usb/host
parent2cdb58ebdc3268a261cd3761b730ca4b98d37985 (diff)
downloadu-boot-imx-b70a3fea947b28c1368063048c494389d030233b.zip
u-boot-imx-b70a3fea947b28c1368063048c494389d030233b.tar.gz
u-boot-imx-b70a3fea947b28c1368063048c494389d030233b.tar.bz2
usb: sandbox: Add support for interrupt operations
Allow USB device emulation to support interrupt URBs so that we can use USB keyboards with sandbox. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/usb/host')
-rw-r--r--drivers/usb/host/usb-sandbox.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/usb/host/usb-sandbox.c b/drivers/usb/host/usb-sandbox.c
index c5f9822..5e3d96c 100644
--- a/drivers/usb/host/usb-sandbox.c
+++ b/drivers/usb/host/usb-sandbox.c
@@ -87,6 +87,24 @@ static int sandbox_submit_bulk(struct udevice *bus, struct usb_device *udev,
return ret;
}
+static int sandbox_submit_int(struct udevice *bus, struct usb_device *udev,
+ unsigned long pipe, void *buffer, int length,
+ int interval)
+{
+ struct udevice *emul;
+ int ret;
+
+ /* Just use child of dev as emulator? */
+ debug("%s: bus=%s\n", __func__, bus->name);
+ ret = usb_emul_find(bus, pipe, &emul);
+ usbmon_trace(bus, pipe, NULL, emul);
+ if (ret)
+ return ret;
+ ret = usb_emul_int(emul, udev, pipe, buffer, length, interval);
+
+ return ret;
+}
+
static int sandbox_alloc_device(struct udevice *dev, struct usb_device *udev)
{
return 0;
@@ -100,6 +118,7 @@ static int sandbox_usb_probe(struct udevice *dev)
static const struct dm_usb_ops sandbox_usb_ops = {
.control = sandbox_submit_control,
.bulk = sandbox_submit_bulk,
+ .interrupt = sandbox_submit_int,
.alloc_device = sandbox_alloc_device,
};