mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-03-28 02:16:50 +08:00
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>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
1f97e3f429
commit
c3a383d8d3
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user