diff options
author | Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com> | 2012-01-25 15:41:49 +0200 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2012-01-27 19:31:58 +0100 |
commit | 2c40326fff69f7c8cf89cde14b3a98bcaf55774b (patch) | |
tree | 77ed90764c87f93c9d717da3e39b7bb79c274d1e | |
parent | 2b42e25bfad80de03ade5677df14472f7021c87c (diff) | |
download | neard-2c40326fff69f7c8cf89cde14b3a98bcaf55774b.tar.gz neard-2c40326fff69f7c8cf89cde14b3a98bcaf55774b.tar.bz2 neard-2c40326fff69f7c8cf89cde14b3a98bcaf55774b.zip |
target: Provide method to get tag from target structure
-rw-r--r-- | include/target.h | 2 | ||||
-rw-r--r-- | src/target.c | 18 |
2 files changed, 20 insertions, 0 deletions
diff --git a/include/target.h b/include/target.h index f42fe14..2228119 100644 --- a/include/target.h +++ b/include/target.h @@ -32,6 +32,8 @@ struct near_tag *near_target_add_tag(uint32_t adapter_idx, uint32_t target_idx, size_t data_length); +struct near_tag *near_target_get_tag(uint32_t adapter_idx, uint32_t target_idx); + enum near_target_sub_type near_target_get_subtype(uint32_t adapter_idx, uint32_t target_idx); uint8_t *near_target_get_nfcid(uint32_t adapter_idx, uint32_t target_idx, diff --git a/src/target.c b/src/target.c index 0c8e602..aeeed92 100644 --- a/src/target.c +++ b/src/target.c @@ -477,6 +477,24 @@ fail: return NULL; } +struct near_tag *near_target_get_tag(uint32_t adapter_idx, uint32_t target_idx) +{ + struct near_target *target; + char *path; + + path = g_strdup_printf("%s/nfc%d/target%d", NFC_PATH, + adapter_idx, target_idx); + if (path == NULL) + return NULL; + + target = g_hash_table_lookup(target_hash, path); + g_free(path); + if (target == NULL) + return NULL; + + return target->tag; +} + struct near_tag *near_target_add_tag(uint32_t adapter_idx, uint32_t target_idx, size_t data_length) { |