Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
a7c2b7ea
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看板
提交
a7c2b7ea
编写于
11月 05, 2021
作者:
J
Jiri Kosina
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'for-5.16/u2fzero' into for-linus
- support for new revision of the NitroKey U2F device firmware (Andrej Shadura)
上级
0cc82d61
6748031a
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
39 addition
and
9 deletion
+39
-9
drivers/hid/hid-ids.h
drivers/hid/hid-ids.h
+3
-0
drivers/hid/hid-u2fzero.c
drivers/hid/hid-u2fzero.c
+36
-9
未找到文件。
drivers/hid/hid-ids.h
浏览文件 @
a7c2b7ea
...
...
@@ -289,6 +289,9 @@
#define USB_DEVICE_ID_CJTOUCH_MULTI_TOUCH_0020 0x0020
#define USB_DEVICE_ID_CJTOUCH_MULTI_TOUCH_0040 0x0040
#define USB_VENDOR_ID_CLAY_LOGIC 0x20a0
#define USB_DEVICE_ID_NITROKEY_U2F 0x4287
#define USB_VENDOR_ID_CMEDIA 0x0d8c
#define USB_DEVICE_ID_CM109 0x000e
#define USB_DEVICE_ID_CMEDIA_HS100B 0x0014
...
...
drivers/hid/hid-u2fzero.c
浏览文件 @
a7c2b7ea
...
...
@@ -26,6 +26,30 @@
#define HID_REPORT_SIZE 64
enum
hw_revision
{
HW_U2FZERO
,
HW_NITROKEY_U2F
,
};
struct
hw_revision_config
{
u8
rng_cmd
;
u8
wink_cmd
;
const
char
*
name
;
};
static
const
struct
hw_revision_config
hw_configs
[]
=
{
[
HW_U2FZERO
]
=
{
.
rng_cmd
=
0x21
,
.
wink_cmd
=
0x24
,
.
name
=
"U2F Zero"
,
},
[
HW_NITROKEY_U2F
]
=
{
.
rng_cmd
=
0xc0
,
.
wink_cmd
=
0xc2
,
.
name
=
"NitroKey U2F"
,
},
};
/* We only use broadcast (CID-less) messages */
#define CID_BROADCAST 0xffffffff
...
...
@@ -52,10 +76,6 @@ struct u2f_hid_report {
#define U2F_HID_MSG_LEN(f) (size_t)(((f).init.bcnth << 8) + (f).init.bcntl)
/* Custom extensions to the U2FHID protocol */
#define U2F_CUSTOM_GET_RNG 0x21
#define U2F_CUSTOM_WINK 0x24
struct
u2fzero_device
{
struct
hid_device
*
hdev
;
struct
urb
*
urb
;
/* URB for the RNG data */
...
...
@@ -67,6 +87,7 @@ struct u2fzero_device {
u8
*
buf_in
;
struct
mutex
lock
;
bool
present
;
kernel_ulong_t
hw_revision
;
};
static
int
u2fzero_send
(
struct
u2fzero_device
*
dev
,
struct
u2f_hid_report
*
req
)
...
...
@@ -154,7 +175,7 @@ static int u2fzero_blink(struct led_classdev *ldev)
.
report_type
=
0
,
.
msg
.
cid
=
CID_BROADCAST
,
.
msg
.
init
=
{
.
cmd
=
U2F_CUSTOM_WINK
,
.
cmd
=
hw_configs
[
dev
->
hw_revision
].
wink_cmd
,
.
bcnth
=
0
,
.
bcntl
=
0
,
.
data
=
{
0
},
...
...
@@ -182,7 +203,7 @@ static int u2fzero_rng_read(struct hwrng *rng, void *data,
.
report_type
=
0
,
.
msg
.
cid
=
CID_BROADCAST
,
.
msg
.
init
=
{
.
cmd
=
U2F_CUSTOM_GET_RNG
,
.
cmd
=
hw_configs
[
dev
->
hw_revision
].
rng_cmd
,
.
bcnth
=
0
,
.
bcntl
=
0
,
.
data
=
{
0
},
...
...
@@ -297,6 +318,8 @@ static int u2fzero_probe(struct hid_device *hdev,
if
(
dev
==
NULL
)
return
-
ENOMEM
;
dev
->
hw_revision
=
id
->
driver_data
;
dev
->
buf_out
=
devm_kmalloc
(
&
hdev
->
dev
,
sizeof
(
struct
u2f_hid_report
),
GFP_KERNEL
);
if
(
dev
->
buf_out
==
NULL
)
...
...
@@ -331,7 +354,7 @@ static int u2fzero_probe(struct hid_device *hdev,
return
ret
;
}
hid_info
(
hdev
,
"
U2F Zero LED initialised
\n
"
);
hid_info
(
hdev
,
"
%s LED initialised
\n
"
,
hw_configs
[
dev
->
hw_revision
].
name
);
ret
=
u2fzero_init_hwrng
(
dev
,
minor
);
if
(
ret
)
{
...
...
@@ -339,7 +362,7 @@ static int u2fzero_probe(struct hid_device *hdev,
return
ret
;
}
hid_info
(
hdev
,
"
U2F Zero RNG initialised
\n
"
);
hid_info
(
hdev
,
"
%s RNG initialised
\n
"
,
hw_configs
[
dev
->
hw_revision
].
name
);
return
0
;
}
...
...
@@ -359,7 +382,11 @@ static void u2fzero_remove(struct hid_device *hdev)
static
const
struct
hid_device_id
u2fzero_table
[]
=
{
{
HID_USB_DEVICE
(
USB_VENDOR_ID_CYGNAL
,
USB_DEVICE_ID_U2F_ZERO
)
},
USB_DEVICE_ID_U2F_ZERO
),
.
driver_data
=
HW_U2FZERO
},
{
HID_USB_DEVICE
(
USB_VENDOR_ID_CLAY_LOGIC
,
USB_DEVICE_ID_NITROKEY_U2F
),
.
driver_data
=
HW_NITROKEY_U2F
},
{
}
};
MODULE_DEVICE_TABLE
(
hid
,
u2fzero_table
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录