owfs: fix the last netlink message recognition
authorMarcin Jurkowski <marcin1j@gmail.com>
Sun, 28 Jun 2015 22:58:06 +0000 (00:58 +0200)
committerMarcin Jurkowski <marcin1j@gmail.com>
Mon, 31 Aug 2015 23:29:20 +0000 (01:29 +0200)
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>
utils/owfs/patches/100-fix-netlink-w1-status-message-detection.patch [new file with mode: 0644]

diff --git a/utils/owfs/patches/100-fix-netlink-w1-status-message-detection.patch b/utils/owfs/patches/100-fix-netlink-w1-status-message-detection.patch
new file mode 100644 (file)
index 0000000..251065f
--- /dev/null
@@ -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 ;
+ }