Commit c09db0b2 authored by David S. Miller's avatar David S. Miller

Merge http://linux-mh.bkbits.net/bluetooth-2.6

into nuts.davemloft.net:/disk1/BK/net-2.6
parents ca322389 4865782e
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
#endif #endif
#ifdef CONFIG_BT_HCIUSB_SCO #ifdef CONFIG_BT_HCIUSB_SCO
static int isoc = 1; static int isoc = 2;
#endif #endif
#define VERSION "2.7" #define VERSION "2.7"
...@@ -898,7 +898,7 @@ static int hci_usb_probe(struct usb_interface *intf, const struct usb_device_id ...@@ -898,7 +898,7 @@ static int hci_usb_probe(struct usb_interface *intf, const struct usb_device_id
switch (ep->desc.bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) { switch (ep->desc.bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) {
case USB_ENDPOINT_XFER_ISOC: case USB_ENDPOINT_XFER_ISOC:
if (ep->desc.wMaxPacketSize < size || if (ep->desc.wMaxPacketSize < size ||
uif->desc.bAlternateSetting > 2) uif->desc.bAlternateSetting != isoc)
break; break;
size = ep->desc.wMaxPacketSize; size = ep->desc.wMaxPacketSize;
...@@ -1037,7 +1037,7 @@ module_init(hci_usb_init); ...@@ -1037,7 +1037,7 @@ module_init(hci_usb_init);
module_exit(hci_usb_exit); module_exit(hci_usb_exit);
#ifdef CONFIG_BT_HCIUSB_SCO #ifdef CONFIG_BT_HCIUSB_SCO
module_param(isoc, bool, 0); module_param(isoc, int, 0644);
MODULE_PARM_DESC(isoc, "Set isochronous transfers for SCO over HCI support"); MODULE_PARM_DESC(isoc, "Set isochronous transfers for SCO over HCI support");
#endif #endif
......
...@@ -38,10 +38,20 @@ extern struct proc_dir_entry *proc_bt_hci; ...@@ -38,10 +38,20 @@ extern struct proc_dir_entry *proc_bt_hci;
/* HCI Core structures */ /* HCI Core structures */
struct inquiry_data {
bdaddr_t bdaddr;
__u8 pscan_rep_mode;
__u8 pscan_period_mode;
__u8 pscan_mode;
__u8 dev_class[3];
__u16 clock_offset;
__s8 rssi;
};
struct inquiry_entry { struct inquiry_entry {
struct inquiry_entry *next; struct inquiry_entry *next;
__u32 timestamp; __u32 timestamp;
struct inquiry_info info; struct inquiry_data data;
}; };
struct inquiry_cache { struct inquiry_cache {
...@@ -142,6 +152,7 @@ struct hci_conn { ...@@ -142,6 +152,7 @@ struct hci_conn {
__u16 state; __u16 state;
__u8 type; __u8 type;
__u8 out; __u8 out;
__u8 dev_class[3];
__u32 link_mode; __u32 link_mode;
unsigned long pend; unsigned long pend;
...@@ -199,7 +210,7 @@ static inline long inquiry_entry_age(struct inquiry_entry *e) ...@@ -199,7 +210,7 @@ static inline long inquiry_entry_age(struct inquiry_entry *e)
} }
struct inquiry_entry *hci_inquiry_cache_lookup(struct hci_dev *hdev, bdaddr_t *bdaddr); struct inquiry_entry *hci_inquiry_cache_lookup(struct hci_dev *hdev, bdaddr_t *bdaddr);
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);
/* ----- HCI Connections ----- */ /* ----- HCI Connections ----- */
enum { enum {
......
...@@ -71,9 +71,10 @@ void hci_acl_connect(struct hci_conn *conn) ...@@ -71,9 +71,10 @@ void hci_acl_connect(struct hci_conn *conn)
if ((ie = hci_inquiry_cache_lookup(hdev, &conn->dst)) && if ((ie = hci_inquiry_cache_lookup(hdev, &conn->dst)) &&
inquiry_entry_age(ie) <= INQUIRY_ENTRY_AGE_MAX) { inquiry_entry_age(ie) <= INQUIRY_ENTRY_AGE_MAX) {
cp.pscan_rep_mode = ie->info.pscan_rep_mode; cp.pscan_rep_mode = ie->data.pscan_rep_mode;
cp.pscan_mode = ie->info.pscan_mode; cp.pscan_mode = ie->data.pscan_mode;
cp.clock_offset = ie->info.clock_offset | __cpu_to_le16(0x8000); 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); cp.pkt_type = __cpu_to_le16(hdev->pkt_type & ACL_PTYPE_MASK);
......
...@@ -313,19 +313,19 @@ struct inquiry_entry *hci_inquiry_cache_lookup(struct hci_dev *hdev, bdaddr_t *b ...@@ -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)); BT_DBG("cache %p, %s", cache, batostr(bdaddr));
for (e = cache->list; e; e = e->next) for (e = cache->list; e; e = e->next)
if (!bacmp(&e->info.bdaddr, bdaddr)) if (!bacmp(&e->data.bdaddr, bdaddr))
break; break;
return e; 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_cache *cache = &hdev->inq_cache;
struct inquiry_entry *e; 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. */ /* Entry not in the cache. Add new one. */
if (!(e = kmalloc(sizeof(struct inquiry_entry), GFP_ATOMIC))) if (!(e = kmalloc(sizeof(struct inquiry_entry), GFP_ATOMIC)))
return; return;
...@@ -334,7 +334,7 @@ void hci_inquiry_cache_update(struct hci_dev *hdev, struct inquiry_info *info) ...@@ -334,7 +334,7 @@ void hci_inquiry_cache_update(struct hci_dev *hdev, struct inquiry_info *info)
cache->list = e; cache->list = e;
} }
memcpy(&e->info, info, sizeof(*info)); memcpy(&e->data, data, sizeof(*data));
e->timestamp = jiffies; e->timestamp = jiffies;
cache->timestamp = jiffies; cache->timestamp = jiffies;
} }
...@@ -346,8 +346,16 @@ static int inquiry_cache_dump(struct hci_dev *hdev, int num, __u8 *buf) ...@@ -346,8 +346,16 @@ static int inquiry_cache_dump(struct hci_dev *hdev, int num, __u8 *buf)
struct inquiry_entry *e; struct inquiry_entry *e;
int copied = 0; int copied = 0;
for (e = cache->list; e && copied < num; e = e->next, copied++) for (e = cache->list; e && copied < num; e = e->next, copied++) {
memcpy(info++, &e->info, sizeof(*info)); 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); BT_DBG("cache %p, copied %d", cache, copied);
return copied; return copied;
......
...@@ -491,8 +491,18 @@ static inline void hci_inquiry_result_evt(struct hci_dev *hdev, struct sk_buff * ...@@ -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); BT_DBG("%s num_rsp %d", hdev->name, num_rsp);
hci_dev_lock(hdev); hci_dev_lock(hdev);
for (; num_rsp; num_rsp--) for (; num_rsp; num_rsp--) {
hci_inquiry_cache_update(hdev, info++); 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); hci_dev_unlock(hdev);
} }
...@@ -506,15 +516,16 @@ static inline void hci_inquiry_result_with_rssi_evt(struct hci_dev *hdev, struct ...@@ -506,15 +516,16 @@ static inline void hci_inquiry_result_with_rssi_evt(struct hci_dev *hdev, struct
hci_dev_lock(hdev); hci_dev_lock(hdev);
for (; num_rsp; num_rsp--) { for (; num_rsp; num_rsp--) {
struct inquiry_info tmp; struct inquiry_data data;
bacpy(&tmp.bdaddr, &info->bdaddr); bacpy(&data.bdaddr, &info->bdaddr);
tmp.pscan_rep_mode = info->pscan_rep_mode; data.pscan_rep_mode = info->pscan_rep_mode;
tmp.pscan_period_mode = info->pscan_period_mode; data.pscan_period_mode = info->pscan_period_mode;
tmp.pscan_mode = 0x00; data.pscan_mode = 0x00;
memcpy(tmp.dev_class, &info->dev_class, 3); memcpy(data.dev_class, info->dev_class, 3);
tmp.clock_offset = info->clock_offset; data.clock_offset = info->clock_offset;
data.rssi = info->rssi;
info++; info++;
hci_inquiry_cache_update(hdev, &tmp); hci_inquiry_cache_update(hdev, &data);
} }
hci_dev_unlock(hdev); hci_dev_unlock(hdev);
} }
...@@ -544,6 +555,7 @@ static inline void hci_conn_request_evt(struct hci_dev *hdev, struct sk_buff *sk ...@@ -544,6 +555,7 @@ static inline void hci_conn_request_evt(struct hci_dev *hdev, struct sk_buff *sk
return; return;
} }
} }
memcpy(conn->dev_class, ev->dev_class, 3);
conn->state = BT_CONNECT; conn->state = BT_CONNECT;
hci_dev_unlock(hdev); hci_dev_unlock(hdev);
......
...@@ -48,14 +48,14 @@ static ssize_t show_inquiry_cache(struct class_device *cdev, char *buf) ...@@ -48,14 +48,14 @@ static ssize_t show_inquiry_cache(struct class_device *cdev, char *buf)
hci_dev_lock_bh(hdev); hci_dev_lock_bh(hdev);
for (e = cache->list; e; e = e->next) { for (e = cache->list; e; e = e->next) {
struct inquiry_info *info = &e->info; struct inquiry_data *data = &e->data;
bdaddr_t bdaddr; bdaddr_t bdaddr;
baswap(&bdaddr, &info->bdaddr); baswap(&bdaddr, &data->bdaddr);
n += sprintf(buf + n, "%s %d %d %d 0x%.2x%.2x%.2x 0x%.4x 0x%.2x %u\n", n += sprintf(buf + n, "%s %d %d %d 0x%.2x%.2x%.2x 0x%.4x %d %u\n",
batostr(&bdaddr), batostr(&bdaddr),
info->pscan_rep_mode, info->pscan_period_mode, info->pscan_mode, data->pscan_rep_mode, data->pscan_period_mode, data->pscan_mode,
info->dev_class[2], info->dev_class[1], info->dev_class[0], data->dev_class[2], data->dev_class[1], data->dev_class[0],
info->clock_offset, 0, e->timestamp); data->clock_offset, data->rssi, e->timestamp);
} }
hci_dev_unlock_bh(hdev); hci_dev_unlock_bh(hdev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment