Changeset 66babbd in mainline for uspace/lib/libc/generic/devman.c


Ignore:
Timestamp:
2010-03-25T09:55:09Z (14 years ago)
Author:
Lenka Trochtova <trochtova.lenka@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a087f2e
Parents:
d347b53
Message:

child device registration - match ids

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/libc/generic/devman.c

    rd347b53 r66babbd  
    3939#include <malloc.h>
    4040#include <bool.h>
     41#include <adt/list.h>
    4142
    4243static int devman_phone_driver = -1;
     
    106107}
    107108
     109static int devman_send_match_id(int phone, match_id_t *match_id) \
     110{
     111        ipc_call_t answer;
     112        async_send_1(phone, DEVMAN_ADD_MATCH_ID, match_id->score, &answer);
     113        int retval = async_data_write_start(phone, match_id->id, str_size(match_id->id));
     114        return retval; 
     115}
     116
     117
     118static int devman_send_match_ids(int phone, match_id_list_t *match_ids)
     119{
     120        link_t *link = match_ids->ids.next;
     121        match_id_t *match_id = NULL;
     122        int ret = EOK;
     123       
     124        while (link != &match_ids->ids) {
     125                match_id = list_get_instance(link, match_id_t, link);
     126                if (EOK != (ret = devman_send_match_id(phone, match_id)))
     127                {
     128                        printf("Driver failed to send match id, error number = %d\n", ret);
     129                        return ret;                     
     130                }
     131                link = link->next;
     132        }
     133        return ret;     
     134}
     135
    108136int devman_child_device_register(
    109137        const char *name, match_id_list_t *match_ids, device_handle_t parent_handle, device_handle_t *handle)
     
    116144        async_serialize_start();
    117145       
     146        int match_count = list_count(&match_ids->ids); 
    118147        ipc_call_t answer;
    119         aid_t req = async_send_1(phone, DEVMAN_ADD_CHILD_DEVICE, parent_handle, &answer);
     148        aid_t req = async_send_2(phone, DEVMAN_ADD_CHILD_DEVICE, parent_handle, match_count, &answer);
    120149
    121150        ipcarg_t retval = async_data_write_start(phone, name, str_size(name));
     
    126155        }
    127156       
    128         // TODO match ids
     157        devman_send_match_ids(phone, match_ids);
    129158       
    130159        async_wait_for(req, &retval);
     
    141170        if (handle != NULL)
    142171                *handle = (int) IPC_GET_ARG1(answer);   
     172               
     173        return retval;
    143174}
    144175
Note: See TracChangeset for help on using the changeset viewer.