Skip to content

Commit 6a9d989

Browse files
authored
Merge branch 'master' into hk-no-float-validation
2 parents c1f15a4 + 9da5c22 commit 6a9d989

File tree

95 files changed

+7927
-676
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+7927
-676
lines changed

UNITTESTS/features/cellular/framework/AT/at_cellulardevice/unittest.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ set(unittest-test-sources
4343
stubs/SerialBase_stub.cpp
4444
stubs/CellularStateMachine_stub.cpp
4545
stubs/CellularContext_stub.cpp
46+
stubs/ThisThread_stub.cpp
4647
stubs/ConditionVariable_stub.cpp
4748
stubs/Mutex_stub.cpp
4849
)

components/TARGET_PSA/services/attestation/COMPONENT_PSA_SRV_IMPL/tfm_impl/attestation_core.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -841,7 +841,6 @@ attest_create_token(struct useful_buf_c *challenge,
841841
enum attest_token_err_t token_err;
842842
struct attest_token_ctx attest_token_ctx;
843843
int32_t key_select;
844-
int32_t alg_select;
845844
uint32_t option_flags = 0;
846845

847846
if (challenge->len == 36) {
@@ -855,14 +854,6 @@ attest_create_token(struct useful_buf_c *challenge,
855854
/* Lower three bits are the key select */
856855
key_select = option_flags & 0x7;
857856

858-
/* Map the key select to an algorithm. Maybe someday we'll support something
859-
* other than ES256
860-
*/
861-
switch (key_select) {
862-
default:
863-
alg_select = COSE_ALGORITHM_ES256;
864-
}
865-
866857
/* Get started creating the token. This sets up the CBOR and COSE contexts
867858
* which causes the COSE headers to be constructed.
868859
*/

components/storage/blockdevice/COMPONENT_SPIF/SPIFBlockDevice.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "mbed_critical.h"
2020

2121
#include <string.h>
22+
#include <inttypes.h>
2223

2324
#include "mbed_trace.h"
2425
#include "mbed_debug.h"

components/wifi/esp8266-driver/ESP8266Interface.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ int ESP8266Interface::set_credentials(const char *ssid, const char *pass, nsapi_
319319
if (ssid_length > 0
320320
&& ssid_length <= ESP8266_SSID_MAX_LENGTH) {
321321
memset(ap_ssid, 0, sizeof(ap_ssid));
322-
strncpy(ap_ssid, ssid, sizeof(ap_ssid));
322+
strncpy(ap_ssid, ssid, ESP8266_SSID_MAX_LENGTH);
323323
} else {
324324
return NSAPI_ERROR_PARAMETER;
325325
}
@@ -438,7 +438,7 @@ int ESP8266Interface::scan(WiFiAccessPoint *res, unsigned count, scan_mode mode,
438438
}
439439

440440
return _esp.scan(res, count, (mode == SCANMODE_ACTIVE ? ESP8266::SCANMODE_ACTIVE : ESP8266::SCANMODE_PASSIVE),
441-
t_min, t_max);
441+
t_max, t_min);
442442
}
443443

444444
bool ESP8266Interface::_get_firmware_ok()

drivers/source/usb/USBDevice.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,7 @@ bool USBDevice::_request_setup()
616616
bool success = false;
617617

618618
/* Process standard requests */
619-
if ((_transfer.setup.bmRequestType.Type == STANDARD_TYPE)) {
619+
if (_transfer.setup.bmRequestType.Type == STANDARD_TYPE) {
620620
switch (_transfer.setup.bRequest) {
621621
case GET_STATUS:
622622
success = _request_get_status();

features/cellular/framework/AT/ATHandler.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -926,7 +926,7 @@ void ATHandler::set_3gpp_error(int err, DeviceErrorType error_type)
926926
for (size_t i = 0; i < sizeof(map_3gpp_errors) / sizeof(map_3gpp_errors[0]); i++) {
927927
if (map_3gpp_errors[i][0] == err) {
928928
_last_3gpp_error = map_3gpp_errors[i][1];
929-
tr_debug("AT3GPP error code %d", get_3gpp_error());
929+
tr_error("AT3GPP error code %d", get_3gpp_error());
930930
break;
931931
}
932932
}
@@ -943,7 +943,7 @@ void ATHandler::at_error(bool error_code_expected, DeviceErrorType error_type)
943943
set_3gpp_error(err, error_type);
944944
_last_at_err.errCode = err;
945945
_last_at_err.errType = error_type;
946-
tr_error("AT error code %ld", err);
946+
tr_warn("AT error code %ld", err);
947947
} else {
948948
tr_warn("ATHandler ERROR reading failed");
949949
}
@@ -1394,7 +1394,7 @@ void ATHandler::write_int(int32_t param)
13941394
// write the integer subparameter
13951395
const int32_t str_len = 12;
13961396
char number_string[str_len];
1397-
int32_t result = sprintf(number_string, "%ld", param);
1397+
int32_t result = sprintf(number_string, "%" PRIi32, param);
13981398
if (result > 0 && result < str_len) {
13991399
(void)write(number_string, strlen(number_string));
14001400
}

features/cellular/framework/AT/AT_CellularBase.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,6 @@ intptr_t AT_CellularBase::get_property(CellularProperty key)
5151
if (_property_array) {
5252
return _property_array[key];
5353
} else {
54-
return NULL;
54+
return 0;
5555
}
5656
}

features/cellular/framework/AT/AT_CellularContext.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -608,6 +608,7 @@ nsapi_error_t AT_CellularContext::open_data_channel()
608608
connected, or timeout after 30 seconds*/
609609
nsapi_error_t err = nsapi_ppp_connect(_at.get_file_handle(), callback(this, &AT_CellularContext::ppp_status_cb), _uname, _pwd, (nsapi_ip_stack_t)_pdp_type);
610610
if (err) {
611+
tr_error("nsapi_ppp_connect failed");
611612
ppp_disconnected();
612613
}
613614

@@ -993,6 +994,7 @@ void AT_CellularContext::cellular_callback(nsapi_event_t ev, intptr_t ptr)
993994
tr_info("cellular_callback: PPP mode and NSAPI_STATUS_DISCONNECTED");
994995
_cb_data.error = NSAPI_ERROR_NO_CONNECTION;
995996
_is_connected = false;
997+
ppp_disconnected();
996998
}
997999
}
9981000
#else

features/cellular/framework/AT/AT_CellularDevice.cpp

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
* limitations under the License.
1616
*/
1717

18+
#include "rtos/ThisThread.h"
1819
#include "CellularUtil.h"
1920
#include "AT_CellularDevice.h"
2021
#include "AT_CellularInformation.h"
@@ -202,6 +203,7 @@ nsapi_error_t AT_CellularDevice::get_sim_state(SimState &state)
202203
_at->flush();
203204
nsapi_error_t error = _at->at_cmd_str("+CPIN", "?", simstr, sizeof(simstr));
204205
ssize_t len = strlen(simstr);
206+
device_err_t err = _at->get_last_device_error();
205207
_at->unlock();
206208

207209
if (len != -1) {
@@ -213,7 +215,6 @@ nsapi_error_t AT_CellularDevice::get_sim_state(SimState &state)
213215
state = SimStatePukNeeded;
214216
} else {
215217
simstr[len] = '\0';
216-
tr_error("Unknown SIM state %s", simstr);
217218
state = SimStateUnknown;
218219
}
219220
} else {
@@ -229,7 +230,11 @@ nsapi_error_t AT_CellularDevice::get_sim_state(SimState &state)
229230
tr_error("SIM PUK required");
230231
break;
231232
case SimStateUnknown:
232-
tr_warn("SIM state unknown");
233+
if (err.errType == DeviceErrorTypeErrorCME && err.errCode == 14) {
234+
tr_info("SIM busy");
235+
} else {
236+
tr_warn("SIM state unknown");
237+
}
233238
break;
234239
default:
235240
tr_info("SIM is ready");
@@ -443,12 +448,18 @@ nsapi_error_t AT_CellularDevice::init()
443448
setup_at_handler();
444449

445450
_at->lock();
446-
_at->flush();
447-
_at->at_cmd_discard("E0", "");
448-
449-
_at->at_cmd_discard("+CMEE", "=1");
450-
451-
_at->at_cmd_discard("+CFUN", "=1");
451+
for (int retry = 1; retry <= 3; retry++) {
452+
_at->clear_error();
453+
_at->flush();
454+
_at->at_cmd_discard("E0", "");
455+
_at->at_cmd_discard("+CMEE", "=1");
456+
_at->at_cmd_discard("+CFUN", "=1");
457+
if (_at->get_last_error() == NSAPI_ERROR_OK) {
458+
break;
459+
}
460+
tr_debug("Wait 100ms to init modem");
461+
rtos::ThisThread::sleep_for(100); // let modem have time to get ready
462+
}
452463

453464
return _at->unlock_return_error();
454465
}

features/cellular/framework/AT/AT_CellularNetwork.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,9 @@ nsapi_error_t AT_CellularNetwork::set_registration(const char *plmn)
211211
if (!plmn) {
212212
tr_debug("Automatic network registration");
213213
NWRegisteringMode mode;
214-
get_network_registering_mode(mode);
215-
214+
if (get_network_registering_mode(mode) != NSAPI_ERROR_OK) {
215+
return NSAPI_ERROR_DEVICE_ERROR;
216+
}
216217
if (mode != NWModeAutomatic) {
217218
return _at.at_cmd_discard("+COPS", "=0");
218219
}

0 commit comments

Comments
 (0)