Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
bf0de3e9
K
Kernel
项目概览
openeuler
/
Kernel
1 年多 前同步成功
通知
8
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
bf0de3e9
编写于
4月 28, 2009
作者:
D
David S. Miller
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' of
git://git.kernel.org/pub/scm/linux/kernel/git/holtmann/bluetooth-2.6
上级
942e4a2b
3fdca1e1
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
61 addition
and
31 deletion
+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
未找到文件。
include/net/bluetooth/hci.h
浏览文件 @
bf0de3e9
...
...
@@ -101,6 +101,7 @@ enum {
/* HCI timeouts */
#define HCI_CONNECT_TIMEOUT (40000)
/* 40 seconds */
#define HCI_DISCONN_TIMEOUT (2000)
/* 2 seconds */
#define HCI_PAIRING_TIMEOUT (60000)
/* 60 seconds */
#define HCI_IDLE_TIMEOUT (6000)
/* 6 seconds */
#define HCI_INIT_TIMEOUT (10000)
/* 10 seconds */
...
...
include/net/bluetooth/hci_core.h
浏览文件 @
bf0de3e9
...
...
@@ -171,6 +171,7 @@ struct hci_conn {
__u8
auth_type
;
__u8
sec_level
;
__u8
power_save
;
__u16
disc_timeout
;
unsigned
long
pend
;
unsigned
int
sent
;
...
...
@@ -180,7 +181,8 @@ struct hci_conn {
struct
timer_list
disc_timer
;
struct
timer_list
idle_timer
;
struct
work_struct
work
;
struct
work_struct
work_add
;
struct
work_struct
work_del
;
struct
device
dev
;
...
...
@@ -348,9 +350,9 @@ static inline void hci_conn_put(struct hci_conn *conn)
if
(
conn
->
type
==
ACL_LINK
)
{
del_timer
(
&
conn
->
idle_timer
);
if
(
conn
->
state
==
BT_CONNECTED
)
{
timeo
=
msecs_to_jiffies
(
HCI_DISCONN_TIMEOUT
);
timeo
=
msecs_to_jiffies
(
conn
->
disc_timeout
);
if
(
!
conn
->
out
)
timeo
*=
5
;
timeo
*=
2
;
}
else
timeo
=
msecs_to_jiffies
(
10
);
}
else
...
...
net/bluetooth/hci_conn.c
浏览文件 @
bf0de3e9
...
...
@@ -215,6 +215,7 @@ struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst)
conn
->
state
=
BT_OPEN
;
conn
->
power_save
=
1
;
conn
->
disc_timeout
=
HCI_DISCONN_TIMEOUT
;
switch
(
type
)
{
case
ACL_LINK
:
...
...
@@ -424,12 +425,9 @@ int hci_conn_security(struct hci_conn *conn, __u8 sec_level, __u8 auth_type)
if
(
sec_level
==
BT_SECURITY_SDP
)
return
1
;
if
(
sec_level
==
BT_SECURITY_LOW
)
{
if
(
conn
->
ssp_mode
>
0
&&
conn
->
hdev
->
ssp_mode
>
0
)
return
hci_conn_auth
(
conn
,
sec_level
,
auth_type
);
else
return
1
;
}
if
(
sec_level
==
BT_SECURITY_LOW
&&
(
!
conn
->
ssp_mode
||
!
conn
->
hdev
->
ssp_mode
))
return
1
;
if
(
conn
->
link_mode
&
HCI_LM_ENCRYPT
)
return
hci_conn_auth
(
conn
,
sec_level
,
auth_type
);
...
...
net/bluetooth/hci_event.c
浏览文件 @
bf0de3e9
...
...
@@ -883,6 +883,7 @@ static inline void hci_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *s
if
(
conn
->
type
==
ACL_LINK
)
{
conn
->
state
=
BT_CONFIG
;
hci_conn_hold
(
conn
);
conn
->
disc_timeout
=
HCI_DISCONN_TIMEOUT
;
}
else
conn
->
state
=
BT_CONNECTED
;
...
...
@@ -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_conn_put
(
conn
);
}
}
else
}
else
{
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
(
!
ev
->
status
)
{
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
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
);
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
)
...
...
@@ -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
)
{
struct
hci_ev_link_key_notify
*
ev
=
(
void
*
)
skb
->
data
;
struct
hci_conn
*
conn
;
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
)
...
...
net/bluetooth/hci_sysfs.c
浏览文件 @
bf0de3e9
...
...
@@ -9,8 +9,7 @@
struct
class
*
bt_class
=
NULL
;
EXPORT_SYMBOL_GPL
(
bt_class
);
static
struct
workqueue_struct
*
btaddconn
;
static
struct
workqueue_struct
*
btdelconn
;
static
struct
workqueue_struct
*
bluetooth
;
static
inline
char
*
link_typetostr
(
int
type
)
{
...
...
@@ -88,9 +87,10 @@ static struct device_type bt_link = {
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
)
{
BT_ERR
(
"Failed to register connection device"
);
...
...
@@ -114,9 +114,9 @@ void hci_conn_add_sysfs(struct hci_conn *conn)
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)
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
;
/* ensure previous add/del is complete */
flush_workqueue
(
bluetooth
);
while
(
1
)
{
struct
device
*
dev
;
...
...
@@ -156,9 +159,9 @@ void hci_conn_del_sysfs(struct hci_conn *conn)
if
(
!
device_is_registered
(
&
conn
->
dev
))
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
)
...
...
@@ -435,20 +438,13 @@ void hci_unregister_sysfs(struct hci_dev *hdev)
int
__init
bt_sysfs_init
(
void
)
{
btaddconn
=
create_singlethread_workqueue
(
"btaddconn"
);
if
(
!
btaddconn
)
return
-
ENOMEM
;
btdelconn
=
create_singlethread_workqueue
(
"btdelconn"
);
if
(
!
btdelconn
)
{
destroy_workqueue
(
btaddconn
);
bluetooth
=
create_singlethread_workqueue
(
"bluetooth"
);
if
(
!
bluetooth
)
return
-
ENOMEM
;
}
bt_class
=
class_create
(
THIS_MODULE
,
"bluetooth"
);
if
(
IS_ERR
(
bt_class
))
{
destroy_workqueue
(
btdelconn
);
destroy_workqueue
(
btaddconn
);
destroy_workqueue
(
bluetooth
);
return
PTR_ERR
(
bt_class
);
}
...
...
@@ -457,8 +453,7 @@ int __init bt_sysfs_init(void)
void
bt_sysfs_cleanup
(
void
)
{
destroy_workqueue
(
btaddconn
);
destroy_workqueue
(
btdelconn
);
destroy_workqueue
(
bluetooth
);
class_destroy
(
bt_class
);
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录