Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 278966
b: refs/heads/master
c: d646960
h: refs/heads/master
v: v3
  • Loading branch information
Samuel Ortiz authored and John W. Linville committed Dec 14, 2011
1 parent 29e61af commit ecd503d
Show file tree
Hide file tree
Showing 11 changed files with 2,336 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 361f3cb7f9cfdb82c80926d0e7843c098c034545
refs/heads/master: d646960f7986fefb460a2b062d5ccc8ccfeacc3a
15 changes: 14 additions & 1 deletion trunk/include/linux/nfc.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,22 @@ struct sockaddr_nfc {
__u32 nfc_protocol;
};

#define NFC_LLCP_MAX_SERVICE_NAME 63
struct sockaddr_nfc_llcp {
sa_family_t sa_family;
__u32 dev_idx;
__u32 target_idx;
__u32 nfc_protocol;
__u8 dsap; /* Destination SAP, if known */
__u8 ssap; /* Source SAP to be bound to */
char service_name[NFC_LLCP_MAX_SERVICE_NAME]; /* Service name URI */;
size_t service_name_len;
};

/* NFC socket protocols */
#define NFC_SOCKPROTO_RAW 0
#define NFC_SOCKPROTO_MAX 1
#define NFC_SOCKPROTO_LLCP 1
#define NFC_SOCKPROTO_MAX 2

#define NFC_HEADER_SIZE 1

Expand Down
1 change: 1 addition & 0 deletions trunk/net/nfc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ menuconfig NFC
be called nfc.

source "net/nfc/nci/Kconfig"
source "net/nfc/llcp/Kconfig"

source "drivers/nfc/Kconfig"
1 change: 1 addition & 0 deletions trunk/net/nfc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ obj-$(CONFIG_NFC) += nfc.o
obj-$(CONFIG_NFC_NCI) += nci/

nfc-objs := core.o netlink.o af_nfc.o rawsock.o
nfc-$(CONFIG_NFC_LLCP) += llcp/llcp.o llcp/commands.o llcp/sock.o
20 changes: 18 additions & 2 deletions trunk/net/nfc/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ int nfc_dep_link_down(struct nfc_dev *dev)
rc = dev->ops->dep_link_down(dev);
if (!rc) {
dev->dep_link_up = false;
nfc_llcp_mac_is_down(dev);
nfc_genl_dep_link_down_event(dev);
}

Expand All @@ -254,6 +255,8 @@ int nfc_dep_link_is_up(struct nfc_dev *dev, u32 target_idx,
dev->dep_link_up = true;
dev->dep_rf_mode = rf_mode;

nfc_llcp_mac_is_up(dev, target_idx, comm_mode, rf_mode);

return nfc_genl_dep_link_up_event(dev, target_idx, comm_mode, rf_mode);
}
EXPORT_SYMBOL(nfc_dep_link_is_up);
Expand Down Expand Up @@ -360,13 +363,13 @@ int nfc_set_remote_general_bytes(struct nfc_dev *dev, u8 *gb, u8 gb_len)
if (gb_len > NFC_MAX_GT_LEN)
return -EINVAL;

return 0;
return nfc_llcp_set_remote_gb(dev, gb, gb_len);
}
EXPORT_SYMBOL(nfc_set_remote_general_bytes);

u8 *nfc_get_local_general_bytes(struct nfc_dev *dev, u8 *gt_len)
{
return NULL;
return nfc_llcp_general_bytes(dev, gt_len);
}
EXPORT_SYMBOL(nfc_get_local_general_bytes);

Expand Down Expand Up @@ -560,6 +563,10 @@ int nfc_register_device(struct nfc_dev *dev)
if (rc < 0)
return rc;

rc = nfc_llcp_register_device(dev);
if (rc)
pr_err("Could not register llcp device\n");

rc = nfc_genl_device_added(dev);
if (rc)
pr_debug("The userspace won't be notified that the device %s was added\n",
Expand Down Expand Up @@ -591,6 +598,8 @@ void nfc_unregister_device(struct nfc_dev *dev)

mutex_unlock(&nfc_devlist_mutex);

nfc_llcp_unregister_device(dev);

rc = nfc_genl_device_removed(dev);
if (rc)
pr_debug("The userspace won't be notified that the device %s was removed\n",
Expand Down Expand Up @@ -620,13 +629,19 @@ static int __init nfc_init(void)
if (rc)
goto err_rawsock;

rc = nfc_llcp_init();
if (rc)
goto err_llcp_sock;

rc = af_nfc_init();
if (rc)
goto err_af_nfc;

return 0;

err_af_nfc:
nfc_llcp_exit();
err_llcp_sock:
rawsock_exit();
err_rawsock:
nfc_genl_exit();
Expand All @@ -638,6 +653,7 @@ static int __init nfc_init(void)
static void __exit nfc_exit(void)
{
af_nfc_exit();
nfc_llcp_exit();
rawsock_exit();
nfc_genl_exit();
class_unregister(&nfc_class);
Expand Down
7 changes: 7 additions & 0 deletions trunk/net/nfc/llcp/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
config NFC_LLCP
depends on NFC && EXPERIMENTAL
bool "NFC LLCP support (EXPERIMENTAL)"
default n
help
Say Y here if you want to build support for a kernel NFC LLCP
implementation.
Loading

0 comments on commit ecd503d

Please sign in to comment.