Changeset 81685dd9 in mainline for uspace/app/devctl/devctl.c


Ignore:
Timestamp:
2017-10-20T07:18:57Z (7 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
feab36ae
Parents:
04efacc
Message:

Add devctl unload-drv subcommand to manually unload a driver that is not in use.

File:
1 edited

Legend:

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

    r04efacc r81685dd9  
    337337}
    338338
     339static int drv_unload(const char *drvname)
     340{
     341        int rc;
     342        devman_handle_t drvh;
     343
     344        rc = devman_driver_get_handle(drvname, &drvh);
     345        if (rc != EOK) {
     346                printf("Failed resolving driver '%s' (%d).\n", drvname, rc);
     347                return rc;
     348        }
     349
     350        rc = devman_driver_unload(drvh);
     351        if (rc != EOK) {
     352                printf("Failed unloading driver '%s' (%d).\n", drvname, rc);
     353                return rc;
     354        }
     355
     356        return EOK;
     357}
     358
    339359static void print_syntax(void)
    340360{
     
    346366        printf("\tdevctl show-drv <driver-name>\n");
    347367        printf("\tdevctl load-drv <driver-name>\n");
     368        printf("\tdevctl unload-drv <driver-name>\n");
    348369}
    349370
     
    412433                if (rc != EOK)
    413434                        return 2;
     435        } else if (str_cmp(argv[1], "unload-drv") == 0) {
     436                if (argc < 3) {
     437                        printf(NAME ": Argument missing.\n");
     438                        print_syntax();
     439                        return 1;
     440                }
     441
     442                rc = drv_unload(argv[2]);
     443                if (rc != EOK)
     444                        return 2;
    414445        } else {
    415446                printf(NAME ": Invalid argument '%s'.\n", argv[1]);
Note: See TracChangeset for help on using the changeset viewer.