@@ -610,6 +610,7 @@ def __init__(
610
610
local_loopback : bool = True ,
611
611
fd : bool = False ,
612
612
can_filters : Optional [CanFilters ] = None ,
613
+ ignore_rx_error_frames = False ,
613
614
** kwargs ,
614
615
) -> None :
615
616
"""Creates a new socketcan bus.
@@ -639,6 +640,8 @@ def __init__(
639
640
If CAN-FD frames should be supported.
640
641
:param can_filters:
641
642
See :meth:`can.BusABC.set_filters`.
643
+ :param ignore_rx_error_frames:
644
+ If incoming error frames should be discarded.
642
645
"""
643
646
self .socket = create_socket ()
644
647
self .channel = channel
@@ -671,11 +674,12 @@ def __init__(
671
674
except socket .error as error :
672
675
log .error ("Could not enable CAN-FD frames (%s)" , error )
673
676
674
- # enable error frames
675
- try :
676
- self .socket .setsockopt (SOL_CAN_RAW , CAN_RAW_ERR_FILTER , 0x1FFFFFFF )
677
- except socket .error as error :
678
- log .error ("Could not enable error frames (%s)" , error )
677
+ if not ignore_rx_error_frames :
678
+ # enable error frames
679
+ try :
680
+ self .socket .setsockopt (SOL_CAN_RAW , CAN_RAW_ERR_FILTER , 0x1FFFFFFF )
681
+ except socket .error as error :
682
+ log .error ("Could not enable error frames (%s)" , error )
679
683
680
684
# enable nanosecond resolution timestamping
681
685
# we can always do this since
0 commit comments