#[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 - a null pointer could be passed in. Usage of !raw_pointer.is_null() checks should prevent unsafe behavior but the caller should ensure no null pointers are passed.