Filters not working properly (socketcan on rPi with MCP 2515 hat
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- linux, python, raspberry-pi
- Área
- embedded-iot, networking
Línea de trabajo
Comienza con la configuración del bus socketcan, el bucle recv y la llamada a set_filters en la reproducción, utilizando la configuración de MCP2515 en Raspberry Pi descrita en la issue. Investiga si los frames que ya están en la ruta de recepción permanecen después de cambiar los filtros y determina cómo debe comportarse el filtrado inmediatamente; se considera terminado cuando los frames 0x100 reportados ya no aparecen después de aplicar el filtro 0x200.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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
- Lenguaje dominante
- Python
- Estrellas
- 1.6k
- Forks
- 715
- Merge medio
- 2 d 4 h
- PR fusionados (30 d)
- 42
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de hardbyte/python-can
-
serial: a frame cut off by the read timeout raises struct.error / TypeError instead of CanOperationErrorPosiblemente ocupada @aloneangel45 la tomó hace 1 día. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
hardbyte/python-can#2157 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 1/5 Menos de una hora Aptitud para principiantes 68/100
hardbyte/python-can#1922 · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
enhancement
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
hardbyte/python-can#2159 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 35/100
hardbyte/python-can#2121 · 2 reacciones ·
Los mantenedores suelen responder en 1 día
-
Make socket binding exceptions more debugablePosiblemente ocupada @vonpanda la tomó hace 57 días. Abiertoenhancement
Dificultad 3/5 1-2 días Aptitud para principiantes 75/100
hardbyte/python-can#2104 ·
Los mantenedores suelen responder en 1 día
Todos los issues de hardbyte/python-can
Issues similares
-
essreduce
Dificultad 2/5 1-3 horas Aptitud para principiantes 69/100
Los mantenedores suelen responder en 1 día
-
area-a2a bug port python
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
strands-agents/harness-sdk#6697 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
TigreGotico/orthography2ipa#2950 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
TigreGotico/text2spoken#929 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100