Merged in masayuki2009/nuttx.apps/gs2200m_supports_SIOCGIFHWADDR (pull request #199)

wireless/gs2200m/gs2200m_main.c: ioctl_request() supports SIOCGIFHWADDR

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>

Approved-by: Gregory Nutt <gnutt@nuttx.org>
This commit is contained in:
Masayuki Ishikawa 2019-09-02 01:53:29 +00:00 committed by Gregory Nutt
parent aa6d5106e7
commit 104d7f3716

View File

@ -1264,16 +1264,23 @@ static int ioctl_request(int fd, FAR struct gs2200m_s *priv,
{
FAR struct usrsock_request_ioctl_s *req = hdrbuf;
struct usrsock_message_req_ack_s resp;
struct usrsock_message_datareq_ack_s resp2;
struct gs2200m_ifreq_msg imsg;
bool getreq = false;
int ret = -EINVAL;
memset(&imsg.ifr, 0, sizeof(imsg.ifr));
switch (req->cmd)
{
case SIOCGIFHWADDR:
getreq = true;
break;
case SIOCSIFADDR:
case SIOCSIFDSTADDR:
case SIOCSIFNETMASK:
memset(&imsg.ifr, 0, sizeof(imsg.ifr));
(void)read(fd, &imsg.ifr, sizeof(imsg.ifr));
break;
@ -1284,6 +1291,8 @@ static int ioctl_request(int fd, FAR struct gs2200m_s *priv,
imsg.cmd = req->cmd;
ret = ioctl(priv->gsfd, GS2200M_IOC_IFREQ, (unsigned long)&imsg);
if (!getreq)
{
/* Send ACK response */
memset(&resp, 0, sizeof(resp));
@ -1294,6 +1303,23 @@ static int ioctl_request(int fd, FAR struct gs2200m_s *priv,
{
return ret;
}
}
if (getreq)
{
resp2.reqack.result = ret;
resp2.reqack.xid = req->head.xid;
resp2.reqack.head.msgid = USRSOCK_MESSAGE_RESPONSE_DATA_ACK;
resp2.reqack.head.flags = 0;
resp2.valuelen_nontrunc = sizeof(imsg.ifr);
resp2.valuelen = sizeof(imsg.ifr);
(void)_write_to_usock(fd, &resp2, sizeof(resp2));
/* Return struct ifreq address */
_write_to_usock(fd, &imsg.ifr, resp2.valuelen);
}
return ret;
}