Fix `is_rx` for `receive_own_messages` for Kvaser by btRooke · Pull Request #1908 · hardbyte/python-can
Context and changes
Most other interfaces set is_rx to False if a transmitted message is received when receive_own_messages is enabled.
This previously wasn't the case for Kvaser.
Enabling the LOCAL_TXACK flag allows us to determine this.
Testing
This can be manually tested with a simple script:
import can import time msg = can.Message( arbitration_id=0xC0FFEE, data=[0, 25, 0, 1, 3, 1, 4, 1], is_extended_id=True ) with can.Bus(receive_own_messages=True) as bus: notifier = can.Notifier(bus, [can.Printer()]) bus.send_periodic(msg, 0.5) time.sleep(3)
Before this change, transmitted messages will be printed as "Rx", after as "Tx".
Do let me know if there's some obvious way to check this in automated tests.