Rockbox open source high quality audio player as a Music Player Daemon
mpris rockbox mpd libadwaita audio rust zig deno
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

usb: fix random "null ctrl req" panic when switching usb config

Change-Id: I7839edb99461abfbff03460d63343691085ef34f

mojyack 75edff78 d395520c

+15 -1
+2
firmware/export/usb.h
··· 240 240 /* USB driver call this function to notify that a transfer has completed */ 241 241 void usb_signal_transfer_completion( 242 242 struct usb_transfer_completion_event_data *event_data); 243 + /* Clear all signaled transfer completion events from event queue */ 244 + void usb_clear_pending_transfer_completion_events(void); 243 245 /* notify the USB code that some important event has occurred which influences the 244 246 * USB state (like USB_NOTIFY_SET_ADDR). USB drivers should call usb_core_notify_* 245 247 * functions and not this function. */
+7
firmware/usb.c
··· 305 305 queue_post(&usb_queue, USB_TRANSFER_COMPLETION, (intptr_t)event_data); 306 306 } 307 307 308 + void usb_clear_pending_transfer_completion_events(void) 309 + { 310 + while (queue_peek_ex(&usb_queue, NULL, 311 + 1 | QPEEK_REMOVE_EVENTS, 312 + QPEEK_FILTER1(USB_TRANSFER_COMPLETION))); 313 + } 314 + 308 315 void usb_signal_notify(long id, intptr_t data) 309 316 { 310 317 queue_post(&usb_queue, id, data);
+6 -1
firmware/usbstack/usb_core.c
··· 863 863 } 864 864 } 865 865 init_deinit_endpoints(usb_config - 1, false); 866 + 867 + /* clear any pending transfer completions, 868 + * because they are depend on contents of ep_data */ 869 + usb_clear_pending_transfer_completion_events(); 870 + /* reset endpoint states */ 871 + memset(ep_data, 0, sizeof(ep_data)); 866 872 } 867 873 868 - memset(ep_data, 0, sizeof(ep_data)); 869 874 usb_config = new_config; 870 875 usb_state = usb_config == 0 ? ADDRESS : CONFIGURED; 871 876