Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/vhc/conndev.c

    re27595b r0b31409  
    2727 */
    2828
    29 /** @addtogroup usb
     29/** @addtogroup drvusbvhc
    3030 * @{
    3131 */
     
    4747{
    4848        ipc_call_t answer_data;
    49         ipcarg_t answer_rc;
     49        sysarg_t answer_rc;
    5050        aid_t req;
    5151        int rc;
     
    8383    ipc_callid_t icallid, ipc_call_t *icall)
    8484{
    85         ipcarg_t method = IPC_GET_METHOD(*icall);
     85        sysarg_t method = IPC_GET_IMETHOD(*icall);
    8686
    8787        if (method == IPC_M_CONNECT_TO_ME) {
    8888                int callback = IPC_GET_ARG5(*icall);
    8989                virtdev_connection_t *dev
    90                     = virtdev_add_device(callback);
     90                    = virtdev_add_device(callback, (sysarg_t)fibril_get_id());
    9191                if (!dev) {
    9292                        ipc_answer_0(icallid, EEXISTS);
     
    9999                int rc = get_device_name(callback, devname, DEVICE_NAME_MAXLENGTH);
    100100
    101                 dprintf(0, "virtual device connected (name: %s)",
    102                     rc == EOK ? devname : "<unknown>");
    103 
    104                 /* FIXME: destroy the device when the client disconnects. */
     101                usb_log_info("New virtual device `%s' (id = %x).\n",
     102                    rc == EOK ? devname : "<unknown>", dev->id);
    105103
    106104                return;
     
    110108}
    111109
     110/** Callback for DDF when client disconnects.
     111 *
     112 * @param d Device the client was connected to.
     113 */
     114void on_client_close(device_t *d)
     115{
     116        /*
     117         * Maybe a virtual device is being unplugged.
     118         */
     119        virtdev_connection_t *dev = virtdev_find((sysarg_t)fibril_get_id());
     120        if (dev == NULL) {
     121                return;
     122        }
     123
     124        usb_log_info("Virtual device disconnected (id = %x).\n", dev->id);
     125        virtdev_destroy_device(dev);
     126}
     127
    112128
    113129/**
Note: See TracChangeset for help on using the changeset viewer.