Function crosvm_control::crosvm_client_usb_list

source ·
#[no_mangle]
pub unsafe extern "C" fn crosvm_client_usb_list(
    socket_path: *const c_char,
    entries: *mut UsbDeviceEntry,
    entries_length: ssize_t,
) -> ssize_t
Expand description

Returns all USB devices passed through the crosvm instance whose control socket is listening on socket_path.

The function returns the amount of entries written.

§Arguments

  • socket_path - Path to the crosvm control socket
  • entries - Pointer to an array of UsbDeviceEntry where the details about the attached devices will be written to
  • entries_length - Amount of entries in the array specified by entries

Use the value returned by crosvm_client_max_usb_devices() to determine the size of the input array to this function.

§Safety

Function is unsafe due to raw pointer usage - socket_path should be a non-null pointer to a C string that is valid and for reads and not modified for the duration of the call. entries should be a valid pointer to an array of UsbDeviceEntry valid for writes that contains at least entries_length elements and is not externally modified for the duration of this call.