Changeset View
Changeset View
Standalone View
Standalone View
plugins/platforms/drm/edid.cpp
Show All 17 Lines | |||||
18 | You should have received a copy of the GNU General Public License | 18 | You should have received a copy of the GNU General Public License | ||
19 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 19 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
20 | *********************************************************************/ | 20 | *********************************************************************/ | ||
21 | 21 | | |||
22 | #include "edid.h" | 22 | #include "edid.h" | ||
23 | #include "config-kwin.h" | 23 | #include "config-kwin.h" | ||
24 | 24 | | |||
25 | #include <QFile> | 25 | #include <QFile> | ||
26 | #include <QStandardPaths> | ||||
26 | 27 | | |||
27 | namespace KWin | 28 | namespace KWin | ||
28 | { | 29 | { | ||
29 | 30 | | |||
30 | static bool verifyHeader(const uint8_t *data) | 31 | static bool verifyHeader(const uint8_t *data) | ||
31 | { | 32 | { | ||
32 | if (data[0] != 0x0 || data[7] != 0x0) { | 33 | if (data[0] != 0x0 || data[7] != 0x0) { | ||
33 | return false; | 34 | return false; | ||
▲ Show 20 Lines • Show All 103 Lines • ▼ Show 20 Line(s) | 137 | if (serialNumber) { | |||
137 | return QByteArray::number(serialNumber); | 138 | return QByteArray::number(serialNumber); | ||
138 | } | 139 | } | ||
139 | 140 | | |||
140 | return QByteArray(); | 141 | return QByteArray(); | ||
141 | } | 142 | } | ||
142 | 143 | | |||
143 | static QByteArray parseVendor(const uint8_t *data) | 144 | static QByteArray parseVendor(const uint8_t *data) | ||
144 | { | 145 | { | ||
145 | #if HAVE_HWDATA | | |||
146 | const auto pnpId = parsePnpId(data); | 146 | const auto pnpId = parsePnpId(data); | ||
147 | 147 | | |||
148 | // Map to vendor name | 148 | // Map to vendor name | ||
149 | QFile pnpFile(QStringLiteral(HWDATA_PNPIDS_FILE)); | 149 | QFile pnpFile(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("hwdata/pnp.ids"))); | ||
zzag: Can you please explain why we can't use HWDATA_PNPIDS_FILE? | |||||
zzag: ok, nvm. | |||||
You can't hardcode /use/share If we do go runtime only, please use QStandardPaths Though I don't yet fully understand the need to avoid the compile time switch, there were comments on what to fix in the last patch. davidedmundson: You can't hardcode /use/share
If we do go runtime only, please use QStandardPaths
Though I… | |||||
150 | if (pnpFile.exists() && pnpFile.open(QIODevice::ReadOnly)) { | 150 | if (pnpFile.exists() && pnpFile.open(QIODevice::ReadOnly)) { | ||
151 | while (!pnpFile.atEnd()) { | 151 | while (!pnpFile.atEnd()) { | ||
152 | const auto line = pnpFile.readLine(); | 152 | const auto line = pnpFile.readLine(); | ||
153 | if (line.startsWith(pnpId)) { | 153 | if (line.startsWith(pnpId)) { | ||
154 | return line.mid(4).trimmed(); | 154 | return line.mid(4).trimmed(); | ||
155 | } | 155 | } | ||
156 | } | 156 | } | ||
157 | } | 157 | } | ||
158 | #endif | 158 | | ||
159 | return {}; | 159 | return {}; | ||
160 | } | 160 | } | ||
161 | 161 | | |||
162 | Edid::Edid() | 162 | Edid::Edid() | ||
163 | { | 163 | { | ||
164 | } | 164 | } | ||
165 | 165 | | |||
166 | Edid::Edid(const void *data, uint32_t size) | 166 | Edid::Edid(const void *data, uint32_t size) | ||
▲ Show 20 Lines • Show All 51 Lines • Show Last 20 Lines |
Can you please explain why we can't use HWDATA_PNPIDS_FILE?