anvil: Report errors of failed device initializations
@@ -411,9 +411,29 @@ impl<S: SessionNotifier, Data: 'static> UdevHandler for UdevHandlerImpl<S, Data>
OFlag::O_RDWR | OFlag::O_CLOEXEC | OFlag::O_NOCTTY | OFlag::O_NONBLOCK,
)
.ok()
- .and_then(|fd| LegacyDrmDevice::new(SessionFd(fd), self.logger.clone()).ok())
- .and_then(|drm| GbmDevice::new(drm, self.logger.clone()).ok())
- .and_then(|gbm| EglDevice::new(gbm, self.logger.clone()).ok())
+ .and_then(
+ |fd| match LegacyDrmDevice::new(SessionFd(fd), self.logger.clone()) {
+ Ok(drm) => Some(drm),
+ Err(err) => {
+ error!(self.logger, "Skipping drm device, because of error: {}", err);
+ None
+ }
+ },
+ )
+ .and_then(|drm| match GbmDevice::new(drm, self.logger.clone()) {
+ Ok(gbm) => Some(gbm),
+ Err(err) => {
+ error!(self.logger, "Skipping gbm device, because of error: {}", err);
+ None
+ }
+ })
+ .and_then(|gbm| match EglDevice::new(gbm, self.logger.clone()) {
+ Ok(egl) => Some(egl),
+ Err(err) => {
+ error!(self.logger, "Skipping egl device, because of error: {}", err);
+ None
+ }
+ })
{
// init hardware acceleration on the primary gpu.
#[cfg(feature = "egl")]
