diff --git a/application/quectel_CM_5G_M/src/QMIThread.c b/application/quectel_CM_5G_M/src/QMIThread.c index ca49704..53c834f 100644 --- a/application/quectel_CM_5G_M/src/QMIThread.c +++ b/application/quectel_CM_5G_M/src/QMIThread.c @@ -2353,6 +2353,17 @@ static int requestBaseBandVersion(PROFILE_T *profile) { { uchar2char(profile->BaseBandVersion, sizeof(profile->BaseBandVersion), &revId->RevisionID, le16_to_cpu(revId->TLVLength)); dbg_time("%s %s", __func__, profile->BaseBandVersion); + +#ifdef CONFIG_FOXCONN_FCC_AUTH + // Check if this modem model needs FCC authentication + if (strstr(profile->BaseBandVersion, "T99W175")) { + profile->needs_fcc_auth = 1; + dbg_time("Modem model %s requires FCC authentication", profile->BaseBandVersion); + } else { + profile->needs_fcc_auth = 0; + dbg_time("Modem model %s does not require FCC authentication", profile->BaseBandVersion); + } +#endif } free(pResponse); diff --git a/application/quectel_CM_5G_M/src/main.c b/application/quectel_CM_5G_M/src/main.c index bd0f00b..a1f64be 100644 --- a/application/quectel_CM_5G_M/src/main.c +++ b/application/quectel_CM_5G_M/src/main.c @@ -325,6 +325,37 @@ static int qmi_main(PROFILE_T *profile) if (request_ops->requestSetEthMode) request_ops->requestSetEthMode(profile); +#ifdef CONFIG_FOXCONN_FCC_AUTH + // Only execute FCC authentication if the modem model requires it + if (profile->needs_fcc_auth) { + dbg_time("Executing FCC authentication for modem model: %s", profile->BaseBandVersion); + + if (request_ops->requestFoxconnSetFccAuthentication) { + // Use magic value 0x01 as seen in libqmi + qmierr = request_ops->requestFoxconnSetFccAuthentication(0x01); + if (qmierr) { + dbg_time("Foxconn FCC Authentication failed with error: %d", qmierr); + } else { + dbg_time("Foxconn FCC Authentication successful"); + } + } + + if (request_ops->requestFoxconnSetFccAuthenticationV2) { + // Based on libqmi, use "FOXCONN" as magic string for Foxconn modems + const char *magic_string = "FOXCONN"; // Correct magic string for Foxconn + UCHAR magic_number = 0x01; // Standard magic number from libqmi + + qmierr = request_ops->requestFoxconnSetFccAuthenticationV2(magic_string, magic_number); + if (qmierr) { + dbg_time("Foxconn FCC Authentication V2 failed with error: %d", qmierr); + } else { + dbg_time("Foxconn FCC Authentication V2 successful"); + } + } + } else { + dbg_time("Skipping FCC authentication - not required for this modem model"); + } +#endif if (request_ops->requestSetLoopBackState && profile->loopback_state) { qmierr = request_ops->requestSetLoopBackState(profile->loopback_state, profile->replication_factor); if (qmierr != QMI_ERR_INVALID_QMI_CMD) //X20 return this error