fix fcc unlock

This commit is contained in:
d3dx9 2025-06-02 10:46:32 +00:00
parent 07c40ddaed
commit 653a4ae591
2 changed files with 42 additions and 0 deletions

View File

@ -2353,6 +2353,17 @@ static int requestBaseBandVersion(PROFILE_T *profile) {
{ {
uchar2char(profile->BaseBandVersion, sizeof(profile->BaseBandVersion), &revId->RevisionID, le16_to_cpu(revId->TLVLength)); uchar2char(profile->BaseBandVersion, sizeof(profile->BaseBandVersion), &revId->RevisionID, le16_to_cpu(revId->TLVLength));
dbg_time("%s %s", __func__, profile->BaseBandVersion); 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); free(pResponse);

View File

@ -325,6 +325,37 @@ static int qmi_main(PROFILE_T *profile)
if (request_ops->requestSetEthMode) if (request_ops->requestSetEthMode)
request_ops->requestSetEthMode(profile); 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) { if (request_ops->requestSetLoopBackState && profile->loopback_state) {
qmierr = request_ops->requestSetLoopBackState(profile->loopback_state, profile->replication_factor); qmierr = request_ops->requestSetLoopBackState(profile->loopback_state, profile->replication_factor);
if (qmierr != QMI_ERR_INVALID_QMI_CMD) //X20 return this error if (qmierr != QMI_ERR_INVALID_QMI_CMD) //X20 return this error