synapticsmst: Adjust EVB board handling

1. Since board ID in synapticsmst.quirk is different based upon how
the board ID is read, don't whitelist it in `write_firmware`

2. Allow using `--force` with `fwupdmgr` or `fwupdtool` to override
board ID check.

3. Allow using custom flag `ignore-board-id` to ignore board IDs.
This will be the default for EVB boards and can be used in the event
of a factory mistake as well.

4. Move the EVB board IDs into their own synapticsmst_evb.quirk.
This file will not be installed by default (So EVB boards are only
functional when manually installed).
This commit is contained in:
Mario Limonciello 2018-11-05 08:17:51 -06:00 committed by Mario Limonciello
parent da4049499e
commit 5e36c9e792
5 changed files with 31 additions and 16 deletions

View File

@ -340,6 +340,7 @@ fu_plugin_update (FuPlugin *plugin,
guint8 layer;
guint8 rad;
gboolean reboot;
gboolean install_force;
/* extract details to build a new device */
kind = synapticsmst_device_kind_from_string (fu_device_get_metadata (dev, "SynapticsMSTKind"));
@ -359,11 +360,14 @@ fu_plugin_update (FuPlugin *plugin,
if (!synapticsmst_device_enumerate_device (device, error))
return FALSE;
reboot = !fu_device_has_custom_flag (dev, "skip-restart");
install_force = (flags & FWUPD_INSTALL_FLAG_FORCE) != 0 ||
fu_device_has_custom_flag (dev, "ignore-board-id");
fu_device_set_status (dev, FWUPD_STATUS_DEVICE_WRITE);
if (!synapticsmst_device_write_firmware (device, blob_fw,
fu_synapticsmst_write_progress_cb,
dev,
reboot,
install_force,
error)) {
g_prefix_error (error, "failed to flash firmware: ");
return FALSE;

View File

@ -1117,6 +1117,7 @@ synapticsmst_device_write_firmware (SynapticsMSTDevice *device,
GFileProgressCallback progress_cb,
gpointer progress_data,
gboolean reboot,
gboolean install_force,
GError **error)
{
const guint8 *payload_data;
@ -1137,21 +1138,16 @@ synapticsmst_device_write_firmware (SynapticsMSTDevice *device,
return FALSE;
}
/* TODO: May need a way to override this to cover field
* issues of invalid firmware flashed*/
/* check firmware and board ID again */
tmp = (*(payload_data + ADDR_CUSTOMER_ID) << 8) + *(payload_data + ADDR_BOARD_ID);
if (synapticsmst_device_get_board_id (device) >> 8 == 0) {
g_warning ("EVB board detected, bypassing customer ID check");
} else {
if (tmp != synapticsmst_device_get_board_id (device)) {
g_set_error_literal (error,
G_IO_ERROR,
G_IO_ERROR_INVALID_DATA,
"board ID mismatch");
return FALSE;
}
if (tmp != synapticsmst_device_get_board_id (device) && !install_force) {
g_set_error_literal (error,
G_IO_ERROR,
G_IO_ERROR_INVALID_DATA,
"board ID mismatch");
return FALSE;
}
/* open device */
if (!synapticsmst_device_open (device, error)) {
g_prefix_error (error,

View File

@ -82,6 +82,7 @@ gboolean synapticsmst_device_write_firmware (SynapticsMSTDevice *device,
GFileProgressCallback progress_cb,
gpointer user_data,
gboolean reboot,
gboolean install_force,
GError **error);
G_END_DECLS

View File

@ -15,10 +15,6 @@
# To override this behavior add the custom flag "skip-restart"
#
[SynapticsMSTBoardID=2]
Name = Synaptics EVB development board
DeviceKind = evb
[SynapticsMSTBoardID=272]
Name = Dell X6 Platform
DeviceKind = system

View File

@ -0,0 +1,18 @@
# Synaptics MST early validation board support
#
# This is not installed by default, but can be used to exercise new boards
# that don't yet have customer ID or board ID bytes filled out.
#
# To use it, load the quirk file into the quirks directory for the fwupd installation
# Usually this is /usr/share/fwupd/quirks.d
#
# Note: The flag "ignore-board-id" will be used to ignore the board ID checking in
# during flashing. This shouldn't be used in practice for production boards.
#
[SynapticsMSTBoardID=2]
Name = Synaptics EVB development board
DeviceKind = panamera_evb
[Guid=MST-panamera_evb-vmm5331-2]
Flags = ignore-board-id