aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2010-02-12 20:28:41 -0500
committerMarcel Holtmann <marcel@holtmann.org>2010-02-27 08:05:38 -0500
commit943da25d95c7e8fd8c39dbf09e030f5da46f5d85 (patch)
treeafa710bb2455ec43db38e205157fd6943ac6b63b
parentb914a250e7b390c713b36a9405a39c4c11abad80 (diff)
Bluetooth: Add controller types for BR/EDR and 802.11 AMP
With the Bluetooth 3.0 specification and the introduction of alternate MAC/PHY (AMP) support, it is required to differentiate between primary BR/EDR controllers and 802.11 AMP controllers. So introduce a special type inside HCI device for differentiation. For now all AMP controllers will be treated as raw devices until an AMP manager has been implemented. Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
-rw-r--r--include/net/bluetooth/hci.h4
-rw-r--r--include/net/bluetooth/hci_core.h1
-rw-r--r--net/bluetooth/hci_core.c6
-rw-r--r--net/bluetooth/hci_sysfs.c20
4 files changed, 30 insertions, 1 deletions
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 3350a665180f..fc0c502d9fd1 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -52,6 +52,10 @@
52#define HCI_PCI 5 52#define HCI_PCI 5
53#define HCI_SDIO 6 53#define HCI_SDIO 6
54 54
55/* HCI controller types */
56#define HCI_BREDR 0x00
57#define HCI_80211 0x01
58
55/* HCI device quirks */ 59/* HCI device quirks */
56enum { 60enum {
57 HCI_QUIRK_NO_RESET, 61 HCI_QUIRK_NO_RESET,
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 4c94c1e233a2..ce3c99e5fa25 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -71,6 +71,7 @@ struct hci_dev {
71 unsigned long flags; 71 unsigned long flags;
72 __u16 id; 72 __u16 id;
73 __u8 bus; 73 __u8 bus;
74 __u8 dev_type;
74 bdaddr_t bdaddr; 75 bdaddr_t bdaddr;
75 __u8 dev_name[248]; 76 __u8 dev_name[248];
76 __u8 dev_class[3]; 77 __u8 dev_class[3];
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 4b62ed01ddc6..4ad23192c7a5 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -491,6 +491,10 @@ int hci_dev_open(__u16 dev)
491 if (test_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks)) 491 if (test_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks))
492 set_bit(HCI_RAW, &hdev->flags); 492 set_bit(HCI_RAW, &hdev->flags);
493 493
494 /* Treat all non BR/EDR controllers as raw devices for now */
495 if (hdev->dev_type != HCI_BREDR)
496 set_bit(HCI_RAW, &hdev->flags);
497
494 if (hdev->open(hdev)) { 498 if (hdev->open(hdev)) {
495 ret = -EIO; 499 ret = -EIO;
496 goto done; 500 goto done;
@@ -797,7 +801,7 @@ int hci_get_dev_info(void __user *arg)
797 801
798 strcpy(di.name, hdev->name); 802 strcpy(di.name, hdev->name);
799 di.bdaddr = hdev->bdaddr; 803 di.bdaddr = hdev->bdaddr;
800 di.type = hdev->bus; 804 di.type = (hdev->bus & 0x0f) | (hdev->dev_type << 4);
801 di.flags = hdev->flags; 805 di.flags = hdev->flags;
802 di.pkt_type = hdev->pkt_type; 806 di.pkt_type = hdev->pkt_type;
803 di.acl_mtu = hdev->acl_mtu; 807 di.acl_mtu = hdev->acl_mtu;
diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c
index f9d93f9cbcd2..1a79a6c7e30e 100644
--- a/net/bluetooth/hci_sysfs.c
+++ b/net/bluetooth/hci_sysfs.c
@@ -192,12 +192,30 @@ static inline char *host_bustostr(int bus)
192 } 192 }
193} 193}
194 194
195static inline char *host_typetostr(int type)
196{
197 switch (type) {
198 case HCI_BREDR:
199 return "BR/EDR";
200 case HCI_80211:
201 return "802.11";
202 default:
203 return "UNKNOWN";
204 }
205}
206
195static ssize_t show_bus(struct device *dev, struct device_attribute *attr, char *buf) 207static ssize_t show_bus(struct device *dev, struct device_attribute *attr, char *buf)
196{ 208{
197 struct hci_dev *hdev = dev_get_drvdata(dev); 209 struct hci_dev *hdev = dev_get_drvdata(dev);
198 return sprintf(buf, "%s\n", host_bustostr(hdev->bus)); 210 return sprintf(buf, "%s\n", host_bustostr(hdev->bus));
199} 211}
200 212
213static ssize_t show_type(struct device *dev, struct device_attribute *attr, char *buf)
214{
215 struct hci_dev *hdev = dev_get_drvdata(dev);
216 return sprintf(buf, "%s\n", host_typetostr(hdev->dev_type));
217}
218
201static ssize_t show_name(struct device *dev, struct device_attribute *attr, char *buf) 219static ssize_t show_name(struct device *dev, struct device_attribute *attr, char *buf)
202{ 220{
203 struct hci_dev *hdev = dev_get_drvdata(dev); 221 struct hci_dev *hdev = dev_get_drvdata(dev);
@@ -334,6 +352,7 @@ static ssize_t store_sniff_min_interval(struct device *dev, struct device_attrib
334} 352}
335 353
336static DEVICE_ATTR(bus, S_IRUGO, show_bus, NULL); 354static DEVICE_ATTR(bus, S_IRUGO, show_bus, NULL);
355static DEVICE_ATTR(type, S_IRUGO, show_type, NULL);
337static DEVICE_ATTR(name, S_IRUGO, show_name, NULL); 356static DEVICE_ATTR(name, S_IRUGO, show_name, NULL);
338static DEVICE_ATTR(class, S_IRUGO, show_class, NULL); 357static DEVICE_ATTR(class, S_IRUGO, show_class, NULL);
339static DEVICE_ATTR(address, S_IRUGO, show_address, NULL); 358static DEVICE_ATTR(address, S_IRUGO, show_address, NULL);
@@ -351,6 +370,7 @@ static DEVICE_ATTR(sniff_min_interval, S_IRUGO | S_IWUSR,
351 370
352static struct attribute *bt_host_attrs[] = { 371static struct attribute *bt_host_attrs[] = {
353 &dev_attr_bus.attr, 372 &dev_attr_bus.attr,
373 &dev_attr_type.attr,
354 &dev_attr_name.attr, 374 &dev_attr_name.attr,
355 &dev_attr_class.attr, 375 &dev_attr_class.attr,
356 &dev_attr_address.attr, 376 &dev_attr_address.attr,