Changeset e85920d in mainline for uspace/srv/devman/devman.c


Ignore:
Timestamp:
2010-02-18T15:23:15Z (14 years ago)
Author:
Lenka Trochtova <trochtova.lenka@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0c3666d
Parents:
08d9c4e6
Message:

parts of device manager

File:
1 edited

Legend:

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

    r08d9c4e6 re85920d  
    244244node_t * create_root_node()
    245245{
     246        printf(NAME ": create_root_node\n");
    246247        node_t *node = create_dev_node();
    247248        if (node) {
     
    257258driver_t * find_best_match_driver(link_t *drivers_list, node_t *node)
    258259{
     260        printf(NAME ": find_best_match_driver\n");
    259261        driver_t *best_drv = NULL, *drv = NULL;
    260262        int best_score = 0, score = 0;
     
    267269                        best_score = score;
    268270                        best_drv = drv;
    269                 }               
     271                }       
     272                link = link->next;
    270273        }       
    271274       
     
    281284bool start_driver(driver_t *drv)
    282285{
     286        printf(NAME ": start_driver\n");
     287       
    283288        char *argv[2];
    284289       
     
    293298        }
    294299       
     300        drv->state = DRIVER_STARTING;
    295301        return true;
    296302}
     
    298304bool add_device(driver_t *drv, node_t *node)
    299305{
     306        printf(NAME ": add_device\n");
     307       
    300308        // TODO
    301309       
     
    310318bool assign_driver(node_t *node, link_t *drivers_list)
    311319{
     320        printf(NAME ": assign_driver\n");
     321       
    312322        // find the driver which is the most suitable for handling this device
    313323        driver_t *drv = find_best_match_driver(drivers_list, node);
    314324        if (NULL == drv) {
     325                printf(NAME ": no driver found for device.\n");
    315326                return false;           
    316327        }
     
    319330        attach_driver(node, drv);
    320331       
    321         if (!drv->running) {
     332        if (DRIVER_NOT_STARTED == drv->state) {
    322333                // start driver
    323334                start_driver(drv);
    324         } else {
     335        }
     336       
     337        if (DRIVER_RUNNING == drv->state) {
    325338                // notify driver about new device
    326339                add_device(drv, node);         
     
    332345bool init_device_tree(dev_tree_t *tree, link_t *drivers_list)
    333346{
    334         printf(NAME ": init_device_tree.");
     347        printf(NAME ": init_device_tree.\n");
    335348        // create root node and add it to the device tree
    336349        if (NULL == (tree->root_node = create_root_node())) {
Note: See TracChangeset for help on using the changeset viewer.