Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linux-davinci-2.6.23
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
linux
linux-davinci-2.6.23
Commits
765db0a3
Commit
765db0a3
authored
Jul 11, 2008
by
吴智聪(John Wu)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clean up neuros_ir and neuros_ir_blaster code
parent
67fc7be9
Changes
2
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
155 additions
and
151 deletions
+155
-151
drivers/input/misc/neuros_ir.c
drivers/input/misc/neuros_ir.c
+73
-69
drivers/misc/neuros_ir_blaster.c
drivers/misc/neuros_ir_blaster.c
+82
-82
No files found.
drivers/input/misc/neuros_ir.c
View file @
765db0a3
...
@@ -61,7 +61,8 @@
...
@@ -61,7 +61,8 @@
#define IR_RETRY_COUNT 3
#define IR_RETRY_COUNT 3
#define FACTORY_TEST_DELAY 6
#define FACTORY_TEST_DELAY 6
struct
irrtc_device
{
struct
irrtc_device
{
int
key
;
int
key
;
};
};
static
struct
irrtc_device
device
;
static
struct
irrtc_device
device
;
...
@@ -71,18 +72,18 @@ static wait_queue_head_t poll_queue;
...
@@ -71,18 +72,18 @@ static wait_queue_head_t poll_queue;
static
char
*
devname
=
"neuros_ir"
;
static
char
*
devname
=
"neuros_ir"
;
static
struct
input_dev
*
ir_input_dev
;
static
struct
input_dev
*
ir_input_dev
;
static
int
factory_test
=
0
;
static
int
factory_test
=
0
;
static
int
osd_key
=
0
;
static
int
osd_key
=
0
;
static
int
is_learning
=
0
;
static
int
is_learning
=
0
;
#if USE_WORKQUEUE
#if USE_WORKQUEUE
#define KEYBUF_SIZE 2
#define KEYBUF_SIZE 2
static
int
keybuf
[
KEYBUF_SIZE
];
static
int
keybuf
[
KEYBUF_SIZE
];
static
int
roffset
=
0
;
static
int
roffset
=
0
;
static
int
woffset
=
0
;
static
int
woffset
=
0
;
static
int
numOfKeys
=
0
;
static
int
numOfKeys
=
0
;
#else
#else
static
int
keyin
=
0
;
static
int
keyin
=
0
;
#endif
#endif
static
void
irrtc_report_key
(
int
ir_key
);
static
void
irrtc_report_key
(
int
ir_key
);
...
@@ -105,7 +106,7 @@ EXPORT_SYMBOL(unlock_data_protect);
...
@@ -105,7 +106,7 @@ EXPORT_SYMBOL(unlock_data_protect);
static
void
set_factory_test
(
int
value
)
static
void
set_factory_test
(
int
value
)
{
{
factory_test
=
value
;
factory_test
=
value
;
}
}
EXPORT_SYMBOL
(
set_factory_test
);
EXPORT_SYMBOL
(
set_factory_test
);
...
@@ -117,13 +118,13 @@ EXPORT_SYMBOL(get_osd_key);
...
@@ -117,13 +118,13 @@ EXPORT_SYMBOL(get_osd_key);
static
void
set_osd_key
(
int
value
)
static
void
set_osd_key
(
int
value
)
{
{
osd_key
=
value
;
osd_key
=
value
;
}
}
EXPORT_SYMBOL
(
set_osd_key
);
EXPORT_SYMBOL
(
set_osd_key
);
static
void
set_is_learning
(
int
value
)
static
void
set_is_learning
(
int
value
)
{
{
is_learning
=
value
;
is_learning
=
value
;
}
}
EXPORT_SYMBOL
(
set_is_learning
);
EXPORT_SYMBOL
(
set_is_learning
);
...
@@ -140,7 +141,7 @@ static int read_keybuf(void)
...
@@ -140,7 +141,7 @@ static int read_keybuf(void)
{
{
numOfKeys
--
;
numOfKeys
--
;
key
=
keybuf
[
roffset
];
key
=
keybuf
[
roffset
];
if
(
++
roffset
>=
KEYBUF_SIZE
)
roffset
=
0
;
if
(
++
roffset
>=
KEYBUF_SIZE
)
roffset
=
0
;
}
}
up
(
&
keybuf_sem
);
up
(
&
keybuf_sem
);
...
@@ -158,14 +159,14 @@ static void write_keybuf(int key)
...
@@ -158,14 +159,14 @@ static void write_keybuf(int key)
// Display some more sober debug message on key presses but don't bother with key releases.
// Display some more sober debug message on key presses but don't bother with key releases.
if
(
key
!=
0x00
)
printk
(
"{IR:key:%02x}
\n
"
,
key
);
if
(
key
!=
0x00
)
printk
(
"{IR:key:%02x}
\n
"
,
key
);
if
(
++
numOfKeys
>
KEYBUF_SIZE
)
if
(
++
numOfKeys
>
KEYBUF_SIZE
)
{
{
numOfKeys
=
KEYBUF_SIZE
;
numOfKeys
=
KEYBUF_SIZE
;
if
(
++
roffset
>=
KEYBUF_SIZE
)
roffset
=
0
;
if
(
++
roffset
>=
KEYBUF_SIZE
)
roffset
=
0
;
}
}
keybuf
[
woffset
]
=
key
;
keybuf
[
woffset
]
=
key
;
if
(
++
woffset
>=
KEYBUF_SIZE
)
woffset
=
0
;
if
(
++
woffset
>=
KEYBUF_SIZE
)
woffset
=
0
;
up
(
&
keybuf_sem
);
up
(
&
keybuf_sem
);
}
}
...
@@ -224,7 +225,7 @@ static irqreturn_t handle_irrtc_irqs(int irq, void * dev_id)
...
@@ -224,7 +225,7 @@ static irqreturn_t handle_irrtc_irqs(int irq, void * dev_id)
set_factory_test
(
0
);
set_factory_test
(
0
);
}
}
#else
#else
keyin
=
1
;
keyin
=
1
;
#endif
#endif
return
IRQ_HANDLED
;
return
IRQ_HANDLED
;
}
}
...
@@ -273,31 +274,34 @@ static ssize_t irrtc_read(struct file *filp, char __user *buff, size_t count, lo
...
@@ -273,31 +274,34 @@ static ssize_t irrtc_read(struct file *filp, char __user *buff, size_t count, lo
key
=
read_keybuf
();
key
=
read_keybuf
();
dbg
(
"key=%d
\n
"
,
key
);
dbg
(
"key=%d
\n
"
,
key
);
if
(
key
!=
-
1
)
//none key
if
(
key
!=
-
1
)
//none key
r
=
copy_to_user
(
buff
,
&
key
,
sizeof
(
int
));
r
=
copy_to_user
(
buff
,
&
key
,
sizeof
(
int
));
else
else
count
=
0
;
count
=
0
;
#else
#else
if
(
-
EINTR
==
down_interruptible
(
&
keybuf_sem
))
if
(
-
EINTR
==
down_interruptible
(
&
keybuf_sem
))
return
0
;
return
0
;
if
(
count
>
KEYBUF_SIZE
*
sizeof
(
int
))
{
if
(
count
>
KEYBUF_SIZE
*
sizeof
(
int
))
{
if
(
roffset
<=
woffset
)
if
(
roffset
<=
woffset
)
count
=
(
woffset
-
roffset
)
*
sizeof
(
int
);
count
=
(
woffset
-
roffset
)
*
sizeof
(
int
);
else
else
count
=
(
KEYBUF_SIZE
-
(
roffset
-
woffset
+
1
))
*
sizeof
(
int
);
count
=
(
KEYBUF_SIZE
-
(
roffset
-
woffset
+
1
))
*
sizeof
(
int
);
}
}
if
(
count
==
0
)
{
if
(
count
==
0
)
{
printk
(
"buffer empty
\n
"
);
printk
(
"buffer empty
\n
"
);
goto
out
;
goto
out
;
}
}
if
(
roffset
<
woffset
)
if
(
roffset
<
woffset
)
r
=
copy_to_user
(
buff
,
keybuf
+
roffset
,
count
);
r
=
copy_to_user
(
buff
,
keybuf
+
roffset
,
count
);
else
{
else
r
=
copy_to_user
(
buff
,
&
keybuf
[
roffset
],
(
KEYBUF_SIZE
-
roffset
+
1
)
*
sizeof
(
int
));
{
r
=
copy_to_user
(
buff
+
(
KEYBUF_SIZE
-
roffset
+
1
)
*
sizeof
(
int
),
keybuf
,
woffset
*
sizeof
(
int
));
r
=
copy_to_user
(
buff
,
&
keybuf
[
roffset
],
(
KEYBUF_SIZE
-
roffset
+
1
)
*
sizeof
(
int
));
r
=
copy_to_user
(
buff
+
(
KEYBUF_SIZE
-
roffset
+
1
)
*
sizeof
(
int
),
keybuf
,
woffset
*
sizeof
(
int
));
}
}
out:
out:
...
...
drivers/misc/neuros_ir_blaster.c
View file @
765db0a3
This diff is collapsed.
Click to expand it.
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