Filters not working properly (socketcan on rPi with MCP 2515 hat
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- linux, python, raspberry-pi
調査の方向性
issue に記載されている MCP2515 Raspberry Pi セットアップを使用し、再現コードの socketcan Bus セットアップ、recv ループ、set_filters 呼び出しから始めます。フィルター変更後も受信パスにすでにあるフレームが残るかどうかを調査し、フィルタリングが直ちにどのように動作すべきかを判断します。0x200 フィルターの適用後に報告された 0x100 フレームが表示されなくなれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
For my aplication I need to set filters dynamically, changing them every second or so. The bus I'm working on is quite crowded and I am runing into issues where blocked IDs are still read after the filter is set, I suppose these messages come from the RX buffer.
To Reproduce
`import os
import can
import time
os.system('sudo ip link set can0 type can bitrate 500000')
os.system('sudo ifconfig can0 up')
can0 = can.interface.Bus(channel='can0', bustype='socketcan') # socketcan_native
print("setup ok")
timeout = 999.0
start_time = time.time()
filterchanged = False
while time.time() - start_time < timeout:
msg = can0.recv(0.1)
if time.time() - start_time > 3 and filterchanged == False:
time.sleep(2)
can0.set_filters([{"can_id" : 0x200, "can_mask" : 0xFFF, "extended" : False}])
filterchanged = True
print("filter changed")
if msg is not None:
print("Received message on can0:", msg)
else:
print('Timeout occurred, no message.')
can0.shutdown()
os.system('sudo ifconfig can0 down')`
While this code is running on the rPi, i'm sending random messages on IDs 0x100 and 0x200. As we can see on the screenshot of the terminal, messages with the ID 0x100 are still read after the filter is set up.
Expected behavior
I expect messages to be filtered right away.
Additional context
OS and version: rPi os 12
Python version: 3.11.2
python-can version:
python-can interface/s (if applicable): MCP2515 2ch hat from waveshare
- 主要言語
- Python
- スター
- 1.6k
- フォーク
- 715
- 平均マージ
- 2日 4時間
- マージ済み PR(30日)
- 42
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
hardbyte/python-can のほかの issue
-
serial: a frame cut off by the read timeout raises struct.error / TypeError instead of CanOperationError対応中かも @aloneangel45 が 1 日前に担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
hardbyte/python-can#2157 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 1/5 1時間未満 初心者へのやさしさ 68/100
hardbyte/python-can#1922 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
hardbyte/python-can#2159 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 35/100
hardbyte/python-can#2121 · リアクション 2 件 ·
メンテナーはふだん 1 日以内に返信
-
Make socket binding exceptions more debugable対応中かも @vonpanda が 57 日前に担当しました。 オープンenhancement
難易度 3/5 1〜2日 初心者へのやさしさ 75/100
hardbyte/python-can#2104 ·
メンテナーはふだん 1 日以内に返信
hardbyte/python-can の issue をすべて見る
似ている issue
-
essreduce
難易度 2/5 1〜3時間 初心者へのやさしさ 69/100
メンテナーはふだん 1 日以内に返信
-
area-a2a bug port python
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
strands-agents/harness-sdk#6697 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
TigreGotico/orthography2ipa#2950 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
TigreGotico/text2spoken#929 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100