Explorar el Código

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>
Marcin Jurkowski hace 9 años
padre
commit
2d537bc98f

+ 30
- 0
utils/owfs/patches/100-fix-netlink-w1-status-message-detection.patch Ver fichero

@@ -0,0 +1,30 @@
1
+AaAA
2
+--- a/module/owlib/src/c/ow_w1_parse.c
3
++++ b/module/owlib/src/c/ow_w1_parse.c
4
+@@ -237,7 +237,7 @@ enum Netlink_Read_Status W1_Process_Resp
5
+ 			owfree(nlp.nlm) ;
6
+ 			return nrs_nodev ;
7
+ 		}
8
+-		if ( nrs_callback == NULL ) { // status message
9
++		if ( nrs_callback == NULL ) { // bus reset
10
+ 			owfree(nlp.nlm) ;
11
+ 			return nrs_complete ;
12
+ 		}
13
+@@ -246,7 +246,7 @@ enum Netlink_Read_Status W1_Process_Resp
14
+ 		nrs_callback( &nlp, v, pn ) ;
15
+ 		LEVEL_DEBUG("Called nrs_callback");
16
+ 		owfree(nlp.nlm) ;
17
+-		if ( nlp.cn->ack != 0 ) {
18
++		if ( nlp.cn->seq != nlp.cn->ack ) {
19
+ 			if ( nlp.w1m->type == W1_LIST_MASTERS ) {
20
+ 				continue ; // look for more data
21
+ 			}
22
+@@ -254,7 +254,7 @@ enum Netlink_Read_Status W1_Process_Resp
23
+ 				continue ; // look for more data
24
+ 			}
25
+ 		}
26
+-		nrs_callback = NULL ; // now look for status message
27
++		return nrs_complete ; // status message
28
+ 	}
29
+ 	return nrs_timeout ;
30
+ }