Changeset 5cd136ab in mainline for uspace/srv/devman/main.c


Ignore:
Timestamp:
2010-04-02T13:37:58Z (14 years ago)
Author:
Lenka Trochtova <trochtova.lenka@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9a66bc2
Parents:
57937dd
Message:

device interfaces and driver cooperation - parts of code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/devman/main.c

    r57937dd r5cd136ab  
    5151#include <ctype.h>
    5252#include <ipc/devman.h>
     53#include <ipc/driver.h>
    5354#include <thread.h>
    5455
     
    158159{
    159160        int ret = EOK;
    160         int i;
     161        size_t i;
    161162        for (i = 0; i < match_count; i++) {
    162163                if (EOK != (ret = devman_receive_match_id(match_ids))) {
     
    257258}
    258259
     260static void devman_forward(ipc_callid_t iid, ipc_call_t *icall, bool drv_to_parent) {
     261        device_handle_t handle;
     262        node_t *dev = find_dev_node(&device_tree, handle);
     263        if (NULL == dev) {
     264                ipc_answer_0(iid, ENOENT);
     265                return;
     266        }
     267       
     268        driver_t *driver = NULL;
     269       
     270        if (drv_to_parent) {
     271                driver = dev->parent->drv;
     272        } else {
     273                driver = dev->drv;             
     274        }
     275       
     276        if (NULL == driver) {           
     277                ipc_answer_0(iid, ENOENT);
     278                return;
     279        }
     280       
     281        int method;     
     282        if (drv_to_parent) {
     283                method = DRIVER_DRIVER;
     284        } else {
     285                method = DRIVER_CLIENT;
     286        }
     287       
     288        ipc_forward_fast(iid, driver->phone, method, dev->handle, 0, IPC_FF_NONE);     
     289}
     290
    259291/** Function for handling connections to device manager.
    260292 *
     
    269301        /*case DEVMAN_CLIENT:
    270302                devmap_connection_client(iid, icall);
    271                 break;
     303                break;*/
    272304        case DEVMAN_CONNECT_TO_DEVICE:
    273305                // Connect client to selected device
    274                 devmap_forward(iid, icall);
    275                 break;*/
     306                devman_forward(iid, icall, false);
     307                break;
     308        case DEVMAN_CONNECT_TO_PARENTS_DEVICE:
     309                // Connect client to selected device
     310                devman_forward(iid, icall, true);
     311                break;         
    276312        default:
    277313                /* No such interface */
Note: See TracChangeset for help on using the changeset viewer.