Changeset 692c40cb in mainline for uspace/lib/c


Ignore:
Timestamp:
2010-05-28T09:04:37Z (15 years ago)
Author:
Lenka Trochtova <trochtova.lenka@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5159ae9
Parents:
c9f3b45c
Message:

Introduce device classes.Device class specifies functional type of the device. Device classes are identified by their string names (actually device class is just a string value). Device classes can be dynamically added. A device can be added to any number of classes.

Location:
uspace/lib/c
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/devman.c

    rc9f3b45c r692c40cb  
    180180}
    181181
     182int devman_add_device_to_class(device_handle_t dev_handle, const char *class_name)
     183{
     184        int phone = devman_get_phone(DEVMAN_DRIVER, IPC_FLAG_BLOCKING);
     185       
     186        if (phone < 0)
     187                return phone;
     188       
     189        async_serialize_start();
     190        ipc_call_t answer;
     191        aid_t req = async_send_1(phone, DEVMAN_ADD_DEVICE_TO_CLASS, dev_handle, &answer);
     192       
     193        ipcarg_t retval = async_data_write_start(phone, class_name, str_size(class_name));
     194        if (retval != EOK) {
     195                async_wait_for(req, NULL);
     196                async_serialize_end();
     197                return retval;
     198        }
     199       
     200        async_wait_for(req, &retval);
     201        async_serialize_end();
     202       
     203        return retval; 
     204}
     205
    182206void devman_hangup_phone(devman_interface_t iface)
    183207{
  • uspace/lib/c/include/devman.h

    rc9f3b45c r692c40cb  
    5353int devman_device_get_handle(const char *pathname, device_handle_t *handle, unsigned int flags);
    5454
     55int devman_add_device_to_class(device_handle_t dev_handle, const char *class_name);
    5556
    5657#endif
  • uspace/lib/c/include/ipc/devman.h

    rc9f3b45c r692c40cb  
    129129        DEVMAN_DRIVER_REGISTER = IPC_FIRST_USER_METHOD,
    130130        DEVMAN_ADD_CHILD_DEVICE,
    131         DEVMAN_ADD_MATCH_ID
     131        DEVMAN_ADD_MATCH_ID,
     132        DEVMAN_ADD_DEVICE_TO_CLASS
    132133
    133134} driver_to_devman_t;
Note: See TracChangeset for help on using the changeset viewer.