Changeset 266d0871 in mainline for uspace/lib/usbvirt/src/ctrlpipe.c


Ignore:
Timestamp:
2010-12-15T13:25:20Z (14 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1840e0d
Parents:
d5e7668
Message:

usbvirt: add callback when device changes state

The virtual root hub uses this to suspend power source to all
ports when entering `configured' state.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usbvirt/src/ctrlpipe.c

    rd5e7668 r266d0871  
    154154                 * setting address when in configured state).
    155155                 */
     156                usbvirt_device_state_t new_state;
    156157                if (device->new_address == 0) {
    157                         device->state = USBVIRT_STATE_DEFAULT;
     158                        new_state = USBVIRT_STATE_DEFAULT;
    158159                } else {
    159                         device->state = USBVIRT_STATE_ADDRESS;
     160                        new_state = USBVIRT_STATE_ADDRESS;
    160161                }
    161162                device->address = device->new_address;
     
    163164                device->new_address = -1;
    164165               
     166                if (DEVICE_HAS_OP(device, on_state_change)) {
     167                        device->ops->on_state_change(device, device->state,
     168                            new_state);
     169                }
     170                device->state = new_state;
     171
    165172                device->lib_debug(device, 2, USBVIRT_DEBUGTAG_CONTROL_PIPE_ZERO,
    166173                    "device address changed to %d (state %s)",
Note: See TracChangeset for help on using the changeset viewer.