Changeset f658458 in mainline for uspace/lib/libdrv


Ignore:
Timestamp:
2010-05-02T20:49:09Z (15 years ago)
Author:
Lenka Trochtova <trochtova.lenka@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
bb864a0
Parents:
25a7e11d
Message:

parts of generic char interface, fixed some bugs

Location:
uspace/lib/libdrv
Files:
3 edited

Legend:

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

    r25a7e11d rf658458  
    254254                        if (!is_valid_iface_idx(iface_idx)) {
    255255                                // this is not device's interface
    256                                 printf("%s: driver_connection_gen error - invalid interface id %x.", driver->name, method);
     256                                printf("%s: driver_connection_gen error - invalid interface id %d.", driver->name, iface_idx);
    257257                                ipc_answer_0(callid, ENOTSUP);
    258258                                break;
     
    265265                        if (NULL == iface) {
    266266                                printf("%s: driver_connection_gen error - ", driver->name);
    267                                 printf("device with handle %x has no interface with id %x.\n", handle, method);
     267                                printf("device with handle %d has no interface with id %d.\n", handle, iface_idx);
    268268                                ipc_answer_0(callid, ENOTSUP);
    269269                                break;
  • uspace/lib/libdrv/generic/remote_char.c

    r25a7e11d rf658458  
    5656
    5757static void remote_char_read(device_t *dev, void *iface, ipc_callid_t callid, ipc_call_t *call)
    58 {
     58{       
    5959        char_iface_t *char_iface = (char_iface_t *)iface;
    60         if (!char_iface->read) {
    61                 ipc_answer_0(callid, ENOTSUP);
    62                 return;
    63         }
    6460       
    6561        size_t len;
    6662        if (!async_data_read_receive(&callid, &len)) {
    6763                // TODO handle protocol error
     64                ipc_answer_0(callid, EINVAL);
     65                return;
     66        }
     67       
     68        if (!char_iface->read) {
     69                async_data_read_finalize(callid, NULL, 0);
     70                ipc_answer_0(callid, ENOTSUP);
    6871                return;
    6972        }
  • uspace/lib/libdrv/include/driver.h

    r25a7e11d rf658458  
    163163{
    164164        assert(is_valid_iface_idx(idx));       
    165 
     165        if (NULL == dev->class) {
     166                return NULL;
     167        }
    166168        return dev->class->interfaces[idx];     
    167169}
Note: See TracChangeset for help on using the changeset viewer.