mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 21:38:32 +08:00
Bluetooth: make batostr() print in the right order
The Bluetooth core uses the the BD_ADDR in the opposite order from the human readable order. So we are changing batostr() to print in the correct order and then removing some baswap(), as they are not needed anymore. Acked-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
This commit is contained in:
parent
cb810a189d
commit
d6b2eb2f89
@ -321,13 +321,10 @@ static int cmtp_session(void *arg)
|
||||
int cmtp_add_connection(struct cmtp_connadd_req *req, struct socket *sock)
|
||||
{
|
||||
struct cmtp_session *session, *s;
|
||||
bdaddr_t dst;
|
||||
int i, err;
|
||||
|
||||
BT_DBG("");
|
||||
|
||||
baswap(&dst, &bt_sk(sock->sk)->dst);
|
||||
|
||||
session = kzalloc(sizeof(struct cmtp_session), GFP_KERNEL);
|
||||
if (!session)
|
||||
return -ENOMEM;
|
||||
@ -346,7 +343,7 @@ int cmtp_add_connection(struct cmtp_connadd_req *req, struct socket *sock)
|
||||
|
||||
BT_DBG("mtu %d", session->mtu);
|
||||
|
||||
sprintf(session->name, "%s", batostr(&dst));
|
||||
sprintf(session->name, "%s", batostr(&bt_sk(sock->sk)->dst));
|
||||
|
||||
session->sock = sock;
|
||||
session->state = BT_CONFIG;
|
||||
|
@ -37,9 +37,7 @@ static ssize_t show_link_type(struct device *dev, struct device_attribute *attr,
|
||||
static ssize_t show_link_address(struct device *dev, struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct hci_conn *conn = dev_get_drvdata(dev);
|
||||
bdaddr_t bdaddr;
|
||||
baswap(&bdaddr, &conn->dst);
|
||||
return sprintf(buf, "%s\n", batostr(&bdaddr));
|
||||
return sprintf(buf, "%s\n", batostr(&conn->dst));
|
||||
}
|
||||
|
||||
static ssize_t show_link_features(struct device *dev, struct device_attribute *attr, char *buf)
|
||||
@ -238,9 +236,7 @@ static ssize_t show_class(struct device *dev, struct device_attribute *attr, cha
|
||||
static ssize_t show_address(struct device *dev, struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct hci_dev *hdev = dev_get_drvdata(dev);
|
||||
bdaddr_t bdaddr;
|
||||
baswap(&bdaddr, &hdev->bdaddr);
|
||||
return sprintf(buf, "%s\n", batostr(&bdaddr));
|
||||
return sprintf(buf, "%s\n", batostr(&hdev->bdaddr));
|
||||
}
|
||||
|
||||
static ssize_t show_features(struct device *dev, struct device_attribute *attr, char *buf)
|
||||
@ -408,10 +404,8 @@ static int inquiry_cache_show(struct seq_file *f, void *p)
|
||||
|
||||
for (e = cache->list; e; e = e->next) {
|
||||
struct inquiry_data *data = &e->data;
|
||||
bdaddr_t bdaddr;
|
||||
baswap(&bdaddr, &data->bdaddr);
|
||||
seq_printf(f, "%s %d %d %d 0x%.2x%.2x%.2x 0x%.4x %d %d %u\n",
|
||||
batostr(&bdaddr),
|
||||
batostr(&data->bdaddr),
|
||||
data->pscan_rep_mode, data->pscan_period_mode,
|
||||
data->pscan_mode, data->dev_class[2],
|
||||
data->dev_class[1], data->dev_class[0],
|
||||
@ -445,13 +439,10 @@ static int blacklist_show(struct seq_file *f, void *p)
|
||||
|
||||
list_for_each(l, &hdev->blacklist) {
|
||||
struct bdaddr_list *b;
|
||||
bdaddr_t bdaddr;
|
||||
|
||||
b = list_entry(l, struct bdaddr_list, list);
|
||||
|
||||
baswap(&bdaddr, &b->bdaddr);
|
||||
|
||||
seq_printf(f, "%s\n", batostr(&bdaddr));
|
||||
seq_printf(f, "%s\n", batostr(&b->bdaddr));
|
||||
}
|
||||
|
||||
hci_dev_unlock_bh(hdev);
|
||||
|
@ -758,7 +758,6 @@ static int hidp_setup_hid(struct hidp_session *session,
|
||||
struct hidp_connadd_req *req)
|
||||
{
|
||||
struct hid_device *hid;
|
||||
bdaddr_t src, dst;
|
||||
int err;
|
||||
|
||||
session->rd_data = kzalloc(req->rd_size, GFP_KERNEL);
|
||||
@ -781,9 +780,6 @@ static int hidp_setup_hid(struct hidp_session *session,
|
||||
|
||||
hid->driver_data = session;
|
||||
|
||||
baswap(&src, &bt_sk(session->ctrl_sock->sk)->src);
|
||||
baswap(&dst, &bt_sk(session->ctrl_sock->sk)->dst);
|
||||
|
||||
hid->bus = BUS_BLUETOOTH;
|
||||
hid->vendor = req->vendor;
|
||||
hid->product = req->product;
|
||||
@ -791,8 +787,8 @@ static int hidp_setup_hid(struct hidp_session *session,
|
||||
hid->country = req->country;
|
||||
|
||||
strncpy(hid->name, req->name, 128);
|
||||
strncpy(hid->phys, batostr(&src), 64);
|
||||
strncpy(hid->uniq, batostr(&dst), 64);
|
||||
strncpy(hid->phys, batostr(&bt_sk(session->ctrl_sock->sk)->src), 64);
|
||||
strncpy(hid->uniq, batostr(&bt_sk(session->ctrl_sock->sk)->dst), 64);
|
||||
|
||||
hid->dev.parent = hidp_get_device(session);
|
||||
hid->ll_driver = &hidp_hid_driver;
|
||||
|
@ -51,8 +51,8 @@ char *batostr(bdaddr_t *ba)
|
||||
|
||||
i ^= 1;
|
||||
sprintf(str[i], "%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X",
|
||||
ba->b[0], ba->b[1], ba->b[2],
|
||||
ba->b[3], ba->b[4], ba->b[5]);
|
||||
ba->b[5], ba->b[4], ba->b[3],
|
||||
ba->b[2], ba->b[1], ba->b[0]);
|
||||
|
||||
return str[i];
|
||||
}
|
||||
|
@ -183,9 +183,7 @@ static struct device *rfcomm_get_device(struct rfcomm_dev *dev)
|
||||
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));
|
||||
return sprintf(buf, "%s\n", batostr(&dev->dst));
|
||||
}
|
||||
|
||||
static ssize_t show_channel(struct device *tty_dev, struct device_attribute *attr, char *buf)
|
||||
|
Loading…
Reference in New Issue
Block a user