Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
bf0de3e9
Commit
bf0de3e9
authored
Apr 28, 2009
by
David S. Miller
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
git://git.kernel.org/pub/scm/linux/kernel/git/holtmann/bluetooth-2.6
parents
942e4a2b
3fdca1e1
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
61 additions
and
31 deletions
+61
-31
include/net/bluetooth/hci.h
include/net/bluetooth/hci.h
+1
-0
include/net/bluetooth/hci_core.h
include/net/bluetooth/hci_core.h
+5
-3
net/bluetooth/hci_conn.c
net/bluetooth/hci_conn.c
+4
-6
net/bluetooth/hci_event.c
net/bluetooth/hci_event.c
+35
-1
net/bluetooth/hci_sysfs.c
net/bluetooth/hci_sysfs.c
+16
-21
No files found.
include/net/bluetooth/hci.h
View file @
bf0de3e9
...
@@ -101,6 +101,7 @@ enum {
...
@@ -101,6 +101,7 @@ enum {
/* HCI timeouts */
/* HCI timeouts */
#define HCI_CONNECT_TIMEOUT (40000)
/* 40 seconds */
#define HCI_CONNECT_TIMEOUT (40000)
/* 40 seconds */
#define HCI_DISCONN_TIMEOUT (2000)
/* 2 seconds */
#define HCI_DISCONN_TIMEOUT (2000)
/* 2 seconds */
#define HCI_PAIRING_TIMEOUT (60000)
/* 60 seconds */
#define HCI_IDLE_TIMEOUT (6000)
/* 6 seconds */
#define HCI_IDLE_TIMEOUT (6000)
/* 6 seconds */
#define HCI_INIT_TIMEOUT (10000)
/* 10 seconds */
#define HCI_INIT_TIMEOUT (10000)
/* 10 seconds */
...
...
include/net/bluetooth/hci_core.h
View file @
bf0de3e9
...
@@ -171,6 +171,7 @@ struct hci_conn {
...
@@ -171,6 +171,7 @@ struct hci_conn {
__u8
auth_type
;
__u8
auth_type
;
__u8
sec_level
;
__u8
sec_level
;
__u8
power_save
;
__u8
power_save
;
__u16
disc_timeout
;
unsigned
long
pend
;
unsigned
long
pend
;
unsigned
int
sent
;
unsigned
int
sent
;
...
@@ -180,7 +181,8 @@ struct hci_conn {
...
@@ -180,7 +181,8 @@ struct hci_conn {
struct
timer_list
disc_timer
;
struct
timer_list
disc_timer
;
struct
timer_list
idle_timer
;
struct
timer_list
idle_timer
;
struct
work_struct
work
;
struct
work_struct
work_add
;
struct
work_struct
work_del
;
struct
device
dev
;
struct
device
dev
;
...
@@ -348,9 +350,9 @@ static inline void hci_conn_put(struct hci_conn *conn)
...
@@ -348,9 +350,9 @@ static inline void hci_conn_put(struct hci_conn *conn)
if
(
conn
->
type
==
ACL_LINK
)
{
if
(
conn
->
type
==
ACL_LINK
)
{
del_timer
(
&
conn
->
idle_timer
);
del_timer
(
&
conn
->
idle_timer
);
if
(
conn
->
state
==
BT_CONNECTED
)
{
if
(
conn
->
state
==
BT_CONNECTED
)
{
timeo
=
msecs_to_jiffies
(
HCI_DISCONN_TIMEOUT
);
timeo
=
msecs_to_jiffies
(
conn
->
disc_timeout
);
if
(
!
conn
->
out
)
if
(
!
conn
->
out
)
timeo
*=
5
;
timeo
*=
2
;
}
else
}
else
timeo
=
msecs_to_jiffies
(
10
);
timeo
=
msecs_to_jiffies
(
10
);
}
else
}
else
...
...
net/bluetooth/hci_conn.c
View file @
bf0de3e9
...
@@ -215,6 +215,7 @@ struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst)
...
@@ -215,6 +215,7 @@ struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst)
conn
->
state
=
BT_OPEN
;
conn
->
state
=
BT_OPEN
;
conn
->
power_save
=
1
;
conn
->
power_save
=
1
;
conn
->
disc_timeout
=
HCI_DISCONN_TIMEOUT
;
switch
(
type
)
{
switch
(
type
)
{
case
ACL_LINK
:
case
ACL_LINK
:
...
@@ -424,12 +425,9 @@ int hci_conn_security(struct hci_conn *conn, __u8 sec_level, __u8 auth_type)
...
@@ -424,12 +425,9 @@ int hci_conn_security(struct hci_conn *conn, __u8 sec_level, __u8 auth_type)
if
(
sec_level
==
BT_SECURITY_SDP
)
if
(
sec_level
==
BT_SECURITY_SDP
)
return
1
;
return
1
;
if
(
sec_level
==
BT_SECURITY_LOW
)
{
if
(
sec_level
==
BT_SECURITY_LOW
&&
if
(
conn
->
ssp_mode
>
0
&&
conn
->
hdev
->
ssp_mode
>
0
)
(
!
conn
->
ssp_mode
||
!
conn
->
hdev
->
ssp_mode
))
return
hci_conn_auth
(
conn
,
sec_level
,
auth_type
);
return
1
;
else
return
1
;
}
if
(
conn
->
link_mode
&
HCI_LM_ENCRYPT
)
if
(
conn
->
link_mode
&
HCI_LM_ENCRYPT
)
return
hci_conn_auth
(
conn
,
sec_level
,
auth_type
);
return
hci_conn_auth
(
conn
,
sec_level
,
auth_type
);
...
...
net/bluetooth/hci_event.c
View file @
bf0de3e9
...
@@ -883,6 +883,7 @@ static inline void hci_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *s
...
@@ -883,6 +883,7 @@ static inline void hci_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *s
if
(
conn
->
type
==
ACL_LINK
)
{
if
(
conn
->
type
==
ACL_LINK
)
{
conn
->
state
=
BT_CONFIG
;
conn
->
state
=
BT_CONFIG
;
hci_conn_hold
(
conn
);
hci_conn_hold
(
conn
);
conn
->
disc_timeout
=
HCI_DISCONN_TIMEOUT
;
}
else
}
else
conn
->
state
=
BT_CONNECTED
;
conn
->
state
=
BT_CONNECTED
;
...
@@ -1063,9 +1064,14 @@ static inline void hci_auth_complete_evt(struct hci_dev *hdev, struct sk_buff *s
...
@@ -1063,9 +1064,14 @@ static inline void hci_auth_complete_evt(struct hci_dev *hdev, struct sk_buff *s
hci_proto_connect_cfm
(
conn
,
ev
->
status
);
hci_proto_connect_cfm
(
conn
,
ev
->
status
);
hci_conn_put
(
conn
);
hci_conn_put
(
conn
);
}
}
}
else
}
else
{
hci_auth_cfm
(
conn
,
ev
->
status
);
hci_auth_cfm
(
conn
,
ev
->
status
);
hci_conn_hold
(
conn
);
conn
->
disc_timeout
=
HCI_DISCONN_TIMEOUT
;
hci_conn_put
(
conn
);
}
if
(
test_bit
(
HCI_CONN_ENCRYPT_PEND
,
&
conn
->
pend
))
{
if
(
test_bit
(
HCI_CONN_ENCRYPT_PEND
,
&
conn
->
pend
))
{
if
(
!
ev
->
status
)
{
if
(
!
ev
->
status
)
{
struct
hci_cp_set_conn_encrypt
cp
;
struct
hci_cp_set_conn_encrypt
cp
;
...
@@ -1479,7 +1485,21 @@ static inline void hci_mode_change_evt(struct hci_dev *hdev, struct sk_buff *skb
...
@@ -1479,7 +1485,21 @@ static inline void hci_mode_change_evt(struct hci_dev *hdev, struct sk_buff *skb
static
inline
void
hci_pin_code_request_evt
(
struct
hci_dev
*
hdev
,
struct
sk_buff
*
skb
)
static
inline
void
hci_pin_code_request_evt
(
struct
hci_dev
*
hdev
,
struct
sk_buff
*
skb
)
{
{
struct
hci_ev_pin_code_req
*
ev
=
(
void
*
)
skb
->
data
;
struct
hci_conn
*
conn
;
BT_DBG
(
"%s"
,
hdev
->
name
);
BT_DBG
(
"%s"
,
hdev
->
name
);
hci_dev_lock
(
hdev
);
conn
=
hci_conn_hash_lookup_ba
(
hdev
,
ACL_LINK
,
&
ev
->
bdaddr
);
if
(
conn
)
{
hci_conn_hold
(
conn
);
conn
->
disc_timeout
=
HCI_PAIRING_TIMEOUT
;
hci_conn_put
(
conn
);
}
hci_dev_unlock
(
hdev
);
}
}
static
inline
void
hci_link_key_request_evt
(
struct
hci_dev
*
hdev
,
struct
sk_buff
*
skb
)
static
inline
void
hci_link_key_request_evt
(
struct
hci_dev
*
hdev
,
struct
sk_buff
*
skb
)
...
@@ -1489,7 +1509,21 @@ static inline void hci_link_key_request_evt(struct hci_dev *hdev, struct sk_buff
...
@@ -1489,7 +1509,21 @@ static inline void hci_link_key_request_evt(struct hci_dev *hdev, struct sk_buff
static
inline
void
hci_link_key_notify_evt
(
struct
hci_dev
*
hdev
,
struct
sk_buff
*
skb
)
static
inline
void
hci_link_key_notify_evt
(
struct
hci_dev
*
hdev
,
struct
sk_buff
*
skb
)
{
{
struct
hci_ev_link_key_notify
*
ev
=
(
void
*
)
skb
->
data
;
struct
hci_conn
*
conn
;
BT_DBG
(
"%s"
,
hdev
->
name
);
BT_DBG
(
"%s"
,
hdev
->
name
);
hci_dev_lock
(
hdev
);
conn
=
hci_conn_hash_lookup_ba
(
hdev
,
ACL_LINK
,
&
ev
->
bdaddr
);
if
(
conn
)
{
hci_conn_hold
(
conn
);
conn
->
disc_timeout
=
HCI_DISCONN_TIMEOUT
;
hci_conn_put
(
conn
);
}
hci_dev_unlock
(
hdev
);
}
}
static
inline
void
hci_clock_offset_evt
(
struct
hci_dev
*
hdev
,
struct
sk_buff
*
skb
)
static
inline
void
hci_clock_offset_evt
(
struct
hci_dev
*
hdev
,
struct
sk_buff
*
skb
)
...
...
net/bluetooth/hci_sysfs.c
View file @
bf0de3e9
...
@@ -9,8 +9,7 @@
...
@@ -9,8 +9,7 @@
struct
class
*
bt_class
=
NULL
;
struct
class
*
bt_class
=
NULL
;
EXPORT_SYMBOL_GPL
(
bt_class
);
EXPORT_SYMBOL_GPL
(
bt_class
);
static
struct
workqueue_struct
*
btaddconn
;
static
struct
workqueue_struct
*
bluetooth
;
static
struct
workqueue_struct
*
btdelconn
;
static
inline
char
*
link_typetostr
(
int
type
)
static
inline
char
*
link_typetostr
(
int
type
)
{
{
...
@@ -88,9 +87,10 @@ static struct device_type bt_link = {
...
@@ -88,9 +87,10 @@ static struct device_type bt_link = {
static
void
add_conn
(
struct
work_struct
*
work
)
static
void
add_conn
(
struct
work_struct
*
work
)
{
{
struct
hci_conn
*
conn
=
container_of
(
work
,
struct
hci_conn
,
work
);
struct
hci_conn
*
conn
=
container_of
(
work
,
struct
hci_conn
,
work
_add
);
flush_workqueue
(
btdelconn
);
/* ensure previous add/del is complete */
flush_workqueue
(
bluetooth
);
if
(
device_add
(
&
conn
->
dev
)
<
0
)
{
if
(
device_add
(
&
conn
->
dev
)
<
0
)
{
BT_ERR
(
"Failed to register connection device"
);
BT_ERR
(
"Failed to register connection device"
);
...
@@ -114,9 +114,9 @@ void hci_conn_add_sysfs(struct hci_conn *conn)
...
@@ -114,9 +114,9 @@ void hci_conn_add_sysfs(struct hci_conn *conn)
device_initialize
(
&
conn
->
dev
);
device_initialize
(
&
conn
->
dev
);
INIT_WORK
(
&
conn
->
work
,
add_conn
);
INIT_WORK
(
&
conn
->
work
_add
,
add_conn
);
queue_work
(
b
taddconn
,
&
conn
->
work
);
queue_work
(
b
luetooth
,
&
conn
->
work_add
);
}
}
/*
/*
...
@@ -131,9 +131,12 @@ static int __match_tty(struct device *dev, void *data)
...
@@ -131,9 +131,12 @@ static int __match_tty(struct device *dev, void *data)
static
void
del_conn
(
struct
work_struct
*
work
)
static
void
del_conn
(
struct
work_struct
*
work
)
{
{
struct
hci_conn
*
conn
=
container_of
(
work
,
struct
hci_conn
,
work
);
struct
hci_conn
*
conn
=
container_of
(
work
,
struct
hci_conn
,
work
_del
);
struct
hci_dev
*
hdev
=
conn
->
hdev
;
struct
hci_dev
*
hdev
=
conn
->
hdev
;
/* ensure previous add/del is complete */
flush_workqueue
(
bluetooth
);
while
(
1
)
{
while
(
1
)
{
struct
device
*
dev
;
struct
device
*
dev
;
...
@@ -156,9 +159,9 @@ void hci_conn_del_sysfs(struct hci_conn *conn)
...
@@ -156,9 +159,9 @@ void hci_conn_del_sysfs(struct hci_conn *conn)
if
(
!
device_is_registered
(
&
conn
->
dev
))
if
(
!
device_is_registered
(
&
conn
->
dev
))
return
;
return
;
INIT_WORK
(
&
conn
->
work
,
del_conn
);
INIT_WORK
(
&
conn
->
work
_del
,
del_conn
);
queue_work
(
b
tdelconn
,
&
conn
->
work
);
queue_work
(
b
luetooth
,
&
conn
->
work_del
);
}
}
static
inline
char
*
host_typetostr
(
int
type
)
static
inline
char
*
host_typetostr
(
int
type
)
...
@@ -435,20 +438,13 @@ void hci_unregister_sysfs(struct hci_dev *hdev)
...
@@ -435,20 +438,13 @@ void hci_unregister_sysfs(struct hci_dev *hdev)
int
__init
bt_sysfs_init
(
void
)
int
__init
bt_sysfs_init
(
void
)
{
{
btaddconn
=
create_singlethread_workqueue
(
"btaddconn"
);
bluetooth
=
create_singlethread_workqueue
(
"bluetooth"
);
if
(
!
btaddconn
)
if
(
!
bluetooth
)
return
-
ENOMEM
;
btdelconn
=
create_singlethread_workqueue
(
"btdelconn"
);
if
(
!
btdelconn
)
{
destroy_workqueue
(
btaddconn
);
return
-
ENOMEM
;
return
-
ENOMEM
;
}
bt_class
=
class_create
(
THIS_MODULE
,
"bluetooth"
);
bt_class
=
class_create
(
THIS_MODULE
,
"bluetooth"
);
if
(
IS_ERR
(
bt_class
))
{
if
(
IS_ERR
(
bt_class
))
{
destroy_workqueue
(
btdelconn
);
destroy_workqueue
(
bluetooth
);
destroy_workqueue
(
btaddconn
);
return
PTR_ERR
(
bt_class
);
return
PTR_ERR
(
bt_class
);
}
}
...
@@ -457,8 +453,7 @@ int __init bt_sysfs_init(void)
...
@@ -457,8 +453,7 @@ int __init bt_sysfs_init(void)
void
bt_sysfs_cleanup
(
void
)
void
bt_sysfs_cleanup
(
void
)
{
{
destroy_workqueue
(
btaddconn
);
destroy_workqueue
(
bluetooth
);
destroy_workqueue
(
btdelconn
);
class_destroy
(
bt_class
);
class_destroy
(
bt_class
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment