diff options
Diffstat (limited to 'net/bluetooth')
-rw-r--r-- | net/bluetooth/hci_core.c | 18 | ||||
-rw-r--r-- | net/bluetooth/hci_event.c | 81 | ||||
-rw-r--r-- | net/bluetooth/hci_sock.c | 26 | ||||
-rw-r--r-- | net/bluetooth/l2cap.c | 2 | ||||
-rw-r--r-- | net/bluetooth/rfcomm/core.c | 73 | ||||
-rw-r--r-- | net/bluetooth/rfcomm/sock.c | 2 | ||||
-rw-r--r-- | net/bluetooth/rfcomm/tty.c | 206 | ||||
-rw-r--r-- | net/bluetooth/sco.c | 2 |
8 files changed, 298 insertions, 112 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index ffa26c10bfe8..55dc42eac92c 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c | |||
@@ -191,7 +191,7 @@ static void hci_init_req(struct hci_dev *hdev, unsigned long opt) | |||
191 | 191 | ||
192 | /* Special commands */ | 192 | /* Special commands */ |
193 | while ((skb = skb_dequeue(&hdev->driver_init))) { | 193 | while ((skb = skb_dequeue(&hdev->driver_init))) { |
194 | skb->pkt_type = HCI_COMMAND_PKT; | 194 | bt_cb(skb)->pkt_type = HCI_COMMAND_PKT; |
195 | skb->dev = (void *) hdev; | 195 | skb->dev = (void *) hdev; |
196 | skb_queue_tail(&hdev->cmd_q, skb); | 196 | skb_queue_tail(&hdev->cmd_q, skb); |
197 | hci_sched_cmd(hdev); | 197 | hci_sched_cmd(hdev); |
@@ -995,11 +995,11 @@ static int hci_send_frame(struct sk_buff *skb) | |||
995 | return -ENODEV; | 995 | return -ENODEV; |
996 | } | 996 | } |
997 | 997 | ||
998 | BT_DBG("%s type %d len %d", hdev->name, skb->pkt_type, skb->len); | 998 | BT_DBG("%s type %d len %d", hdev->name, bt_cb(skb)->pkt_type, skb->len); |
999 | 999 | ||
1000 | if (atomic_read(&hdev->promisc)) { | 1000 | if (atomic_read(&hdev->promisc)) { |
1001 | /* Time stamp */ | 1001 | /* Time stamp */ |
1002 | do_gettimeofday(&skb->stamp); | 1002 | __net_timestamp(skb); |
1003 | 1003 | ||
1004 | hci_send_to_sock(hdev, skb); | 1004 | hci_send_to_sock(hdev, skb); |
1005 | } | 1005 | } |
@@ -1034,7 +1034,7 @@ int hci_send_cmd(struct hci_dev *hdev, __u16 ogf, __u16 ocf, __u32 plen, void *p | |||
1034 | 1034 | ||
1035 | BT_DBG("skb len %d", skb->len); | 1035 | BT_DBG("skb len %d", skb->len); |
1036 | 1036 | ||
1037 | skb->pkt_type = HCI_COMMAND_PKT; | 1037 | bt_cb(skb)->pkt_type = HCI_COMMAND_PKT; |
1038 | skb->dev = (void *) hdev; | 1038 | skb->dev = (void *) hdev; |
1039 | skb_queue_tail(&hdev->cmd_q, skb); | 1039 | skb_queue_tail(&hdev->cmd_q, skb); |
1040 | hci_sched_cmd(hdev); | 1040 | hci_sched_cmd(hdev); |
@@ -1081,7 +1081,7 @@ int hci_send_acl(struct hci_conn *conn, struct sk_buff *skb, __u16 flags) | |||
1081 | BT_DBG("%s conn %p flags 0x%x", hdev->name, conn, flags); | 1081 | BT_DBG("%s conn %p flags 0x%x", hdev->name, conn, flags); |
1082 | 1082 | ||
1083 | skb->dev = (void *) hdev; | 1083 | skb->dev = (void *) hdev; |
1084 | skb->pkt_type = HCI_ACLDATA_PKT; | 1084 | bt_cb(skb)->pkt_type = HCI_ACLDATA_PKT; |
1085 | hci_add_acl_hdr(skb, conn->handle, flags | ACL_START); | 1085 | hci_add_acl_hdr(skb, conn->handle, flags | ACL_START); |
1086 | 1086 | ||
1087 | if (!(list = skb_shinfo(skb)->frag_list)) { | 1087 | if (!(list = skb_shinfo(skb)->frag_list)) { |
@@ -1103,7 +1103,7 @@ int hci_send_acl(struct hci_conn *conn, struct sk_buff *skb, __u16 flags) | |||
1103 | skb = list; list = list->next; | 1103 | skb = list; list = list->next; |
1104 | 1104 | ||
1105 | skb->dev = (void *) hdev; | 1105 | skb->dev = (void *) hdev; |
1106 | skb->pkt_type = HCI_ACLDATA_PKT; | 1106 | bt_cb(skb)->pkt_type = HCI_ACLDATA_PKT; |
1107 | hci_add_acl_hdr(skb, conn->handle, flags | ACL_CONT); | 1107 | hci_add_acl_hdr(skb, conn->handle, flags | ACL_CONT); |
1108 | 1108 | ||
1109 | BT_DBG("%s frag %p len %d", hdev->name, skb, skb->len); | 1109 | BT_DBG("%s frag %p len %d", hdev->name, skb, skb->len); |
@@ -1139,7 +1139,7 @@ int hci_send_sco(struct hci_conn *conn, struct sk_buff *skb) | |||
1139 | memcpy(skb->h.raw, &hdr, HCI_SCO_HDR_SIZE); | 1139 | memcpy(skb->h.raw, &hdr, HCI_SCO_HDR_SIZE); |
1140 | 1140 | ||
1141 | skb->dev = (void *) hdev; | 1141 | skb->dev = (void *) hdev; |
1142 | skb->pkt_type = HCI_SCODATA_PKT; | 1142 | bt_cb(skb)->pkt_type = HCI_SCODATA_PKT; |
1143 | skb_queue_tail(&conn->data_q, skb); | 1143 | skb_queue_tail(&conn->data_q, skb); |
1144 | hci_sched_tx(hdev); | 1144 | hci_sched_tx(hdev); |
1145 | return 0; | 1145 | return 0; |
@@ -1369,7 +1369,7 @@ void hci_rx_task(unsigned long arg) | |||
1369 | 1369 | ||
1370 | if (test_bit(HCI_INIT, &hdev->flags)) { | 1370 | if (test_bit(HCI_INIT, &hdev->flags)) { |
1371 | /* Don't process data packets in this states. */ | 1371 | /* Don't process data packets in this states. */ |
1372 | switch (skb->pkt_type) { | 1372 | switch (bt_cb(skb)->pkt_type) { |
1373 | case HCI_ACLDATA_PKT: | 1373 | case HCI_ACLDATA_PKT: |
1374 | case HCI_SCODATA_PKT: | 1374 | case HCI_SCODATA_PKT: |
1375 | kfree_skb(skb); | 1375 | kfree_skb(skb); |
@@ -1378,7 +1378,7 @@ void hci_rx_task(unsigned long arg) | |||
1378 | } | 1378 | } |
1379 | 1379 | ||
1380 | /* Process frame */ | 1380 | /* Process frame */ |
1381 | switch (skb->pkt_type) { | 1381 | switch (bt_cb(skb)->pkt_type) { |
1382 | case HCI_EVENT_PKT: | 1382 | case HCI_EVENT_PKT: |
1383 | hci_event_packet(hdev, skb); | 1383 | hci_event_packet(hdev, skb); |
1384 | break; | 1384 | break; |
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 46367bd129c3..d6da0939216d 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c | |||
@@ -484,14 +484,18 @@ static inline void hci_inquiry_complete_evt(struct hci_dev *hdev, struct sk_buff | |||
484 | /* Inquiry Result */ | 484 | /* Inquiry Result */ |
485 | static inline void hci_inquiry_result_evt(struct hci_dev *hdev, struct sk_buff *skb) | 485 | static inline void hci_inquiry_result_evt(struct hci_dev *hdev, struct sk_buff *skb) |
486 | { | 486 | { |
487 | struct inquiry_data data; | ||
487 | struct inquiry_info *info = (struct inquiry_info *) (skb->data + 1); | 488 | struct inquiry_info *info = (struct inquiry_info *) (skb->data + 1); |
488 | int num_rsp = *((__u8 *) skb->data); | 489 | int num_rsp = *((__u8 *) skb->data); |
489 | 490 | ||
490 | BT_DBG("%s num_rsp %d", hdev->name, num_rsp); | 491 | BT_DBG("%s num_rsp %d", hdev->name, num_rsp); |
491 | 492 | ||
493 | if (!num_rsp) | ||
494 | return; | ||
495 | |||
492 | hci_dev_lock(hdev); | 496 | hci_dev_lock(hdev); |
497 | |||
493 | for (; num_rsp; num_rsp--) { | 498 | for (; num_rsp; num_rsp--) { |
494 | struct inquiry_data data; | ||
495 | bacpy(&data.bdaddr, &info->bdaddr); | 499 | bacpy(&data.bdaddr, &info->bdaddr); |
496 | data.pscan_rep_mode = info->pscan_rep_mode; | 500 | data.pscan_rep_mode = info->pscan_rep_mode; |
497 | data.pscan_period_mode = info->pscan_period_mode; | 501 | data.pscan_period_mode = info->pscan_period_mode; |
@@ -502,30 +506,55 @@ static inline void hci_inquiry_result_evt(struct hci_dev *hdev, struct sk_buff * | |||
502 | info++; | 506 | info++; |
503 | hci_inquiry_cache_update(hdev, &data); | 507 | hci_inquiry_cache_update(hdev, &data); |
504 | } | 508 | } |
509 | |||
505 | hci_dev_unlock(hdev); | 510 | hci_dev_unlock(hdev); |
506 | } | 511 | } |
507 | 512 | ||
508 | /* Inquiry Result With RSSI */ | 513 | /* Inquiry Result With RSSI */ |
509 | static inline void hci_inquiry_result_with_rssi_evt(struct hci_dev *hdev, struct sk_buff *skb) | 514 | static inline void hci_inquiry_result_with_rssi_evt(struct hci_dev *hdev, struct sk_buff *skb) |
510 | { | 515 | { |
511 | struct inquiry_info_with_rssi *info = (struct inquiry_info_with_rssi *) (skb->data + 1); | 516 | struct inquiry_data data; |
512 | int num_rsp = *((__u8 *) skb->data); | 517 | int num_rsp = *((__u8 *) skb->data); |
513 | 518 | ||
514 | BT_DBG("%s num_rsp %d", hdev->name, num_rsp); | 519 | BT_DBG("%s num_rsp %d", hdev->name, num_rsp); |
515 | 520 | ||
521 | if (!num_rsp) | ||
522 | return; | ||
523 | |||
516 | hci_dev_lock(hdev); | 524 | hci_dev_lock(hdev); |
517 | for (; num_rsp; num_rsp--) { | 525 | |
518 | struct inquiry_data data; | 526 | if ((skb->len - 1) / num_rsp != sizeof(struct inquiry_info_with_rssi)) { |
519 | bacpy(&data.bdaddr, &info->bdaddr); | 527 | struct inquiry_info_with_rssi_and_pscan_mode *info = |
520 | data.pscan_rep_mode = info->pscan_rep_mode; | 528 | (struct inquiry_info_with_rssi_and_pscan_mode *) (skb->data + 1); |
521 | data.pscan_period_mode = info->pscan_period_mode; | 529 | |
522 | data.pscan_mode = 0x00; | 530 | for (; num_rsp; num_rsp--) { |
523 | memcpy(data.dev_class, info->dev_class, 3); | 531 | bacpy(&data.bdaddr, &info->bdaddr); |
524 | data.clock_offset = info->clock_offset; | 532 | data.pscan_rep_mode = info->pscan_rep_mode; |
525 | data.rssi = info->rssi; | 533 | data.pscan_period_mode = info->pscan_period_mode; |
526 | info++; | 534 | data.pscan_mode = info->pscan_mode; |
527 | hci_inquiry_cache_update(hdev, &data); | 535 | memcpy(data.dev_class, info->dev_class, 3); |
536 | data.clock_offset = info->clock_offset; | ||
537 | data.rssi = info->rssi; | ||
538 | info++; | ||
539 | hci_inquiry_cache_update(hdev, &data); | ||
540 | } | ||
541 | } else { | ||
542 | struct inquiry_info_with_rssi *info = | ||
543 | (struct inquiry_info_with_rssi *) (skb->data + 1); | ||
544 | |||
545 | for (; num_rsp; num_rsp--) { | ||
546 | bacpy(&data.bdaddr, &info->bdaddr); | ||
547 | data.pscan_rep_mode = info->pscan_rep_mode; | ||
548 | data.pscan_period_mode = info->pscan_period_mode; | ||
549 | data.pscan_mode = 0x00; | ||
550 | memcpy(data.dev_class, info->dev_class, 3); | ||
551 | data.clock_offset = info->clock_offset; | ||
552 | data.rssi = info->rssi; | ||
553 | info++; | ||
554 | hci_inquiry_cache_update(hdev, &data); | ||
555 | } | ||
528 | } | 556 | } |
557 | |||
529 | hci_dev_unlock(hdev); | 558 | hci_dev_unlock(hdev); |
530 | } | 559 | } |
531 | 560 | ||
@@ -865,6 +894,24 @@ static inline void hci_clock_offset_evt(struct hci_dev *hdev, struct sk_buff *sk | |||
865 | hci_dev_unlock(hdev); | 894 | hci_dev_unlock(hdev); |
866 | } | 895 | } |
867 | 896 | ||
897 | /* Page Scan Repetition Mode */ | ||
898 | static inline void hci_pscan_rep_mode_evt(struct hci_dev *hdev, struct sk_buff *skb) | ||
899 | { | ||
900 | struct hci_ev_pscan_rep_mode *ev = (struct hci_ev_pscan_rep_mode *) skb->data; | ||
901 | struct inquiry_entry *ie; | ||
902 | |||
903 | BT_DBG("%s", hdev->name); | ||
904 | |||
905 | hci_dev_lock(hdev); | ||
906 | |||
907 | if ((ie = hci_inquiry_cache_lookup(hdev, &ev->bdaddr))) { | ||
908 | ie->data.pscan_rep_mode = ev->pscan_rep_mode; | ||
909 | ie->timestamp = jiffies; | ||
910 | } | ||
911 | |||
912 | hci_dev_unlock(hdev); | ||
913 | } | ||
914 | |||
868 | void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb) | 915 | void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb) |
869 | { | 916 | { |
870 | struct hci_event_hdr *hdr = (struct hci_event_hdr *) skb->data; | 917 | struct hci_event_hdr *hdr = (struct hci_event_hdr *) skb->data; |
@@ -937,6 +984,10 @@ void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb) | |||
937 | hci_clock_offset_evt(hdev, skb); | 984 | hci_clock_offset_evt(hdev, skb); |
938 | break; | 985 | break; |
939 | 986 | ||
987 | case HCI_EV_PSCAN_REP_MODE: | ||
988 | hci_pscan_rep_mode_evt(hdev, skb); | ||
989 | break; | ||
990 | |||
940 | case HCI_EV_CMD_STATUS: | 991 | case HCI_EV_CMD_STATUS: |
941 | cs = (struct hci_ev_cmd_status *) skb->data; | 992 | cs = (struct hci_ev_cmd_status *) skb->data; |
942 | skb_pull(skb, sizeof(cs)); | 993 | skb_pull(skb, sizeof(cs)); |
@@ -1036,9 +1087,9 @@ void hci_si_event(struct hci_dev *hdev, int type, int dlen, void *data) | |||
1036 | memcpy(ev->data, data, dlen); | 1087 | memcpy(ev->data, data, dlen); |
1037 | 1088 | ||
1038 | bt_cb(skb)->incoming = 1; | 1089 | bt_cb(skb)->incoming = 1; |
1039 | do_gettimeofday(&skb->stamp); | 1090 | __net_timestamp(skb); |
1040 | 1091 | ||
1041 | skb->pkt_type = HCI_EVENT_PKT; | 1092 | bt_cb(skb)->pkt_type = HCI_EVENT_PKT; |
1042 | skb->dev = (void *) hdev; | 1093 | skb->dev = (void *) hdev; |
1043 | hci_send_to_sock(hdev, skb); | 1094 | hci_send_to_sock(hdev, skb); |
1044 | kfree_skb(skb); | 1095 | kfree_skb(skb); |
diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c index ebdcce5e7ca0..32ef7975a139 100644 --- a/net/bluetooth/hci_sock.c +++ b/net/bluetooth/hci_sock.c | |||
@@ -110,11 +110,11 @@ void hci_send_to_sock(struct hci_dev *hdev, struct sk_buff *skb) | |||
110 | /* Apply filter */ | 110 | /* Apply filter */ |
111 | flt = &hci_pi(sk)->filter; | 111 | flt = &hci_pi(sk)->filter; |
112 | 112 | ||
113 | if (!test_bit((skb->pkt_type == HCI_VENDOR_PKT) ? | 113 | if (!test_bit((bt_cb(skb)->pkt_type == HCI_VENDOR_PKT) ? |
114 | 0 : (skb->pkt_type & HCI_FLT_TYPE_BITS), &flt->type_mask)) | 114 | 0 : (bt_cb(skb)->pkt_type & HCI_FLT_TYPE_BITS), &flt->type_mask)) |
115 | continue; | 115 | continue; |
116 | 116 | ||
117 | if (skb->pkt_type == HCI_EVENT_PKT) { | 117 | if (bt_cb(skb)->pkt_type == HCI_EVENT_PKT) { |
118 | register int evt = (*(__u8 *)skb->data & HCI_FLT_EVENT_BITS); | 118 | register int evt = (*(__u8 *)skb->data & HCI_FLT_EVENT_BITS); |
119 | 119 | ||
120 | if (!hci_test_bit(evt, &flt->event_mask)) | 120 | if (!hci_test_bit(evt, &flt->event_mask)) |
@@ -131,7 +131,7 @@ void hci_send_to_sock(struct hci_dev *hdev, struct sk_buff *skb) | |||
131 | continue; | 131 | continue; |
132 | 132 | ||
133 | /* Put type byte before the data */ | 133 | /* Put type byte before the data */ |
134 | memcpy(skb_push(nskb, 1), &nskb->pkt_type, 1); | 134 | memcpy(skb_push(nskb, 1), &bt_cb(nskb)->pkt_type, 1); |
135 | 135 | ||
136 | if (sock_queue_rcv_skb(sk, nskb)) | 136 | if (sock_queue_rcv_skb(sk, nskb)) |
137 | kfree_skb(nskb); | 137 | kfree_skb(nskb); |
@@ -327,11 +327,17 @@ static inline void hci_sock_cmsg(struct sock *sk, struct msghdr *msg, struct sk_ | |||
327 | { | 327 | { |
328 | __u32 mask = hci_pi(sk)->cmsg_mask; | 328 | __u32 mask = hci_pi(sk)->cmsg_mask; |
329 | 329 | ||
330 | if (mask & HCI_CMSG_DIR) | 330 | if (mask & HCI_CMSG_DIR) { |
331 | put_cmsg(msg, SOL_HCI, HCI_CMSG_DIR, sizeof(int), &bt_cb(skb)->incoming); | 331 | int incoming = bt_cb(skb)->incoming; |
332 | put_cmsg(msg, SOL_HCI, HCI_CMSG_DIR, sizeof(incoming), &incoming); | ||
333 | } | ||
334 | |||
335 | if (mask & HCI_CMSG_TSTAMP) { | ||
336 | struct timeval tv; | ||
332 | 337 | ||
333 | if (mask & HCI_CMSG_TSTAMP) | 338 | skb_get_timestamp(skb, &tv); |
334 | put_cmsg(msg, SOL_HCI, HCI_CMSG_TSTAMP, sizeof(skb->stamp), &skb->stamp); | 339 | put_cmsg(msg, SOL_HCI, HCI_CMSG_TSTAMP, sizeof(tv), &tv); |
340 | } | ||
335 | } | 341 | } |
336 | 342 | ||
337 | static int hci_sock_recvmsg(struct kiocb *iocb, struct socket *sock, | 343 | static int hci_sock_recvmsg(struct kiocb *iocb, struct socket *sock, |
@@ -405,11 +411,11 @@ static int hci_sock_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
405 | goto drop; | 411 | goto drop; |
406 | } | 412 | } |
407 | 413 | ||
408 | skb->pkt_type = *((unsigned char *) skb->data); | 414 | bt_cb(skb)->pkt_type = *((unsigned char *) skb->data); |
409 | skb_pull(skb, 1); | 415 | skb_pull(skb, 1); |
410 | skb->dev = (void *) hdev; | 416 | skb->dev = (void *) hdev; |
411 | 417 | ||
412 | if (skb->pkt_type == HCI_COMMAND_PKT) { | 418 | if (bt_cb(skb)->pkt_type == HCI_COMMAND_PKT) { |
413 | u16 opcode = __le16_to_cpu(get_unaligned((u16 *)skb->data)); | 419 | u16 opcode = __le16_to_cpu(get_unaligned((u16 *)skb->data)); |
414 | u16 ogf = hci_opcode_ogf(opcode); | 420 | u16 ogf = hci_opcode_ogf(opcode); |
415 | u16 ocf = hci_opcode_ocf(opcode); | 421 | u16 ocf = hci_opcode_ocf(opcode); |
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c index 32fccfb5bfa5..d3d6bc547212 100644 --- a/net/bluetooth/l2cap.c +++ b/net/bluetooth/l2cap.c | |||
@@ -372,7 +372,7 @@ static struct proto l2cap_proto = { | |||
372 | .obj_size = sizeof(struct l2cap_pinfo) | 372 | .obj_size = sizeof(struct l2cap_pinfo) |
373 | }; | 373 | }; |
374 | 374 | ||
375 | static struct sock *l2cap_sock_alloc(struct socket *sock, int proto, int prio) | 375 | static struct sock *l2cap_sock_alloc(struct socket *sock, int proto, unsigned int __nocast prio) |
376 | { | 376 | { |
377 | struct sock *sk; | 377 | struct sock *sk; |
378 | 378 | ||
diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c index 27bf5047cd33..173f46e8cdae 100644 --- a/net/bluetooth/rfcomm/core.c +++ b/net/bluetooth/rfcomm/core.c | |||
@@ -21,10 +21,6 @@ | |||
21 | SOFTWARE IS DISCLAIMED. | 21 | SOFTWARE IS DISCLAIMED. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | /* | ||
25 | RPN support - Dirk Husemann <hud@zurich.ibm.com> | ||
26 | */ | ||
27 | |||
28 | /* | 24 | /* |
29 | * Bluetooth RFCOMM core. | 25 | * Bluetooth RFCOMM core. |
30 | * | 26 | * |
@@ -115,10 +111,10 @@ static void rfcomm_session_del(struct rfcomm_session *s); | |||
115 | #define __get_mcc_len(b) ((b & 0xfe) >> 1) | 111 | #define __get_mcc_len(b) ((b & 0xfe) >> 1) |
116 | 112 | ||
117 | /* RPN macros */ | 113 | /* RPN macros */ |
118 | #define __rpn_line_settings(data, stop, parity) ((data & 0x3) | ((stop & 0x1) << 2) | ((parity & 0x3) << 3)) | 114 | #define __rpn_line_settings(data, stop, parity) ((data & 0x3) | ((stop & 0x1) << 2) | ((parity & 0x7) << 3)) |
119 | #define __get_rpn_data_bits(line) ((line) & 0x3) | 115 | #define __get_rpn_data_bits(line) ((line) & 0x3) |
120 | #define __get_rpn_stop_bits(line) (((line) >> 2) & 0x1) | 116 | #define __get_rpn_stop_bits(line) (((line) >> 2) & 0x1) |
121 | #define __get_rpn_parity(line) (((line) >> 3) & 0x3) | 117 | #define __get_rpn_parity(line) (((line) >> 3) & 0x7) |
122 | 118 | ||
123 | static inline void rfcomm_schedule(uint event) | 119 | static inline void rfcomm_schedule(uint event) |
124 | { | 120 | { |
@@ -233,7 +229,7 @@ static void rfcomm_dlc_clear_state(struct rfcomm_dlc *d) | |||
233 | d->rx_credits = RFCOMM_DEFAULT_CREDITS; | 229 | d->rx_credits = RFCOMM_DEFAULT_CREDITS; |
234 | } | 230 | } |
235 | 231 | ||
236 | struct rfcomm_dlc *rfcomm_dlc_alloc(int prio) | 232 | struct rfcomm_dlc *rfcomm_dlc_alloc(unsigned int __nocast prio) |
237 | { | 233 | { |
238 | struct rfcomm_dlc *d = kmalloc(sizeof(*d), prio); | 234 | struct rfcomm_dlc *d = kmalloc(sizeof(*d), prio); |
239 | if (!d) | 235 | if (!d) |
@@ -780,10 +776,10 @@ static int rfcomm_send_pn(struct rfcomm_session *s, int cr, struct rfcomm_dlc *d | |||
780 | return rfcomm_send_frame(s, buf, ptr - buf); | 776 | return rfcomm_send_frame(s, buf, ptr - buf); |
781 | } | 777 | } |
782 | 778 | ||
783 | static int rfcomm_send_rpn(struct rfcomm_session *s, int cr, u8 dlci, | 779 | int rfcomm_send_rpn(struct rfcomm_session *s, int cr, u8 dlci, |
784 | u8 bit_rate, u8 data_bits, u8 stop_bits, | 780 | u8 bit_rate, u8 data_bits, u8 stop_bits, |
785 | u8 parity, u8 flow_ctrl_settings, | 781 | u8 parity, u8 flow_ctrl_settings, |
786 | u8 xon_char, u8 xoff_char, u16 param_mask) | 782 | u8 xon_char, u8 xoff_char, u16 param_mask) |
787 | { | 783 | { |
788 | struct rfcomm_hdr *hdr; | 784 | struct rfcomm_hdr *hdr; |
789 | struct rfcomm_mcc *mcc; | 785 | struct rfcomm_mcc *mcc; |
@@ -791,9 +787,9 @@ static int rfcomm_send_rpn(struct rfcomm_session *s, int cr, u8 dlci, | |||
791 | u8 buf[16], *ptr = buf; | 787 | u8 buf[16], *ptr = buf; |
792 | 788 | ||
793 | BT_DBG("%p cr %d dlci %d bit_r 0x%x data_b 0x%x stop_b 0x%x parity 0x%x" | 789 | BT_DBG("%p cr %d dlci %d bit_r 0x%x data_b 0x%x stop_b 0x%x parity 0x%x" |
794 | "flwc_s 0x%x xon_c 0x%x xoff_c 0x%x p_mask 0x%x", | 790 | " flwc_s 0x%x xon_c 0x%x xoff_c 0x%x p_mask 0x%x", |
795 | s, cr, dlci, bit_rate, data_bits, stop_bits, parity, | 791 | s, cr, dlci, bit_rate, data_bits, stop_bits, parity, |
796 | flow_ctrl_settings, xon_char, xoff_char, param_mask); | 792 | flow_ctrl_settings, xon_char, xoff_char, param_mask); |
797 | 793 | ||
798 | hdr = (void *) ptr; ptr += sizeof(*hdr); | 794 | hdr = (void *) ptr; ptr += sizeof(*hdr); |
799 | hdr->addr = __addr(s->initiator, 0); | 795 | hdr->addr = __addr(s->initiator, 0); |
@@ -1265,16 +1261,16 @@ static int rfcomm_recv_rpn(struct rfcomm_session *s, int cr, int len, struct sk_ | |||
1265 | u8 xon_char = 0; | 1261 | u8 xon_char = 0; |
1266 | u8 xoff_char = 0; | 1262 | u8 xoff_char = 0; |
1267 | u16 rpn_mask = RFCOMM_RPN_PM_ALL; | 1263 | u16 rpn_mask = RFCOMM_RPN_PM_ALL; |
1268 | 1264 | ||
1269 | BT_DBG("dlci %d cr %d len 0x%x bitr 0x%x line 0x%x flow 0x%x xonc 0x%x xoffc 0x%x pm 0x%x", | 1265 | BT_DBG("dlci %d cr %d len 0x%x bitr 0x%x line 0x%x flow 0x%x xonc 0x%x xoffc 0x%x pm 0x%x", |
1270 | dlci, cr, len, rpn->bit_rate, rpn->line_settings, rpn->flow_ctrl, | 1266 | dlci, cr, len, rpn->bit_rate, rpn->line_settings, rpn->flow_ctrl, |
1271 | rpn->xon_char, rpn->xoff_char, rpn->param_mask); | 1267 | rpn->xon_char, rpn->xoff_char, rpn->param_mask); |
1272 | 1268 | ||
1273 | if (!cr) | 1269 | if (!cr) |
1274 | return 0; | 1270 | return 0; |
1275 | 1271 | ||
1276 | if (len == 1) { | 1272 | if (len == 1) { |
1277 | /* request: return default setting */ | 1273 | /* This is a request, return default settings */ |
1278 | bit_rate = RFCOMM_RPN_BR_115200; | 1274 | bit_rate = RFCOMM_RPN_BR_115200; |
1279 | data_bits = RFCOMM_RPN_DATA_8; | 1275 | data_bits = RFCOMM_RPN_DATA_8; |
1280 | stop_bits = RFCOMM_RPN_STOP_1; | 1276 | stop_bits = RFCOMM_RPN_STOP_1; |
@@ -1282,11 +1278,12 @@ static int rfcomm_recv_rpn(struct rfcomm_session *s, int cr, int len, struct sk_ | |||
1282 | flow_ctrl = RFCOMM_RPN_FLOW_NONE; | 1278 | flow_ctrl = RFCOMM_RPN_FLOW_NONE; |
1283 | xon_char = RFCOMM_RPN_XON_CHAR; | 1279 | xon_char = RFCOMM_RPN_XON_CHAR; |
1284 | xoff_char = RFCOMM_RPN_XOFF_CHAR; | 1280 | xoff_char = RFCOMM_RPN_XOFF_CHAR; |
1285 | |||
1286 | goto rpn_out; | 1281 | goto rpn_out; |
1287 | } | 1282 | } |
1288 | /* check for sane values: ignore/accept bit_rate, 8 bits, 1 stop bit, no parity, | 1283 | |
1289 | no flow control lines, normal XON/XOFF chars */ | 1284 | /* Check for sane values, ignore/accept bit_rate, 8 bits, 1 stop bit, |
1285 | * no parity, no flow control lines, normal XON/XOFF chars */ | ||
1286 | |||
1290 | if (rpn->param_mask & RFCOMM_RPN_PM_BITRATE) { | 1287 | if (rpn->param_mask & RFCOMM_RPN_PM_BITRATE) { |
1291 | bit_rate = rpn->bit_rate; | 1288 | bit_rate = rpn->bit_rate; |
1292 | if (bit_rate != RFCOMM_RPN_BR_115200) { | 1289 | if (bit_rate != RFCOMM_RPN_BR_115200) { |
@@ -1295,6 +1292,7 @@ static int rfcomm_recv_rpn(struct rfcomm_session *s, int cr, int len, struct sk_ | |||
1295 | rpn_mask ^= RFCOMM_RPN_PM_BITRATE; | 1292 | rpn_mask ^= RFCOMM_RPN_PM_BITRATE; |
1296 | } | 1293 | } |
1297 | } | 1294 | } |
1295 | |||
1298 | if (rpn->param_mask & RFCOMM_RPN_PM_DATA) { | 1296 | if (rpn->param_mask & RFCOMM_RPN_PM_DATA) { |
1299 | data_bits = __get_rpn_data_bits(rpn->line_settings); | 1297 | data_bits = __get_rpn_data_bits(rpn->line_settings); |
1300 | if (data_bits != RFCOMM_RPN_DATA_8) { | 1298 | if (data_bits != RFCOMM_RPN_DATA_8) { |
@@ -1303,6 +1301,7 @@ static int rfcomm_recv_rpn(struct rfcomm_session *s, int cr, int len, struct sk_ | |||
1303 | rpn_mask ^= RFCOMM_RPN_PM_DATA; | 1301 | rpn_mask ^= RFCOMM_RPN_PM_DATA; |
1304 | } | 1302 | } |
1305 | } | 1303 | } |
1304 | |||
1306 | if (rpn->param_mask & RFCOMM_RPN_PM_STOP) { | 1305 | if (rpn->param_mask & RFCOMM_RPN_PM_STOP) { |
1307 | stop_bits = __get_rpn_stop_bits(rpn->line_settings); | 1306 | stop_bits = __get_rpn_stop_bits(rpn->line_settings); |
1308 | if (stop_bits != RFCOMM_RPN_STOP_1) { | 1307 | if (stop_bits != RFCOMM_RPN_STOP_1) { |
@@ -1311,6 +1310,7 @@ static int rfcomm_recv_rpn(struct rfcomm_session *s, int cr, int len, struct sk_ | |||
1311 | rpn_mask ^= RFCOMM_RPN_PM_STOP; | 1310 | rpn_mask ^= RFCOMM_RPN_PM_STOP; |
1312 | } | 1311 | } |
1313 | } | 1312 | } |
1313 | |||
1314 | if (rpn->param_mask & RFCOMM_RPN_PM_PARITY) { | 1314 | if (rpn->param_mask & RFCOMM_RPN_PM_PARITY) { |
1315 | parity = __get_rpn_parity(rpn->line_settings); | 1315 | parity = __get_rpn_parity(rpn->line_settings); |
1316 | if (parity != RFCOMM_RPN_PARITY_NONE) { | 1316 | if (parity != RFCOMM_RPN_PARITY_NONE) { |
@@ -1319,6 +1319,7 @@ static int rfcomm_recv_rpn(struct rfcomm_session *s, int cr, int len, struct sk_ | |||
1319 | rpn_mask ^= RFCOMM_RPN_PM_PARITY; | 1319 | rpn_mask ^= RFCOMM_RPN_PM_PARITY; |
1320 | } | 1320 | } |
1321 | } | 1321 | } |
1322 | |||
1322 | if (rpn->param_mask & RFCOMM_RPN_PM_FLOW) { | 1323 | if (rpn->param_mask & RFCOMM_RPN_PM_FLOW) { |
1323 | flow_ctrl = rpn->flow_ctrl; | 1324 | flow_ctrl = rpn->flow_ctrl; |
1324 | if (flow_ctrl != RFCOMM_RPN_FLOW_NONE) { | 1325 | if (flow_ctrl != RFCOMM_RPN_FLOW_NONE) { |
@@ -1327,6 +1328,7 @@ static int rfcomm_recv_rpn(struct rfcomm_session *s, int cr, int len, struct sk_ | |||
1327 | rpn_mask ^= RFCOMM_RPN_PM_FLOW; | 1328 | rpn_mask ^= RFCOMM_RPN_PM_FLOW; |
1328 | } | 1329 | } |
1329 | } | 1330 | } |
1331 | |||
1330 | if (rpn->param_mask & RFCOMM_RPN_PM_XON) { | 1332 | if (rpn->param_mask & RFCOMM_RPN_PM_XON) { |
1331 | xon_char = rpn->xon_char; | 1333 | xon_char = rpn->xon_char; |
1332 | if (xon_char != RFCOMM_RPN_XON_CHAR) { | 1334 | if (xon_char != RFCOMM_RPN_XON_CHAR) { |
@@ -1335,6 +1337,7 @@ static int rfcomm_recv_rpn(struct rfcomm_session *s, int cr, int len, struct sk_ | |||
1335 | rpn_mask ^= RFCOMM_RPN_PM_XON; | 1337 | rpn_mask ^= RFCOMM_RPN_PM_XON; |
1336 | } | 1338 | } |
1337 | } | 1339 | } |
1340 | |||
1338 | if (rpn->param_mask & RFCOMM_RPN_PM_XOFF) { | 1341 | if (rpn->param_mask & RFCOMM_RPN_PM_XOFF) { |
1339 | xoff_char = rpn->xoff_char; | 1342 | xoff_char = rpn->xoff_char; |
1340 | if (xoff_char != RFCOMM_RPN_XOFF_CHAR) { | 1343 | if (xoff_char != RFCOMM_RPN_XOFF_CHAR) { |
@@ -1345,9 +1348,8 @@ static int rfcomm_recv_rpn(struct rfcomm_session *s, int cr, int len, struct sk_ | |||
1345 | } | 1348 | } |
1346 | 1349 | ||
1347 | rpn_out: | 1350 | rpn_out: |
1348 | rfcomm_send_rpn(s, 0, dlci, | 1351 | rfcomm_send_rpn(s, 0, dlci, bit_rate, data_bits, stop_bits, |
1349 | bit_rate, data_bits, stop_bits, parity, flow_ctrl, | 1352 | parity, flow_ctrl, xon_char, xoff_char, rpn_mask); |
1350 | xon_char, xoff_char, rpn_mask); | ||
1351 | 1353 | ||
1352 | return 0; | 1354 | return 0; |
1353 | } | 1355 | } |
@@ -1358,14 +1360,13 @@ static int rfcomm_recv_rls(struct rfcomm_session *s, int cr, struct sk_buff *skb | |||
1358 | u8 dlci = __get_dlci(rls->dlci); | 1360 | u8 dlci = __get_dlci(rls->dlci); |
1359 | 1361 | ||
1360 | BT_DBG("dlci %d cr %d status 0x%x", dlci, cr, rls->status); | 1362 | BT_DBG("dlci %d cr %d status 0x%x", dlci, cr, rls->status); |
1361 | 1363 | ||
1362 | if (!cr) | 1364 | if (!cr) |
1363 | return 0; | 1365 | return 0; |
1364 | 1366 | ||
1365 | /* FIXME: We should probably do something with this | 1367 | /* We should probably do something with this information here. But |
1366 | information here. But for now it's sufficient just | 1368 | * for now it's sufficient just to reply -- Bluetooth 1.1 says it's |
1367 | to reply -- Bluetooth 1.1 says it's mandatory to | 1369 | * mandatory to recognise and respond to RLS */ |
1368 | recognise and respond to RLS */ | ||
1369 | 1370 | ||
1370 | rfcomm_send_rls(s, 0, dlci, rls->status); | 1371 | rfcomm_send_rls(s, 0, dlci, rls->status); |
1371 | 1372 | ||
@@ -1381,7 +1382,7 @@ static int rfcomm_recv_msc(struct rfcomm_session *s, int cr, struct sk_buff *skb | |||
1381 | BT_DBG("dlci %d cr %d v24 0x%x", dlci, cr, msc->v24_sig); | 1382 | BT_DBG("dlci %d cr %d v24 0x%x", dlci, cr, msc->v24_sig); |
1382 | 1383 | ||
1383 | d = rfcomm_dlc_get(s, dlci); | 1384 | d = rfcomm_dlc_get(s, dlci); |
1384 | if (!d) | 1385 | if (!d) |
1385 | return 0; | 1386 | return 0; |
1386 | 1387 | ||
1387 | if (cr) { | 1388 | if (cr) { |
@@ -1389,7 +1390,7 @@ static int rfcomm_recv_msc(struct rfcomm_session *s, int cr, struct sk_buff *skb | |||
1389 | set_bit(RFCOMM_TX_THROTTLED, &d->flags); | 1390 | set_bit(RFCOMM_TX_THROTTLED, &d->flags); |
1390 | else | 1391 | else |
1391 | clear_bit(RFCOMM_TX_THROTTLED, &d->flags); | 1392 | clear_bit(RFCOMM_TX_THROTTLED, &d->flags); |
1392 | 1393 | ||
1393 | rfcomm_dlc_lock(d); | 1394 | rfcomm_dlc_lock(d); |
1394 | if (d->modem_status) | 1395 | if (d->modem_status) |
1395 | d->modem_status(d, msc->v24_sig); | 1396 | d->modem_status(d, msc->v24_sig); |
@@ -1398,7 +1399,7 @@ static int rfcomm_recv_msc(struct rfcomm_session *s, int cr, struct sk_buff *skb | |||
1398 | rfcomm_send_msc(s, 0, dlci, msc->v24_sig); | 1399 | rfcomm_send_msc(s, 0, dlci, msc->v24_sig); |
1399 | 1400 | ||
1400 | d->mscex |= RFCOMM_MSCEX_RX; | 1401 | d->mscex |= RFCOMM_MSCEX_RX; |
1401 | } else | 1402 | } else |
1402 | d->mscex |= RFCOMM_MSCEX_TX; | 1403 | d->mscex |= RFCOMM_MSCEX_TX; |
1403 | 1404 | ||
1404 | return 0; | 1405 | return 0; |
diff --git a/net/bluetooth/rfcomm/sock.c b/net/bluetooth/rfcomm/sock.c index 63a123c5c41b..90e19eb6d3cc 100644 --- a/net/bluetooth/rfcomm/sock.c +++ b/net/bluetooth/rfcomm/sock.c | |||
@@ -284,7 +284,7 @@ static struct proto rfcomm_proto = { | |||
284 | .obj_size = sizeof(struct rfcomm_pinfo) | 284 | .obj_size = sizeof(struct rfcomm_pinfo) |
285 | }; | 285 | }; |
286 | 286 | ||
287 | static struct sock *rfcomm_sock_alloc(struct socket *sock, int proto, int prio) | 287 | static struct sock *rfcomm_sock_alloc(struct socket *sock, int proto, unsigned int __nocast prio) |
288 | { | 288 | { |
289 | struct rfcomm_dlc *d; | 289 | struct rfcomm_dlc *d; |
290 | struct sock *sk; | 290 | struct sock *sk; |
diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c index 6304590fd36a..1bca860a6109 100644 --- a/net/bluetooth/rfcomm/tty.c +++ b/net/bluetooth/rfcomm/tty.c | |||
@@ -286,7 +286,7 @@ static inline void rfcomm_set_owner_w(struct sk_buff *skb, struct rfcomm_dev *de | |||
286 | skb->destructor = rfcomm_wfree; | 286 | skb->destructor = rfcomm_wfree; |
287 | } | 287 | } |
288 | 288 | ||
289 | static struct sk_buff *rfcomm_wmalloc(struct rfcomm_dev *dev, unsigned long size, int priority) | 289 | static struct sk_buff *rfcomm_wmalloc(struct rfcomm_dev *dev, unsigned long size, unsigned int __nocast priority) |
290 | { | 290 | { |
291 | if (atomic_read(&dev->wmem_alloc) < rfcomm_room(dev->dlc)) { | 291 | if (atomic_read(&dev->wmem_alloc) < rfcomm_room(dev->dlc)) { |
292 | struct sk_buff *skb = alloc_skb(size, priority); | 292 | struct sk_buff *skb = alloc_skb(size, priority); |
@@ -528,9 +528,14 @@ static void rfcomm_dev_modem_status(struct rfcomm_dlc *dlc, u8 v24_sig) | |||
528 | struct rfcomm_dev *dev = dlc->owner; | 528 | struct rfcomm_dev *dev = dlc->owner; |
529 | if (!dev) | 529 | if (!dev) |
530 | return; | 530 | return; |
531 | 531 | ||
532 | BT_DBG("dlc %p dev %p v24_sig 0x%02x", dlc, dev, v24_sig); | 532 | BT_DBG("dlc %p dev %p v24_sig 0x%02x", dlc, dev, v24_sig); |
533 | 533 | ||
534 | if ((dev->modem_status & TIOCM_CD) && !(v24_sig & RFCOMM_V24_DV)) { | ||
535 | if (dev->tty && !C_CLOCAL(dev->tty)) | ||
536 | tty_hangup(dev->tty); | ||
537 | } | ||
538 | |||
534 | dev->modem_status = | 539 | dev->modem_status = |
535 | ((v24_sig & RFCOMM_V24_RTC) ? (TIOCM_DSR | TIOCM_DTR) : 0) | | 540 | ((v24_sig & RFCOMM_V24_RTC) ? (TIOCM_DSR | TIOCM_DTR) : 0) | |
536 | ((v24_sig & RFCOMM_V24_RTR) ? (TIOCM_RTS | TIOCM_CTS) : 0) | | 541 | ((v24_sig & RFCOMM_V24_RTR) ? (TIOCM_RTS | TIOCM_CTS) : 0) | |
@@ -740,20 +745,143 @@ static int rfcomm_tty_ioctl(struct tty_struct *tty, struct file *filp, unsigned | |||
740 | return -ENOIOCTLCMD; | 745 | return -ENOIOCTLCMD; |
741 | } | 746 | } |
742 | 747 | ||
743 | #define RELEVANT_IFLAG(iflag) (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK)) | ||
744 | |||
745 | static void rfcomm_tty_set_termios(struct tty_struct *tty, struct termios *old) | 748 | static void rfcomm_tty_set_termios(struct tty_struct *tty, struct termios *old) |
746 | { | 749 | { |
747 | BT_DBG("tty %p", tty); | 750 | struct termios *new = (struct termios *) tty->termios; |
751 | int old_baud_rate = tty_termios_baud_rate(old); | ||
752 | int new_baud_rate = tty_termios_baud_rate(new); | ||
748 | 753 | ||
749 | if ((tty->termios->c_cflag == old->c_cflag) && | 754 | u8 baud, data_bits, stop_bits, parity, x_on, x_off; |
750 | (RELEVANT_IFLAG(tty->termios->c_iflag) == RELEVANT_IFLAG(old->c_iflag))) | 755 | u16 changes = 0; |
751 | return; | 756 | |
757 | struct rfcomm_dev *dev = (struct rfcomm_dev *) tty->driver_data; | ||
758 | |||
759 | BT_DBG("tty %p termios %p", tty, old); | ||
760 | |||
761 | /* Handle turning off CRTSCTS */ | ||
762 | if ((old->c_cflag & CRTSCTS) && !(new->c_cflag & CRTSCTS)) | ||
763 | BT_DBG("Turning off CRTSCTS unsupported"); | ||
764 | |||
765 | /* Parity on/off and when on, odd/even */ | ||
766 | if (((old->c_cflag & PARENB) != (new->c_cflag & PARENB)) || | ||
767 | ((old->c_cflag & PARODD) != (new->c_cflag & PARODD)) ) { | ||
768 | changes |= RFCOMM_RPN_PM_PARITY; | ||
769 | BT_DBG("Parity change detected."); | ||
770 | } | ||
771 | |||
772 | /* Mark and space parity are not supported! */ | ||
773 | if (new->c_cflag & PARENB) { | ||
774 | if (new->c_cflag & PARODD) { | ||
775 | BT_DBG("Parity is ODD"); | ||
776 | parity = RFCOMM_RPN_PARITY_ODD; | ||
777 | } else { | ||
778 | BT_DBG("Parity is EVEN"); | ||
779 | parity = RFCOMM_RPN_PARITY_EVEN; | ||
780 | } | ||
781 | } else { | ||
782 | BT_DBG("Parity is OFF"); | ||
783 | parity = RFCOMM_RPN_PARITY_NONE; | ||
784 | } | ||
785 | |||
786 | /* Setting the x_on / x_off characters */ | ||
787 | if (old->c_cc[VSTOP] != new->c_cc[VSTOP]) { | ||
788 | BT_DBG("XOFF custom"); | ||
789 | x_on = new->c_cc[VSTOP]; | ||
790 | changes |= RFCOMM_RPN_PM_XON; | ||
791 | } else { | ||
792 | BT_DBG("XOFF default"); | ||
793 | x_on = RFCOMM_RPN_XON_CHAR; | ||
794 | } | ||
795 | |||
796 | if (old->c_cc[VSTART] != new->c_cc[VSTART]) { | ||
797 | BT_DBG("XON custom"); | ||
798 | x_off = new->c_cc[VSTART]; | ||
799 | changes |= RFCOMM_RPN_PM_XOFF; | ||
800 | } else { | ||
801 | BT_DBG("XON default"); | ||
802 | x_off = RFCOMM_RPN_XOFF_CHAR; | ||
803 | } | ||
804 | |||
805 | /* Handle setting of stop bits */ | ||
806 | if ((old->c_cflag & CSTOPB) != (new->c_cflag & CSTOPB)) | ||
807 | changes |= RFCOMM_RPN_PM_STOP; | ||
808 | |||
809 | /* POSIX does not support 1.5 stop bits and RFCOMM does not | ||
810 | * support 2 stop bits. So a request for 2 stop bits gets | ||
811 | * translated to 1.5 stop bits */ | ||
812 | if (new->c_cflag & CSTOPB) { | ||
813 | stop_bits = RFCOMM_RPN_STOP_15; | ||
814 | } else { | ||
815 | stop_bits = RFCOMM_RPN_STOP_1; | ||
816 | } | ||
817 | |||
818 | /* Handle number of data bits [5-8] */ | ||
819 | if ((old->c_cflag & CSIZE) != (new->c_cflag & CSIZE)) | ||
820 | changes |= RFCOMM_RPN_PM_DATA; | ||
821 | |||
822 | switch (new->c_cflag & CSIZE) { | ||
823 | case CS5: | ||
824 | data_bits = RFCOMM_RPN_DATA_5; | ||
825 | break; | ||
826 | case CS6: | ||
827 | data_bits = RFCOMM_RPN_DATA_6; | ||
828 | break; | ||
829 | case CS7: | ||
830 | data_bits = RFCOMM_RPN_DATA_7; | ||
831 | break; | ||
832 | case CS8: | ||
833 | data_bits = RFCOMM_RPN_DATA_8; | ||
834 | break; | ||
835 | default: | ||
836 | data_bits = RFCOMM_RPN_DATA_8; | ||
837 | break; | ||
838 | } | ||
839 | |||
840 | /* Handle baudrate settings */ | ||
841 | if (old_baud_rate != new_baud_rate) | ||
842 | changes |= RFCOMM_RPN_PM_BITRATE; | ||
752 | 843 | ||
753 | /* handle turning off CRTSCTS */ | 844 | switch (new_baud_rate) { |
754 | if ((old->c_cflag & CRTSCTS) && !(tty->termios->c_cflag & CRTSCTS)) { | 845 | case 2400: |
755 | BT_DBG("turning off CRTSCTS"); | 846 | baud = RFCOMM_RPN_BR_2400; |
847 | break; | ||
848 | case 4800: | ||
849 | baud = RFCOMM_RPN_BR_4800; | ||
850 | break; | ||
851 | case 7200: | ||
852 | baud = RFCOMM_RPN_BR_7200; | ||
853 | break; | ||
854 | case 9600: | ||
855 | baud = RFCOMM_RPN_BR_9600; | ||
856 | break; | ||
857 | case 19200: | ||
858 | baud = RFCOMM_RPN_BR_19200; | ||
859 | break; | ||
860 | case 38400: | ||
861 | baud = RFCOMM_RPN_BR_38400; | ||
862 | break; | ||
863 | case 57600: | ||
864 | baud = RFCOMM_RPN_BR_57600; | ||
865 | break; | ||
866 | case 115200: | ||
867 | baud = RFCOMM_RPN_BR_115200; | ||
868 | break; | ||
869 | case 230400: | ||
870 | baud = RFCOMM_RPN_BR_230400; | ||
871 | break; | ||
872 | default: | ||
873 | /* 9600 is standard accordinag to the RFCOMM specification */ | ||
874 | baud = RFCOMM_RPN_BR_9600; | ||
875 | break; | ||
876 | |||
756 | } | 877 | } |
878 | |||
879 | if (changes) | ||
880 | rfcomm_send_rpn(dev->dlc->session, 1, dev->dlc->dlci, baud, | ||
881 | data_bits, stop_bits, parity, | ||
882 | RFCOMM_RPN_FLOW_NONE, x_on, x_off, changes); | ||
883 | |||
884 | return; | ||
757 | } | 885 | } |
758 | 886 | ||
759 | static void rfcomm_tty_throttle(struct tty_struct *tty) | 887 | static void rfcomm_tty_throttle(struct tty_struct *tty) |
@@ -761,7 +889,7 @@ static void rfcomm_tty_throttle(struct tty_struct *tty) | |||
761 | struct rfcomm_dev *dev = (struct rfcomm_dev *) tty->driver_data; | 889 | struct rfcomm_dev *dev = (struct rfcomm_dev *) tty->driver_data; |
762 | 890 | ||
763 | BT_DBG("tty %p dev %p", tty, dev); | 891 | BT_DBG("tty %p dev %p", tty, dev); |
764 | 892 | ||
765 | rfcomm_dlc_throttle(dev->dlc); | 893 | rfcomm_dlc_throttle(dev->dlc); |
766 | } | 894 | } |
767 | 895 | ||
@@ -770,7 +898,7 @@ static void rfcomm_tty_unthrottle(struct tty_struct *tty) | |||
770 | struct rfcomm_dev *dev = (struct rfcomm_dev *) tty->driver_data; | 898 | struct rfcomm_dev *dev = (struct rfcomm_dev *) tty->driver_data; |
771 | 899 | ||
772 | BT_DBG("tty %p dev %p", tty, dev); | 900 | BT_DBG("tty %p dev %p", tty, dev); |
773 | 901 | ||
774 | rfcomm_dlc_unthrottle(dev->dlc); | 902 | rfcomm_dlc_unthrottle(dev->dlc); |
775 | } | 903 | } |
776 | 904 | ||
@@ -841,35 +969,35 @@ static int rfcomm_tty_tiocmget(struct tty_struct *tty, struct file *filp) | |||
841 | 969 | ||
842 | static int rfcomm_tty_tiocmset(struct tty_struct *tty, struct file *filp, unsigned int set, unsigned int clear) | 970 | static int rfcomm_tty_tiocmset(struct tty_struct *tty, struct file *filp, unsigned int set, unsigned int clear) |
843 | { | 971 | { |
844 | struct rfcomm_dev *dev = (struct rfcomm_dev *) tty->driver_data; | 972 | struct rfcomm_dev *dev = (struct rfcomm_dev *) tty->driver_data; |
845 | struct rfcomm_dlc *dlc = dev->dlc; | 973 | struct rfcomm_dlc *dlc = dev->dlc; |
846 | u8 v24_sig; | 974 | u8 v24_sig; |
847 | 975 | ||
848 | BT_DBG("tty %p dev %p set 0x%02x clear 0x%02x", tty, dev, set, clear); | 976 | BT_DBG("tty %p dev %p set 0x%02x clear 0x%02x", tty, dev, set, clear); |
849 | 977 | ||
850 | rfcomm_dlc_get_modem_status(dlc, &v24_sig); | 978 | rfcomm_dlc_get_modem_status(dlc, &v24_sig); |
851 | 979 | ||
852 | if (set & TIOCM_DSR || set & TIOCM_DTR) | 980 | if (set & TIOCM_DSR || set & TIOCM_DTR) |
853 | v24_sig |= RFCOMM_V24_RTC; | 981 | v24_sig |= RFCOMM_V24_RTC; |
854 | if (set & TIOCM_RTS || set & TIOCM_CTS) | 982 | if (set & TIOCM_RTS || set & TIOCM_CTS) |
855 | v24_sig |= RFCOMM_V24_RTR; | 983 | v24_sig |= RFCOMM_V24_RTR; |
856 | if (set & TIOCM_RI) | 984 | if (set & TIOCM_RI) |
857 | v24_sig |= RFCOMM_V24_IC; | 985 | v24_sig |= RFCOMM_V24_IC; |
858 | if (set & TIOCM_CD) | 986 | if (set & TIOCM_CD) |
859 | v24_sig |= RFCOMM_V24_DV; | 987 | v24_sig |= RFCOMM_V24_DV; |
860 | 988 | ||
861 | if (clear & TIOCM_DSR || clear & TIOCM_DTR) | 989 | if (clear & TIOCM_DSR || clear & TIOCM_DTR) |
862 | v24_sig &= ~RFCOMM_V24_RTC; | 990 | v24_sig &= ~RFCOMM_V24_RTC; |
863 | if (clear & TIOCM_RTS || clear & TIOCM_CTS) | 991 | if (clear & TIOCM_RTS || clear & TIOCM_CTS) |
864 | v24_sig &= ~RFCOMM_V24_RTR; | 992 | v24_sig &= ~RFCOMM_V24_RTR; |
865 | if (clear & TIOCM_RI) | 993 | if (clear & TIOCM_RI) |
866 | v24_sig &= ~RFCOMM_V24_IC; | 994 | v24_sig &= ~RFCOMM_V24_IC; |
867 | if (clear & TIOCM_CD) | 995 | if (clear & TIOCM_CD) |
868 | v24_sig &= ~RFCOMM_V24_DV; | 996 | v24_sig &= ~RFCOMM_V24_DV; |
869 | 997 | ||
870 | rfcomm_dlc_set_modem_status(dlc, v24_sig); | 998 | rfcomm_dlc_set_modem_status(dlc, v24_sig); |
871 | 999 | ||
872 | return 0; | 1000 | return 0; |
873 | } | 1001 | } |
874 | 1002 | ||
875 | /* ---- TTY structure ---- */ | 1003 | /* ---- TTY structure ---- */ |
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c index 746c11fc017e..ce7ab7dfa0b2 100644 --- a/net/bluetooth/sco.c +++ b/net/bluetooth/sco.c | |||
@@ -418,7 +418,7 @@ static struct proto sco_proto = { | |||
418 | .obj_size = sizeof(struct sco_pinfo) | 418 | .obj_size = sizeof(struct sco_pinfo) |
419 | }; | 419 | }; |
420 | 420 | ||
421 | static struct sock *sco_sock_alloc(struct socket *sock, int proto, int prio) | 421 | static struct sock *sco_sock_alloc(struct socket *sock, int proto, unsigned int __nocast prio) |
422 | { | 422 | { |
423 | struct sock *sk; | 423 | struct sock *sk; |
424 | 424 | ||