Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
Simple PCIe FMC carrier SPEC - Software
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
Simple PCIe FMC carrier SPEC - Software
Commits
3b3364b0
Commit
3b3364b0
authored
May 28, 2014
by
garcialasheras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixing the automatic scan for available SPEC boards
parent
5154cd5e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
26 deletions
+21
-26
speclib.c
tools/speclib.c
+21
-26
No files found.
tools/speclib.c
View file @
3b3364b0
...
...
@@ -82,11 +82,9 @@ static int spec_check_id(int bus, int dev)
static
int
spec_scan
(
int
*
bus
,
int
*
devfn
)
{
struct
dirent
**
namelist
;
int
n
,
found
=
0
;
int
n
,
i
,
found
=
0
;
int
my_bus
,
my_devfn
;
if
(
*
bus
<
0
||
*
devfn
<
0
)
{
// Automatic search for the first availabe card
n
=
scandir
(
"/sys/bus/pci/devices/"
,
&
namelist
,
0
,
0
);
if
(
n
<
0
)
...
...
@@ -94,12 +92,14 @@ static int spec_scan(int *bus, int *devfn)
perror
(
"scandir"
);
exit
(
-
1
);
}
else
{
while
(
n
--
)
for
(
i
=
0
;
i
<
n
;
i
++
)
{
if
(
!
found
&&
sscanf
(
namelist
[
n
]
->
d_name
,
if
(
!
found
&&
sscanf
(
namelist
[
i
]
->
d_name
,
"0000:%02x:%02x.0"
,
&
my_bus
,
&
my_devfn
)
==
2
)
{
if
(
*
bus
>=
0
)
my_bus
=
*
bus
;
if
(
*
devfn
>=
0
)
my_devfn
=
*
devfn
;
if
(
spec_check_id
(
my_bus
,
my_devfn
))
{
*
bus
=
my_bus
;
...
...
@@ -108,16 +108,11 @@ static int spec_scan(int *bus, int *devfn)
}
}
free
(
namelist
[
n
]);
free
(
namelist
[
i
]);
}
free
(
namelist
);
}
}
else
{
// Check if the requested card is available
if
(
spec_check_id
(
*
bus
,
*
devfn
))
found
=
1
;
}
if
(
!
found
)
{
...
...
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