* Use the rescan function when compiled for Haiku

* Move waiting for the first explore to complete
* Small cleanup

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23099 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Michael Lotz
2007-12-09 20:42:47 +00:00
parent 1ca1c1fb08
commit 1a802bca9d
2 changed files with 8 additions and 10 deletions
@@ -26,8 +26,6 @@ Pipe::~Pipe()
}
void
Pipe::InitCommon(int8 deviceAddress, uint8 endpointAddress, usb_speed speed,
pipeDirection direction, size_t maxPacketSize, uint8 interval,
@@ -57,7 +57,7 @@ Stack::Stack()
size_t bufferSize = sizeof(moduleName);
TRACE(("USB Stack: looking for host controller modules\n"));
while(read_next_module_name(moduleList, moduleName, &bufferSize) == B_OK) {
while (read_next_module_name(moduleList, moduleName, &bufferSize) == B_OK) {
bufferSize = sizeof(moduleName);
TRACE(("USB Stack: found module %s\n", moduleName));
@@ -81,6 +81,12 @@ Stack::Stack()
fExploreThread = spawn_kernel_thread(ExploreThread, "usb explore",
B_LOW_PRIORITY, this);
resume_thread(fExploreThread);
// wait for the first explore to complete. this ensures that a driver that
// is opening the module does not get rescanned while or before installing
// its hooks.
while (!fFirstExploreDone)
snooze(100);
}
@@ -110,7 +116,6 @@ Stack::InitCheck()
{
if (fBusManagers.Count() == 0)
return ENODEV;
return B_OK;
}
@@ -355,7 +360,7 @@ Stack::RescanDrivers(rescan_item *rescanItem)
close(devFS);
#else
// use the private devfs API under Haiku
//devfs_rescan_driver(name);
devfs_rescan_driver(rescanItem->name);
#endif
rescan_item *next = rescanItem->link;
@@ -436,11 +441,6 @@ Stack::InstallNotify(const char *driverName, const usb_notify_hooks *hooks)
{
TRACE(("USB Stack: installing notify hooks for driver \"%s\"\n", driverName));
// wait for the first explore to complete
// this ensures that we get all initial devices
while (!fFirstExploreDone)
snooze(1000);
usb_driver_info *element = fDriverList;
while (element) {
if (strcmp(element->driver_name, driverName) == 0) {