/work/fwupd-device-struct.c
Line | Count | Source |
1 | | /* |
2 | | * This file is auto-generated, do not modify! |
3 | | * |
4 | | * SPDX-License-Identifier: LGPL-2.1-or-later |
5 | | */ |
6 | | |
7 | | #include "config.h" |
8 | | |
9 | | #include <glib.h> |
10 | | |
11 | | #include "fwupd-device-struct.h" |
12 | | |
13 | | #ifdef G_LOG_DOMAIN |
14 | | #undef G_LOG_DOMAIN |
15 | | #endif |
16 | | #define G_LOG_DOMAIN "FuStruct" |
17 | | |
18 | | /** |
19 | | * fwupd_device_flag_to_string: |
20 | | * @val: value, e.g. %FWUPD_DEVICE_FLAG_INTERNAL |
21 | | * |
22 | | * Converts an enumerated value to a string. |
23 | | * |
24 | | * Returns: identifier string |
25 | | * |
26 | | * Since: 0.7.0 |
27 | | **/ |
28 | | const gchar * |
29 | | fwupd_device_flag_to_string(FwupdDeviceFlags val) |
30 | 0 | { |
31 | 0 | if (val == FWUPD_DEVICE_FLAG_NONE) |
32 | 0 | return "none"; |
33 | 0 | if (val == FWUPD_DEVICE_FLAG_INTERNAL) |
34 | 0 | return "internal"; |
35 | 0 | if (val == FWUPD_DEVICE_FLAG_UPDATABLE) |
36 | 0 | return "updatable"; |
37 | 0 | if (val == FWUPD_DEVICE_FLAG_REQUIRE_AC) |
38 | 0 | return "require-ac"; |
39 | 0 | if (val == FWUPD_DEVICE_FLAG_LOCKED) |
40 | 0 | return "locked"; |
41 | 0 | if (val == FWUPD_DEVICE_FLAG_SUPPORTED) |
42 | 0 | return "supported"; |
43 | 0 | if (val == FWUPD_DEVICE_FLAG_NEEDS_BOOTLOADER) |
44 | 0 | return "needs-bootloader"; |
45 | 0 | if (val == FWUPD_DEVICE_FLAG_NEEDS_REBOOT) |
46 | 0 | return "needs-reboot"; |
47 | 0 | if (val == FWUPD_DEVICE_FLAG_REPORTED) |
48 | 0 | return "reported"; |
49 | 0 | if (val == FWUPD_DEVICE_FLAG_NOTIFIED) |
50 | 0 | return "notified"; |
51 | 0 | if (val == FWUPD_DEVICE_FLAG_IS_BOOTLOADER) |
52 | 0 | return "is-bootloader"; |
53 | 0 | if (val == FWUPD_DEVICE_FLAG_WAIT_FOR_REPLUG) |
54 | 0 | return "wait-for-replug"; |
55 | 0 | if (val == FWUPD_DEVICE_FLAG_NEEDS_SHUTDOWN) |
56 | 0 | return "needs-shutdown"; |
57 | 0 | if (val == FWUPD_DEVICE_FLAG_ANOTHER_WRITE_REQUIRED) |
58 | 0 | return "another-write-required"; |
59 | 0 | if (val == FWUPD_DEVICE_FLAG_NEEDS_ACTIVATION) |
60 | 0 | return "needs-activation"; |
61 | 0 | if (val == FWUPD_DEVICE_FLAG_HISTORICAL) |
62 | 0 | return "historical"; |
63 | 0 | if (val == FWUPD_DEVICE_FLAG_WILL_DISAPPEAR) |
64 | 0 | return "will-disappear"; |
65 | 0 | if (val == FWUPD_DEVICE_FLAG_CAN_VERIFY) |
66 | 0 | return "can-verify"; |
67 | 0 | if (val == FWUPD_DEVICE_FLAG_CAN_VERIFY_IMAGE) |
68 | 0 | return "can-verify-image"; |
69 | 0 | if (val == FWUPD_DEVICE_FLAG_DUAL_IMAGE) |
70 | 0 | return "dual-image"; |
71 | 0 | if (val == FWUPD_DEVICE_FLAG_SELF_RECOVERY) |
72 | 0 | return "self-recovery"; |
73 | 0 | if (val == FWUPD_DEVICE_FLAG_USABLE_DURING_UPDATE) |
74 | 0 | return "usable-during-update"; |
75 | 0 | if (val == FWUPD_DEVICE_FLAG_VERSION_CHECK_REQUIRED) |
76 | 0 | return "version-check-required"; |
77 | 0 | if (val == FWUPD_DEVICE_FLAG_INSTALL_ALL_RELEASES) |
78 | 0 | return "install-all-releases"; |
79 | 0 | if (val == FWUPD_DEVICE_FLAG_UPDATABLE_HIDDEN) |
80 | 0 | return "updatable-hidden"; |
81 | 0 | if (val == FWUPD_DEVICE_FLAG_HAS_MULTIPLE_BRANCHES) |
82 | 0 | return "has-multiple-branches"; |
83 | 0 | if (val == FWUPD_DEVICE_FLAG_BACKUP_BEFORE_INSTALL) |
84 | 0 | return "backup-before-install"; |
85 | 0 | if (val == FWUPD_DEVICE_FLAG_WILDCARD_INSTALL) |
86 | 0 | return "wildcard-install"; |
87 | 0 | if (val == FWUPD_DEVICE_FLAG_ONLY_VERSION_UPGRADE) |
88 | 0 | return "only-version-upgrade"; |
89 | 0 | if (val == FWUPD_DEVICE_FLAG_UNREACHABLE) |
90 | 0 | return "unreachable"; |
91 | 0 | if (val == FWUPD_DEVICE_FLAG_AFFECTS_FDE) |
92 | 0 | return "affects-fde"; |
93 | 0 | if (val == FWUPD_DEVICE_FLAG_END_OF_LIFE) |
94 | 0 | return "end-of-life"; |
95 | 0 | if (val == FWUPD_DEVICE_FLAG_SIGNED_PAYLOAD) |
96 | 0 | return "signed-payload"; |
97 | 0 | if (val == FWUPD_DEVICE_FLAG_UNSIGNED_PAYLOAD) |
98 | 0 | return "unsigned-payload"; |
99 | 0 | if (val == FWUPD_DEVICE_FLAG_EMULATED) |
100 | 0 | return "emulated"; |
101 | 0 | if (val == FWUPD_DEVICE_FLAG_EMULATION_TAG) |
102 | 0 | return "emulation-tag"; |
103 | 0 | if (val == FWUPD_DEVICE_FLAG_ONLY_EXPLICIT_UPDATES) |
104 | 0 | return "only-explicit-updates"; |
105 | 0 | if (val == FWUPD_DEVICE_FLAG_CAN_EMULATION_TAG) |
106 | 0 | return "can-emulation-tag"; |
107 | 0 | if (val == FWUPD_DEVICE_FLAG_INSTALL_SKIP_VERSION_CHECK) |
108 | 0 | return "install-skip-version-check"; |
109 | 0 | return NULL; |
110 | 0 | } |
111 | | /** |
112 | | * fwupd_device_flag_from_string: |
113 | | * @val: (nullable): a string, e.g. `internal` |
114 | | * |
115 | | * Converts a string to an enumerated value. |
116 | | * |
117 | | * Returns: enumerated value |
118 | | * |
119 | | * Since: 0.7.0 |
120 | | **/ |
121 | | FwupdDeviceFlags |
122 | | fwupd_device_flag_from_string(const gchar *val) |
123 | 0 | { |
124 | 0 | if (g_strcmp0(val, "none") == 0) |
125 | 0 | return FWUPD_DEVICE_FLAG_NONE; |
126 | 0 | if (g_strcmp0(val, "internal") == 0) |
127 | 0 | return FWUPD_DEVICE_FLAG_INTERNAL; |
128 | 0 | if (g_strcmp0(val, "updatable") == 0) |
129 | 0 | return FWUPD_DEVICE_FLAG_UPDATABLE; |
130 | 0 | if (g_strcmp0(val, "require-ac") == 0) |
131 | 0 | return FWUPD_DEVICE_FLAG_REQUIRE_AC; |
132 | 0 | if (g_strcmp0(val, "locked") == 0) |
133 | 0 | return FWUPD_DEVICE_FLAG_LOCKED; |
134 | 0 | if (g_strcmp0(val, "supported") == 0) |
135 | 0 | return FWUPD_DEVICE_FLAG_SUPPORTED; |
136 | 0 | if (g_strcmp0(val, "needs-bootloader") == 0) |
137 | 0 | return FWUPD_DEVICE_FLAG_NEEDS_BOOTLOADER; |
138 | 0 | if (g_strcmp0(val, "needs-reboot") == 0) |
139 | 0 | return FWUPD_DEVICE_FLAG_NEEDS_REBOOT; |
140 | 0 | if (g_strcmp0(val, "reported") == 0) |
141 | 0 | return FWUPD_DEVICE_FLAG_REPORTED; |
142 | 0 | if (g_strcmp0(val, "notified") == 0) |
143 | 0 | return FWUPD_DEVICE_FLAG_NOTIFIED; |
144 | 0 | if (g_strcmp0(val, "is-bootloader") == 0) |
145 | 0 | return FWUPD_DEVICE_FLAG_IS_BOOTLOADER; |
146 | 0 | if (g_strcmp0(val, "wait-for-replug") == 0) |
147 | 0 | return FWUPD_DEVICE_FLAG_WAIT_FOR_REPLUG; |
148 | 0 | if (g_strcmp0(val, "needs-shutdown") == 0) |
149 | 0 | return FWUPD_DEVICE_FLAG_NEEDS_SHUTDOWN; |
150 | 0 | if (g_strcmp0(val, "another-write-required") == 0) |
151 | 0 | return FWUPD_DEVICE_FLAG_ANOTHER_WRITE_REQUIRED; |
152 | 0 | if (g_strcmp0(val, "needs-activation") == 0) |
153 | 0 | return FWUPD_DEVICE_FLAG_NEEDS_ACTIVATION; |
154 | 0 | if (g_strcmp0(val, "historical") == 0) |
155 | 0 | return FWUPD_DEVICE_FLAG_HISTORICAL; |
156 | 0 | if (g_strcmp0(val, "will-disappear") == 0) |
157 | 0 | return FWUPD_DEVICE_FLAG_WILL_DISAPPEAR; |
158 | 0 | if (g_strcmp0(val, "can-verify") == 0) |
159 | 0 | return FWUPD_DEVICE_FLAG_CAN_VERIFY; |
160 | 0 | if (g_strcmp0(val, "can-verify-image") == 0) |
161 | 0 | return FWUPD_DEVICE_FLAG_CAN_VERIFY_IMAGE; |
162 | 0 | if (g_strcmp0(val, "dual-image") == 0) |
163 | 0 | return FWUPD_DEVICE_FLAG_DUAL_IMAGE; |
164 | 0 | if (g_strcmp0(val, "self-recovery") == 0) |
165 | 0 | return FWUPD_DEVICE_FLAG_SELF_RECOVERY; |
166 | 0 | if (g_strcmp0(val, "usable-during-update") == 0) |
167 | 0 | return FWUPD_DEVICE_FLAG_USABLE_DURING_UPDATE; |
168 | 0 | if (g_strcmp0(val, "version-check-required") == 0) |
169 | 0 | return FWUPD_DEVICE_FLAG_VERSION_CHECK_REQUIRED; |
170 | 0 | if (g_strcmp0(val, "install-all-releases") == 0) |
171 | 0 | return FWUPD_DEVICE_FLAG_INSTALL_ALL_RELEASES; |
172 | 0 | if (g_strcmp0(val, "updatable-hidden") == 0) |
173 | 0 | return FWUPD_DEVICE_FLAG_UPDATABLE_HIDDEN; |
174 | 0 | if (g_strcmp0(val, "has-multiple-branches") == 0) |
175 | 0 | return FWUPD_DEVICE_FLAG_HAS_MULTIPLE_BRANCHES; |
176 | 0 | if (g_strcmp0(val, "backup-before-install") == 0) |
177 | 0 | return FWUPD_DEVICE_FLAG_BACKUP_BEFORE_INSTALL; |
178 | 0 | if (g_strcmp0(val, "wildcard-install") == 0) |
179 | 0 | return FWUPD_DEVICE_FLAG_WILDCARD_INSTALL; |
180 | 0 | if (g_strcmp0(val, "only-version-upgrade") == 0) |
181 | 0 | return FWUPD_DEVICE_FLAG_ONLY_VERSION_UPGRADE; |
182 | 0 | if (g_strcmp0(val, "unreachable") == 0) |
183 | 0 | return FWUPD_DEVICE_FLAG_UNREACHABLE; |
184 | 0 | if (g_strcmp0(val, "affects-fde") == 0) |
185 | 0 | return FWUPD_DEVICE_FLAG_AFFECTS_FDE; |
186 | 0 | if (g_strcmp0(val, "end-of-life") == 0) |
187 | 0 | return FWUPD_DEVICE_FLAG_END_OF_LIFE; |
188 | 0 | if (g_strcmp0(val, "signed-payload") == 0) |
189 | 0 | return FWUPD_DEVICE_FLAG_SIGNED_PAYLOAD; |
190 | 0 | if (g_strcmp0(val, "unsigned-payload") == 0) |
191 | 0 | return FWUPD_DEVICE_FLAG_UNSIGNED_PAYLOAD; |
192 | 0 | if (g_strcmp0(val, "emulated") == 0) |
193 | 0 | return FWUPD_DEVICE_FLAG_EMULATED; |
194 | 0 | if (g_strcmp0(val, "emulation-tag") == 0) |
195 | 0 | return FWUPD_DEVICE_FLAG_EMULATION_TAG; |
196 | 0 | if (g_strcmp0(val, "only-explicit-updates") == 0) |
197 | 0 | return FWUPD_DEVICE_FLAG_ONLY_EXPLICIT_UPDATES; |
198 | 0 | if (g_strcmp0(val, "can-emulation-tag") == 0) |
199 | 0 | return FWUPD_DEVICE_FLAG_CAN_EMULATION_TAG; |
200 | 0 | if (g_strcmp0(val, "install-skip-version-check") == 0) |
201 | 0 | return FWUPD_DEVICE_FLAG_INSTALL_SKIP_VERSION_CHECK; |
202 | 0 | return FWUPD_DEVICE_FLAG_UNKNOWN; |
203 | 0 | } |
204 | | |
205 | | /** |
206 | | * fwupd_device_problem_to_string: |
207 | | * @val: value, e.g. %FWUPD_DEVICE_PROBLEM_SYSTEM_POWER_TOO_LOW |
208 | | * |
209 | | * Converts an enumerated value to a string. |
210 | | * |
211 | | * Returns: identifier string |
212 | | * |
213 | | * Since: 1.8.1 |
214 | | **/ |
215 | | const gchar * |
216 | | fwupd_device_problem_to_string(FwupdDeviceProblem val) |
217 | 0 | { |
218 | 0 | if (val == FWUPD_DEVICE_PROBLEM_NONE) |
219 | 0 | return "none"; |
220 | 0 | if (val == FWUPD_DEVICE_PROBLEM_SYSTEM_POWER_TOO_LOW) |
221 | 0 | return "system-power-too-low"; |
222 | 0 | if (val == FWUPD_DEVICE_PROBLEM_UNREACHABLE) |
223 | 0 | return "unreachable"; |
224 | 0 | if (val == FWUPD_DEVICE_PROBLEM_POWER_TOO_LOW) |
225 | 0 | return "power-too-low"; |
226 | 0 | if (val == FWUPD_DEVICE_PROBLEM_UPDATE_PENDING) |
227 | 0 | return "update-pending"; |
228 | 0 | if (val == FWUPD_DEVICE_PROBLEM_REQUIRE_AC_POWER) |
229 | 0 | return "require-ac-power"; |
230 | 0 | if (val == FWUPD_DEVICE_PROBLEM_LID_IS_CLOSED) |
231 | 0 | return "lid-is-closed"; |
232 | 0 | if (val == FWUPD_DEVICE_PROBLEM_IS_EMULATED) |
233 | 0 | return "is-emulated"; |
234 | 0 | if (val == FWUPD_DEVICE_PROBLEM_MISSING_LICENSE) |
235 | 0 | return "missing-license"; |
236 | 0 | if (val == FWUPD_DEVICE_PROBLEM_SYSTEM_INHIBIT) |
237 | 0 | return "system-inhibit"; |
238 | 0 | if (val == FWUPD_DEVICE_PROBLEM_UPDATE_IN_PROGRESS) |
239 | 0 | return "update-in-progress"; |
240 | 0 | if (val == FWUPD_DEVICE_PROBLEM_IN_USE) |
241 | 0 | return "in-use"; |
242 | 0 | if (val == FWUPD_DEVICE_PROBLEM_DISPLAY_REQUIRED) |
243 | 0 | return "display-required"; |
244 | 0 | if (val == FWUPD_DEVICE_PROBLEM_LOWER_PRIORITY) |
245 | 0 | return "lower-priority"; |
246 | 0 | if (val == FWUPD_DEVICE_PROBLEM_INSECURE_PLATFORM) |
247 | 0 | return "insecure-platform"; |
248 | 0 | if (val == FWUPD_DEVICE_PROBLEM_FIRMWARE_LOCKED) |
249 | 0 | return "firmware-locked"; |
250 | 0 | return NULL; |
251 | 0 | } |
252 | | /** |
253 | | * fwupd_device_problem_from_string: |
254 | | * @val: (nullable): a string, e.g. `system-power-too-low` |
255 | | * |
256 | | * Converts a string to an enumerated value. |
257 | | * |
258 | | * Returns: enumerated value |
259 | | * |
260 | | * Since: 1.8.1 |
261 | | **/ |
262 | | FwupdDeviceProblem |
263 | | fwupd_device_problem_from_string(const gchar *val) |
264 | 0 | { |
265 | 0 | if (g_strcmp0(val, "none") == 0) |
266 | 0 | return FWUPD_DEVICE_PROBLEM_NONE; |
267 | 0 | if (g_strcmp0(val, "system-power-too-low") == 0) |
268 | 0 | return FWUPD_DEVICE_PROBLEM_SYSTEM_POWER_TOO_LOW; |
269 | 0 | if (g_strcmp0(val, "unreachable") == 0) |
270 | 0 | return FWUPD_DEVICE_PROBLEM_UNREACHABLE; |
271 | 0 | if (g_strcmp0(val, "power-too-low") == 0) |
272 | 0 | return FWUPD_DEVICE_PROBLEM_POWER_TOO_LOW; |
273 | 0 | if (g_strcmp0(val, "update-pending") == 0) |
274 | 0 | return FWUPD_DEVICE_PROBLEM_UPDATE_PENDING; |
275 | 0 | if (g_strcmp0(val, "require-ac-power") == 0) |
276 | 0 | return FWUPD_DEVICE_PROBLEM_REQUIRE_AC_POWER; |
277 | 0 | if (g_strcmp0(val, "lid-is-closed") == 0) |
278 | 0 | return FWUPD_DEVICE_PROBLEM_LID_IS_CLOSED; |
279 | 0 | if (g_strcmp0(val, "is-emulated") == 0) |
280 | 0 | return FWUPD_DEVICE_PROBLEM_IS_EMULATED; |
281 | 0 | if (g_strcmp0(val, "missing-license") == 0) |
282 | 0 | return FWUPD_DEVICE_PROBLEM_MISSING_LICENSE; |
283 | 0 | if (g_strcmp0(val, "system-inhibit") == 0) |
284 | 0 | return FWUPD_DEVICE_PROBLEM_SYSTEM_INHIBIT; |
285 | 0 | if (g_strcmp0(val, "update-in-progress") == 0) |
286 | 0 | return FWUPD_DEVICE_PROBLEM_UPDATE_IN_PROGRESS; |
287 | 0 | if (g_strcmp0(val, "in-use") == 0) |
288 | 0 | return FWUPD_DEVICE_PROBLEM_IN_USE; |
289 | 0 | if (g_strcmp0(val, "display-required") == 0) |
290 | 0 | return FWUPD_DEVICE_PROBLEM_DISPLAY_REQUIRED; |
291 | 0 | if (g_strcmp0(val, "lower-priority") == 0) |
292 | 0 | return FWUPD_DEVICE_PROBLEM_LOWER_PRIORITY; |
293 | 0 | if (g_strcmp0(val, "insecure-platform") == 0) |
294 | 0 | return FWUPD_DEVICE_PROBLEM_INSECURE_PLATFORM; |
295 | 0 | if (g_strcmp0(val, "firmware-locked") == 0) |
296 | 0 | return FWUPD_DEVICE_PROBLEM_FIRMWARE_LOCKED; |
297 | 0 | return FWUPD_DEVICE_PROBLEM_UNKNOWN; |
298 | 0 | } |