Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 184582
b: refs/heads/master
c: 943da25
h: refs/heads/master
v: v3
  • Loading branch information
Marcel Holtmann committed Feb 27, 2010
1 parent 964ad77 commit 2281659
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b914a250e7b390c713b36a9405a39c4c11abad80
refs/heads/master: 943da25d95c7e8fd8c39dbf09e030f5da46f5d85
4 changes: 4 additions & 0 deletions trunk/include/net/bluetooth/hci.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@
#define HCI_PCI 5
#define HCI_SDIO 6

/* HCI controller types */
#define HCI_BREDR 0x00
#define HCI_80211 0x01

/* HCI device quirks */
enum {
HCI_QUIRK_NO_RESET,
Expand Down
1 change: 1 addition & 0 deletions trunk/include/net/bluetooth/hci_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ struct hci_dev {
unsigned long flags;
__u16 id;
__u8 bus;
__u8 dev_type;
bdaddr_t bdaddr;
__u8 dev_name[248];
__u8 dev_class[3];
Expand Down
6 changes: 5 additions & 1 deletion trunk/net/bluetooth/hci_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,10 @@ int hci_dev_open(__u16 dev)
if (test_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks))
set_bit(HCI_RAW, &hdev->flags);

/* Treat all non BR/EDR controllers as raw devices for now */
if (hdev->dev_type != HCI_BREDR)
set_bit(HCI_RAW, &hdev->flags);

if (hdev->open(hdev)) {
ret = -EIO;
goto done;
Expand Down Expand Up @@ -797,7 +801,7 @@ int hci_get_dev_info(void __user *arg)

strcpy(di.name, hdev->name);
di.bdaddr = hdev->bdaddr;
di.type = hdev->bus;
di.type = (hdev->bus & 0x0f) | (hdev->dev_type << 4);
di.flags = hdev->flags;
di.pkt_type = hdev->pkt_type;
di.acl_mtu = hdev->acl_mtu;
Expand Down
20 changes: 20 additions & 0 deletions trunk/net/bluetooth/hci_sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,12 +192,30 @@ static inline char *host_bustostr(int bus)
}
}

static inline char *host_typetostr(int type)
{
switch (type) {
case HCI_BREDR:
return "BR/EDR";
case HCI_80211:
return "802.11";
default:
return "UNKNOWN";
}
}

static ssize_t show_bus(struct device *dev, struct device_attribute *attr, char *buf)
{
struct hci_dev *hdev = dev_get_drvdata(dev);
return sprintf(buf, "%s\n", host_bustostr(hdev->bus));
}

static ssize_t show_type(struct device *dev, struct device_attribute *attr, char *buf)
{
struct hci_dev *hdev = dev_get_drvdata(dev);
return sprintf(buf, "%s\n", host_typetostr(hdev->dev_type));
}

static ssize_t show_name(struct device *dev, struct device_attribute *attr, char *buf)
{
struct hci_dev *hdev = dev_get_drvdata(dev);
Expand Down Expand Up @@ -334,6 +352,7 @@ static ssize_t store_sniff_min_interval(struct device *dev, struct device_attrib
}

static DEVICE_ATTR(bus, S_IRUGO, show_bus, NULL);
static DEVICE_ATTR(type, S_IRUGO, show_type, NULL);
static DEVICE_ATTR(name, S_IRUGO, show_name, NULL);
static DEVICE_ATTR(class, S_IRUGO, show_class, NULL);
static DEVICE_ATTR(address, S_IRUGO, show_address, NULL);
Expand All @@ -351,6 +370,7 @@ static DEVICE_ATTR(sniff_min_interval, S_IRUGO | S_IWUSR,

static struct attribute *bt_host_attrs[] = {
&dev_attr_bus.attr,
&dev_attr_type.attr,
&dev_attr_name.attr,
&dev_attr_class.attr,
&dev_attr_address.attr,
Expand Down

0 comments on commit 2281659

Please sign in to comment.