Changeset 7969087 in mainline for uspace/app/devctl/devctl.c


Ignore:
Timestamp:
2013-09-11T10:35:49Z (11 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
43dd8028
Parents:
e5556e4a
Message:

devctl load-drv to manually load a driver.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/devctl/devctl.c

    re5556e4a r7969087  
    199199}
    200200
     201static int drv_load(const char *drvname)
     202{
     203        int rc;
     204        devman_handle_t drvh;
     205
     206        rc = devman_driver_get_handle(drvname, &drvh);
     207        if (rc != EOK) {
     208                printf("Failed resolving driver '%s' (%d).\n", drvname, rc);
     209                return rc;
     210        }
     211
     212        rc = devman_driver_load(drvh);
     213        if (rc != EOK) {
     214                printf("Failed loading driver '%s' (%d).\n", drvname, rc);
     215                return rc;
     216        }
     217
     218        return EOK;
     219}
     220
    201221static void print_syntax(void)
    202222{
     
    206226        printf("\tdevctl offline <function>]\n");
    207227        printf("\tdevctl list-drv\n");
     228        printf("\tdevctl load-drv <driver-name>\n");
    208229}
    209230
     
    242263                if (rc != EOK)
    243264                        return 2;
     265        } else if (str_cmp(argv[1], "load-drv") == 0) {
     266                if (argc < 3) {
     267                        printf(NAME ": Argument missing.\n");
     268                        print_syntax();
     269                        return 1;
     270                }
     271
     272                rc = drv_load(argv[2]);
     273                if (rc != EOK)
     274                        return 2;
    244275        } else {
    245276                printf(NAME ": Invalid argument '%s'.\n", argv[1]);
Note: See TracChangeset for help on using the changeset viewer.