plugins/flashrom: enable for 2 Tuxedo laptops

Their ME region in flash can be unlocked manually, give user
instructions on how to do it.

Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
This commit is contained in:
Sergii Dmytruk 2022-04-18 16:06:12 +03:00 committed by Richard Hughes
parent e65cb98cc8
commit ddf4e10d7b
4 changed files with 54 additions and 0 deletions

View File

@ -99,3 +99,15 @@ Plugin = flashrom
[43455705-4c7d-5440-b285-8362b67a5743]
Branch = dasharo
VersionFormat = triplet
# Tuxedo InifinityBook S14 Gen6 (HwId)
[6c80d85b-d0b6-5ee2-99d4-ec28dd32febd]
Plugin = flashrom
[FLASHROM\GUID_6c80d85b-d0b6-5ee2-99d4-ec28dd32febd]
Flags = fn-m-me-unlock
# Tuxedo InifinityBook S15 Gen6 (HwId)
[60f53465-e8fc-5122-b79b-f7b03f063037]
Plugin = flashrom
[FLASHROM\GUID_60f53465-e8fc-5122-b79b-f7b03f063037]
Flags = fn-m-me-unlock

View File

@ -19,6 +19,11 @@
*/
#define FU_FLASHROM_DEVICE_FLAG_RESET_CMOS (1 << 0)
/*
* Flag to determine if manual ME unlocking by pressing Fn + M is supported.
*/
#define FU_FLASHROM_DEVICE_FLAG_FN_M_ME_UNLOCK (1 << 1)
struct _FuFlashromDevice {
FuUdevDevice parent_instance;
FuIfdRegion region;
@ -304,6 +309,9 @@ fu_flashrom_device_init(FuFlashromDevice *self)
fu_device_register_private_flag(FU_DEVICE(self),
FU_FLASHROM_DEVICE_FLAG_RESET_CMOS,
"reset-cmos");
fu_device_register_private_flag(FU_DEVICE(self),
FU_FLASHROM_DEVICE_FLAG_FN_M_ME_UNLOCK,
"fn-m-me-unlock");
}
static void
@ -398,3 +406,27 @@ fu_flashrom_device_get_region(FuFlashromDevice *self)
{
return self->region;
}
gboolean
fu_flashrom_device_unlock(FuFlashromDevice *self, GError **error)
{
if (fu_flashrom_device_get_region(self) == FU_IFD_REGION_ME &&
fu_device_has_private_flag(FU_DEVICE(self), FU_FLASHROM_DEVICE_FLAG_FN_M_ME_UNLOCK)) {
g_set_error_literal(error,
FWUPD_ERROR,
FWUPD_ERROR_NOTHING_TO_DO,
"\n"
"ME region should be unlocked manually the following way:\n"
" 1. Power off your device\n"
" 2. Press and keep holding Fn + M during the next step\n"
" 3. Press power on button");
return FALSE;
}
g_set_error(error,
FWUPD_ERROR,
FWUPD_ERROR_NOT_SUPPORTED,
"Unlocking of device %s is not supported",
fu_device_get_name(FU_DEVICE(self)));
return FALSE;
}

View File

@ -17,3 +17,6 @@ fu_flashrom_device_new(FuContext *ctx, FuIfdRegion region);
FuIfdRegion
fu_flashrom_device_get_region(FuFlashromDevice *self);
gboolean
fu_flashrom_device_unlock(FuFlashromDevice *self, GError **error);

View File

@ -281,6 +281,12 @@ fu_plugin_flashrom_startup(FuPlugin *plugin, GError **error)
return TRUE;
}
static gboolean
fu_plugin_flashrom_unlock(FuPlugin *self, FuDevice *device, GError **error)
{
return fu_flashrom_device_unlock(FU_FLASHROM_DEVICE(device), error);
}
void
fu_plugin_init_vfuncs(FuPluginVfuncs *vfuncs)
{
@ -290,4 +296,5 @@ fu_plugin_init_vfuncs(FuPluginVfuncs *vfuncs)
vfuncs->device_registered = fu_plugin_flashrom_device_registered;
vfuncs->startup = fu_plugin_flashrom_startup;
vfuncs->coldplug = fu_plugin_flashrom_coldplug;
vfuncs->unlock = fu_plugin_flashrom_unlock;
}