Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
Software for White Rabbit PTP Core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
32
Issues
32
List
Board
Labels
Milestones
Merge Requests
7
Merge Requests
7
CI / CD
CI / CD
Pipelines
Schedules
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
Software for White Rabbit PTP Core
Commits
463e159b
Commit
463e159b
authored
Sep 14, 2018
by
Maciej Lipinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[MAC/w1] fixed creation of MAC from onewire thermometer's ID when no SDB
parent
6f17361c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
17 deletions
+21
-17
sdb-storage.c
dev/sdb-storage.c
+21
-17
No files found.
dev/sdb-storage.c
View file @
463e159b
...
@@ -310,9 +310,10 @@ found_exit:
...
@@ -310,9 +310,10 @@ found_exit:
*/
*/
int
get_persistent_mac
(
uint8_t
portnum
,
uint8_t
*
mac
)
int
get_persistent_mac
(
uint8_t
portnum
,
uint8_t
*
mac
)
{
{
int
ret
;
int
ret
=
0
;
int
i
,
class
;
int
i
,
class
;
uint64_t
rom
;
uint64_t
rom
;
struct
w1_dev
*
d
;
if
(
IS_HOST_PROCESS
)
{
if
(
IS_HOST_PROCESS
)
{
/* we don't have sdb working, so get the real eth address */
/* we don't have sdb working, so get the real eth address */
...
@@ -321,10 +322,12 @@ int get_persistent_mac(uint8_t portnum, uint8_t *mac)
...
@@ -321,10 +322,12 @@ int get_persistent_mac(uint8_t portnum, uint8_t *mac)
}
}
if
(
sdbfs_open_id
(
&
wrc_sdb
,
SDB_VENDOR
,
SDB_DEV_MAC
)
<
0
)
if
(
sdbfs_open_id
(
&
wrc_sdb
,
SDB_VENDOR
,
SDB_DEV_MAC
)
<
0
)
return
-
1
;
ret
=-
1
;
else
ret
=
sdbfs_fread
(
&
wrc_sdb
,
0
,
mac
,
6
);
{
sdbfs_close
(
&
wrc_sdb
);
ret
=
sdbfs_fread
(
&
wrc_sdb
,
0
,
mac
,
6
);
sdbfs_close
(
&
wrc_sdb
);
}
if
(
ret
<
0
)
if
(
ret
<
0
)
pp_printf
(
"%s: SDB error
\n
"
,
__func__
);
pp_printf
(
"%s: SDB error
\n
"
,
__func__
);
...
@@ -335,19 +338,20 @@ int get_persistent_mac(uint8_t portnum, uint8_t *mac)
...
@@ -335,19 +338,20 @@ int get_persistent_mac(uint8_t portnum, uint8_t *mac)
}
}
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
pp_printf
(
"%s: Using W1 serial number
\n
"
,
__func__
);
pp_printf
(
"%s: Using W1 serial number
\n
"
,
__func__
);
w1_scan_bus
(
&
wrpc_w1_bus
);
for
(
i
=
0
;
i
<
W1_MAX_DEVICES
;
i
++
)
{
for
(
i
=
0
;
i
<
W1_MAX_DEVICES
;
i
++
)
{
class
=
w1_class
(
wrpc_w1_bus
.
devs
+
i
)
;
d
=
wrpc_w1_bus
.
devs
+
i
;
if
(
class
!=
0x28
&&
class
!=
0x42
)
if
(
d
->
rom
)
{
continue
;
mac
[
0
]
=
0x22
;
rom
=
wrpc_w1_bus
.
devs
[
i
].
rom
;
mac
[
1
]
=
0x33
;
mac
[
0
]
=
0x22
;
mac
[
2
]
=
0xff
&
(
d
->
rom
>>
32
)
;
mac
[
1
]
=
0x33
;
mac
[
3
]
=
0xff
&
(
d
->
rom
>>
24
)
;
mac
[
2
]
=
rom
>>
32
;
mac
[
4
]
=
0xff
&
(
d
->
rom
>>
16
)
;
mac
[
3
]
=
rom
>>
24
;
mac
[
5
]
=
0xff
&
(
d
->
rom
>>
8
)
;
mac
[
4
]
=
rom
>>
16
;
ret
=
0
;
mac
[
5
]
=
rom
>>
8
;
break
;
ret
=
0
;
}
}
}
}
}
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
pp_printf
(
"%s: failure
\n
"
,
__func__
);
pp_printf
(
"%s: failure
\n
"
,
__func__
);
...
...
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