Skip to content

Commit

Permalink
NFC: Add device powered netlink attribute
Browse files Browse the repository at this point in the history
For user space to know if a device is up or down.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Samuel Ortiz authored and John W. Linville committed Mar 6, 2012
1 parent c3b1e1e commit c970a1a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/linux/nfc.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ enum nfc_attrs {
NFC_ATTR_TARGET_SENSF_RES,
NFC_ATTR_COMM_MODE,
NFC_ATTR_RF_MODE,
NFC_ATTR_DEVICE_POWERED,
/* private: internal use only */
__NFC_ATTR_AFTER_LAST
};
Expand Down
3 changes: 3 additions & 0 deletions net/nfc/netlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ static const struct nla_policy nfc_genl_policy[NFC_ATTR_MAX + 1] = {
[NFC_ATTR_PROTOCOLS] = { .type = NLA_U32 },
[NFC_ATTR_COMM_MODE] = { .type = NLA_U8 },
[NFC_ATTR_RF_MODE] = { .type = NLA_U8 },
[NFC_ATTR_DEVICE_POWERED] = { .type = NLA_U8 },
};

static int nfc_genl_send_target(struct sk_buff *msg, struct nfc_target *target,
Expand Down Expand Up @@ -200,6 +201,7 @@ int nfc_genl_device_added(struct nfc_dev *dev)
NLA_PUT_STRING(msg, NFC_ATTR_DEVICE_NAME, nfc_device_name(dev));
NLA_PUT_U32(msg, NFC_ATTR_DEVICE_INDEX, dev->idx);
NLA_PUT_U32(msg, NFC_ATTR_PROTOCOLS, dev->supported_protocols);
NLA_PUT_U8(msg, NFC_ATTR_DEVICE_POWERED, dev->dev_up);

genlmsg_end(msg, hdr);

Expand Down Expand Up @@ -261,6 +263,7 @@ static int nfc_genl_send_device(struct sk_buff *msg, struct nfc_dev *dev,
NLA_PUT_STRING(msg, NFC_ATTR_DEVICE_NAME, nfc_device_name(dev));
NLA_PUT_U32(msg, NFC_ATTR_DEVICE_INDEX, dev->idx);
NLA_PUT_U32(msg, NFC_ATTR_PROTOCOLS, dev->supported_protocols);
NLA_PUT_U8(msg, NFC_ATTR_DEVICE_POWERED, dev->dev_up);

return genlmsg_end(msg, hdr);

Expand Down

0 comments on commit c970a1a

Please sign in to comment.