Changeset 243cb86 in mainline for uspace/lib/drv/generic/driver.c


Ignore:
Timestamp:
2010-12-12T10:50:19Z (13 years ago)
Author:
Lubos Slovak <lubos.slovak@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8365533
Parents:
101ef25c (diff), ebb98c5 (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 from development + several changes to hid driver.

Changes to hid driver:

  • copied some code to usbkbd_get_descriptors() function
  • base structure for hid descriptor and report parser (files uspace/lib/usb/include/usb/classes/hidparser.h

and uspace/lib/usb/src/hidparser.c)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/drv/generic/driver.c

    r101ef25c r243cb86  
    381381}
    382382
     383/** Wrapper for child_device_register for devices with single match id.
     384 *
     385 * @param parent Parent device.
     386 * @param child_name Child device name.
     387 * @param child_match_id Child device match id.
     388 * @param child_match_score Child device match score.
     389 * @return Error code.
     390 */
     391int child_device_register_wrapper(device_t *parent, const char *child_name,
     392    const char *child_match_id, int child_match_score,
     393    devman_handle_t *child_handle)
     394{
     395        device_t *child = NULL;
     396        match_id_t *match_id = NULL;
     397        int rc;
     398
     399        child = create_device();
     400        if (child == NULL) {
     401                rc = ENOMEM;
     402                goto failure;
     403        }
     404
     405        child->name = child_name;
     406
     407        match_id = create_match_id();
     408        if (match_id == NULL) {
     409                rc = ENOMEM;
     410                goto failure;
     411        }
     412
     413        match_id->id = child_match_id;
     414        match_id->score = child_match_score;
     415        add_match_id(&child->match_ids, match_id);
     416
     417        rc = child_device_register(child, parent);
     418        if (EOK != rc)
     419                goto failure;
     420
     421        if (child_handle != NULL) {
     422                *child_handle = child->handle;
     423        }
     424        return EOK;
     425
     426failure:
     427        if (match_id != NULL) {
     428                match_id->id = NULL;
     429                delete_match_id(match_id);
     430        }
     431
     432        if (child != NULL) {
     433                child->name = NULL;
     434                delete_device(child);
     435        }
     436
     437        return rc;
     438}
     439
    383440int driver_main(driver_t *drv)
    384441{
Note: See TracChangeset for help on using the changeset viewer.