With plain R5 kernels, the usb module image is apparently loaded twice (once for each exported module), while for BONE kernels and up the module is only loaded once.
So the mechanism with the global variable did not work for R5 what caused two USB stacks and host controller drivers to be active concurrently which resulted in completely unpredictable results. This kind-of-inelegant fix was all I could come up with, if someone has a better idea please send it this way. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20003 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
b6a6e8e347
commit
a94a8358e8
@ -23,12 +23,19 @@ bus_std_ops(int32 op, ...)
|
||||
if (gUSBStack)
|
||||
return B_OK;
|
||||
|
||||
void *address = NULL;
|
||||
area_id shared = find_area("shared usb stack");
|
||||
if (shared >= B_OK && clone_area("usb stack clone", &address,
|
||||
B_ANY_KERNEL_ADDRESS, B_KERNEL_READ_AREA, shared) >= B_OK) {
|
||||
gUSBStack = *((Stack **)address);
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
#ifdef TRACE_USB
|
||||
set_dprintf_enabled(true);
|
||||
load_driver_symbols("usb");
|
||||
TRACE(("usb_module: init\n"));
|
||||
#endif
|
||||
|
||||
Stack *stack = new(std::nothrow) Stack();
|
||||
if (!stack)
|
||||
return B_NO_MEMORY;
|
||||
@ -39,6 +46,13 @@ bus_std_ops(int32 op, ...)
|
||||
}
|
||||
|
||||
gUSBStack = stack;
|
||||
shared = create_area("shared usb stack", &address,
|
||||
B_ANY_KERNEL_ADDRESS, B_PAGE_SIZE, B_NO_LOCK,
|
||||
B_KERNEL_WRITE_AREA);
|
||||
if (shared >= B_OK) {
|
||||
*((Stack **)address) = gUSBStack;
|
||||
return B_OK;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user