Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset a78fa2a in mainline


Ignore:
Timestamp:
2010-04-23T08:35:36Z (12 years ago)
Author:
Lenka Trochtova <trochtova.lenka@…>
Branches:
lfn, master
Children:
df747b9c
Parents:
1f8657b
Message:

Send device's name to a driver when the device is passed to it.

Location:
uspace
Files:
2 edited

Legend:

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

    r1f8657b ra78fa2a  
    111111        device_t *dev = driver_create_device();
    112112        dev->handle = dev_handle;
     113        async_string_receive(&dev->name, 0, NULL);
    113114        add_to_devices_list(dev);
    114115        if (driver->driver_ops->add_device(dev)) {             
     
    121122                ret = 0;
    122123        }
    123         ipc_answer_1(iid, EOK, ret);
     124        ipc_answer_0(iid, EOK);
    124125}
    125126
  • uspace/srv/devman/devman.c

    r1f8657b ra78fa2a  
    503503{
    504504        printf(NAME ": add_device\n");
    505 
    506         ipcarg_t ret;
    507         ipcarg_t rc = async_req_1_1(phone, DRIVER_ADD_DEVICE, node->handle, &ret);
    508         if (rc != EOK) {
     505       
     506        ipcarg_t rc;
     507        ipc_call_t answer;
     508       
     509        // send the device to the driver
     510        aid_t req = async_send_1(phone, DRIVER_ADD_DEVICE, node->handle, &answer);
     511       
     512        // send the device's name to the driver
     513        rc = async_data_write_start(phone, node->name, str_size(node->name) + 1);
     514    if (rc != EOK) {
    509515                // TODO handle error
    510                 return;
    511         }
    512        
    513         // TODO inspect return value (ret) to find out whether the device was successfully probed and added
     516    }
     517       
     518        // wait for answer from the driver
     519        async_wait_for(req, &rc);
     520        switch(rc) {
     521                // TODO inspect return value to find out whether the device was successfully probed and added
     522        case EOK:
     523        case ENOENT:
     524               
     525                break;
     526               
     527        }
    514528       
    515529        return;
Note: See TracChangeset for help on using the changeset viewer.