Changeset 415c5116 in mainline for uspace/lib/usbhost/src/usb2_bus.c


Ignore:
Timestamp:
2017-12-29T00:23:34Z (6 years ago)
Author:
Petr Manek <petr.manek@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5dfb70c9
Parents:
deb2e55
Message:

usbhost: first stab at usb2 disconnect (wip)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usbhost/src/usb2_bus.c

    rdeb2e55 r415c5116  
    367367        assert(bus);
    368368
    369         // FIXME: Implement me!
    370 
    371         return ENOTSUP;
     369        int err;
     370        /* Tear down all drivers working with the device. */
     371        if ((err = ddf_fun_offline(device->fun))) {
     372                return err;
     373        }
     374
     375        /* Block creation of new endpoints and transfers. */
     376        usb_log_info("Device(%d): Going offline.", device->address);
     377        fibril_mutex_lock(&device->guard);
     378        device->online = false;
     379        fibril_mutex_unlock(&device->guard);
     380
     381        /* FIXME: This implementation leaves sleeping parts of drivers around.
     382         * With XHCI bus, the HID driver disengages and completely deactivates
     383         * when the DDF function is offlined. In USB2 bus, the driver receives
     384         * dev_remove and disengages "on paper" but later when interrupt message arrives,
     385         * some sleeping code is woken up and crashes the driver.
     386         *
     387         * The XHCI does 2 extra things that might prevent this behavior:
     388         *   (1) deconfigure the device,
     389         *   (2) deallocate all transfer TRB rings
     390         */
     391
     392        return EOK;
    372393}
    373394
Note: See TracChangeset for help on using the changeset viewer.