diff options
author | Andrey Konovalov <andreyknvl@gmail.com> | 2023-10-26 22:01:14 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-10-27 12:58:16 +0200 |
commit | c3a383d8d382e066038ab245c8d2b6d02f4bf8a2 (patch) | |
tree | a0dab8fa35c85c372b541d81a4ca42665aa40b2d /include/uapi/linux | |
parent | 1f97e3f429cff941b5f7adc9fcbb1b5138cd6125 (diff) | |
download | lwn-c3a383d8d382e066038ab245c8d2b6d02f4bf8a2.tar.gz lwn-c3a383d8d382e066038ab245c8d2b6d02f4bf8a2.zip |
usb: raw-gadget: report suspend, resume, reset, and disconnect events
Update USB_RAW_IOCTL_EVENT_FETCH to also report suspend, resume, reset,
and disconnect events.
This allows the code that emulates a USB device via Raw Gadget to handle
these events. For example, the device can restart enumeration when it
gets reset.
Also do not print a WARNING when the event queue overflows. With these new
events being queued, the queue might overflow if the device emulation code
stops fetching events.
Also print debug messages when a non-control event is received.
Signed-off-by: Andrey Konovalov <andreyknvl@gmail.com>
Link: https://lore.kernel.org/r/d610b629a5f32fb76c24012180743f7f0f1872c0.1698350424.git.andreyknvl@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/uapi/linux')
-rw-r--r-- | include/uapi/linux/usb/raw_gadget.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/include/uapi/linux/usb/raw_gadget.h b/include/uapi/linux/usb/raw_gadget.h index c7d2199134d7..f0224a8dc858 100644 --- a/include/uapi/linux/usb/raw_gadget.h +++ b/include/uapi/linux/usb/raw_gadget.h @@ -44,6 +44,16 @@ enum usb_raw_event_type { /* This event is queued when a new control request arrived to ep0. */ USB_RAW_EVENT_CONTROL = 2, + /* + * These events are queued when the gadget driver is suspended, + * resumed, reset, or disconnected. Note that some UDCs (e.g. dwc2) + * report a disconnect event instead of a reset. + */ + USB_RAW_EVENT_SUSPEND = 3, + USB_RAW_EVENT_RESUME = 4, + USB_RAW_EVENT_RESET = 5, + USB_RAW_EVENT_DISCONNECT = 6, + /* The list might grow in the future. */ }; @@ -54,8 +64,8 @@ enum usb_raw_event_type { * actual length of the fetched event data. * @data: A buffer to store the fetched event data. * - * Currently the fetched data buffer is empty for USB_RAW_EVENT_CONNECT, - * and contains struct usb_ctrlrequest for USB_RAW_EVENT_CONTROL. + * The fetched event data buffer contains struct usb_ctrlrequest for + * USB_RAW_EVENT_CONTROL and is empty for other events. */ struct usb_raw_event { __u32 type; |