diff options
Diffstat (limited to 'hcid/security.c')
-rw-r--r-- | hcid/security.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/hcid/security.c b/hcid/security.c index f4b46bfe..c3c8caeb 100644 --- a/hcid/security.c +++ b/hcid/security.c @@ -38,6 +38,7 @@ #include <signal.h> #include <syslog.h> #include <time.h> +#include <sys/time.h> #include <sys/ioctl.h> #include <sys/socket.h> @@ -422,6 +423,17 @@ static inline void inquiry_complete(int dev, bdaddr_t *sba, void *ptr) hcid_dbus_inquiry_complete(sba); } +static inline void update_lastseen(bdaddr_t *sba, bdaddr_t *dba) +{ + time_t t; + struct tm *tm; + + t = time(NULL); + tm = gmtime(&t); + + write_lastseen_info(sba, dba, tm); +} + static inline void inquiry_result(int dev, bdaddr_t *sba, int plen, void *ptr) { uint8_t num = *(uint8_t *) ptr++; @@ -435,6 +447,8 @@ static inline void inquiry_result(int dev, bdaddr_t *sba, int plen, void *ptr) hcid_dbus_inquiry_result(sba, &info->bdaddr, class, 0); + update_lastseen(sba, &info->bdaddr); + ptr += INQUIRY_INFO_SIZE; } } @@ -457,6 +471,8 @@ static inline void inquiry_result_with_rssi(int dev, bdaddr_t *sba, int plen, vo hcid_dbus_inquiry_result(sba, &info->bdaddr, class, info->rssi); + update_lastseen(sba, &info->bdaddr); + ptr += INQUIRY_INFO_WITH_RSSI_AND_PSCAN_MODE_SIZE; } } else { @@ -469,6 +485,8 @@ static inline void inquiry_result_with_rssi(int dev, bdaddr_t *sba, int plen, vo hcid_dbus_inquiry_result(sba, &info->bdaddr, class, info->rssi); + update_lastseen(sba, &info->bdaddr); + ptr += INQUIRY_INFO_WITH_RSSI_SIZE; } } @@ -487,6 +505,8 @@ static inline void extended_inquiry_result(int dev, bdaddr_t *sba, int plen, voi hcid_dbus_inquiry_result(sba, &info->bdaddr, class, info->rssi); + update_lastseen(sba, &info->bdaddr); + ptr += EXTENDED_INQUIRY_INFO_SIZE; } } |