@@ -1232,11 +1232,10 @@ def __init__( self, name=None, **kwds ):
12321232 mesg [None ] = rout
12331233
12341234 # Parser for an Unconnected Send error response (only seen if Unconnected Send itself fails, eg.
1235- # was sent to a Non-Routing (simple) CIP device, or was otherwise malformed. From
1235+ # was sent to a Non-Routing (simple) CIP device, or was otherwise malformed.
12361236 uerr = USINT ( context = 'service' )
12371237 uerr [True ] = uers = octets_drop ( 'reserved' , repeat = 1 )
1238- uers [True ] = uest = status ()
1239- uest [None ] = octets_noop ( terminal = True )
1238+ uers [True ] = status ( terminal = True )
12401239
12411240 # So; 0x52 Unconnected Send parses a request with a Route Path, and 0x52|0x80 *with a length
12421241 # of exactly 4 bytes* (ie. carrying no other data) is an Unconnected Send response carrying
@@ -1245,10 +1244,10 @@ def __init__( self, name=None, **kwds ):
12451244 # single enecapsulated C*Logix Read Tag Fragmented response (0x52/0xD2) carrying an error
12461245 # status. In fact, it is impossible to distinguish -- they are exactly the same size and
12471246 # carry the same server == 0xD2 and status coded.
1248- def u_s_err ( path = None , data = None , source = None , ** kwds ):
1247+ def is_uerr ( path = None , data = None , source = None , ** kwds ):
12491248 log .isEnabledFor ( logging .INFO ) and log .info (
1250- "%s -- checking data[%r] (kwds %r) for unconnected_send error: %s" ,
1251- self , path , kwds , enip_format ( data )
1249+ "%s -- checking data[%r] (kwds %r) for unconnected_send error (%5s) : %s" ,
1250+ self , path , kwds , data [ path + '..length' ] <= 6 , enip_format ( data ),
12521251 )
12531252 if data [path + '..length' ] > 6 :
12541253 return False
@@ -1276,15 +1275,14 @@ def u_s_err( path=None, data=None, source=None, **kwds ):
12761275 )
12771276 return sts < 0x10 and ext_siz == 0
12781277
1278+ othr = octets ( context = 'request' , terminal = True )
1279+ othr [True ] = othr
12791280
12801281 slct [b'\x52 ' [0 ]] = usnd
1281- slct [b'\xD2 ' [0 ]] = decide (
1282- 'u_s_err' ,
1283- predicate = u_s_err ,
1284- state = uerr
1285- )
1286- slct [True ] = othr = octets ( context = 'request' , terminal = True )
1287- othr [True ] = othr
1282+ slct [b'\xD2 ' [0 ]] = decide ( 'uerr' , predicate = is_uerr ,
1283+ state = uerr )
1284+ slct [b'\xD2 ' [0 ]] = othr
1285+ slct [True ] = othr
12881286
12891287 super ( unconnected_send , self ).__init__ ( name = name , initial = slct , ** kwds )
12901288
0 commit comments