June 2025 | ||||||
Mo | Tu | We | Th | Fr | Sa | Su |
26 | 27 | 28 | 29 | 30 | 31 | 1 |
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 1 | 2 | 3 | 4 | 5 | 6 |
001: /* 002: * Copyright (C) 2011 Instituto Nokia de Tecnologia 003: * 004: * Authors: 005: * Lauro Ramos Venancio <lauro.venancio@openbossa.org> 006: * Aloisio Almeida Jr <aloisio.almeida@openbossa.org> 007: * 008: * This program is free software; you can redistribute it and/or modify 009: * it under the terms of the GNU General Public License as published by 010: * the Free Software Foundation; either version 2 of the License, or 011: * (at your option) any later version. 012: * 013: * This program is distributed in the hope that it will be useful, 014: * but WITHOUT ANY WARRANTY; without even the implied warranty of 015: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 016: * GNU General Public License for more details. 017: * 018: * You should have received a copy of the GNU General Public License 019: * along with this program; if not, write to the 020: * Free Software Foundation, Inc., 021: * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 022: */ 023: 024: #ifndef __LINUX_NFC_H 025: #define __LINUX_NFC_H 026: 027: #include <linux/types.h> 028: #include <linux/socket.h> 029: 030: #define NFC_GENL_NAME "nfc" 031: #define NFC_GENL_VERSION 1 032: 033: #define NFC_GENL_MCAST_EVENT_NAME "events" 034: 035: /** 036: * enum nfc_commands - supported nfc commands 037: * 038: * @NFC_CMD_UNSPEC: unspecified command 039: * 040: * @NFC_CMD_GET_DEVICE: request information about a device (requires 041: * %NFC_ATTR_DEVICE_INDEX) or dump request to get a list of all nfc devices 042: * @NFC_CMD_DEV_UP: turn on the nfc device 043: * (requires %NFC_ATTR_DEVICE_INDEX) 044: * @NFC_CMD_DEV_DOWN: turn off the nfc device 045: * (requires %NFC_ATTR_DEVICE_INDEX) 046: * @NFC_CMD_START_POLL: start polling for targets using the given protocols 047: * (requires %NFC_ATTR_DEVICE_INDEX and %NFC_ATTR_PROTOCOLS) 048: * @NFC_CMD_STOP_POLL: stop polling for targets (requires 049: * %NFC_ATTR_DEVICE_INDEX) 050: * @NFC_CMD_GET_TARGET: dump all targets found by the previous poll (requires 051: * %NFC_ATTR_DEVICE_INDEX) 052: * @NFC_EVENT_TARGETS_FOUND: event emitted when a new target is found 053: * (it sends %NFC_ATTR_DEVICE_INDEX) 054: * @NFC_EVENT_DEVICE_ADDED: event emitted when a new device is registred 055: * (it sends %NFC_ATTR_DEVICE_NAME, %NFC_ATTR_DEVICE_INDEX and 056: * %NFC_ATTR_PROTOCOLS) 057: * @NFC_EVENT_DEVICE_REMOVED: event emitted when a device is removed 058: * (it sends %NFC_ATTR_DEVICE_INDEX) 059: */ 060: enum nfc_commands { 061: NFC_CMD_UNSPEC, 062: NFC_CMD_GET_DEVICE, 063: NFC_CMD_DEV_UP, 064: NFC_CMD_DEV_DOWN, 065: NFC_CMD_START_POLL, 066: NFC_CMD_STOP_POLL, 067: NFC_CMD_GET_TARGET, 068: NFC_EVENT_TARGETS_FOUND, 069: NFC_EVENT_DEVICE_ADDED, 070: NFC_EVENT_DEVICE_REMOVED, 071: /* private: internal use only */ 072: __NFC_CMD_AFTER_LAST 073: }; 074: #define NFC_CMD_MAX (__NFC_CMD_AFTER_LAST - 1) 075: 076: /** 077: * enum nfc_attrs - supported nfc attributes 078: * 079: * @NFC_ATTR_UNSPEC: unspecified attribute 080: * 081: * @NFC_ATTR_DEVICE_INDEX: index of nfc device 082: * @NFC_ATTR_DEVICE_NAME: device name, max 8 chars 083: * @NFC_ATTR_PROTOCOLS: nfc protocols - bitwise or-ed combination from 084: * NFC_PROTO_*_MASK constants 085: * @NFC_ATTR_TARGET_INDEX: index of the nfc target 086: * @NFC_ATTR_TARGET_SENS_RES: NFC-A targets extra information such as NFCID 087: * @NFC_ATTR_TARGET_SEL_RES: NFC-A targets extra information (useful if the 088: * target is not NFC-Forum compliant) 089: */ 090: enum nfc_attrs { 091: NFC_ATTR_UNSPEC, 092: NFC_ATTR_DEVICE_INDEX, 093: NFC_ATTR_DEVICE_NAME, 094: NFC_ATTR_PROTOCOLS, 095: NFC_ATTR_TARGET_INDEX, 096: NFC_ATTR_TARGET_SENS_RES, 097: NFC_ATTR_TARGET_SEL_RES, 098: /* private: internal use only */ 099: __NFC_ATTR_AFTER_LAST 100: }; 101: #define NFC_ATTR_MAX (__NFC_ATTR_AFTER_LAST - 1) 102: 103: #define NFC_DEVICE_NAME_MAXSIZE 8 104: 105: /* NFC protocols */ 106: #define NFC_PROTO_JEWEL 1 107: #define NFC_PROTO_MIFARE 2 108: #define NFC_PROTO_FELICA 3 109: #define NFC_PROTO_ISO14443 4 110: #define NFC_PROTO_NFC_DEP 5 111: 112: #define NFC_PROTO_MAX 6 113: 114: /* NFC protocols masks used in bitsets */ 115: #define NFC_PROTO_JEWEL_MASK (1 << NFC_PROTO_JEWEL) 116: #define NFC_PROTO_MIFARE_MASK (1 << NFC_PROTO_MIFARE) 117: #define NFC_PROTO_FELICA_MASK (1 << NFC_PROTO_FELICA) 118: #define NFC_PROTO_ISO14443_MASK (1 << NFC_PROTO_ISO14443) 119: #define NFC_PROTO_NFC_DEP_MASK (1 << NFC_PROTO_NFC_DEP) 120: 121: struct sockaddr_nfc { 122: sa_family_t sa_family; 123: __u32 dev_idx; 124: __u32 target_idx; 125: __u32 nfc_protocol; 126: }; 127: 128: /* NFC socket protocols */ 129: #define NFC_SOCKPROTO_RAW 0 130: #define NFC_SOCKPROTO_MAX 1 131: 132: #define NFC_HEADER_SIZE 1 133: 134: #endif /*__LINUX_NFC_H */ 135: