pub fn create_usb_manager(
metadata: DeviceMetadata,
) -> Result<Box<dyn UsbManager>, UsbError>Expand description
Creates a USB manager appropriate for the current platform.
Detects the platform from the PLATFORM environment variable and returns
the appropriate implementation:
mt8113t-ntx→ MTK ConfigFS-based manager- All others → Legacy kernel module-based manager
§Errors
Returns UsbError if:
- the
PLATFORMenvironment variable is not set, or - the MTK UDC cannot be discovered.
§Example
ⓘ
use cadmus_core::device::{CURRENT_DEVICE, DeviceMetadata};
let usb_manager = CURRENT_DEVICE.usb_manager()?;