2 BlueZ - Bluetooth protocol stack for Linux
3 Copyright (C) 2000-2001 Qualcomm Incorporated
5 Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com>
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License version 2 as
9 published by the Free Software Foundation;
11 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
12 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
14 IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
15 CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
16 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
17 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
18 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20 ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
21 COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
22 SOFTWARE IS DISCLAIMED.
25 /* Bluetooth SCO sockets. */
27 #include <linux/config.h>
28 #include <linux/module.h>
30 #include <linux/types.h>
31 #include <linux/errno.h>
32 #include <linux/kernel.h>
33 #include <linux/major.h>
34 #include <linux/sched.h>
35 #include <linux/slab.h>
36 #include <linux/poll.h>
37 #include <linux/fcntl.h>
38 #include <linux/init.h>
39 #include <linux/interrupt.h>
40 #include <linux/socket.h>
41 #include <linux/skbuff.h>
42 #include <linux/proc_fs.h>
43 #include <linux/seq_file.h>
44 #include <linux/list.h>
47 #include <asm/system.h>
48 #include <asm/uaccess.h>
50 #include <net/bluetooth/bluetooth.h>
51 #include <net/bluetooth/hci_core.h>
52 #include <net/bluetooth/sco.h>
54 #ifndef CONFIG_BT_SCO_DEBUG
61 static struct proto_ops sco_sock_ops
;
63 static struct bt_sock_list sco_sk_list
= {
64 .lock
= RW_LOCK_UNLOCKED
67 static void __sco_chan_add(struct sco_conn
*conn
, struct sock
*sk
, struct sock
*parent
);
68 static void sco_chan_del(struct sock
*sk
, int err
);
70 static int sco_conn_del(struct hci_conn
*conn
, int err
);
72 static void sco_sock_close(struct sock
*sk
);
73 static void sco_sock_kill(struct sock
*sk
);
75 /* ---- SCO timers ---- */
76 static void sco_sock_timeout(unsigned long arg
)
78 struct sock
*sk
= (struct sock
*) arg
;
80 BT_DBG("sock %p state %d", sk
, sk
->sk_state
);
83 sk
->sk_err
= ETIMEDOUT
;
84 sk
->sk_state_change(sk
);
91 static void sco_sock_set_timer(struct sock
*sk
, long timeout
)
93 BT_DBG("sock %p state %d timeout %ld", sk
, sk
->sk_state
, timeout
);
94 sk_reset_timer(sk
, &sk
->sk_timer
, jiffies
+ timeout
);
97 static void sco_sock_clear_timer(struct sock
*sk
)
99 BT_DBG("sock %p state %d", sk
, sk
->sk_state
);
100 sk_stop_timer(sk
, &sk
->sk_timer
);
103 static void sco_sock_init_timer(struct sock
*sk
)
105 init_timer(&sk
->sk_timer
);
106 sk
->sk_timer
.function
= sco_sock_timeout
;
107 sk
->sk_timer
.data
= (unsigned long)sk
;
110 /* ---- SCO connections ---- */
111 static struct sco_conn
*sco_conn_add(struct hci_conn
*hcon
, __u8 status
)
113 struct hci_dev
*hdev
= hcon
->hdev
;
114 struct sco_conn
*conn
;
116 if ((conn
= hcon
->sco_data
))
122 if (!(conn
= kmalloc(sizeof(struct sco_conn
), GFP_ATOMIC
)))
124 memset(conn
, 0, sizeof(struct sco_conn
));
126 spin_lock_init(&conn
->lock
);
128 hcon
->sco_data
= conn
;
131 conn
->src
= &hdev
->bdaddr
;
132 conn
->dst
= &hcon
->dst
;
134 if (hdev
->sco_mtu
> 0)
135 conn
->mtu
= hdev
->sco_mtu
;
139 BT_DBG("hcon %p conn %p", hcon
, conn
);
143 static inline struct sock
*sco_chan_get(struct sco_conn
*conn
)
145 struct sock
*sk
= NULL
;
148 sco_conn_unlock(conn
);
152 static int sco_conn_del(struct hci_conn
*hcon
, int err
)
154 struct sco_conn
*conn
;
157 if (!(conn
= hcon
->sco_data
))
160 BT_DBG("hcon %p conn %p, err %d", hcon
, conn
, err
);
163 if ((sk
= sco_chan_get(conn
))) {
165 sco_sock_clear_timer(sk
);
166 sco_chan_del(sk
, err
);
171 hcon
->sco_data
= NULL
;
176 static inline int sco_chan_add(struct sco_conn
*conn
, struct sock
*sk
, struct sock
*parent
)
184 __sco_chan_add(conn
, sk
, parent
);
186 sco_conn_unlock(conn
);
190 static int sco_connect(struct sock
*sk
)
192 bdaddr_t
*src
= &bt_sk(sk
)->src
;
193 bdaddr_t
*dst
= &bt_sk(sk
)->dst
;
194 struct sco_conn
*conn
;
195 struct hci_conn
*hcon
;
196 struct hci_dev
*hdev
;
199 BT_DBG("%s -> %s", batostr(src
), batostr(dst
));
201 if (!(hdev
= hci_get_route(dst
, src
)))
202 return -EHOSTUNREACH
;
204 hci_dev_lock_bh(hdev
);
208 hcon
= hci_connect(hdev
, SCO_LINK
, dst
);
212 conn
= sco_conn_add(hcon
, 0);
218 /* Update source addr of the socket */
219 bacpy(src
, conn
->src
);
221 err
= sco_chan_add(conn
, sk
, NULL
);
225 if (hcon
->state
== BT_CONNECTED
) {
226 sco_sock_clear_timer(sk
);
227 sk
->sk_state
= BT_CONNECTED
;
229 sk
->sk_state
= BT_CONNECT
;
230 sco_sock_set_timer(sk
, sk
->sk_sndtimeo
);
233 hci_dev_unlock_bh(hdev
);
238 static inline int sco_send_frame(struct sock
*sk
, struct msghdr
*msg
, int len
)
240 struct sco_conn
*conn
= sco_pi(sk
)->conn
;
244 /* Check outgoing MTU */
248 BT_DBG("sk %p len %d", sk
, len
);
250 count
= min_t(unsigned int, conn
->mtu
, len
);
251 if (!(skb
= bt_skb_send_alloc(sk
, count
, msg
->msg_flags
& MSG_DONTWAIT
, &err
)))
254 if (memcpy_fromiovec(skb_put(skb
, count
), msg
->msg_iov
, count
)) {
259 if ((err
= hci_send_sco(conn
->hcon
, skb
)) < 0)
269 static inline void sco_recv_frame(struct sco_conn
*conn
, struct sk_buff
*skb
)
271 struct sock
*sk
= sco_chan_get(conn
);
276 BT_DBG("sk %p len %d", sk
, skb
->len
);
278 if (sk
->sk_state
!= BT_CONNECTED
)
281 if (!sock_queue_rcv_skb(sk
, skb
))
289 /* -------- Socket interface ---------- */
290 static struct sock
*__sco_get_sock_by_addr(bdaddr_t
*ba
)
293 struct hlist_node
*node
;
295 sk_for_each(sk
, node
, &sco_sk_list
.head
)
296 if (!bacmp(&bt_sk(sk
)->src
, ba
))
303 /* Find socket listening on source bdaddr.
304 * Returns closest match.
306 static struct sock
*sco_get_sock_listen(bdaddr_t
*src
)
308 struct sock
*sk
= NULL
, *sk1
= NULL
;
309 struct hlist_node
*node
;
311 read_lock(&sco_sk_list
.lock
);
313 sk_for_each(sk
, node
, &sco_sk_list
.head
) {
314 if (sk
->sk_state
!= BT_LISTEN
)
318 if (!bacmp(&bt_sk(sk
)->src
, src
))
322 if (!bacmp(&bt_sk(sk
)->src
, BDADDR_ANY
))
326 read_unlock(&sco_sk_list
.lock
);
328 return node
? sk
: sk1
;
331 static void sco_sock_destruct(struct sock
*sk
)
335 skb_queue_purge(&sk
->sk_receive_queue
);
336 skb_queue_purge(&sk
->sk_write_queue
);
339 kfree(sk
->sk_protinfo
);
342 static void sco_sock_cleanup_listen(struct sock
*parent
)
346 BT_DBG("parent %p", parent
);
348 /* Close not yet accepted channels */
349 while ((sk
= bt_accept_dequeue(parent
, NULL
))) {
354 parent
->sk_state
= BT_CLOSED
;
355 parent
->sk_zapped
= 1;
358 /* Kill socket (only if zapped and orphan)
359 * Must be called on unlocked socket.
361 static void sco_sock_kill(struct sock
*sk
)
363 if (!sk
->sk_zapped
|| sk
->sk_socket
)
366 BT_DBG("sk %p state %d", sk
, sk
->sk_state
);
368 /* Kill poor orphan */
369 bt_sock_unlink(&sco_sk_list
, sk
);
370 sock_set_flag(sk
, SOCK_DEAD
);
375 * Must be called on unlocked socket.
377 static void sco_sock_close(struct sock
*sk
)
379 struct sco_conn
*conn
;
381 sco_sock_clear_timer(sk
);
385 conn
= sco_pi(sk
)->conn
;
387 BT_DBG("sk %p state %d conn %p socket %p", sk
, sk
->sk_state
, conn
, sk
->sk_socket
);
389 switch (sk
->sk_state
) {
391 sco_sock_cleanup_listen(sk
);
398 sco_chan_del(sk
, ECONNRESET
);
411 static void sco_sock_init(struct sock
*sk
, struct sock
*parent
)
416 sk
->sk_type
= parent
->sk_type
;
419 static struct sock
*sco_sock_alloc(struct socket
*sock
, int proto
, int prio
)
423 sk
= bt_sock_alloc(sock
, proto
, sizeof(struct sco_pinfo
), prio
);
427 sk_set_owner(sk
, THIS_MODULE
);
429 sk
->sk_destruct
= sco_sock_destruct
;
430 sk
->sk_sndtimeo
= SCO_CONN_TIMEOUT
;
431 sk
->sk_state
= BT_OPEN
;
433 sco_sock_init_timer(sk
);
435 bt_sock_link(&sco_sk_list
, sk
);
439 static int sco_sock_create(struct socket
*sock
, int protocol
)
443 BT_DBG("sock %p", sock
);
445 sock
->state
= SS_UNCONNECTED
;
447 if (sock
->type
!= SOCK_SEQPACKET
)
448 return -ESOCKTNOSUPPORT
;
450 sock
->ops
= &sco_sock_ops
;
452 if (!(sk
= sco_sock_alloc(sock
, protocol
, GFP_KERNEL
)))
455 sco_sock_init(sk
, NULL
);
459 static int sco_sock_bind(struct socket
*sock
, struct sockaddr
*addr
, int addr_len
)
461 struct sockaddr_sco
*sa
= (struct sockaddr_sco
*) addr
;
462 struct sock
*sk
= sock
->sk
;
463 bdaddr_t
*src
= &sa
->sco_bdaddr
;
466 BT_DBG("sk %p %s", sk
, batostr(&sa
->sco_bdaddr
));
468 if (!addr
|| addr
->sa_family
!= AF_BLUETOOTH
)
473 if (sk
->sk_state
!= BT_OPEN
) {
478 write_lock_bh(&sco_sk_list
.lock
);
480 if (bacmp(src
, BDADDR_ANY
) && __sco_get_sock_by_addr(src
)) {
483 /* Save source address */
484 bacpy(&bt_sk(sk
)->src
, &sa
->sco_bdaddr
);
485 sk
->sk_state
= BT_BOUND
;
488 write_unlock_bh(&sco_sk_list
.lock
);
495 static int sco_sock_connect(struct socket
*sock
, struct sockaddr
*addr
, int alen
, int flags
)
497 struct sockaddr_sco
*sa
= (struct sockaddr_sco
*) addr
;
498 struct sock
*sk
= sock
->sk
;
504 if (addr
->sa_family
!= AF_BLUETOOTH
|| alen
< sizeof(struct sockaddr_sco
))
507 if (sk
->sk_state
!= BT_OPEN
&& sk
->sk_state
!= BT_BOUND
)
510 if (sk
->sk_type
!= SOCK_SEQPACKET
)
515 /* Set destination address and psm */
516 bacpy(&bt_sk(sk
)->dst
, &sa
->sco_bdaddr
);
518 if ((err
= sco_connect(sk
)))
521 err
= bt_sock_wait_state(sk
, BT_CONNECTED
,
522 sock_sndtimeo(sk
, flags
& O_NONBLOCK
));
529 static int sco_sock_listen(struct socket
*sock
, int backlog
)
531 struct sock
*sk
= sock
->sk
;
534 BT_DBG("sk %p backlog %d", sk
, backlog
);
538 if (sk
->sk_state
!= BT_BOUND
|| sock
->type
!= SOCK_SEQPACKET
) {
543 sk
->sk_max_ack_backlog
= backlog
;
544 sk
->sk_ack_backlog
= 0;
545 sk
->sk_state
= BT_LISTEN
;
552 static int sco_sock_accept(struct socket
*sock
, struct socket
*newsock
, int flags
)
554 DECLARE_WAITQUEUE(wait
, current
);
555 struct sock
*sk
= sock
->sk
, *ch
;
561 if (sk
->sk_state
!= BT_LISTEN
) {
566 timeo
= sock_rcvtimeo(sk
, flags
& O_NONBLOCK
);
568 BT_DBG("sk %p timeo %ld", sk
, timeo
);
570 /* Wait for an incoming connection. (wake-one). */
571 add_wait_queue_exclusive(sk
->sk_sleep
, &wait
);
572 while (!(ch
= bt_accept_dequeue(sk
, newsock
))) {
573 set_current_state(TASK_INTERRUPTIBLE
);
580 timeo
= schedule_timeout(timeo
);
583 if (sk
->sk_state
!= BT_LISTEN
) {
588 if (signal_pending(current
)) {
589 err
= sock_intr_errno(timeo
);
593 set_current_state(TASK_RUNNING
);
594 remove_wait_queue(sk
->sk_sleep
, &wait
);
599 newsock
->state
= SS_CONNECTED
;
601 BT_DBG("new socket %p", ch
);
608 static int sco_sock_getname(struct socket
*sock
, struct sockaddr
*addr
, int *len
, int peer
)
610 struct sockaddr_sco
*sa
= (struct sockaddr_sco
*) addr
;
611 struct sock
*sk
= sock
->sk
;
613 BT_DBG("sock %p, sk %p", sock
, sk
);
615 addr
->sa_family
= AF_BLUETOOTH
;
616 *len
= sizeof(struct sockaddr_sco
);
619 bacpy(&sa
->sco_bdaddr
, &bt_sk(sk
)->dst
);
621 bacpy(&sa
->sco_bdaddr
, &bt_sk(sk
)->src
);
626 static int sco_sock_sendmsg(struct kiocb
*iocb
, struct socket
*sock
,
627 struct msghdr
*msg
, size_t len
)
629 struct sock
*sk
= sock
->sk
;
632 BT_DBG("sock %p, sk %p", sock
, sk
);
635 return sock_error(sk
);
637 if (msg
->msg_flags
& MSG_OOB
)
642 if (sk
->sk_state
== BT_CONNECTED
)
643 err
= sco_send_frame(sk
, msg
, len
);
651 static int sco_sock_setsockopt(struct socket
*sock
, int level
, int optname
, char __user
*optval
, int optlen
)
653 struct sock
*sk
= sock
->sk
;
670 static int sco_sock_getsockopt(struct socket
*sock
, int level
, int optname
, char __user
*optval
, int __user
*optlen
)
672 struct sock
*sk
= sock
->sk
;
673 struct sco_options opts
;
674 struct sco_conninfo cinfo
;
679 if (get_user(len
, optlen
))
686 if (sk
->sk_state
!= BT_CONNECTED
) {
691 opts
.mtu
= sco_pi(sk
)->conn
->mtu
;
693 BT_DBG("mtu %d", opts
.mtu
);
695 len
= min_t(unsigned int, len
, sizeof(opts
));
696 if (copy_to_user(optval
, (char *)&opts
, len
))
702 if (sk
->sk_state
!= BT_CONNECTED
) {
707 cinfo
.hci_handle
= sco_pi(sk
)->conn
->hcon
->handle
;
709 len
= min_t(unsigned int, len
, sizeof(cinfo
));
710 if (copy_to_user(optval
, (char *)&cinfo
, len
))
724 static int sco_sock_release(struct socket
*sock
)
726 struct sock
*sk
= sock
->sk
;
729 BT_DBG("sock %p, sk %p", sock
, sk
);
736 if (sock_flag(sk
, SOCK_LINGER
) && sk
->sk_lingertime
) {
738 err
= bt_sock_wait_state(sk
, BT_CLOSED
, sk
->sk_lingertime
);
747 static void __sco_chan_add(struct sco_conn
*conn
, struct sock
*sk
, struct sock
*parent
)
749 BT_DBG("conn %p", conn
);
751 sco_pi(sk
)->conn
= conn
;
755 bt_accept_enqueue(parent
, sk
);
759 * Must be called on the locked socket. */
760 static void sco_chan_del(struct sock
*sk
, int err
)
762 struct sco_conn
*conn
;
764 conn
= sco_pi(sk
)->conn
;
766 BT_DBG("sk %p, conn %p, err %d", sk
, conn
, err
);
771 sco_pi(sk
)->conn
= NULL
;
772 sco_conn_unlock(conn
);
773 hci_conn_put(conn
->hcon
);
776 sk
->sk_state
= BT_CLOSED
;
778 sk
->sk_state_change(sk
);
783 static void sco_conn_ready(struct sco_conn
*conn
)
785 struct sock
*parent
, *sk
;
787 BT_DBG("conn %p", conn
);
791 if ((sk
= conn
->sk
)) {
792 sco_sock_clear_timer(sk
);
794 sk
->sk_state
= BT_CONNECTED
;
795 sk
->sk_state_change(sk
);
798 parent
= sco_get_sock_listen(conn
->src
);
802 bh_lock_sock(parent
);
804 sk
= sco_sock_alloc(NULL
, BTPROTO_SCO
, GFP_ATOMIC
);
806 bh_unlock_sock(parent
);
810 sco_sock_init(sk
, parent
);
812 bacpy(&bt_sk(sk
)->src
, conn
->src
);
813 bacpy(&bt_sk(sk
)->dst
, conn
->dst
);
815 hci_conn_hold(conn
->hcon
);
816 __sco_chan_add(conn
, sk
, parent
);
818 sk
->sk_state
= BT_CONNECTED
;
821 parent
->sk_data_ready(parent
, 1);
823 bh_unlock_sock(parent
);
827 sco_conn_unlock(conn
);
830 /* ----- SCO interface with lower layer (HCI) ----- */
831 static int sco_connect_ind(struct hci_dev
*hdev
, bdaddr_t
*bdaddr
, __u8 type
)
833 BT_DBG("hdev %s, bdaddr %s", hdev
->name
, batostr(bdaddr
));
835 /* Always accept connection */
836 return HCI_LM_ACCEPT
;
839 static int sco_connect_cfm(struct hci_conn
*hcon
, __u8 status
)
841 BT_DBG("hcon %p bdaddr %s status %d", hcon
, batostr(&hcon
->dst
), status
);
843 if (hcon
->type
!= SCO_LINK
)
847 struct sco_conn
*conn
;
849 conn
= sco_conn_add(hcon
, status
);
851 sco_conn_ready(conn
);
853 sco_conn_del(hcon
, bt_err(status
));
858 static int sco_disconn_ind(struct hci_conn
*hcon
, __u8 reason
)
860 BT_DBG("hcon %p reason %d", hcon
, reason
);
862 if (hcon
->type
!= SCO_LINK
)
865 sco_conn_del(hcon
, bt_err(reason
));
869 static int sco_recv_scodata(struct hci_conn
*hcon
, struct sk_buff
*skb
)
871 struct sco_conn
*conn
= hcon
->sco_data
;
876 BT_DBG("conn %p len %d", conn
, skb
->len
);
879 sco_recv_frame(conn
, skb
);
888 /* ---- Proc fs support ---- */
889 #ifdef CONFIG_PROC_FS
890 static void *sco_seq_start(struct seq_file
*seq
, loff_t
*pos
)
893 struct hlist_node
*node
;
896 read_lock_bh(&sco_sk_list
.lock
);
898 sk_for_each(sk
, node
, &sco_sk_list
.head
)
906 static void *sco_seq_next(struct seq_file
*seq
, void *e
, loff_t
*pos
)
913 static void sco_seq_stop(struct seq_file
*seq
, void *e
)
915 read_unlock_bh(&sco_sk_list
.lock
);
918 static int sco_seq_show(struct seq_file
*seq
, void *e
)
921 seq_printf(seq
, "%s %s %d\n",
922 batostr(&bt_sk(sk
)->src
), batostr(&bt_sk(sk
)->dst
), sk
->sk_state
);
926 static struct seq_operations sco_seq_ops
= {
927 .start
= sco_seq_start
,
928 .next
= sco_seq_next
,
929 .stop
= sco_seq_stop
,
933 static int sco_seq_open(struct inode
*inode
, struct file
*file
)
935 return seq_open(file
, &sco_seq_ops
);
938 static struct file_operations sco_seq_fops
= {
939 .owner
= THIS_MODULE
,
940 .open
= sco_seq_open
,
943 .release
= seq_release
,
946 static int __init
sco_proc_init(void)
948 struct proc_dir_entry
*p
= create_proc_entry("sco", S_IRUGO
, proc_bt
);
951 p
->owner
= THIS_MODULE
;
952 p
->proc_fops
= &sco_seq_fops
;
956 static void __exit
sco_proc_cleanup(void)
958 remove_proc_entry("sco", proc_bt
);
961 #else /* CONFIG_PROC_FS */
963 static int __init
sco_proc_init(void)
968 static void __exit
sco_proc_cleanup(void)
972 #endif /* CONFIG_PROC_FS */
974 static struct proto_ops sco_sock_ops
= {
975 .family
= PF_BLUETOOTH
,
976 .owner
= THIS_MODULE
,
977 .release
= sco_sock_release
,
978 .bind
= sco_sock_bind
,
979 .connect
= sco_sock_connect
,
980 .listen
= sco_sock_listen
,
981 .accept
= sco_sock_accept
,
982 .getname
= sco_sock_getname
,
983 .sendmsg
= sco_sock_sendmsg
,
984 .recvmsg
= bt_sock_recvmsg
,
985 .poll
= bt_sock_poll
,
986 .ioctl
= sock_no_ioctl
,
987 .mmap
= sock_no_mmap
,
988 .socketpair
= sock_no_socketpair
,
989 .shutdown
= sock_no_shutdown
,
990 .setsockopt
= sco_sock_setsockopt
,
991 .getsockopt
= sco_sock_getsockopt
994 static struct net_proto_family sco_sock_family_ops
= {
995 .family
= PF_BLUETOOTH
,
996 .owner
= THIS_MODULE
,
997 .create
= sco_sock_create
,
1000 static struct hci_proto sco_hci_proto
= {
1002 .id
= HCI_PROTO_SCO
,
1003 .connect_ind
= sco_connect_ind
,
1004 .connect_cfm
= sco_connect_cfm
,
1005 .disconn_ind
= sco_disconn_ind
,
1006 .recv_scodata
= sco_recv_scodata
1009 static int __init
sco_init(void)
1013 if ((err
= bt_sock_register(BTPROTO_SCO
, &sco_sock_family_ops
))) {
1014 BT_ERR("SCO socket registration failed");
1018 if ((err
= hci_register_proto(&sco_hci_proto
))) {
1019 BT_ERR("SCO protocol registration failed");
1025 BT_INFO("SCO (Voice Link) ver %s", VERSION
);
1026 BT_INFO("SCO socket layer initialized");
1031 static void __exit
sco_exit(void)
1037 /* Unregister socket, protocol and notifier */
1038 if ((err
= bt_sock_unregister(BTPROTO_SCO
)))
1039 BT_ERR("SCO socket unregistration failed. %d", err
);
1041 if ((err
= hci_unregister_proto(&sco_hci_proto
)))
1042 BT_ERR("SCO protocol unregistration failed. %d", err
);
1045 module_init(sco_init
);
1046 module_exit(sco_exit
);
1048 MODULE_AUTHOR("Maxim Krasnyansky <maxk@qualcomm.com>");
1049 MODULE_DESCRIPTION("Bluetooth SCO ver " VERSION
);
1050 MODULE_VERSION(VERSION
);
1051 MODULE_LICENSE("GPL");
1052 MODULE_ALIAS("bt-proto-2");