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
Kirill Smelkov
linux
Commits
09b01b90
Commit
09b01b90
authored
Dec 14, 2009
by
Mauro Carvalho Chehab
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
V4L/DVB (13636): ir-core: add method to change IR protocol
Signed-off-by:
Mauro Carvalho Chehab
<
mchehab@redhat.com
>
parent
53f87022
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
1 deletion
+43
-1
drivers/media/IR/ir-sysfs.c
drivers/media/IR/ir-sysfs.c
+43
-1
No files found.
drivers/media/IR/ir-sysfs.c
View file @
09b01b90
...
...
@@ -47,8 +47,50 @@ static ssize_t show_protocol(struct device *d,
return
sprintf
(
buf
,
"%s
\n
"
,
s
);
}
static
ssize_t
store_protocol
(
struct
device
*
d
,
struct
device_attribute
*
mattr
,
const
char
*
data
,
size_t
len
)
{
struct
ir_input_dev
*
ir_dev
=
dev_get_drvdata
(
d
);
enum
ir_type
ir_type
=
IR_TYPE_UNKNOWN
;
int
rc
=
-
EINVAL
;
char
*
buf
;
buf
=
strsep
((
char
**
)
&
data
,
"
\n
"
);
if
(
!
strcasecmp
(
buf
,
"rc-5"
))
ir_type
=
IR_TYPE_RC5
;
else
if
(
!
strcasecmp
(
buf
,
"pd"
))
ir_type
=
IR_TYPE_PD
;
else
if
(
!
strcasecmp
(
buf
,
"nec"
))
ir_type
=
IR_TYPE_NEC
;
if
(
ir_type
==
IR_TYPE_UNKNOWN
)
{
IR_dprintk
(
1
,
"Error setting protocol to %ld
\n
"
,
ir_type
);
return
-
EINVAL
;
}
if
(
ir_dev
->
props
->
change_protocol
)
rc
=
ir_dev
->
props
->
change_protocol
(
ir_dev
->
props
->
priv
,
ir_type
);
if
(
rc
<
0
)
{
IR_dprintk
(
1
,
"Error setting protocol to %ld
\n
"
,
ir_type
);
return
-
EINVAL
;
}
ir_dev
->
rc_tab
.
ir_type
=
ir_type
;
IR_dprintk
(
1
,
"Current protocol is %ld
\n
"
,
ir_type
);
return
len
;
}
static
DEVICE_ATTR
(
current_protocol
,
S_IRUGO
|
S_IWUSR
,
show_protocol
,
NULL
);
show_protocol
,
store_protocol
);
static
struct
attribute
*
ir_dev_attrs
[]
=
{
&
dev_attr_current_protocol
.
attr
,
...
...
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