Commit f0bc237c authored by Mario Limonciello's avatar Mario Limonciello
Browse files

dell: block owned TPM updates (#339)

Also make it clearer what the logic is checking.
parent 9271a196
......@@ -594,12 +594,15 @@ fu_plugin_dell_detect_tpm (FuPlugin *plugin, GError **error)
fu_device_set_version (dev, version_str);
fu_device_add_flag (dev, FWUPD_DEVICE_FLAG_INTERNAL);
fu_device_add_flag (dev, FWUPD_DEVICE_FLAG_REQUIRE_AC);
if (out->flashes_left > 0) {
if ((out->status & TPM_OWN_MASK) == 0 && out->flashes_left > 0) {
if (fu_plugin_dell_capsule_supported (plugin)) {
fu_device_add_flag (dev, FWUPD_DEVICE_FLAG_UPDATABLE);
fu_device_add_flag (dev, FWUPD_DEVICE_FLAG_NEEDS_REBOOT);
}
fu_device_set_flashes_left (dev, out->flashes_left);
} else {
g_debug ("%s updating disabled due to TPM ownership",
pretty_tpm_name);
}
fu_plugin_device_add (plugin, dev);
......@@ -619,8 +622,7 @@ fu_plugin_dell_detect_tpm (FuPlugin *plugin, GError **error)
* Mode switching is turned on by setting flashes left on alternate
* device.
*/
if (!((out->status) & TPM_OWN_MASK) &&
out->flashes_left > 0) {
if ((out->status & TPM_OWN_MASK) == 0 && out->flashes_left > 0) {
fu_device_set_flashes_left (dev_alt, out->flashes_left);
} else {
g_debug ("%s mode switch disabled due to TPM ownership",
......
......@@ -138,8 +138,8 @@ fu_plugin_dell_tpm_func (void)
g_assert (device != NULL);
g_assert (device_alt != NULL);
/* make sure allowed to flash 1.2 */
g_assert_true (fu_device_has_flag (device_alt, FWUPD_DEVICE_FLAG_UPDATABLE));
/* make sure not allowed to flash 1.2 */
g_assert_false (fu_device_has_flag (device_alt, FWUPD_DEVICE_FLAG_UPDATABLE));
/* try to unlock 2.0 */
ret = fu_plugin_runner_unlock (plugin, device, &error);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment