When doing removal notifications for USB devices, report the hub after the
children. Otherwise a driver that builds up a device hierarchy could run into trouble when the parent hub is removed before its child devices. Not that there were any drivers that do so, but it just seems more correct. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30641 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -349,16 +349,16 @@ Hub::ReportDevice(usb_support_descriptor *supportDescriptors,
|
||||
uint32 supportDescriptorCount, const usb_notify_hooks *hooks,
|
||||
usb_driver_cookie **cookies, bool added, bool recursive)
|
||||
{
|
||||
TRACE("reporting hub\n");
|
||||
status_t result = B_UNSUPPORTED;
|
||||
|
||||
// Report ourselfs first
|
||||
status_t result = Device::ReportDevice(supportDescriptors,
|
||||
supportDescriptorCount, hooks, cookies, added, recursive);
|
||||
if (added) {
|
||||
// Report hub before children when adding devices
|
||||
TRACE("reporting hub before children\n");
|
||||
result = Device::ReportDevice(supportDescriptors,
|
||||
supportDescriptorCount, hooks, cookies, added, recursive);
|
||||
}
|
||||
|
||||
if (!recursive)
|
||||
return result;
|
||||
|
||||
for (int32 i = 0; i < fHubDescriptor.num_ports; i++) {
|
||||
for (int32 i = 0; recursive && i < fHubDescriptor.num_ports; i++) {
|
||||
if (!fChildren[i])
|
||||
continue;
|
||||
|
||||
@@ -367,6 +367,14 @@ Hub::ReportDevice(usb_support_descriptor *supportDescriptors,
|
||||
result = B_OK;
|
||||
}
|
||||
|
||||
if (!added) {
|
||||
// Report hub after children when removing devices
|
||||
TRACE("reporting hub after children\n");
|
||||
if (Device::ReportDevice(supportDescriptors, supportDescriptorCount,
|
||||
hooks, cookies, added, recursive) == B_OK)
|
||||
result = B_OK;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user