pub struct VirtualDeviceConfig {
pub manufacturer: String,
pub model: String,
pub serial: String,
pub storages: Vec<VirtualStorageConfig>,
pub supports_rename: bool,
pub event_poll_interval: Duration,
pub watch_backing_dirs: bool,
}Expand description
Configuration for a virtual MTP device.
Defines the identity and storages of a virtual device that operates against a local filesystem directory instead of real USB hardware.
§Example
use std::path::PathBuf;
use std::time::Duration;
use mtp_rs::transport::virtual_device::config::{VirtualDeviceConfig, VirtualStorageConfig};
let config = VirtualDeviceConfig {
manufacturer: "Google".into(),
model: "Virtual Pixel 9".into(),
serial: "virtual-001".into(),
storages: vec![VirtualStorageConfig {
description: "Internal Storage".into(),
capacity: 64 * 1024 * 1024 * 1024,
backing_dir: PathBuf::from("/tmp/mtp-test"),
read_only: false,
}],
supports_rename: true,
event_poll_interval: Duration::from_millis(50),
watch_backing_dirs: true,
};Fields§
§manufacturer: StringManufacturer name reported by the virtual device.
model: StringModel name reported by the virtual device.
serial: StringSerial number for the virtual device.
storages: Vec<VirtualStorageConfig>Storage configurations. At least one storage is required.
supports_rename: boolWhether the device advertises SetObjectPropValue support (rename).
event_poll_interval: DurationHow long receive_interrupt waits when no events are pending.
Simulates the USB interrupt endpoint blocking behavior.
Default: 50ms for production use. Use Duration::ZERO in tests
to avoid slowing down the test suite.
watch_backing_dirs: boolWatch backing directories for out-of-band changes and emit MTP events.
When true, a background filesystem watcher detects files created or
removed directly in the backing directories (bypassing MTP) and queues
ObjectAdded/ObjectRemoved events. Set to false for tests that
don’t need this (faster startup, no background threads).
Trait Implementations§
Source§impl Clone for VirtualDeviceConfig
impl Clone for VirtualDeviceConfig
Source§fn clone(&self) -> VirtualDeviceConfig
fn clone(&self) -> VirtualDeviceConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more