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
nexedi
linux
Commits
ec5b478a
Commit
ec5b478a
authored
Mar 15, 2004
by
Russell King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ARM] Provide userspace method for controlling LEDs in ARM machines.
parent
f0caf996
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
0 deletions
+50
-0
arch/arm/kernel/time.c
arch/arm/kernel/time.c
+50
-0
No files found.
arch/arm/kernel/time.c
View file @
ec5b478a
...
...
@@ -143,6 +143,54 @@ static void dummy_leds_event(led_event_t evt)
void
(
*
leds_event
)(
led_event_t
)
=
dummy_leds_event
;
struct
leds_evt_name
{
const
char
name
[
8
];
int
on
;
int
off
;
};
static
const
struct
leds_evt_name
evt_names
[]
=
{
{
"amber"
,
led_amber_on
,
led_amber_off
},
{
"blue"
,
led_blue_on
,
led_blue_off
},
{
"green"
,
led_green_on
,
led_green_off
},
{
"red"
,
led_red_on
,
led_red_off
},
};
static
ssize_t
leds_store
(
struct
sys_device
*
dev
,
const
char
*
buf
,
size_t
size
)
{
int
ret
=
-
EINVAL
,
len
=
strcspn
(
buf
,
" "
);
if
(
len
>
0
&&
buf
[
len
]
==
'\0'
)
len
--
;
if
(
strncmp
(
buf
,
"claim"
,
len
)
==
0
)
{
leds_event
(
led_claim
);
ret
=
size
;
}
else
if
(
strncmp
(
buf
,
"release"
,
len
)
==
0
)
{
leds_event
(
led_release
);
ret
=
size
;
}
else
{
int
i
;
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
evt_names
);
i
++
)
{
if
(
strlen
(
evt_names
[
i
].
name
)
!=
len
||
strncmp
(
buf
,
evt_names
[
i
].
name
,
len
)
!=
0
)
continue
;
if
(
strncmp
(
buf
+
len
,
" on"
,
3
)
==
0
)
{
leds_event
(
evt_names
[
i
].
on
);
ret
=
size
;
}
else
if
(
strncmp
(
buf
+
len
,
" off"
,
4
)
==
0
)
{
leds_event
(
evt_names
[
i
].
off
);
ret
=
size
;
}
break
;
}
}
return
ret
;
}
static
SYSDEV_ATTR
(
event
,
0200
,
NULL
,
leds_store
);
static
int
leds_suspend
(
struct
sys_device
*
dev
,
u32
state
)
{
leds_event
(
led_stop
);
...
...
@@ -179,6 +227,8 @@ static int __init leds_init(void)
ret
=
sysdev_class_register
(
&
leds_sysclass
);
if
(
ret
==
0
)
ret
=
sysdev_register
(
&
leds_device
);
if
(
ret
==
0
)
ret
=
sysdev_create_file
(
&
leds_device
,
&
attr_event
);
return
ret
;
}
...
...
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