battery: Ignore GPUs without rendering capabilities
This commit is contained in:
parent
d949f7f43f
commit
7fdba2f933
1 changed files with 11 additions and 3 deletions
|
|
@ -15,9 +15,12 @@ use cosmic::{
|
||||||
iced::{self, Subscription},
|
iced::{self, Subscription},
|
||||||
iced_futures::stream,
|
iced_futures::stream,
|
||||||
};
|
};
|
||||||
use drm::control::{
|
use drm::{
|
||||||
Device as ControlDevice,
|
control::{
|
||||||
connector::{Info as ConnectorInfo, Interface},
|
Device as ControlDevice,
|
||||||
|
connector::{Info as ConnectorInfo, Interface},
|
||||||
|
},
|
||||||
|
node::DrmNode,
|
||||||
};
|
};
|
||||||
use futures::{FutureExt, SinkExt};
|
use futures::{FutureExt, SinkExt};
|
||||||
use tokio::{
|
use tokio::{
|
||||||
|
|
@ -331,6 +334,11 @@ fn all_gpus<S: AsRef<str>>(seat: S) -> io::Result<Vec<Gpu>> {
|
||||||
})
|
})
|
||||||
.flat_map(|device| {
|
.flat_map(|device| {
|
||||||
let path = device.devnode().map(PathBuf::from)?;
|
let path = device.devnode().map(PathBuf::from)?;
|
||||||
|
let node = DrmNode::from_path(&path).ok()?;
|
||||||
|
if !node.has_render() {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
let boot_vga = if let Ok(Some(pci)) = device.parent_with_subsystem(Path::new("pci")) {
|
let boot_vga = if let Ok(Some(pci)) = device.parent_with_subsystem(Path::new("pci")) {
|
||||||
if let Some(value) = pci.attribute_value("boot_vga") {
|
if let Some(value) = pci.attribute_value("boot_vga") {
|
||||||
value == "1"
|
value == "1"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue