diff options
author | Johannes Berg <johannes.berg@intel.com> | 2011-02-24 21:59:58 +0200 |
---|---|---|
committer | Jouni Malinen <j@w1.fi> | 2011-02-24 21:59:58 +0200 |
commit | 8fd7dc1b1cb8bceae0b493fa724b5e076d45a42d (patch) | |
tree | 73e9f5056b2f7f6cfcc2d5ea0528e6072f417c95 /src/p2p/p2p.c | |
parent | c5db8e517040f096d6c180150219c8ff88791efa (diff) | |
download | external_wpa_supplicant_8_ti-8fd7dc1b1cb8bceae0b493fa724b5e076d45a42d.zip external_wpa_supplicant_8_ti-8fd7dc1b1cb8bceae0b493fa724b5e076d45a42d.tar.gz external_wpa_supplicant_8_ti-8fd7dc1b1cb8bceae0b493fa724b5e076d45a42d.tar.bz2 |
P2P: Add new_device flag to dev_found callback
The DBus code will want to have perfect matching of dev_found and the
dev_lost it adds so it doesn't need to keep track internally. Enable
that with a new flag in the core that tracks whether we have already
notified about this -- the existing users can ignore it.
The part where this is always set to 1 if the new device is discovered
by a driver that has P2P in the driver is buggy -- the driver should
feed the P2P peer database and then that should feed the notification
here instead.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'src/p2p/p2p.c')
-rw-r--r-- | src/p2p/p2p.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c index d655484..d422499 100644 --- a/src/p2p/p2p.c +++ b/src/p2p/p2p.c @@ -390,7 +390,8 @@ static int p2p_add_group_clients(struct p2p_data *p2p, const u8 *go_dev_addr, dev->oper_freq = freq; p2p->cfg->dev_found(p2p->cfg->cb_ctx, dev->info.p2p_device_addr, - &dev->info); + &dev->info, 1); + dev->flags |= P2P_DEV_REPORTED | P2P_DEV_REPORTED_ONCE; } os_memcpy(dev->interface_addr, cli->p2p_interface_addr, @@ -539,8 +540,10 @@ int p2p_add_device(struct p2p_data *p2p, const u8 *addr, int freq, int level, "P2P: Do not report rejected device"); return 0; } - p2p->cfg->dev_found(p2p->cfg->cb_ctx, addr, &dev->info); - dev->flags |= P2P_DEV_REPORTED; + + p2p->cfg->dev_found(p2p->cfg->cb_ctx, addr, &dev->info, + !(dev->flags & P2P_DEV_REPORTED_ONCE)); + dev->flags |= P2P_DEV_REPORTED | P2P_DEV_REPORTED_ONCE; return 0; } @@ -1118,7 +1121,9 @@ void p2p_add_dev_info(struct p2p_data *p2p, const u8 *addr, return; } - p2p->cfg->dev_found(p2p->cfg->cb_ctx, addr, &dev->info); + p2p->cfg->dev_found(p2p->cfg->cb_ctx, addr, &dev->info, + !(dev->flags & P2P_DEV_REPORTED_ONCE)); + dev->flags |= P2P_DEV_REPORTED | P2P_DEV_REPORTED_ONCE; } |