owfs: fix the last netlink message recognition

This fixes the endless loop waiting for w1 subsystem connector status
message.

According to the 8a0427d kernel commit, the last (status) netlink msg
should have ack=seq, whereas all the others messages should have ack=seq+1.

This patch has been submitted upstream: https://sourceforge.net/p/owfs/bugs/66/.

For independent problem report, see this thread:
https://www.raspberrypi.org/forums/viewtopic.php?f=44&t=98772

Signed-off-by: Marcin Jurkowski <marcin1j@gmail.com>
This commit is contained in:
Marcin Jurkowski 2015-06-29 00:58:06 +02:00
parent d6fe15a85c
commit 2d537bc98f
1 changed files with 30 additions and 0 deletions

View File

@ -0,0 +1,30 @@
AaAA
--- a/module/owlib/src/c/ow_w1_parse.c
+++ b/module/owlib/src/c/ow_w1_parse.c
@@ -237,7 +237,7 @@ enum Netlink_Read_Status W1_Process_Resp
owfree(nlp.nlm) ;
return nrs_nodev ;
}
- if ( nrs_callback == NULL ) { // status message
+ if ( nrs_callback == NULL ) { // bus reset
owfree(nlp.nlm) ;
return nrs_complete ;
}
@@ -246,7 +246,7 @@ enum Netlink_Read_Status W1_Process_Resp
nrs_callback( &nlp, v, pn ) ;
LEVEL_DEBUG("Called nrs_callback");
owfree(nlp.nlm) ;
- if ( nlp.cn->ack != 0 ) {
+ if ( nlp.cn->seq != nlp.cn->ack ) {
if ( nlp.w1m->type == W1_LIST_MASTERS ) {
continue ; // look for more data
}
@@ -254,7 +254,7 @@ enum Netlink_Read_Status W1_Process_Resp
continue ; // look for more data
}
}
- nrs_callback = NULL ; // now look for status message
+ return nrs_complete ; // status message
}
return nrs_timeout ;
}