pub fn new(
        stdio_serial: Option<Arc<Mutex<devices::legacy::Serial>>>,
        i8042_reset_evfd: EventFd,
    ) -> Result<Self> {
        let io_bus = devices::Bus::new();
        let com_evt_1_3 = if let Some(serial) = &stdio_serial {
            serial
                .lock()
                .unwrap()
                .interrupt_evt()
                .try_clone()
                .map_err(Error::EventFd)?
        } else {
            EventFd::new(utils::eventfd::EFD_NONBLOCK).map_err(Error::EventFd)?
        };
        let com_evt_2_4 = EventFd::new(utils::eventfd::EFD_NONBLOCK).map_err(Error::EventFd)?;
        let kbd_evt = EventFd::new(utils::eventfd::EFD_NONBLOCK).map_err(Error::EventFd)?;

        let i8042 = Arc::new(Mutex::new(devices::legacy::I8042Device::new(
            i8042_reset_evfd,
            kbd_evt.try_clone().map_err(Error::EventFd)?,
        )));

        Ok(PortIODeviceManager {
            io_bus,
            stdio_serial,
            i8042,
            com_evt_1_3,
            com_evt_2_4,
            kbd_evt,
        })
    }
/// Create a new DeviceManager handling legacy devices (uart, i8042).
Create a new DeviceManager handling legacy devices (uart, i8042).
Create a new DeviceManager handling legacy devices ( uart i8042 ) .
pub fn new(
        stdio_serial: Option<Arc<Mutex<devices::legacy::Serial>>>,
        i8042_reset_evfd: EventFd,
    ) -> Result<Self> {
        let io_bus = devices::Bus::new();
        let com_evt_1_3 = if let Some(serial) = &stdio_serial {
            serial
                .lock()
                .unwrap()
                .interrupt_evt()
                .try_clone()
                .map_err(Error::EventFd)?
        } else {
            EventFd::new(utils::eventfd::EFD_NONBLOCK).map_err(Error::EventFd)?
        };
        let com_evt_2_4 = EventFd::new(utils::eventfd::EFD_NONBLOCK).map_err(Error::EventFd)?;
        let kbd_evt = EventFd::new(utils::eventfd::EFD_NONBLOCK).map_err(Error::EventFd)?;
        let i8042 = Arc::new(Mutex::new(devices::legacy::I8042Device::new(
            i8042_reset_evfd,
            kbd_evt.try_clone().map_err(Error::EventFd)?,
        )));
        Ok(PortIODeviceManager {
            io_bus,
            stdio_serial,
            i8042,
            com_evt_1_3,
            com_evt_2_4,
            kbd_evt,
        })
    }
pub fn new ( stdio_serial : Option < Arc < Mutex < devices :: legacy :: Serial > > > , i8042_reset_evfd : EventFd , ) -> Result < Self > { let io_bus = devices :: Bus :: new ( ) ; let com_evt_1_3 = if let Some ( serial ) = & stdio_serial { serial . lock ( ) . unwrap ( ) . interrupt_evt ( ) . try_clone ( ) . map_err ( Error :: EventFd ) ? } else { EventFd :: new ( utils :: eventfd :: EFD_NONBLOCK ) . map_err ( Error :: EventFd ) ? } ; let com_evt_2_4 = EventFd :: new ( utils :: eventfd :: EFD_NONBLOCK ) . map_err ( Error :: EventFd ) ? ; let kbd_evt = EventFd :: new ( utils :: eventfd :: EFD_NONBLOCK ) . map_err ( Error :: EventFd ) ? ; let i8042 = Arc :: new ( Mutex :: new ( devices :: legacy :: I8042Device :: new ( i8042_reset_evfd , kbd_evt . try_clone ( ) . map_err ( Error :: EventFd ) ? , ) ) ) ; Ok ( PortIODeviceManager { io_bus , stdio_serial , i8042 , com_evt_1_3 , com_evt_2_4 , kbd_evt , } ) }
Create a new DeviceManager handling legacy devices (uart, i8042).
Create a new DeviceManager handling legacy devices ( uart i8042 ) .
stdio_serial
Option<Arc<Mutex<devices::legacy::Serial>>>
i8042_reset_evfd
EventFd