You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CANable fails to detect a USB transmit buffer overflow most of the time.
Message is lost without error.
To reproduce
I made a script to produce a buffer overflow, which is provided at the end of this post.
It sends 200 V commands at once then checks the reply.
I got only 154 replies and one of them was corrupted as follows:
It is obvious some of data was lost.
However the result of E command showed no error.
CANable Error Register: 0
Expected behavior
Buffer overflow in this case is quite normal, but CANable should detect it and notify of the error.
Script to produce buffer overflow
overflow.py
import time
import serial
# connect to canable
# device name should be changed
canable = serial.Serial('/dev/ttyACM0', timeout=1)
# send a lot of command without receiving data
# maybe 200 is not enough depending on environment
for idx in range(0, 200):
canable.write('V\r'.encode())
# recieve all reply
rx_data = b''
while True:
time.sleep(1)
tmp = canable.read_all()
rx_data = rx_data + tmp
if len(tmp) == 0:
break
# print reply
rx_data = rx_data.replace('\r'.encode(), '[CR]\n'.encode())
print(rx_data.decode())
# check error
canable.write('E\r'.encode())
time.sleep(1)
print(canable.read_all().decode())
canable.close()
My environment:
Ubuntu 24.04.1 LTS
Python 3.12.3
pyserial 3.5
The text was updated successfully, but these errors were encountered:
Description of the bug
CANable fails to detect a USB transmit buffer overflow most of the time.
Message is lost without error.
To reproduce
I made a script to produce a buffer overflow, which is provided at the end of this post.
It sends 200
V
commands at once then checks the reply.I got only 154 replies and one of them was corrupted as follows:
It is obvious some of data was lost.
However the result of
E
command showed no error.Expected behavior
Buffer overflow in this case is quite normal, but CANable should detect it and notify of the error.
Script to produce buffer overflow
overflow.py
My environment:
The text was updated successfully, but these errors were encountered: