projects
/
revag-nm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
0aa4c34
)
Handle NM_MAIN_ON messages when we just logged in
author
norly
<ny-git@enpas.org>
Sat, 18 Mar 2017 20:38:58 +0000
(21:38 +0100)
committer
norly
<ny-git@enpas.org>
Sat, 18 Mar 2017 20:38:58 +0000
(21:38 +0100)
vw-nm.c
patch
|
blob
|
history
diff --git
a/vw-nm.c
b/vw-nm.c
index 689cf694db56450e12bd639c60d77b4636bb1d0c..2b9bccf7649946c14ac3cd2cecd846549b91d80f 100644
(file)
--- a/
vw-nm.c
+++ b/
vw-nm.c
@@
-115,14
+115,20
@@
static void nm_handle_can_frame(struct NM_Main *nm, struct can_frame *frame)
} else if (next == nm->nodes[nm->my_id].next) {
/* where nm->nodes[nm->my_id].next == nm->my_id */
} else if (next == nm->nodes[nm->my_id].next) {
/* where nm->nodes[nm->my_id].next == nm->my_id */
- /* TODO: Is this a case we need to handle? */
-
/* It can happen when:
* - our sent frames don't go anywhere
* - we just logged in and immediately
* afterwards another ECU sent a regular
/* It can happen when:
* - our sent frames don't go anywhere
* - we just logged in and immediately
* afterwards another ECU sent a regular
- * NM frame without knowing that we exist.
+ * NM frame.
+ */
+
+ /* Let's handle this just like a LOGIN, since
+ * we're learning about a new device.
+ * See case NM_MAIN_LOGIN below for details.
*/
*/
+
+ nm_update_my_next_id(nm);
+ nm->nodes[nm->my_id].state = NM_MAIN_ON;
} else if (next == nm->my_id) {
/* It's our turn.
* Reset the timeout so anyone we missed
} else if (next == nm->my_id) {
/* It's our turn.
* Reset the timeout so anyone we missed
@@
-142,8
+148,6
@@
static void nm_handle_can_frame(struct NM_Main *nm, struct can_frame *frame)
case NM_MAIN_LOGIN:
/* Note: sender != nm->my_id */
case NM_MAIN_LOGIN:
/* Note: sender != nm->my_id */
- printf("Handling LOGIN\n");
-
nm_update_my_next_id(nm);
/* We're not alone anymore, so let's change state. */
nm_update_my_next_id(nm);
/* We're not alone anymore, so let's change state. */