summary refs log tree commit diff
path: root/devices/src/usb/xhci/xhci_backend_device_provider.rs
blob: 2c9d4bfe43f2a6873d55b47b2af7e56998e655b3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Copyright 2019 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

use super::usb_hub::UsbHub;
use std::os::unix::io::RawFd;
use std::sync::Arc;
use utils::{EventLoop, FailHandle};

/// Xhci backend provider will run on an EventLoop and connect new devices to usb ports.
pub trait XhciBackendDeviceProvider: Send {
    /// Start the provider on EventLoop.
    fn start(
        &mut self,
        fail_handle: Arc<FailHandle>,
        event_loop: Arc<EventLoop>,
        hub: Arc<UsbHub>,
    ) -> std::result::Result<(), ()>;

    /// Keep fds that should be kept open.
    fn keep_fds(&self) -> Vec<RawFd>;
}