Changeset 25a7e11d in mainline for uspace/lib/libdrv/generic/driver.c


Ignore:
Timestamp:
2010-04-30T14:13:41Z (14 years ago)
Author:
Lenka Trochtova <trochtova.lenka@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f658458
Parents:
dafe675
Message:

backup (unstable)

File:
1 edited

Legend:

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

    rdafe675 r25a7e11d  
    224224        // TODO - if the client is not a driver, check whether it is allowed to use the device
    225225
    226         // TODO open the device (introduce some callbacks for opening and closing devices registered by the driver)
    227        
    228         ipc_answer_0(iid, EOK);
     226        int ret = EOK;
     227        // open the device
     228        if (NULL != dev->class && NULL != dev->class->open) {
     229                ret = (*dev->class->open)(dev);
     230        }
     231       
     232        ipc_answer_0(iid, ret);
    229233
    230234        while (1) {
     
    236240               
    237241                switch  (method) {
    238                 case IPC_M_PHONE_HUNGUP:
    239                
    240                         // TODO close the device
    241                        
     242                case IPC_M_PHONE_HUNGUP:               
     243                        // close the device
     244                        if (NULL != dev->class && NULL != dev->class->close) {
     245                                (*dev->class->close)(dev);
     246                        }                       
    242247                        ipc_answer_0(callid, EOK);
    243248                        return;
Note: See TracChangeset for help on using the changeset viewer.