Changeset a81a1d09 in mainline for uspace/lib/usbhost/src


Ignore:
Timestamp:
2011-05-11T16:49:28Z (15 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

Location:
uspace/lib/usbhost/src
Files:
5 moved

Legend:

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

    re1dbcbc ra81a1d09  
    128128        memcpy(instance->buffer, instance->data_buffer, instance->buffer_size);
    129129
    130         usb_log_debug("Batch %p done (T%d.%d, %s %s in, %zuB): %s (%d).\n",
     130        usb_log_debug("Batch(%p) done (T%d.%d, %s %s in, %zuB): %s (%d).\n",
    131131            instance, instance->ep->address, instance->ep->endpoint,
    132132            usb_str_speed(instance->ep->speed),
    133133            usb_str_transfer_type_short(instance->ep->transfer_type),
    134             instance->transfered_size, str_error(instance->error), instance->error);
     134            instance->transfered_size, str_error(instance->error),
     135            instance->error);
    135136
    136137        instance->callback_in(instance->fun, instance->error,
     
    147148        assert(instance->callback_out);
    148149
    149         usb_log_debug("Batch %p done (T%d.%d, %s %s out): %s (%d).\n",
     150        usb_log_debug("Batch(%p) done (T%d.%d, %s %s out): %s (%d).\n",
    150151            instance, instance->ep->address, instance->ep->endpoint,
    151152            usb_str_speed(instance->ep->speed),
  • uspace/lib/usbhost/src/device_keeper.c

    re1dbcbc ra81a1d09  
    157157        return ENOENT;
    158158}
     159
     160/** Find devman handled assigned to USB address.
     161 *
     162 * @param[in] instance Device keeper structure to use.
     163 * @param[in] address Address the caller wants to find.
     164 * @param[out] handle Where to store found handle.
     165 * @return Whether such address is currently occupied.
     166 */
     167bool usb_device_keeper_find_by_address(usb_device_keeper_t *instance,
     168    usb_address_t address, devman_handle_t *handle)
     169{
     170        assert(instance);
     171        fibril_mutex_lock(&instance->guard);
     172        if ((address < 0) || (address >= USB_ADDRESS_COUNT)) {
     173                fibril_mutex_unlock(&instance->guard);
     174                return false;
     175        }
     176        if (!instance->devices[address].occupied) {
     177                fibril_mutex_unlock(&instance->guard);
     178                return false;
     179        }
     180
     181        if (handle != NULL) {
     182                *handle = instance->devices[address].handle;
     183        }
     184
     185        fibril_mutex_unlock(&instance->guard);
     186        return true;
     187}
     188
    159189/*----------------------------------------------------------------------------*/
    160190/** Get speed associated with the address
Note: See TracChangeset for help on using the changeset viewer.