From af9c7c11e97ce99a8b8a0de99f91bde1b703377e Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 8 Nov 2015 23:47:55 -0700 Subject: sandbox: usb: Allow finding a USB emulator for a device Each USB device has an emulator. Currently this can only be found by supplying the 'pipe' value, which contains the device number. Add a way to find it directly from the emulated device. Signed-off-by: Simon Glass --- include/usb.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'include/usb.h') diff --git a/include/usb.h b/include/usb.h index a09c7f199a..d68453109a 100644 --- a/include/usb.h +++ b/include/usb.h @@ -949,6 +949,16 @@ int usb_emul_bulk(struct udevice *emul, struct usb_device *udev, */ int usb_emul_find(struct udevice *bus, ulong pipe, struct udevice **emulp); +/** + * usb_emul_find_for_dev() - Find an emulator for a particular device + * + * @bus: USB bus (controller) + * @dev: USB device to check + * @emulp: Returns pointer to emulator, or NULL if not found + * @return 0 if found, -ve on error + */ +int usb_emul_find_for_dev(struct udevice *dev, struct udevice **emulp); + /** * usb_emul_reset() - Reset all emulators ready for use * -- cgit v1.2.3