devices/usb/xhci/
xhci_backend_device_provider.rs

1// Copyright 2019 The ChromiumOS Authors
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5use std::sync::Arc;
6
7use base::RawDescriptor;
8
9use super::usb_hub::UsbHub;
10use crate::usb::backend::error::Result;
11use crate::utils::EventLoop;
12use crate::utils::FailHandle;
13
14/// Xhci backend provider will run on an EventLoop and connect new devices to usb ports.
15pub trait XhciBackendDeviceProvider: Send + Sync {
16    /// Start the provider on EventLoop.
17    fn start(
18        &mut self,
19        fail_handle: Arc<dyn FailHandle>,
20        event_loop: Arc<EventLoop>,
21        hub: Arc<UsbHub>,
22    ) -> Result<()>;
23
24    /// Keep raw descriptors that should be kept open.
25    fn keep_rds(&self) -> Vec<RawDescriptor>;
26}