Changeset 5dfb70c9 in mainline for uspace/lib/usbhost/src/usb2_bus.c


Ignore:
Timestamp:
2017-12-29T12:10:56Z (7 years ago)
Author:
Petr Manek <petr.manek@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5c75456
Parents:
415c5116
Message:

uhci: moved offline call from usbhost, terminating hanging transfers

File:
1 edited

Legend:

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

    r415c5116 r5dfb70c9  
    352352}
    353353
    354 static int usb2_bus_device_online(device_t *device)
    355 {
    356         usb2_bus_t *bus = bus_to_usb2_bus(device->bus);
    357         assert(bus);
    358 
    359         // FIXME: Implement me!
    360 
    361         return ENOTSUP;
    362 }
    363 
    364 static int usb2_bus_device_offline(device_t *device)
    365 {
    366         usb2_bus_t *bus = bus_to_usb2_bus(device->bus);
    367         assert(bus);
    368 
    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;
    393 }
    394 
    395354static endpoint_t *usb2_bus_create_ep(device_t *dev, const usb_endpoint_desc_t *desc)
    396355{
     
    496455        .device_enumerate = usb2_bus_device_enumerate,
    497456        .device_find_endpoint = usb2_bus_find_ep,
    498         .device_online = usb2_bus_device_online,
    499         .device_offline = usb2_bus_device_offline,
    500457        .endpoint_create = usb2_bus_create_ep,
    501458        .endpoint_register = usb2_bus_register_ep,
Note: See TracChangeset for help on using the changeset viewer.