1

I have a USB/CAN adapter, from lsusb:

OpenMoko, Inc. Geschwister Schneider CAN adapter

it provides a socket interface, from ip addr:

5: can0: <NOARP,UP,LOWER_UP,ECHO> mtu 16 qdisc pfifo_fast state UP group default qlen 10 link/can 

On the bus there are other devices that sends data continuously. If I reboot my PC, I cannot send/receive data anymore, because I get the following error:

No buffer space available

I guess that while the device is "disconnected" from the PC (because it's rebooting, but still powered) the internal buffers fill up.

Is there a command I can issue to clear the buffers?

Mark
  • 677
  • 1
  • 10
  • 24

1 Answers1

1

I believe the python-can library offers a solution to this

https://buildmedia.readthedocs.org/media/pdf/python-can/develop/python-can.pdf

The python-can library provides Controller Area Network support for Python, providing common abstractions to different hardware devices, and a suite of utilities for sending and receiving messages on a CAN bus.

One of the functions offered there is flush_tx_buffer()

flush_tx_buffer()

Discard every message that may be queued in the output buffer(s).

The library can be downloaded from various locations, including from the github repo at https://github.com/hardbyte/python-can

steve
  • 21,582
  • 5
  • 48
  • 75