Skip to content

Conversation

@karlding
Copy link
Collaborator

Currently bus.send_periodic blindly wraps the BCM socket API, and sends
a BCM operation with the TX_SETUP opcode. However, the semantics that
the kernel driver provides are an "upsert". As such, when one attempts
to create two Tasks with the same CAN Arbitration ID, it ends up
silently modifying the periodic messages, which is contrary to what our
API implies.

This fixes the problem by first sending a TX_READ opcode with the CAN
Arbitration ID that we wish to create. The kernel driver will return
-EINVAL if a periodic transmission with the given Arbitration ID does
not exist. If this is the case, then we can continue creating the Task,
otherwise we error and notify the user.

Fixes #605

Currently bus.send_periodic blindly wraps the BCM socket API, and sends
a BCM operation with the TX_SETUP opcode. However, the semantics that
the kernel driver provides are an "upsert". As such, when one attempts
to create two Tasks with the same CAN Arbitration ID, it ends up
silently modifying the periodic messages, which is contrary to what our
API implies.

This fixes the problem by first sending a TX_READ opcode with the CAN
Arbitration ID that we wish to create. The kernel driver will return
-EINVAL if a periodic transmission with the given Arbitration ID does
not exist. If this is the case, then we can continue creating the Task,
otherwise we error and notify the user.

Fixes hardbyte#605
@karlding karlding requested review from felixdivo and hardbyte July 11, 2019 17:27
@codecov
Copy link

codecov bot commented Jul 13, 2019

Codecov Report

Merging #638 into develop will increase coverage by 0.02%.
The diff coverage is 87.5%.

@@             Coverage Diff             @@
##           develop     #638      +/-   ##
===========================================
+ Coverage    63.87%   63.89%   +0.02%     
===========================================
  Files           66       66              
  Lines         5946     5955       +9     
===========================================
+ Hits          3798     3805       +7     
- Misses        2148     2150       +2

@codecov
Copy link

codecov bot commented Jul 13, 2019

Codecov Report

Merging #638 into develop will decrease coverage by 2.77%.
The diff coverage is 14.28%.

@@             Coverage Diff             @@
##           develop     #638      +/-   ##
===========================================
- Coverage    63.87%   61.09%   -2.78%     
===========================================
  Files           66       66              
  Lines         5946     5953       +7     
===========================================
- Hits          3798     3637     -161     
- Misses        2148     2316     +168

@felixdivo felixdivo merged commit c7c1640 into hardbyte:develop Jul 14, 2019
@karlding karlding deleted the read_bcm_status_before_creating_task branch July 17, 2019 03:43
@karlding karlding mentioned this pull request Oct 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error when attempting to stop messages with same arbitration ID

3 participants