Ignore:
File:
1 edited

Legend:

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

    r00b6c73 r6cb58e6  
    3737#include <errno.h>
    3838#include <ddf/driver.h>
    39 #include <usbvirt/ipc.h>
    4039#include "conn.h"
    4140
    4241static fibril_local uintptr_t plugged_device_handle = 0;
    43 #define PLUGGED_DEVICE_NAME_MAXLEN 256
    44 static fibril_local char plugged_device_name[PLUGGED_DEVICE_NAME_MAXLEN + 1] = "<unknown>";
    45 
    46 /** Receive device name.
    47  *
    48  * @warning Errors are silently ignored.
    49  *
    50  * @param phone Phone to the virtual device.
    51  */
    52 static void receive_device_name(int phone)
    53 {
    54         aid_t opening_request = async_send_0(phone, IPC_M_USBVIRT_GET_NAME, NULL);
    55         if (opening_request == 0) {
    56                 return;
    57         }
    58 
    59 
    60         ipc_call_t data_request_call;
    61         aid_t data_request = async_data_read(phone,
    62              plugged_device_name, PLUGGED_DEVICE_NAME_MAXLEN,
    63              &data_request_call);
    64 
    65         if (data_request == 0) {
    66                 async_wait_for(opening_request, NULL);
    67                 return;
    68         }
    69 
    70         sysarg_t data_request_rc;
    71         sysarg_t opening_request_rc;
    72         async_wait_for(data_request, &data_request_rc);
    73         async_wait_for(opening_request, &opening_request_rc);
    74 
    75         if ((data_request_rc != EOK) || (opening_request_rc != EOK)) {
    76                 return;
    77         }
    78 
    79         size_t len = IPC_GET_ARG2(data_request_call);
    80         plugged_device_name[len] = 0;
    81 }
    8242
    8343/** Default handler for IPC methods not handled by DDF.
     
    10565                async_answer_0(icallid, EOK);
    10666
    107                 receive_device_name(callback);
    108 
    109                 usb_log_info("New virtual device `%s' (id: %" PRIxn ").\n",
    110                     plugged_device_name, plugged_device_handle);
     67                usb_log_info("New virtual device `%s' (id = %" PRIxn ").\n",
     68                    rc == EOK ? "XXX" : "<unknown>", plugged_device_handle);
    11169
    11270                return;
     
    12785
    12886        if (plugged_device_handle != 0) {
    129                 usb_log_info("Virtual device `%s' disconnected (id: %" PRIxn ").\n",
    130                     plugged_device_name, plugged_device_handle);
     87                usb_log_info("Virtual device disconnected (id = %" PRIxn ").\n",
     88                    plugged_device_handle);
    13189                vhc_virtdev_unplug(vhc, plugged_device_handle);
    13290        }
Note: See TracChangeset for help on using the changeset viewer.