Changeset 7969087 in mainline for uspace/srv/devman/client_conn.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/srv/devman/client_conn.c

    re5556e4a r7969087  
    450450}
    451451
     452/** Find driver by name. */
     453static void devman_driver_get_handle(ipc_callid_t iid, ipc_call_t *icall)
     454{
     455        char *drvname;
     456       
     457        int rc = async_data_write_accept((void **) &drvname, true, 0, 0, 0, 0);
     458        if (rc != EOK) {
     459                async_answer_0(iid, rc);
     460                return;
     461        }
     462       
     463        driver_t *driver = driver_find_by_name(&drivers_list, drvname);
     464       
     465        free(drvname);
     466       
     467        if (driver == NULL) {
     468                async_answer_0(iid, ENOENT);
     469                return;
     470        }
     471       
     472        async_answer_1(iid, EOK, driver->handle);
     473}
     474
    452475/** Get driver name. */
    453476static void devman_driver_get_name(ipc_callid_t iid, ipc_call_t *icall)
     
    502525       
    503526        async_answer_1(iid, EOK, (sysarg_t) drv->state);
     527}
     528
     529/** Forcibly load a driver. */
     530static void devman_driver_load(ipc_callid_t iid, ipc_call_t *icall)
     531{
     532        driver_t *drv;
     533        int rc;
     534       
     535        drv = driver_find(&drivers_list, IPC_GET_ARG1(*icall));
     536        if (drv == NULL) {
     537                async_answer_0(iid, ENOENT);
     538                return;
     539        }
     540       
     541        fibril_mutex_lock(&drv->driver_mutex);
     542        rc = start_driver(drv) ? EOK : EIO;
     543        fibril_mutex_unlock(&drv->driver_mutex);
     544
     545        async_answer_0(iid, rc);
    504546}
    505547
     
    548590                        devman_get_drivers(callid, &call);
    549591                        break;
     592                case DEVMAN_DRIVER_GET_HANDLE:
     593                        devman_driver_get_handle(callid, &call);
     594                        break;
    550595                case DEVMAN_DRIVER_GET_NAME:
    551596                        devman_driver_get_name(callid, &call);
     
    553598                case DEVMAN_DRIVER_GET_STATE:
    554599                        devman_driver_get_state(callid, &call);
     600                        break;
     601                case DEVMAN_DRIVER_LOAD:
     602                        devman_driver_load(callid, &call);
    555603                        break;
    556604                default:
Note: See TracChangeset for help on using the changeset viewer.