Commit 064f370c authored by Thierry Escande's avatar Thierry Escande Committed by Samuel Ortiz

NFC: llcp: Add support in getsockopt for RW, LTO, and MIU remote parameters

Useful for LLCP validation tests.
Signed-off-by: default avatarThierry Escande <thierry.escande@linux.intel.com>
Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
parent abd18d43
...@@ -233,7 +233,10 @@ struct sockaddr_nfc_llcp { ...@@ -233,7 +233,10 @@ struct sockaddr_nfc_llcp {
#define NFC_LLCP_DIRECTION_TX 0x01 #define NFC_LLCP_DIRECTION_TX 0x01
/* socket option names */ /* socket option names */
#define NFC_LLCP_RW 0 #define NFC_LLCP_RW 0
#define NFC_LLCP_MIUX 1 #define NFC_LLCP_MIUX 1
#define NFC_LLCP_REMOTE_MIU 2
#define NFC_LLCP_REMOTE_LTO 3
#define NFC_LLCP_REMOTE_RW 4
#endif /*__LINUX_NFC_H */ #endif /*__LINUX_NFC_H */
...@@ -303,7 +303,7 @@ static int nfc_llcp_getsockopt(struct socket *sock, int level, int optname, ...@@ -303,7 +303,7 @@ static int nfc_llcp_getsockopt(struct socket *sock, int level, int optname,
struct sock *sk = sock->sk; struct sock *sk = sock->sk;
struct nfc_llcp_sock *llcp_sock = nfc_llcp_sock(sk); struct nfc_llcp_sock *llcp_sock = nfc_llcp_sock(sk);
int len, err = 0; int len, err = 0;
u16 miux; u16 miux, remote_miu;
u8 rw; u8 rw;
pr_debug("%p optname %d\n", sk, optname); pr_debug("%p optname %d\n", sk, optname);
...@@ -339,6 +339,27 @@ static int nfc_llcp_getsockopt(struct socket *sock, int level, int optname, ...@@ -339,6 +339,27 @@ static int nfc_llcp_getsockopt(struct socket *sock, int level, int optname,
break; break;
case NFC_LLCP_REMOTE_MIU:
remote_miu = llcp_sock->remote_miu > LLCP_MAX_MIU ?
local->remote_miu : llcp_sock->remote_miu;
if (put_user(remote_miu, (u32 __user *) optval))
err = -EFAULT;
break;
case NFC_LLCP_REMOTE_LTO:
if (put_user(local->remote_lto / 10, (u32 __user *) optval))
err = -EFAULT;
break;
case NFC_LLCP_REMOTE_RW:
if (put_user(llcp_sock->remote_rw, (u32 __user *) optval))
err = -EFAULT;
break;
default: default:
err = -ENOPROTOOPT; err = -ENOPROTOOPT;
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment