Skip to content

Commit d74a370

Browse files
More detailed errors
1 parent bb4e648 commit d74a370

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/display.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,17 +174,20 @@ fn try_open_card(path: &Path) -> Result<DrmBackend> {
174174

175175
impl DrmBackend {
176176
pub fn open_card() -> Result<DrmBackend> {
177+
let mut errors = Vec::new();
177178
for entry in fs::read_dir("/dev/dri/")? {
178179
let entry = entry?;
179180
if !entry.file_name().to_string_lossy().starts_with("card") {
180181
continue
181182
}
182183
match try_open_card(&entry.path()) {
183184
Ok(card) => return Ok(card),
184-
Err(_) => {}
185+
Err(err) => {
186+
errors.push(format!("{}: {}", entry.path().as_os_str().to_string_lossy(), err.to_string()))
187+
}
185188
}
186189
}
187-
Err(anyhow!("No touchbar device found"))
190+
Err(anyhow!("No touchbar device found, attempted: [\n {}\n]", errors.join(",\n ")))
188191
}
189192
pub fn dirty(&self, clips: &[ClipRect]) -> Result<()> {
190193
Ok(self.card.dirty_framebuffer(self.fb, clips)?)

0 commit comments

Comments
 (0)