Changeset View
Changeset View
Standalone View
Standalone View
udev.cpp
Show First 20 Lines • Show All 142 Lines • ▼ Show 20 Line(s) | 137 | return enumerate.find([](const UdevDevice::Ptr &device) { | |||
---|---|---|---|---|---|
143 | const char *systAttrValue = udev_device_get_sysattr_value(pci, "boot_vga"); | 143 | const char *systAttrValue = udev_device_get_sysattr_value(pci, "boot_vga"); | ||
144 | if (systAttrValue && qstrcmp(systAttrValue, "1") == 0) { | 144 | if (systAttrValue && qstrcmp(systAttrValue, "1") == 0) { | ||
145 | return true; | 145 | return true; | ||
146 | } | 146 | } | ||
147 | return false; | 147 | return false; | ||
148 | }); | 148 | }); | ||
149 | } | 149 | } | ||
150 | 150 | | |||
151 | UdevDevice::Ptr Udev::virtualGpu() | ||||
152 | { | ||||
153 | if (!m_udev) { | ||||
154 | return UdevDevice::Ptr(); | ||||
155 | } | ||||
156 | UdevEnumerate enumerate(this); | ||||
157 | enumerate.addMatch(UdevEnumerate::Match::SubSystem, "drm"); | ||||
158 | enumerate.addMatch(UdevEnumerate::Match::SysName, "card[0-9]*"); | ||||
159 | enumerate.scan(); | ||||
160 | return enumerate.find([](const UdevDevice::Ptr &device) { | ||||
161 | const QByteArray deviceName(udev_device_get_syspath(*device)); | ||||
162 | return deviceName.contains("virtual"); | ||||
163 | }); | ||||
164 | } | ||||
165 | | ||||
166 | UdevDevice::Ptr Udev::renderNode() | ||||
167 | { | ||||
168 | if (!m_udev) { | ||||
169 | return UdevDevice::Ptr(); | ||||
170 | } | ||||
171 | UdevEnumerate enumerate(this); | ||||
172 | enumerate.addMatch(UdevEnumerate::Match::SubSystem, "drm"); | ||||
173 | enumerate.addMatch(UdevEnumerate::Match::SysName, "renderD[0-9]*"); | ||||
174 | enumerate.scan(); | ||||
175 | return enumerate.find([](const UdevDevice::Ptr &device) { | ||||
176 | Q_UNUSED(device) | ||||
177 | return true; | ||||
178 | }); | ||||
179 | } | ||||
180 | | ||||
151 | UdevDevice::Ptr Udev::deviceFromSyspath(const char *syspath) | 181 | UdevDevice::Ptr Udev::deviceFromSyspath(const char *syspath) | ||
152 | { | 182 | { | ||
153 | return std::move(UdevDevice::Ptr(new UdevDevice(udev_device_new_from_syspath(m_udev, syspath)))); | 183 | return std::move(UdevDevice::Ptr(new UdevDevice(udev_device_new_from_syspath(m_udev, syspath)))); | ||
154 | } | 184 | } | ||
155 | 185 | | |||
156 | UdevMonitor *Udev::monitor() | 186 | UdevMonitor *Udev::monitor() | ||
157 | { | 187 | { | ||
158 | UdevMonitor *m = new UdevMonitor(this); | 188 | UdevMonitor *m = new UdevMonitor(this); | ||
▲ Show 20 Lines • Show All 106 Lines • Show Last 20 Lines |