Changeset a81a1d09 in mainline for uspace/app/vuhid/device.c


Ignore:
Timestamp:
2011-05-11T16:49:28Z (13 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
19387b61
Parents:
e1dbcbc (diff), 9212f8a (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge development/ changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/vuhid/device.c

    re1dbcbc ra81a1d09  
    7777{
    7878        vuhid_interface_t *iface = arg;
     79        vuhid_data_t *hid_data = iface->vuhid_data;
    7980
    8081        if (iface->live != NULL) {
    8182                iface->live(iface);
    8283        }
     84
     85        fibril_mutex_lock(&hid_data->iface_count_mutex);
     86        hid_data->iface_died_count++;
     87        fibril_condvar_broadcast(&hid_data->iface_count_cv);
     88        fibril_mutex_unlock(&hid_data->iface_count_mutex);
    8389
    8490        return EOK;
     
    110116        if ((iface->in_data_size == 0) && (iface->out_data_size == 0)) {
    111117                return EEMPTY;
     118        }
     119
     120        // FIXME - we shall set vuhid_data to NULL in the main() rather
     121        // than to depend on individual interfaces
     122        /* Already used interface. */
     123        if (iface->vuhid_data != NULL) {
     124                return EEXISTS;
    112125        }
    113126
     
    252265
    253266        /* Launch the "life" fibril. */
     267        iface->vuhid_data = hid_data;
    254268        fid_t life_fibril = fibril_create(interface_life_fibril, iface);
    255269        if (life_fibril == 0) {
     
    310324            += total_descr_size;
    311325
     326        hid_data->iface_count++;
    312327        fibril_add_ready(life_fibril);
    313328
     
    331346}
    332347
     348void wait_for_interfaces_death(usbvirt_device_t *dev)
     349{
     350        vuhid_data_t *hid_data = dev->device_data;
     351
     352        fibril_mutex_lock(&hid_data->iface_count_mutex);
     353        while (hid_data->iface_died_count < hid_data->iface_count) {
     354                fibril_condvar_wait(&hid_data->iface_count_cv,
     355                    &hid_data->iface_count_mutex);
     356        }
     357        fibril_mutex_unlock(&hid_data->iface_count_mutex);
     358}
    333359
    334360/** @}
Note: See TracChangeset for help on using the changeset viewer.