Merge git://git.kernel.org/pub/scm/linux/kernel/git/holtmann/bluetooth-2.6
This commit is contained in:
commit
d5bb306b42
|
@ -114,10 +114,16 @@ static struct usb_device_id blacklist_ids[] = {
|
||||||
{ USB_DEVICE(0x0a5c, 0x200a), .driver_info = HCI_RESET | HCI_WRONG_SCO_MTU },
|
{ USB_DEVICE(0x0a5c, 0x200a), .driver_info = HCI_RESET | HCI_WRONG_SCO_MTU },
|
||||||
{ USB_DEVICE(0x0a5c, 0x2009), .driver_info = HCI_BCM92035 },
|
{ USB_DEVICE(0x0a5c, 0x2009), .driver_info = HCI_BCM92035 },
|
||||||
|
|
||||||
|
/* Broadcom BCM2045 */
|
||||||
|
{ USB_DEVICE(0x0a5c, 0x2101), .driver_info = HCI_WRONG_SCO_MTU },
|
||||||
|
|
||||||
/* IBM/Lenovo ThinkPad with Broadcom chip */
|
/* IBM/Lenovo ThinkPad with Broadcom chip */
|
||||||
{ USB_DEVICE(0x0a5c, 0x201e), .driver_info = HCI_WRONG_SCO_MTU },
|
{ USB_DEVICE(0x0a5c, 0x201e), .driver_info = HCI_WRONG_SCO_MTU },
|
||||||
{ USB_DEVICE(0x0a5c, 0x2110), .driver_info = HCI_WRONG_SCO_MTU },
|
{ USB_DEVICE(0x0a5c, 0x2110), .driver_info = HCI_WRONG_SCO_MTU },
|
||||||
|
|
||||||
|
/* Targus ACB10US */
|
||||||
|
{ USB_DEVICE(0x0a5c, 0x2100), .driver_info = HCI_RESET },
|
||||||
|
|
||||||
/* ANYCOM Bluetooth USB-200 and USB-250 */
|
/* ANYCOM Bluetooth USB-200 and USB-250 */
|
||||||
{ USB_DEVICE(0x0a5c, 0x2111), .driver_info = HCI_RESET },
|
{ USB_DEVICE(0x0a5c, 0x2111), .driver_info = HCI_RESET },
|
||||||
|
|
||||||
|
|
|
@ -499,6 +499,15 @@ static int hci_sock_setsockopt(struct socket *sock, int level, int optname, char
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HCI_FILTER:
|
case HCI_FILTER:
|
||||||
|
{
|
||||||
|
struct hci_filter *f = &hci_pi(sk)->filter;
|
||||||
|
|
||||||
|
uf.type_mask = f->type_mask;
|
||||||
|
uf.opcode = f->opcode;
|
||||||
|
uf.event_mask[0] = *((u32 *) f->event_mask + 0);
|
||||||
|
uf.event_mask[1] = *((u32 *) f->event_mask + 1);
|
||||||
|
}
|
||||||
|
|
||||||
len = min_t(unsigned int, len, sizeof(uf));
|
len = min_t(unsigned int, len, sizeof(uf));
|
||||||
if (copy_from_user(&uf, optval, len)) {
|
if (copy_from_user(&uf, optval, len)) {
|
||||||
err = -EFAULT;
|
err = -EFAULT;
|
||||||
|
|
|
@ -305,7 +305,7 @@ int hci_register_sysfs(struct hci_dev *hdev)
|
||||||
|
|
||||||
BT_DBG("%p name %s type %d", hdev, hdev->name, hdev->type);
|
BT_DBG("%p name %s type %d", hdev, hdev->name, hdev->type);
|
||||||
|
|
||||||
dev->class = bt_class;
|
dev->bus = &bt_bus;
|
||||||
dev->parent = hdev->parent;
|
dev->parent = hdev->parent;
|
||||||
|
|
||||||
strlcpy(dev->bus_id, hdev->name, BUS_ID_SIZE);
|
strlcpy(dev->bus_id, hdev->name, BUS_ID_SIZE);
|
||||||
|
@ -322,6 +322,10 @@ int hci_register_sysfs(struct hci_dev *hdev)
|
||||||
if (device_create_file(dev, bt_attrs[i]) < 0)
|
if (device_create_file(dev, bt_attrs[i]) < 0)
|
||||||
BT_ERR("Failed to create device attribute");
|
BT_ERR("Failed to create device attribute");
|
||||||
|
|
||||||
|
if (sysfs_create_link(&bt_class->subsys.kset.kobj,
|
||||||
|
&dev->kobj, kobject_name(&dev->kobj)) < 0)
|
||||||
|
BT_ERR("Failed to create class symlink");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -329,6 +333,9 @@ void hci_unregister_sysfs(struct hci_dev *hdev)
|
||||||
{
|
{
|
||||||
BT_DBG("%p name %s type %d", hdev, hdev->name, hdev->type);
|
BT_DBG("%p name %s type %d", hdev, hdev->name, hdev->type);
|
||||||
|
|
||||||
|
sysfs_remove_link(&bt_class->subsys.kset.kobj,
|
||||||
|
kobject_name(&hdev->dev.kobj));
|
||||||
|
|
||||||
device_del(&hdev->dev);
|
device_del(&hdev->dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -954,11 +954,17 @@ static int l2cap_sock_setsockopt(struct socket *sock, int level, int optname, ch
|
||||||
|
|
||||||
switch (optname) {
|
switch (optname) {
|
||||||
case L2CAP_OPTIONS:
|
case L2CAP_OPTIONS:
|
||||||
|
opts.imtu = l2cap_pi(sk)->imtu;
|
||||||
|
opts.omtu = l2cap_pi(sk)->omtu;
|
||||||
|
opts.flush_to = l2cap_pi(sk)->flush_to;
|
||||||
|
opts.mode = 0x00;
|
||||||
|
|
||||||
len = min_t(unsigned int, sizeof(opts), optlen);
|
len = min_t(unsigned int, sizeof(opts), optlen);
|
||||||
if (copy_from_user((char *) &opts, optval, len)) {
|
if (copy_from_user((char *) &opts, optval, len)) {
|
||||||
err = -EFAULT;
|
err = -EFAULT;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
l2cap_pi(sk)->imtu = opts.imtu;
|
l2cap_pi(sk)->imtu = opts.imtu;
|
||||||
l2cap_pi(sk)->omtu = opts.omtu;
|
l2cap_pi(sk)->omtu = opts.omtu;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -622,7 +622,7 @@ static struct rfcomm_session *rfcomm_session_create(bdaddr_t *src, bdaddr_t *dst
|
||||||
bacpy(&addr.l2_bdaddr, src);
|
bacpy(&addr.l2_bdaddr, src);
|
||||||
addr.l2_family = AF_BLUETOOTH;
|
addr.l2_family = AF_BLUETOOTH;
|
||||||
addr.l2_psm = 0;
|
addr.l2_psm = 0;
|
||||||
*err = sock->ops->bind(sock, (struct sockaddr *) &addr, sizeof(addr));
|
*err = kernel_bind(sock, (struct sockaddr *) &addr, sizeof(addr));
|
||||||
if (*err < 0)
|
if (*err < 0)
|
||||||
goto failed;
|
goto failed;
|
||||||
|
|
||||||
|
@ -643,7 +643,7 @@ static struct rfcomm_session *rfcomm_session_create(bdaddr_t *src, bdaddr_t *dst
|
||||||
bacpy(&addr.l2_bdaddr, dst);
|
bacpy(&addr.l2_bdaddr, dst);
|
||||||
addr.l2_family = AF_BLUETOOTH;
|
addr.l2_family = AF_BLUETOOTH;
|
||||||
addr.l2_psm = htobs(RFCOMM_PSM);
|
addr.l2_psm = htobs(RFCOMM_PSM);
|
||||||
*err = sock->ops->connect(sock, (struct sockaddr *) &addr, sizeof(addr), O_NONBLOCK);
|
*err = kernel_connect(sock, (struct sockaddr *) &addr, sizeof(addr), O_NONBLOCK);
|
||||||
if (*err == 0 || *err == -EINPROGRESS)
|
if (*err == 0 || *err == -EINPROGRESS)
|
||||||
return s;
|
return s;
|
||||||
|
|
||||||
|
@ -1058,6 +1058,12 @@ static int rfcomm_recv_ua(struct rfcomm_session *s, u8 dlci)
|
||||||
case BT_DISCONN:
|
case BT_DISCONN:
|
||||||
d->state = BT_CLOSED;
|
d->state = BT_CLOSED;
|
||||||
__rfcomm_dlc_close(d, 0);
|
__rfcomm_dlc_close(d, 0);
|
||||||
|
|
||||||
|
if (list_empty(&s->dlcs)) {
|
||||||
|
s->state = BT_DISCONN;
|
||||||
|
rfcomm_send_disc(s, 0);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -1067,6 +1073,10 @@ static int rfcomm_recv_ua(struct rfcomm_session *s, u8 dlci)
|
||||||
s->state = BT_CONNECTED;
|
s->state = BT_CONNECTED;
|
||||||
rfcomm_process_connect(s);
|
rfcomm_process_connect(s);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case BT_DISCONN:
|
||||||
|
rfcomm_session_put(s);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1757,19 +1767,12 @@ static inline void rfcomm_accept_connection(struct rfcomm_session *s)
|
||||||
|
|
||||||
BT_DBG("session %p", s);
|
BT_DBG("session %p", s);
|
||||||
|
|
||||||
if (sock_create_lite(PF_BLUETOOTH, sock->type, BTPROTO_L2CAP, &nsock))
|
err = kernel_accept(sock, &nsock, O_NONBLOCK);
|
||||||
|
if (err < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
nsock->ops = sock->ops;
|
|
||||||
|
|
||||||
__module_get(nsock->ops->owner);
|
__module_get(nsock->ops->owner);
|
||||||
|
|
||||||
err = sock->ops->accept(sock, nsock, O_NONBLOCK);
|
|
||||||
if (err < 0) {
|
|
||||||
sock_release(nsock);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Set our callbacks */
|
/* Set our callbacks */
|
||||||
nsock->sk->sk_data_ready = rfcomm_l2data_ready;
|
nsock->sk->sk_data_ready = rfcomm_l2data_ready;
|
||||||
nsock->sk->sk_state_change = rfcomm_l2state_change;
|
nsock->sk->sk_state_change = rfcomm_l2state_change;
|
||||||
|
@ -1885,7 +1888,7 @@ static int rfcomm_add_listener(bdaddr_t *ba)
|
||||||
bacpy(&addr.l2_bdaddr, ba);
|
bacpy(&addr.l2_bdaddr, ba);
|
||||||
addr.l2_family = AF_BLUETOOTH;
|
addr.l2_family = AF_BLUETOOTH;
|
||||||
addr.l2_psm = htobs(RFCOMM_PSM);
|
addr.l2_psm = htobs(RFCOMM_PSM);
|
||||||
err = sock->ops->bind(sock, (struct sockaddr *) &addr, sizeof(addr));
|
err = kernel_bind(sock, (struct sockaddr *) &addr, sizeof(addr));
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
BT_ERR("Bind failed %d", err);
|
BT_ERR("Bind failed %d", err);
|
||||||
goto failed;
|
goto failed;
|
||||||
|
@ -1898,7 +1901,7 @@ static int rfcomm_add_listener(bdaddr_t *ba)
|
||||||
release_sock(sk);
|
release_sock(sk);
|
||||||
|
|
||||||
/* Start listening on the socket */
|
/* Start listening on the socket */
|
||||||
err = sock->ops->listen(sock, 10);
|
err = kernel_listen(sock, 10);
|
||||||
if (err) {
|
if (err) {
|
||||||
BT_ERR("Listen failed %d", err);
|
BT_ERR("Listen failed %d", err);
|
||||||
goto failed;
|
goto failed;
|
||||||
|
|
|
@ -517,9 +517,10 @@ static void rfcomm_dev_state_change(struct rfcomm_dlc *dlc, int err)
|
||||||
if (dlc->state == BT_CLOSED) {
|
if (dlc->state == BT_CLOSED) {
|
||||||
if (!dev->tty) {
|
if (!dev->tty) {
|
||||||
if (test_bit(RFCOMM_RELEASE_ONHUP, &dev->flags)) {
|
if (test_bit(RFCOMM_RELEASE_ONHUP, &dev->flags)) {
|
||||||
rfcomm_dev_hold(dev);
|
if (rfcomm_dev_get(dev->id) == NULL)
|
||||||
rfcomm_dev_del(dev);
|
return;
|
||||||
|
|
||||||
|
rfcomm_dev_del(dev);
|
||||||
/* We have to drop DLC lock here, otherwise
|
/* We have to drop DLC lock here, otherwise
|
||||||
rfcomm_dev_put() will dead lock if it's
|
rfcomm_dev_put() will dead lock if it's
|
||||||
the last reference. */
|
the last reference. */
|
||||||
|
@ -974,8 +975,12 @@ static void rfcomm_tty_hangup(struct tty_struct *tty)
|
||||||
|
|
||||||
rfcomm_tty_flush_buffer(tty);
|
rfcomm_tty_flush_buffer(tty);
|
||||||
|
|
||||||
if (test_bit(RFCOMM_RELEASE_ONHUP, &dev->flags))
|
if (test_bit(RFCOMM_RELEASE_ONHUP, &dev->flags)) {
|
||||||
|
if (rfcomm_dev_get(dev->id) == NULL)
|
||||||
|
return;
|
||||||
rfcomm_dev_del(dev);
|
rfcomm_dev_del(dev);
|
||||||
|
rfcomm_dev_put(dev);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rfcomm_tty_read_proc(char *buf, char **start, off_t offset, int len, int *eof, void *unused)
|
static int rfcomm_tty_read_proc(char *buf, char **start, off_t offset, int len, int *eof, void *unused)
|
||||||
|
|
Loading…
Reference in New Issue