Skip to content

Commit

Permalink
plugins/flashrom: enable for 2 Tuxedo laptops
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
SergiiDmytruk authored and hughsie committed Apr 21, 2022
1 parent e65cb98 commit ddf4e10
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 0 deletions.
12 changes: 12 additions & 0 deletions plugins/flashrom/flashrom.quirk
Expand Up @@ -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
32 changes: 32 additions & 0 deletions plugins/flashrom/fu-flashrom-device.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
}
3 changes: 3 additions & 0 deletions plugins/flashrom/fu-flashrom-device.h
Expand Up @@ -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);
7 changes: 7 additions & 0 deletions plugins/flashrom/fu-plugin-flashrom.c
Expand Up @@ -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)
{
Expand All @@ -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;
}

0 comments on commit ddf4e10

Please sign in to comment.