Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
ada39630
cloud-kernel
项目概览
openanolis
/
cloud-kernel
大约 1 年 前同步成功
通知
158
Star
36
Fork
7
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
10
列表
看板
标记
里程碑
合并请求
2
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
cloud-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
10
Issue
10
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
ada39630
编写于
3月 21, 2010
作者:
M
Mauro Carvalho Chehab
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
V4L/DVB: ir-core/saa7134: Move ir keyup/keydown code to the ir-core
Signed-off-by:
N
Mauro Carvalho Chehab
<
mchehab@redhat.com
>
上级
6660de56
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
61 addition
and
44 deletion
+61
-44
drivers/media/IR/ir-nec-decoder.c
drivers/media/IR/ir-nec-decoder.c
+58
-32
drivers/media/video/saa7134/saa7134-input.c
drivers/media/video/saa7134/saa7134-input.c
+1
-11
include/media/ir-core.h
include/media/ir-core.h
+2
-1
未找到文件。
drivers/media/IR/ir-nec-decoder.c
浏览文件 @
ada39630
...
...
@@ -30,37 +30,35 @@
#define MIN_BIT0_TIME 360000
#define MAX_BIT0_TIME 760000
/** Decode NEC pulsecode. This code can take up to 76.5 ms to run.
Unfortunately, using IRQ to decode pulse didn't work, since it uses
a pulse train of 38KHz. This means one pulse on each 52 us
*/
int
ir_nec_decode
(
struct
input_dev
*
input_dev
,
struct
ir_raw_event
*
evs
,
int
len
)
/**
* __ir_nec_decode() - Decode one NEC pulsecode
* @input_dev: the struct input_dev descriptor of the device
* @evs: event array with type/duration of pulse/space
* @len: length of the array
* @pos: position to start seeking for a code
* This function returns the decoded ircode or -EINVAL if no pulse got decoded
*/
static
int
__ir_nec_decode
(
struct
input_dev
*
input_dev
,
struct
ir_raw_event
*
evs
,
int
len
,
int
*
pos
)
{
int
i
,
count
=
-
1
;
int
count
=
-
1
;
int
ircode
=
0
,
not_code
=
0
;
#if 0
/* Needed only after porting the event code to the decoder */
struct ir_input_dev *ir = input_get_drvdata(input_dev);
#endif
/* Be sure that the first event is an start one and is a pulse */
for
(
i
=
0
;
i
<
len
;
i
++
)
{
if
(
evs
[
i
].
type
&
(
IR_START_EVENT
|
IR_PULSE
))
for
(
;
*
pos
<
len
;
(
*
pos
)
++
)
{
if
(
evs
[
*
pos
].
type
&
(
IR_START_EVENT
|
IR_PULSE
))
break
;
}
i
++
;
/* First event doesn't contain data */
(
*
pos
)
++
;
/* First event doesn't contain data */
if
(
i
>=
len
)
if
(
*
pos
>=
len
)
return
0
;
/* First space should have 4.5 ms otherwise is not NEC protocol */
if
((
evs
[
i
].
delta
.
tv_nsec
<
MIN_START_TIME
)
|
(
evs
[
i
].
delta
.
tv_nsec
>
MAX_START_TIME
)
|
(
evs
[
i
].
type
!=
IR_SPACE
))
if
((
evs
[
*
pos
].
delta
.
tv_nsec
<
MIN_START_TIME
)
|
(
evs
[
*
pos
].
delta
.
tv_nsec
>
MAX_START_TIME
)
|
(
evs
[
*
pos
].
type
!=
IR_SPACE
))
goto
err
;
/*
...
...
@@ -68,24 +66,24 @@ int ir_nec_decode(struct input_dev *input_dev,
*/
count
=
0
;
for
(
i
++
;
i
<
len
;
i
++
)
{
for
(
(
*
pos
)
++
;
*
pos
<
len
;
(
*
pos
)
++
)
{
int
bit
;
if
((
evs
[
i
].
delta
.
tv_nsec
<
MIN_PULSE_TIME
)
|
(
evs
[
i
].
delta
.
tv_nsec
>
MAX_PULSE_TIME
)
|
(
evs
[
i
].
type
!=
IR_PULSE
))
if
((
evs
[
*
pos
].
delta
.
tv_nsec
<
MIN_PULSE_TIME
)
|
(
evs
[
*
pos
].
delta
.
tv_nsec
>
MAX_PULSE_TIME
)
|
(
evs
[
*
pos
].
type
!=
IR_PULSE
))
goto
err
;
if
(
++
i
>=
len
)
if
(
++
*
pos
>=
len
)
goto
err
;
if
(
evs
[
i
].
type
!=
IR_SPACE
)
if
(
evs
[
*
pos
].
type
!=
IR_SPACE
)
goto
err
;
if
((
evs
[
i
].
delta
.
tv_nsec
>
MIN_BIT1_TIME
)
&&
(
evs
[
i
].
delta
.
tv_nsec
<
MAX_BIT1_TIME
))
if
((
evs
[
*
pos
].
delta
.
tv_nsec
>
MIN_BIT1_TIME
)
&&
(
evs
[
*
pos
].
delta
.
tv_nsec
<
MAX_BIT1_TIME
))
bit
=
1
;
else
if
((
evs
[
i
].
delta
.
tv_nsec
>
MIN_BIT0_TIME
)
&&
(
evs
[
i
].
delta
.
tv_nsec
<
MAX_BIT0_TIME
))
else
if
((
evs
[
*
pos
].
delta
.
tv_nsec
>
MIN_BIT0_TIME
)
&&
(
evs
[
*
pos
].
delta
.
tv_nsec
<
MAX_BIT0_TIME
))
bit
=
0
;
else
goto
err
;
...
...
@@ -120,12 +118,40 @@ int ir_nec_decode(struct input_dev *input_dev,
}
IR_dprintk
(
1
,
"NEC scancode 0x%04x
\n
"
,
ircode
);
ir_keydown
(
input_dev
,
ircode
);
ir_keyup
(
input_dev
);
return
ircode
;
err:
IR_dprintk
(
1
,
"NEC decoded failed at bit %d while decoding %luus time
\n
"
,
count
,
(
evs
[
i
].
delta
.
tv_nsec
+
500
)
/
1000
);
count
,
(
evs
[
*
pos
].
delta
.
tv_nsec
+
500
)
/
1000
);
return
-
EINVAL
;
}
/**
* __ir_nec_decode() - Decodes all NEC pulsecodes on a given array
* @input_dev: the struct input_dev descriptor of the device
* @evs: event array with type/duration of pulse/space
* @len: length of the array
* This function returns the number of decoded pulses or -EINVAL if no
* pulse got decoded
*/
int
ir_nec_decode
(
struct
input_dev
*
input_dev
,
struct
ir_raw_event
*
evs
,
int
len
)
{
int
pos
=
0
;
int
rc
=
0
;
while
(
pos
<
len
)
{
if
(
__ir_nec_decode
(
input_dev
,
evs
,
len
,
&
pos
)
>=
0
)
rc
++
;
}
if
(
!
rc
)
return
-
EINVAL
;
return
rc
;
}
EXPORT_SYMBOL_GPL
(
ir_nec_decode
);
drivers/media/video/saa7134/saa7134-input.c
浏览文件 @
ada39630
...
...
@@ -425,18 +425,8 @@ static void saa7134_input_timer(unsigned long data)
void
ir_raw_decode_timer_end
(
unsigned
long
data
)
{
struct
saa7134_dev
*
dev
=
(
struct
saa7134_dev
*
)
data
;
struct
card_ir
*
ir
=
dev
->
remote
;
int
rc
;
/*
* FIXME: the IR key handling code should be called by the decoder,
* after implementing the repeat mode
*/
rc
=
ir_raw_event_handle
(
dev
->
remote
->
dev
);
if
(
rc
>=
0
)
{
ir_input_keydown
(
ir
->
dev
,
&
ir
->
ir
,
rc
);
ir_input_nokey
(
ir
->
dev
,
&
ir
->
ir
);
}
ir_raw_event_handle
(
dev
->
remote
->
dev
);
}
void
saa7134_ir_start
(
struct
saa7134_dev
*
dev
,
struct
card_ir
*
ir
)
...
...
include/media/ir-core.h
浏览文件 @
ada39630
...
...
@@ -84,7 +84,8 @@ struct ir_input_dev {
u32
ir_g_keycode_from_table
(
struct
input_dev
*
input_dev
,
u32
scancode
);
void
ir_keyup
(
struct
input_dev
*
dev
);
void
ir_keydown
(
struct
input_dev
*
dev
,
int
scancode
);
int
ir_input_register
(
struct
input_dev
*
dev
,
const
struct
ir_scancode_table
*
ir_codes
,
const
struct
ir_dev_props
*
props
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录