Changeset View
Changeset View
Standalone View
Standalone View
udev.cpp
Context not available. | |||||
186 | }); | 186 | }); | ||
---|---|---|---|---|---|
187 | } | 187 | } | ||
188 | 188 | | |||
189 | UdevDevice::Ptr Udev::primaryFramebuffer() | ||||
190 | { | ||||
191 | if (!m_udev) { | ||||
192 | return UdevDevice::Ptr(); | ||||
193 | } | ||||
194 | UdevEnumerate enumerate(this); | ||||
195 | enumerate.addMatch(UdevEnumerate::Match::SubSystem, "graphics"); | ||||
196 | enumerate.addMatch(UdevEnumerate::Match::SysName, "fb[0-9]*"); | ||||
197 | enumerate.scan(); | ||||
198 | return enumerate.find([](const UdevDevice::Ptr &device) { | ||||
199 | auto pci = device->getParentWithSubsystemDevType("pci"); | ||||
200 | if (!pci) { | ||||
201 | return false; | ||||
202 | } | ||||
203 | const char *systAttrValue = udev_device_get_sysattr_value(pci, "boot_vga"); | ||||
204 | if (systAttrValue && qstrcmp(systAttrValue, "1") == 0) { | ||||
205 | return true; | ||||
206 | } | ||||
207 | return false; | ||||
208 | }); | ||||
209 | } | ||||
210 | | ||||
189 | UdevDevice::Ptr Udev::deviceFromSyspath(const char *syspath) | 211 | UdevDevice::Ptr Udev::deviceFromSyspath(const char *syspath) | ||
190 | { | 212 | { | ||
191 | return UdevDevice::Ptr(new UdevDevice(udev_device_new_from_syspath(m_udev, syspath))); | 213 | return UdevDevice::Ptr(new UdevDevice(udev_device_new_from_syspath(m_udev, syspath))); | ||
Context not available. |