diff options
author | David S. Miller <davem@nuts.davemloft.net> | 2004-12-08 06:37:57 -0800 |
---|---|---|
committer | David S. Miller <davem@nuts.davemloft.net> | 2004-12-08 06:37:57 -0800 |
commit | c09db0b27e52fc5cb028b9c52f6eb05a47dc227d (patch) | |
tree | f7db74cd24098359abbe4b3cdf83b2fb4f97e221 /net | |
parent | ca32238957a0f3a2d7e3dd74b9c18f13a438fc38 (diff) | |
parent | 4865782efb0706b175043d28359b1274c97b762e (diff) | |
download | history-c09db0b27e52fc5cb028b9c52f6eb05a47dc227d.tar.gz |
Merge http://linux-mh.bkbits.net/bluetooth-2.6
into nuts.davemloft.net:/disk1/BK/net-2.6
Diffstat (limited to 'net')
-rw-r--r-- | net/bluetooth/hci_conn.c | 7 | ||||
-rw-r--r-- | net/bluetooth/hci_core.c | 22 | ||||
-rw-r--r-- | net/bluetooth/hci_event.c | 32 | ||||
-rw-r--r-- | net/bluetooth/hci_sysfs.c | 12 |
4 files changed, 47 insertions, 26 deletions
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c index 122e9edbdf7ecd..bacc386111b24e 100644 --- a/net/bluetooth/hci_conn.c +++ b/net/bluetooth/hci_conn.c @@ -71,9 +71,10 @@ void hci_acl_connect(struct hci_conn *conn) if ((ie = hci_inquiry_cache_lookup(hdev, &conn->dst)) && inquiry_entry_age(ie) <= INQUIRY_ENTRY_AGE_MAX) { - cp.pscan_rep_mode = ie->info.pscan_rep_mode; - cp.pscan_mode = ie->info.pscan_mode; - cp.clock_offset = ie->info.clock_offset | __cpu_to_le16(0x8000); + cp.pscan_rep_mode = ie->data.pscan_rep_mode; + cp.pscan_mode = ie->data.pscan_mode; + cp.clock_offset = ie->data.clock_offset | __cpu_to_le16(0x8000); + memcpy(conn->dev_class, ie->data.dev_class, 3); } cp.pkt_type = __cpu_to_le16(hdev->pkt_type & ACL_PTYPE_MASK); diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 830a7a73bb2bfb..37690eacff030f 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -313,19 +313,19 @@ struct inquiry_entry *hci_inquiry_cache_lookup(struct hci_dev *hdev, bdaddr_t *b BT_DBG("cache %p, %s", cache, batostr(bdaddr)); for (e = cache->list; e; e = e->next) - if (!bacmp(&e->info.bdaddr, bdaddr)) + if (!bacmp(&e->data.bdaddr, bdaddr)) break; return e; } -void hci_inquiry_cache_update(struct hci_dev *hdev, struct inquiry_info *info) +void hci_inquiry_cache_update(struct hci_dev *hdev, struct inquiry_data *data) { struct inquiry_cache *cache = &hdev->inq_cache; struct inquiry_entry *e; - BT_DBG("cache %p, %s", cache, batostr(&info->bdaddr)); + BT_DBG("cache %p, %s", cache, batostr(&data->bdaddr)); - if (!(e = hci_inquiry_cache_lookup(hdev, &info->bdaddr))) { + if (!(e = hci_inquiry_cache_lookup(hdev, &data->bdaddr))) { /* Entry not in the cache. Add new one. */ if (!(e = kmalloc(sizeof(struct inquiry_entry), GFP_ATOMIC))) return; @@ -334,7 +334,7 @@ void hci_inquiry_cache_update(struct hci_dev *hdev, struct inquiry_info *info) cache->list = e; } - memcpy(&e->info, info, sizeof(*info)); + memcpy(&e->data, data, sizeof(*data)); e->timestamp = jiffies; cache->timestamp = jiffies; } @@ -346,8 +346,16 @@ static int inquiry_cache_dump(struct hci_dev *hdev, int num, __u8 *buf) struct inquiry_entry *e; int copied = 0; - for (e = cache->list; e && copied < num; e = e->next, copied++) - memcpy(info++, &e->info, sizeof(*info)); + for (e = cache->list; e && copied < num; e = e->next, copied++) { + struct inquiry_data *data = &e->data; + bacpy(&info->bdaddr, &data->bdaddr); + info->pscan_rep_mode = data->pscan_rep_mode; + info->pscan_period_mode = data->pscan_period_mode; + info->pscan_mode = data->pscan_mode; + memcpy(info->dev_class, data->dev_class, 3); + info->clock_offset = data->clock_offset; + info++; + } BT_DBG("cache %p, copied %d", cache, copied); return copied; diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 31b1ceb38f268a..e88d18da3b4f7c 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c @@ -491,8 +491,18 @@ static inline void hci_inquiry_result_evt(struct hci_dev *hdev, struct sk_buff * BT_DBG("%s num_rsp %d", hdev->name, num_rsp); hci_dev_lock(hdev); - for (; num_rsp; num_rsp--) - hci_inquiry_cache_update(hdev, info++); + for (; num_rsp; num_rsp--) { + struct inquiry_data data; + bacpy(&data.bdaddr, &info->bdaddr); + data.pscan_rep_mode = info->pscan_rep_mode; + data.pscan_period_mode = info->pscan_period_mode; + data.pscan_mode = info->pscan_mode; + memcpy(data.dev_class, info->dev_class, 3); + data.clock_offset = info->clock_offset; + data.rssi = 0x00; + info++; + hci_inquiry_cache_update(hdev, &data); + } hci_dev_unlock(hdev); } @@ -506,15 +516,16 @@ static inline void hci_inquiry_result_with_rssi_evt(struct hci_dev *hdev, struct hci_dev_lock(hdev); for (; num_rsp; num_rsp--) { - struct inquiry_info tmp; - bacpy(&tmp.bdaddr, &info->bdaddr); - tmp.pscan_rep_mode = info->pscan_rep_mode; - tmp.pscan_period_mode = info->pscan_period_mode; - tmp.pscan_mode = 0x00; - memcpy(tmp.dev_class, &info->dev_class, 3); - tmp.clock_offset = info->clock_offset; + struct inquiry_data data; + bacpy(&data.bdaddr, &info->bdaddr); + data.pscan_rep_mode = info->pscan_rep_mode; + data.pscan_period_mode = info->pscan_period_mode; + data.pscan_mode = 0x00; + memcpy(data.dev_class, info->dev_class, 3); + data.clock_offset = info->clock_offset; + data.rssi = info->rssi; info++; - hci_inquiry_cache_update(hdev, &tmp); + hci_inquiry_cache_update(hdev, &data); } hci_dev_unlock(hdev); } @@ -544,6 +555,7 @@ static inline void hci_conn_request_evt(struct hci_dev *hdev, struct sk_buff *sk return; } } + memcpy(conn->dev_class, ev->dev_class, 3); conn->state = BT_CONNECT; hci_dev_unlock(hdev); diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c index 5a6b7fdaee254e..0fc90e3ebc78f7 100644 --- a/net/bluetooth/hci_sysfs.c +++ b/net/bluetooth/hci_sysfs.c @@ -48,14 +48,14 @@ static ssize_t show_inquiry_cache(struct class_device *cdev, char *buf) hci_dev_lock_bh(hdev); for (e = cache->list; e; e = e->next) { - struct inquiry_info *info = &e->info; + struct inquiry_data *data = &e->data; bdaddr_t bdaddr; - baswap(&bdaddr, &info->bdaddr); - n += sprintf(buf + n, "%s %d %d %d 0x%.2x%.2x%.2x 0x%.4x 0x%.2x %u\n", + baswap(&bdaddr, &data->bdaddr); + n += sprintf(buf + n, "%s %d %d %d 0x%.2x%.2x%.2x 0x%.4x %d %u\n", batostr(&bdaddr), - info->pscan_rep_mode, info->pscan_period_mode, info->pscan_mode, - info->dev_class[2], info->dev_class[1], info->dev_class[0], - info->clock_offset, 0, e->timestamp); + data->pscan_rep_mode, data->pscan_period_mode, data->pscan_mode, + data->dev_class[2], data->dev_class[1], data->dev_class[0], + data->clock_offset, data->rssi, e->timestamp); } hci_dev_unlock_bh(hdev); |