Lines Matching +full:verify +full:- +full:formatting
4 * SPDX-License-Identifier: Apache-2.0
12 #include "quectel-bg9x.h"
63 struct modem_data *data = dev->data; in modem_get_mac()
66 data->mac_addr[0] = 0x00; in modem_get_mac()
67 data->mac_addr[1] = 0x10; in modem_get_mac()
72 UNALIGNED_PUT(hash_value, (uint32_t *)(data->mac_addr + 2)); in modem_get_mac()
74 return data->mac_addr; in modem_get_mac()
127 return -EAGAIN; in on_cmd_sockread_common()
131 if (!data->rx_buf) { in on_cmd_sockread_common()
133 return -EINVAL; in on_cmd_sockread_common()
136 socket_data_length = find_len(data->rx_buf->data); in on_cmd_sockread_common()
142 return -EAGAIN; in on_cmd_sockread_common()
146 if (net_buf_frags_len(data->rx_buf) < (socket_data_length + bytes_to_skip)) { in on_cmd_sockread_common()
147 LOG_DBG("Not enough data -- wait!"); in on_cmd_sockread_common()
148 return -EAGAIN; in on_cmd_sockread_common()
154 net_buf_pull_u8(data->rx_buf); in on_cmd_sockread_common()
157 if (!data->rx_buf->len) { in on_cmd_sockread_common()
158 data->rx_buf = net_buf_frag_del(NULL, data->rx_buf); in on_cmd_sockread_common()
164 ret = -EINVAL; in on_cmd_sockread_common()
168 sock_data = (struct socket_read_data *)sock->data; in on_cmd_sockread_common()
171 ret = -EINVAL; in on_cmd_sockread_common()
175 ret = net_buf_linearize(sock_data->recv_buf, sock_data->recv_buf_len, in on_cmd_sockread_common()
176 data->rx_buf, 0, (uint16_t)socket_data_length); in on_cmd_sockread_common()
177 data->rx_buf = net_buf_skip(data->rx_buf, ret); in on_cmd_sockread_common()
178 sock_data->recv_read_len = ret; in on_cmd_sockread_common()
182 ret = -EINVAL; in on_cmd_sockread_common()
188 -socket_data_length); in on_cmd_sockread_common()
190 /* don't give back semaphore -- OK to follow */ in on_cmd_sockread_common()
202 snprintk(buf, sizeof(buf), "AT+QICLOSE=%d", sock->id); in socket_close()
212 modem_socket_put(&mdata.socket_config, sock->sock_fd); in socket_close()
226 modem_cmd_handler_set_error(data, -EIO); in MODEM_CMD_DEFINE()
234 modem_cmd_handler_set_error(data, -EIO); in MODEM_CMD_DEFINE()
246 mdata.mdm_rssi = -51; in MODEM_CMD_DEFINE()
248 mdata.mdm_rssi = -114 + ((rssi * 2) + 1); in MODEM_CMD_DEFINE()
250 mdata.mdm_rssi = -1000; in MODEM_CMD_DEFINE()
273 sizeof(mdata.mdm_manufacturer) - 1, in MODEM_CMD_DEFINE()
274 data->rx_buf, 0, len); in MODEM_CMD_DEFINE()
284 sizeof(mdata.mdm_model) - 1, in MODEM_CMD_DEFINE()
285 data->rx_buf, 0, len); in MODEM_CMD_DEFINE()
297 sizeof(mdata.mdm_revision) - 1, in MODEM_CMD_DEFINE()
298 data->rx_buf, 0, len); in MODEM_CMD_DEFINE()
310 sizeof(mdata.mdm_imei) - 1, in MODEM_CMD_DEFINE()
311 data->rx_buf, 0, len); in MODEM_CMD_DEFINE()
324 sizeof(mdata.mdm_imsi) - 1, in MODEM_CMD_DEFINE()
325 data->rx_buf, 0, len); in MODEM_CMD_DEFINE()
339 out_len = net_buf_linearize(mdata.mdm_iccid, sizeof(mdata.mdm_iccid) - 1, in MODEM_CMD_DEFINE()
340 data->rx_buf, 0, len); in MODEM_CMD_DEFINE()
377 modem_cmd_handler_set_error(data, -EIO); in MODEM_CMD_DEFINE()
457 snprintk(send_buf, sizeof(send_buf), "AT+QISEND=%d,%ld", sock->id, (long) buf_len); in send_socket_data()
481 /* Didn't get the data prompt - Exit. */ in send_socket_data()
528 * -> We firstly send the "AT+QISEND" command on the given socket and in offload_sendto()
530 * -> In response to "AT+QISEND" command, the modem may respond with a in offload_sendto()
533 * -> We plainly write all data on the UART and terminate by sending a in offload_sendto()
548 return -1; in offload_sendto()
552 if (sock->ip_proto == IPPROTO_UDP) { in offload_sendto()
554 return -1; in offload_sendto()
557 if (!sock->is_connected) { in offload_sendto()
559 return -1; in offload_sendto()
565 errno = -ret; in offload_sendto()
566 return -1; in offload_sendto()
591 return -1; in offload_recvfrom()
596 return -1; in offload_recvfrom()
599 snprintk(sendbuf, sizeof(sendbuf), "AT+QIRD=%d,%zd", sock->id, len); in offload_recvfrom()
606 sock->data = &sock_data; in offload_recvfrom()
607 mdata.sock_fd = sock->sock_fd; in offload_recvfrom()
614 errno = -ret; in offload_recvfrom()
615 ret = -1; in offload_recvfrom()
621 *fromlen = sizeof(sock->dst); in offload_recvfrom()
622 memcpy(from, &sock->dst, *fromlen); in offload_recvfrom()
631 sock->data = NULL; in offload_recvfrom()
680 return -1; in offload_ioctl()
700 /* Verify socket has been allocated */ in offload_connect()
703 sock->id, sock->sock_fd); in offload_connect()
705 return -1; in offload_connect()
708 if (sock->is_connected == true) { in offload_connect()
710 sock->id, sock->sock_fd); in offload_connect()
712 return -1; in offload_connect()
716 if (addr->sa_family == AF_INET6) { in offload_connect()
717 dst_port = ntohs(net_sin6(addr)->sin6_port); in offload_connect()
718 } else if (addr->sa_family == AF_INET) { in offload_connect()
719 dst_port = ntohs(net_sin(addr)->sin_port); in offload_connect()
723 if (sock->ip_proto == IPPROTO_UDP) { in offload_connect()
725 return -1; in offload_connect()
732 LOG_ERR("Error formatting IP string %d", ret); in offload_connect()
735 errno = -ret; in offload_connect()
736 return -1; in offload_connect()
740 snprintk(buf, sizeof(buf), "AT+QIOPEN=%d,%d,\"%s\",\"%s\",%d,0,0", 1, sock->id, protocol, in offload_connect()
751 errno = -ret; in offload_connect()
752 return -1; in offload_connect()
779 sock->is_connected = true; in offload_connect()
786 errno = -ret; in offload_connect()
787 return -1; in offload_connect()
804 if (sock->is_connected) { in offload_close()
819 LOG_DBG("msg_iovlen:%zd flags:%d", msg->msg_iovlen, flags); in offload_sendmsg()
821 for (int i = 0; i < msg->msg_iovlen; i++) { in offload_sendmsg()
822 const char *buf = msg->msg_iov[i].iov_base; in offload_sendmsg()
823 size_t len = msg->msg_iov[i].iov_len; in offload_sendmsg()
827 msg->msg_name, msg->msg_namelen); in offload_sendmsg()
829 if (rc == -EAGAIN) { in offload_sendmsg()
838 len -= rc; in offload_sendmsg()
881 /* Re-start RSSI query work */ in modem_rssi_query_work()
913 /* MDM_POWER -> 1 for 500-1000 msec. */ in pin_init()
917 /* MDM_POWER -> 0 and wait for ~2secs as UART remains in "inactive" state in pin_init()
932 LOG_INF("Modem powering off. Re-power modem..."); in MODEM_CMD_DEFINE()
986 while (ret == -EIO && retry_count < MDM_PDP_ACT_RETRY_COUNT) { in modem_pdp_context_activate()
1003 if (ret == -EIO && retry_count >= MDM_PDP_ACT_RETRY_COUNT) { in modem_pdp_context_activate()
1052 /* Keep trying to read RSSI until we get a valid value - Eventually, exit. */ in modem_setup()
1054 (mdata.mdm_rssi >= 0 || mdata.mdm_rssi <= -1000)) { in modem_setup()
1060 if (mdata.mdm_rssi >= 0 || mdata.mdm_rssi <= -1000) { in modem_setup()
1065 ret = -ENETUNREACH; in modem_setup()
1075 /* Network is ready - Start RSSI work in the background. */ in modem_setup()
1115 struct modem_data *data = dev->data; in modem_net_iface_init()
1119 sizeof(data->mac_addr), in modem_net_iface_init()
1121 data->net_iface = iface; in modem_net_iface_init()
1155 errno = -ret; in offload_socket()
1156 return -1; in offload_socket()