Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 72088
b: refs/heads/master
c: dae6a0f
h: refs/heads/master
v: v3
  • Loading branch information
Marcel Holtmann authored and David S. Miller committed Oct 22, 2007
1 parent a9aff88 commit d6fe010
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6792b5ec8d9e723e4689fd5b16cfa52603985f43
refs/heads/master: dae6a0f6636d05bcb28ece1f3630b23ed2d66e18
25 changes: 25 additions & 0 deletions trunk/net/bluetooth/rfcomm/tty.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,23 @@ static struct device *rfcomm_get_device(struct rfcomm_dev *dev)
return conn ? &conn->dev : NULL;
}

static ssize_t show_address(struct device *tty_dev, struct device_attribute *attr, char *buf)
{
struct rfcomm_dev *dev = dev_get_drvdata(tty_dev);
bdaddr_t bdaddr;
baswap(&bdaddr, &dev->dst);
return sprintf(buf, "%s\n", batostr(&bdaddr));
}

static ssize_t show_channel(struct device *tty_dev, struct device_attribute *attr, char *buf)
{
struct rfcomm_dev *dev = dev_get_drvdata(tty_dev);
return sprintf(buf, "%d\n", dev->channel);
}

static DEVICE_ATTR(address, S_IRUGO, show_address, NULL);
static DEVICE_ATTR(channel, S_IRUGO, show_channel, NULL);

static int rfcomm_dev_add(struct rfcomm_dev_req *req, struct rfcomm_dlc *dlc)
{
struct rfcomm_dev *dev;
Expand Down Expand Up @@ -281,6 +298,14 @@ static int rfcomm_dev_add(struct rfcomm_dev_req *req, struct rfcomm_dlc *dlc)
return err;
}

dev_set_drvdata(dev->tty_dev, dev);

if (device_create_file(dev->tty_dev, &dev_attr_address) < 0)
BT_ERR("Failed to create address attribute");

if (device_create_file(dev->tty_dev, &dev_attr_channel) < 0)
BT_ERR("Failed to create channel attribute");

return dev->id;
}

Expand Down

0 comments on commit d6fe010

Please sign in to comment.