diff options
author | Samuel Ortiz <sameo@linux.intel.com> | 2013-07-03 15:31:04 +0200 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2013-07-03 15:31:04 +0200 |
commit | 4f15ea7508e6624600f7a44c7133825d9bc7e068 (patch) | |
tree | cac5ed86f09c3da1f7d184d68fd82830183b92f9 /src | |
parent | 72f3cbcb268545f8c3cc1233038078fb4ca630f9 (diff) | |
download | neard-4f15ea7508e6624600f7a44c7133825d9bc7e068.tar.gz neard-4f15ea7508e6624600f7a44c7133825d9bc7e068.tar.bz2 neard-4f15ea7508e6624600f7a44c7133825d9bc7e068.zip |
adapter: Restart polling when failing to connect to a new target
If a newly detected target failed to be connected then a new polling
loop is started if constant poll is enabled.
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/adapter.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/adapter.c b/src/adapter.c index d61a166..a67d59c 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -874,6 +874,7 @@ int __near_adapter_add_target(uint32_t idx, uint32_t target_idx, uint8_t *nfcid, uint8_t nfcid_len) { struct near_adapter *adapter; + int ret; DBG("idx %d", idx); @@ -888,11 +889,16 @@ int __near_adapter_add_target(uint32_t idx, uint32_t target_idx, rf_mode_changed(adapter); if (protocols & NFC_PROTO_NFC_DEP_MASK) - return adapter_add_device(adapter, target_idx, + ret = adapter_add_device(adapter, target_idx, nfcid, nfcid_len); else - return adapter_add_tag(adapter, target_idx, protocols, + ret = adapter_add_tag(adapter, target_idx, protocols, sens_res, sel_res, nfcid, nfcid_len); + + if (ret < 0 && adapter->constant_poll == TRUE) + adapter_start_poll(adapter); + + return ret; } int __near_adapter_remove_target(uint32_t idx, uint32_t target_idx) |