Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
etherlabmaster
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ICS Control System Infrastructure
etherlabmaster
Commits
e9676bfd
Commit
e9676bfd
authored
18 years ago
by
Florian Pose
Browse files
Options
Downloads
Patches
Plain Diff
Coupler information in slave info file, lines in lsec.
parent
1eb49525
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
master/slave.c
+3
-1
3 additions, 1 deletion
master/slave.c
script/lsec.pl
+33
-4
33 additions, 4 deletions
script/lsec.pl
with
36 additions
and
5 deletions
master/slave.c
+
3
−
1
View file @
e9676bfd
...
@@ -530,8 +530,10 @@ size_t ec_slave_info(const ec_slave_t *slave, /**< EtherCAT slave */
...
@@ -530,8 +530,10 @@ size_t ec_slave_info(const ec_slave_t *slave, /**< EtherCAT slave */
off
+=
ec_state_string
(
slave
->
current_state
,
buffer
+
off
);
off
+=
ec_state_string
(
slave
->
current_state
,
buffer
+
off
);
off
+=
sprintf
(
buffer
+
off
,
"
\n
Ring position: %i
\n
"
,
off
+=
sprintf
(
buffer
+
off
,
"
\n
Ring position: %i
\n
"
,
slave
->
ring_position
);
slave
->
ring_position
);
off
+=
sprintf
(
buffer
+
off
,
"Advanced position: %i:%i
\n
\n
"
,
off
+=
sprintf
(
buffer
+
off
,
"Advanced position: %i:%i
\n
"
,
slave
->
coupler_index
,
slave
->
coupler_subindex
);
slave
->
coupler_index
,
slave
->
coupler_subindex
);
off
+=
sprintf
(
buffer
+
off
,
"Coupler: %s
\n\n
"
,
ec_slave_is_coupler
(
slave
)
?
"yes"
:
"no"
);
off
+=
sprintf
(
buffer
+
off
,
"Data link status:
\n
"
);
off
+=
sprintf
(
buffer
+
off
,
"Data link status:
\n
"
);
for
(
i
=
0
;
i
<
4
;
i
++
)
{
for
(
i
=
0
;
i
<
4
;
i
++
)
{
...
...
This diff is collapsed.
Click to expand it.
script/lsec.pl
+
33
−
4
View file @
e9676bfd
...
@@ -37,20 +37,45 @@
...
@@ -37,20 +37,45 @@
#
#
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
require
'
sys/ioctl.ph
';
use
strict
;
use
strict
;
use
Getopt::
Std
;
use
Getopt::
Std
;
my
$master_index
;
my
$master_index
;
my
$master_dir
;
my
$master_dir
;
my
$term_width
;
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
$term_width
=
&get_terminal_width
;
&get_options
;
&get_options
;
&query_master
;
&query_master
;
exit
0
;
exit
0
;
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
sub
get_terminal_width
{
my
$winsize
;
die
"
no TIOCGWINSZ
"
unless
defined
&TIOCGWINSZ
;
open
(
TTY
,
"
+</dev/tty
")
or
die
"
No tty: $!
";
unless
(
ioctl
(
TTY
,
&TIOCGWINSZ
,
$winsize
=
''))
{
die
sprintf
"
$0: ioctl TIOCGWINSZ (%08x: $!)
\n
",
&TIOCGWINSZ
;
}
(
my
$row
,
my
$col
,
my
$xpixel
,
my
$ypixel
)
=
unpack
('
S4
',
$winsize
);
return
$col
;
}
#------------------------------------------------------------------------------
sub
print_line
{
for
(
my
$i
=
0
;
$i
<
$term_width
;
$i
++
)
{
print
"
-
";}
print
"
\n
";
}
#------------------------------------------------------------------------------
sub
query_master
sub
query_master
{
{
$master_dir
=
"
/sys/ethercat
"
.
$master_index
;
$master_dir
=
"
/sys/ethercat
"
.
$master_index
;
...
@@ -94,6 +119,9 @@ sub query_slaves
...
@@ -94,6 +119,9 @@ sub query_slaves
elsif
(
$line
=~
/^State: (.+)$/
)
{
elsif
(
$line
=~
/^State: (.+)$/
)
{
$slave
->
{'
state
'}
=
$
1
;
$slave
->
{'
state
'}
=
$
1
;
}
}
elsif
(
$line
=~
/^Coupler: ([a-z]+)$/
)
{
$slave
->
{'
coupler
'}
=
$
1
;
}
}
}
close
INFO
;
close
INFO
;
...
@@ -106,10 +134,11 @@ sub query_slaves
...
@@ -106,10 +134,11 @@ sub query_slaves
print
"
EtherCAT bus listing for master
$master_index
:
\n
";
print
"
EtherCAT bus listing for master
$master_index
:
\n
";
for
$slave
(
@slaves
)
{
for
$slave
(
@slaves
)
{
$abs
=
sprintf
"
%i
",
$slave
->
{'
ring_position
'};
print_line
if
$slave
->
{'
coupler
'}
eq
"
yes
";
printf
("
%3s %8s %-6s %s
\n
",
$abs
=
sprintf
"
%i
",
$slave
->
{'
ring_position
'};
$abs
,
$slave
->
{'
advanced_position
'},
printf
("
%3s %8s %-6s %s
\n
",
$slave
->
{'
state
'},
$slave
->
{'
name
'});
$abs
,
$slave
->
{'
advanced_position
'},
$slave
->
{'
state
'},
$slave
->
{'
name
'});
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment