Examples | can/hello_can: Add minimal virtual CAN initialization example (!22)

MITHILESH MATTAPALLI (@mithileshm) gitlab at rtems.org
Tue Mar 10 15:18:32 UTC 2026




MITHILESH MATTAPALLI commented on a discussion on can/hello_can/hello_can.c: https://gitlab.rtems.org/rtems/rtos/rtems-examples/-/merge_requests/22#note_144956

 > +
 > +  bus1 = calloc( 1, sizeof( *bus1 ) );
 > +  bus1->chip = rtems_can_virtual_initialize();
 > +  rv = rtems_can_bus_register( bus1, "/dev/can1" );
 > +  if ( rv != 0 ) {
 > +    printf( "can1 register failed: %s\n", strerror( errno ) );
 > +    exit( 1 );
 > +  }
 > +
 > +  fd_tx = open( "/dev/can0", O_RDWR );
 > +  if ( fd_tx < 0 ) {
 > +    printf( "can0 open failed: %s\n", strerror( errno ) );
 > +    exit( 1 );
 > +  }
 > +
 > +  fd_rx = open( "/dev/can1", O_RDWR );

I put `can1` in there thinking I might use it for a two-way loopback example later.I've stripped out the extra bus and reduced `CONFIGURE_MAXIMUM_CAN_CHIPS` to 1.

-- 
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems-examples/-/merge_requests/22#note_144956
You're receiving this email because of your account on gitlab.rtems.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20260310/c8741fe2/attachment-0001.htm>


More information about the bugs mailing list