drivers: modem: sara-r4: handle read limits
SARA-R4 has a max read limit of 512 when using binary hex formatting. Otherwise the max read limit is 1024. Signed-off-by: Michael Scott <mike@foundries.io>
This commit is contained in:
parent
52afcc21d6
commit
87481e8eef
1 changed files with 15 additions and 0 deletions
|
@ -1161,6 +1161,21 @@ static ssize_t offload_recvfrom(void *obj, void *buf, size_t len,
|
|||
&mdata.socket_config, sock);
|
||||
}
|
||||
|
||||
#if defined(CONFIG_MODEM_UBLOX_SARA_R4)
|
||||
/* max length in hex mode is MDM_MAX_DATA_LENGTH / 2 */
|
||||
if (next_packet_size > (MDM_MAX_DATA_LENGTH / 2)) {
|
||||
next_packet_size = (MDM_MAX_DATA_LENGTH / 2);
|
||||
}
|
||||
#else
|
||||
/*
|
||||
* Binary and ASCII mode allows sending MDM_MAX_DATA_LENGTH bytes to
|
||||
* the socket in one command
|
||||
*/
|
||||
if (next_packet_size > MDM_MAX_DATA_LENGTH) {
|
||||
next_packet_size = MDM_MAX_DATA_LENGTH;
|
||||
}
|
||||
#endif
|
||||
|
||||
snprintk(sendbuf, sizeof(sendbuf), "AT+USO%s=%d,%d",
|
||||
from ? "RF" : "RD", sock->id,
|
||||
len < next_packet_size ? len : next_packet_size);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue