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 5 use std::sync::Arc; 6 7 use base::RawDescriptor; 8 9 use super::usb_hub::UsbHub; 10 use crate::usb::backend::error::Result; 11 use crate::utils::EventLoop; 12 use crate::utils::FailHandle; 13 14 /// Xhci backend provider will run on an EventLoop and connect new devices to usb ports. 15 pub trait XhciBackendDeviceProvider: Send + Sync { 16 /// Start the provider on EventLoop. start( &mut self, fail_handle: Arc<dyn FailHandle>, event_loop: Arc<EventLoop>, hub: Arc<UsbHub>, ) -> Result<()>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. keep_rds(&self) -> Vec<RawDescriptor>25 fn keep_rds(&self) -> Vec<RawDescriptor>; 26 } 27