modem-manager: add firehose prog name quirk

Adds FirehoseProgFile quirk to determine the correct filename for the
firehose prog depending on the device VID:PID.
This commit is contained in:
Ivan Mikhanchuk 2022-12-27 11:20:22 -08:00 committed by Richard Hughes
parent b20737fe4a
commit d1fc1d1f93
3 changed files with 33 additions and 1 deletions

View File

@ -30,6 +30,12 @@ AT command to execute to determine the firmware branch currently installed on th
Since: 1.7.4
### ModemManagerFirehoseProgFile
Firehose program file to use during the switch to EDL (Emergency Download) mode.
Since: 1.8.10
## Vendor ID Security
The vendor ID is set from the USB or PCI vendor, for example `USB:0x413C` `PCI:0x105B`

View File

@ -88,10 +88,12 @@ struct _FuMmDevice {
/* firehose update handling */
gchar *port_qcdm;
gchar *port_edl;
gchar *firehose_prog_file;
FuSaharaLoader *sahara_loader;
#if MM_CHECK_VERSION(1, 17, 2)
FuFirehoseUpdater *firehose_updater;
#endif
/* for sahara */
FuUsbDevice *usb_device;
@ -1473,11 +1475,19 @@ fu_mm_copy_firehose_prog(FuMmDevice *self, GBytes *prog, GError **error)
g_autofree gchar *qcom_fw_dir = NULL;
g_autofree gchar *firehose_file_path = NULL;
if (self->firehose_prog_file == NULL) {
g_set_error(error,
FWUPD_ERROR,
FWUPD_ERROR_NOT_FOUND,
"Firehose prog filename is not set for the device");
return FALSE;
}
qcom_fw_dir = g_build_filename(self->firmware_path, "qcom", NULL);
if (!fu_path_mkdir_parent(qcom_fw_dir, error))
return FALSE;
firehose_file_path = g_build_filename(qcom_fw_dir, "prog_firehose_sdx24.mbn", NULL);
firehose_file_path = g_build_filename(qcom_fw_dir, self->firehose_prog_file, NULL);
if (!fu_bytes_set_contents(firehose_file_path, prog, error))
return FALSE;
@ -1681,6 +1691,11 @@ fu_mm_device_set_quirk_kv(FuDevice *device, const gchar *key, const gchar *value
return TRUE;
}
if (g_strcmp0(key, "ModemManagerFirehoseProgFile") == 0) {
self->firehose_prog_file = g_strdup(value);
return TRUE;
}
/* failed */
g_set_error_literal(error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED, "quirk key not supported");
return FALSE;
@ -1947,6 +1962,7 @@ fu_mm_device_finalize(GObject *object)
g_free(self->inhibition_uid);
g_free(self->firmware_path);
g_free(self->restore_firmware_path);
g_free(self->firehose_prog_file);
G_OBJECT_CLASS(fu_mm_device_parent_class)->finalize(object);
}

View File

@ -58,3 +58,13 @@ ModemManagerBranchAtCommand = AT+GETFWBRANCH
[USB\VID_05C6&PID_9008]
Summary = Qualcomm based modems in EDL (sahara)
Plugin = modem_manager
# Quectel EM120 firehose prog file
[PCI\VID_1EAC&PID_1001]
Summary = Quectel EM120 firehose prog file
ModemManagerFirehoseProgFile = prog_firehose_sdx24.mbn
# Quectel EM160 firehose prog file
[PCI\VID_1EAC&PID_1002]
Summary = Quectel EM160 firehose prog file
ModemManagerFirehoseProgFile = prog_firehose_sdx24.mbn