summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2020-07-30 18:52:08 +0200
committerAleksander Morgado <aleksander@aleksander.es>2021-05-19 10:25:42 +0200
commit3d05b1c81b9841fb376e6f122e807e3c2b515dac (patch)
tree1c28b1889d00e204d753ccdaa6ebd111a3e21a4a
parenta80b1f1f25db0b81b25c45b3929975b68ac44ecb (diff)
downloadlibqmi-3d05b1c81b9841fb376e6f122e807e3c2b515dac.tar.gz
dms: new 'Foxconn Set FCC authentication' command
This command allows unlocking Foxconn-manufactured modules like the Dell-branded DW5821e (T77W968) or the new 5G-capable T99W175 module shipped in Lenovo Thinkpads. Without the unlock, the module cannot be put online (RF is kept off). The command was found looking at a USB capture obtained from running the "Dell Custkit tool for the DW5821e/DW5829e" under Windows: 0x01, 0x10, 0x00, 0x00, 0x02, 0x01, 0x00, 0x01, 0x00, 0x71, 0x55, 0x04, 0x00, 0x01, 0x01, 0x00, 0x00 See: https://lists.freedesktop.org/archives/modemmanager-devel/2021-May/008571.html https://lists.freedesktop.org/archives/modemmanager-devel/2021-May/008572.html https://lists.freedesktop.org/archives/modemmanager-devel/2021-May/008586.html
-rw-r--r--data/qmi-service-dms.json14
-rw-r--r--docs/reference/libqmi-glib/libqmi-glib-docs.xml1
-rw-r--r--src/qmicli/qmicli-dms.c61
3 files changed, 76 insertions, 0 deletions
diff --git a/data/qmi-service-dms.json b/data/qmi-service-dms.json
index e67ed671..c6c5aafc 100644
--- a/data/qmi-service-dms.json
+++ b/data/qmi-service-dms.json
@@ -1425,6 +1425,20 @@
"since" : "1.26",
"format" : "guint8",
"public-format" : "QmiDmsFoxconnDeviceMode" } ],
+ "output" : [ { "common-ref" : "Operation Result" } ] },
+
+ // *********************************************************************************
+ { "name" : "Foxconn Set FCC Authentication",
+ "type" : "Message",
+ "service" : "DMS",
+ "id" : "0x5571",
+ "vendor" : "0x0489",
+ "since" : "1.30",
+ "input" : [ { "name" : "Value",
+ "id" : "0x01",
+ "type" : "TLV",
+ "since" : "1.30",
+ "format" : "guint8" } ],
"output" : [ { "common-ref" : "Operation Result" } ] }
]
diff --git a/docs/reference/libqmi-glib/libqmi-glib-docs.xml b/docs/reference/libqmi-glib/libqmi-glib-docs.xml
index ce3b0312..2d3c6969 100644
--- a/docs/reference/libqmi-glib/libqmi-glib-docs.xml
+++ b/docs/reference/libqmi-glib/libqmi-glib-docs.xml
@@ -131,6 +131,7 @@
<xi:include href="xml/qmi-message-dms-foxconn-get-firmware-version.xml"/>
<xi:include href="xml/qmi-message-dms-set-fcc-authentication.xml"/>
<xi:include href="xml/qmi-message-dms-foxconn-change-device-mode.xml"/>
+ <xi:include href="xml/qmi-message-dms-foxconn-set-fcc-authentication.xml"/>
<xi:include href="xml/qmi-message-dms-get-supported-messages.xml"/>
</section>
</chapter>
diff --git a/src/qmicli/qmicli-dms.c b/src/qmicli/qmicli-dms.c
index 8492da4e..50b1918b 100644
--- a/src/qmicli/qmicli-dms.c
+++ b/src/qmicli/qmicli-dms.c
@@ -105,6 +105,7 @@ static gchar *dell_change_device_mode_str; /* deprecated */
static gchar *foxconn_change_device_mode_str;
static gchar *dell_get_firmware_version_str; /* deprecated */
static gchar *foxconn_get_firmware_version_str;
+static gint foxconn_set_fcc_authentication_int = -1;
static gchar *get_mac_address_str;
static gboolean reset_flag;
static gboolean noop_flag;
@@ -429,6 +430,12 @@ static GOptionEntry entries[] = {
"[firmware-mcfg-apps|firmware-mcfg|apps]"
},
#endif
+#if defined HAVE_QMI_MESSAGE_DMS_FOXCONN_SET_FCC_AUTHENTICATION
+ { "dms-foxconn-set-fcc-authentication", 0, 0, G_OPTION_ARG_INT, &foxconn_set_fcc_authentication_int,
+ "Set FCC authentication (Foxconn specific)",
+ "[magic]"
+ },
+#endif
#if defined HAVE_QMI_MESSAGE_DMS_GET_MAC_ADDRESS
{ "dms-get-mac-address", 0, 0, G_OPTION_ARG_STRING, &get_mac_address_str,
"Get default MAC address",
@@ -540,6 +547,7 @@ qmicli_dms_options_enabled (void)
!!foxconn_change_device_mode_str +
!!dell_get_firmware_version_str +
!!foxconn_get_firmware_version_str +
+ (foxconn_set_fcc_authentication_int >= 0) +
!!get_mac_address_str +
reset_flag +
noop_flag);
@@ -4281,6 +4289,35 @@ foxconn_get_firmware_version_ready (QmiClientDms *client,
#endif /* HAVE_QMI_MESSAGE_DMS_FOXCONN_GET_FIRMWARE_VERSION */
+#if defined HAVE_QMI_MESSAGE_DMS_FOXCONN_SET_FCC_AUTHENTICATION
+
+static void
+foxconn_set_fcc_authentication_ready (QmiClientDms *client,
+ GAsyncResult *res)
+{
+ g_autoptr(QmiMessageDmsFoxconnSetFccAuthenticationOutput) output = NULL;
+ g_autoptr(GError) error = NULL;
+
+ output = qmi_client_dms_foxconn_set_fcc_authentication_finish (client, res, &error);
+ if (!output) {
+ g_printerr ("error: operation failed: %s\n", error->message);
+ operation_shutdown (FALSE);
+ return;
+ }
+
+ if (!qmi_message_dms_foxconn_set_fcc_authentication_output_get_result (output, &error)) {
+ g_printerr ("error: couldn't run Foxconn FCC authentication: %s\n", error->message);
+ operation_shutdown (FALSE);
+ return;
+ }
+
+ g_print ("[%s] Successfully run Foxconn FCC authentication\n",
+ qmi_device_get_path_display (ctx->device));
+ operation_shutdown (TRUE);
+}
+
+#endif /* HAVE_QMI_MESSAGE_DMS_FOXCONN_SET_FCC_AUTHENTICATION */
+
#if defined HAVE_QMI_MESSAGE_DMS_GET_MAC_ADDRESS
static QmiMessageDmsGetMacAddressInput *
@@ -5274,6 +5311,30 @@ qmicli_dms_run (QmiDevice *device,
}
#endif
+#if defined HAVE_QMI_MESSAGE_DMS_FOXCONN_SET_FCC_AUTHENTICATION
+ if (foxconn_set_fcc_authentication_int >= 0) {
+ g_autoptr(QmiMessageDmsFoxconnSetFccAuthenticationInput) input = NULL;
+
+ if (foxconn_set_fcc_authentication_int > 0xFF) {
+ g_printerr ("error: magic value out of [0,255] range\n");
+ operation_shutdown (FALSE);
+ return;
+ }
+
+ g_debug ("Asynchronously running Foxconn FCC authentication...");
+
+ input = qmi_message_dms_foxconn_set_fcc_authentication_input_new ();
+ qmi_message_dms_foxconn_set_fcc_authentication_input_set_value (input, (guint8)foxconn_set_fcc_authentication_int, NULL);
+ qmi_client_dms_foxconn_set_fcc_authentication (ctx->client,
+ input,
+ 10,
+ ctx->cancellable,
+ (GAsyncReadyCallback)foxconn_set_fcc_authentication_ready,
+ NULL);
+ return;
+ }
+#endif
+
#if defined HAVE_QMI_MESSAGE_DMS_GET_MAC_ADDRESS
if (get_mac_address_str) {
QmiMessageDmsGetMacAddressInput *input;