CC3351: Received "err == 31" for NL80211_CMD_GET_INTERFACE

Part Number: CC3351

Tool/software:

Hi TI's experts,

      We encountered error return "err == 31 (No such device)" for NL80211_CMD_GET_INTERFACE and we confirmed that wlan0 was up via "ifconfig wlan0" command and it could connect to an AP normally.

      Here is the reference code:

      

nl_msg *msg = nlmsg_alloc();
nl_sock *sock = nl_socket_alloc();
genlmsg_put(msg, NL_AUTO_PORT, NL_AUTO_SEQ, "nl80211", 0, 0, NL80211_CMD_GET_INTERFACE, 0);
nla_put_u32(msg, NL80211_ATTR_IFINDEX, if_nametoindex("wlan0"));
nl_send_auto(sock, msg);
int err = nl_wait_for_ack(sock);    // err == 31 (No such device)
nlmsg_free(msg);
nl_socket_free(sock);