Skip to content
Permalink
Browse files
Add files via upload
  • Loading branch information
adakes committed Jan 5, 2023
1 parent e58fe67 commit cf0904b021110df5b4970a7be8ee10cccdb9a37e
Showing 1 changed file with 31 additions and 0 deletions.
@@ -0,0 +1,31 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

#include <linux/can.h>
#include <linux/can/raw.h>

#include "can_wrap.h"

int main( int argc, char* argv[] )
{
const char* canChannel = "vcan0";
const int canSocket = can_connect( canChannel, false );

for( int c=0; c<100; ++c )
{
struct can_frame frame;
if( can_read( canSocket, &frame ) )
{
printf("0x%X [%X]", frame.can_id, frame.can_dlc );
for( int i=0; i<frame.can_dlc; ++i )
printf( " %02X", frame.data[i] );
printf("\n");
}
}

can_close( canSocket );

return 0;
}

0 comments on commit cf0904b

Please sign in to comment.