Forum: µC & Digital Electronics CAN Sniffer for Linux

von Netseal (Guest)

Rate this post
0 useful
not useful

I have developed a basic CAN Sniffer for Linux. It is the very first 
See the howto in the attachment.


von Netseal (Guest)

Rate this post
0 useful
not useful

von Netseal (Guest)

Rate this post
0 useful
not useful
the attachment does not work for me.
I do not know why.
svn co https://qcanobserver.svn.sourceforge.net/svnroot/qcanobserver 

von David M. (md2k7)

Rate this post
0 useful
not useful
I guess you need to be registered and logged in to post attachments (?)

Your software seems to be for the CAN ("PCAN") adapter of the company 
Peak System-Technik. I have an "Octopus CAN" from embedded-projects.net. 
Maybe if I have some time, I will adapt your software, but at the moment 
I'm too busy for that.
(There should be an abstraction layer somewhere, so the driver-related 
CAN calls can be adapted to another driver)

You should look into entering library dependencies into your Qt project 
file, AFAIK, it supports checking the system for their existence, so you 
don't get build errors for e.g. not finding an include file of libqwt. 
Instead, you get a nice info that you need to install the lib.

I will be able to further comment after having the kernel sources and 
built the peak driver.

von David M. (md2k7)

Rate this post
0 useful
not useful
Some suggestions on revision 2:

- my qwt include directory is /usr/include/qwt-qt4 (on Ubuntu 9.10 
Karmic Koala) - one more reason to automatically look for libraries!
  I also have to link with -lqwt-qt4

- in messagebufferinterface.h, I need to include <sys/time.h> for 
'struct timeval', I don't know why you apparently don't.

- in C++, you declare structs without typedef, simply as:
struct myStruct {
// bla bla

- mainwindow.h:49 -> 1. you don't usually declare variables in a header 
file, because many source files may include them, and then all of them 
have a separate variable, which then leads to a linker error.
  2. why make a struct with a single entry?

- there are a huge lot of warnings, the compiler usually means them. 
Good code doesn't produce warnings.

- write a README file which explains how to compile the code...

- SVN usually uses a directory structure with root directories 'trunk', 
'branches' and 'tags', your source goes in trunk.

The program itself (sadly, I don't have the adapter to really test it):

- name the columns, not "column 0", "column 1", ...

- if you click "start" without having the adapter, the program dies with 
a segmentation fault, that is not the way to handle errors :-)

Nice work for a start, anyway. Don't let me take your motivation :-)


Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]

Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.