Changeset f658458 in mainline for uspace/srv/devman/main.c


Ignore:
Timestamp:
2010-05-02T20:49: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:
bb864a0
Parents:
25a7e11d
Message:

parts of generic char interface, fixed some bugs

File:
1 edited

Legend:

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

    r25a7e11d rf658458  
    291291}
    292292
     293/** Find handle for the device instance identified by the device's path in the device tree.
     294 */
     295static void devman_device_get_handle(ipc_callid_t iid, ipc_call_t *icall)
     296{
     297        char *pathname;
     298       
     299        /* Get fqdn */
     300        int rc = async_string_receive(&pathname, 0, NULL);
     301        if (rc != EOK) {
     302                ipc_answer_0(iid, rc);
     303                return;
     304        }
     305       
     306        node_t * dev = find_dev_node_by_path(&device_tree, pathname);
     307       
     308        free(pathname);
     309
     310        if (NULL == dev) {
     311                ipc_answer_0(iid, ENOENT);
     312                return;
     313        }
     314       
     315        ipc_answer_1(iid, EOK, dev->handle);
     316}
     317
     318
     319/** Function for handling connections from a client to the device manager.
     320 */
     321static void devman_connection_client(ipc_callid_t iid, ipc_call_t *icall)
     322{
     323        /* Accept connection */
     324        ipc_answer_0(iid, EOK);
     325       
     326        bool cont = true;
     327        while (cont) {
     328                ipc_call_t call;
     329                ipc_callid_t callid = async_get_call(&call);
     330               
     331                switch (IPC_GET_METHOD(call)) {
     332                case IPC_M_PHONE_HUNGUP:
     333                        cont = false;
     334                        continue;
     335                case DEVMAN_DEVICE_GET_HANDLE:
     336                        devman_device_get_handle(callid, &call);
     337                        break;
     338                default:
     339                        if (!(callid & IPC_CALLID_NOTIFICATION))
     340                                ipc_answer_0(callid, ENOENT);
     341                }
     342        }       
     343}
     344
    293345static void devman_forward(ipc_callid_t iid, ipc_call_t *icall, bool drv_to_parent) {   
    294346       
     
    346398                devman_connection_driver(iid, icall);
    347399                break;
    348         /*case DEVMAN_CLIENT:
    349                 devmap_connection_client(iid, icall);
    350                 break;*/
     400        case DEVMAN_CLIENT:
     401                devman_connection_client(iid, icall);
     402                break;
    351403        case DEVMAN_CONNECT_TO_DEVICE:
    352404                // Connect client to selected device
Note: See TracChangeset for help on using the changeset viewer.