Resolve porting mistake on initial bus registration
On first registering a new bus in the the NetBSD build of the code usb_kthread_create(usb_create_event_thread, sc) is called which in turn creates the main event thread ("usb_event_thread"). The first thing usb_event_thread() does is set sc->sc_bus->needs_explore = 1; usb_discover(sc); however in the RISC OS version of the code (usb.c around line 254) only the first action is performed, no discover happens. This change schedules a callback via usb_needs_explore_callback() which in turn calls discover_callback() when the OS is next free, which calls usb_discover() for each bus in an equivalent way to NetBSD's event thread. There's then no longer any need for the special one-shot 11s rediscover callback, only the repeating 30s rediscover is needed. For reference, the places that set needs_explore in this version are all in usb.c Line 254: set, but doesn't schedule a callback, as noted above Line 339: code not compiled for __riscos Line 548: set, does schedule a callback Line 727: cleared, in usb_discover() Line 743: set, does schedule a callback Line 756: code not called in RISC OS NetBSD uses 500ms initial delay before discover, then 60s between discovers (or until requested by a hub, whichever is sooner). RISC OS has a periodic callback of 30s (in usbmodule.c) and an initial discover of however long it is from the bus being registered until callbacks next fire usb_event_thread(), assumed ~500ms. Version 1.07. Tagged as 'NetBSD-1_07'
Showing
Please register or sign in to comment