Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset beee81a in mainline for uspace/lib/usbvirt/src/device.c


Ignore:
Timestamp:
2011-05-07T09:35:15Z (11 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master
Children:
bc02b83, d38d830
Parents:
42e2172
Message:

Virtual USB refactoring

Changes include

  • add missing comments
  • add function for virtual device disconnect
  • fix memory leak
  • support for bulks
  • checking of input parameters
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usbvirt/src/device.c

    r42e2172 rbeee81a  
    4444#include <usb/debug.h>
    4545
     46/** Current device. */
    4647static usbvirt_device_t *DEV = NULL;
    4748
     49/** Main IPC call handling from virtual host controller.
     50 *
     51 * @param iid Caller identification.
     52 * @param icall Initial incoming call.
     53 */
    4854static void callback_connection(ipc_callid_t iid, ipc_call_t *icall)
    4955{
     
    8288        devman_handle_t handle;
    8389
     90        if (DEV != NULL) {
     91                return ELIMIT;
     92        }
     93
    8494        rc = devman_device_get_handle(vhc_path, &handle, 0);
    8595        if (rc != EOK) {
     
    94104
    95105        DEV = dev;
     106        dev->vhc_phone = hcd_phone;
    96107
    97108        rc = async_connect_to_me(hcd_phone, 0, 0, 0, callback_connection);
    98109        if (rc != EOK) {
    99110                DEV = NULL;
    100                 return rc;
    101111        }
    102112
    103 
    104 
    105         return EOK;
     113        return rc;
    106114}
    107115
     116/** Disconnect the device from virtual host controller.
     117 *
     118 * @param dev Device to be disconnected.
     119 */
     120void usbvirt_device_unplug(usbvirt_device_t *dev)
     121{
     122        async_hangup(dev->vhc_phone);
     123}
    108124
    109125/**
Note: See TracChangeset for help on using the changeset viewer.