On Tuesday 26 October 2010, 15:44:26 Marc Kleine-Budde wrote:
> On 10/26/2010 03:16 PM, Alexander Stein wrote:
> > I'm just wondering what's the correct way to change the bitrate. I
> > already noticed I need to shutdown the can interface previously. So I
> > use system() with "ip link..." to shutdown, set the new bitrate and
> > restart the interface. I kept my sockets during bitrate change and the
> > first read() or write() call return ENETDOWN once. Afterwards those
> > sockets work normally.
> > So, how can I get rid of this ENETDOWN? Close the sockets on this
> > interface previously?
> 
> Yes. Shuttig down the interface causes all sockets bind()ed to that
> interface to get an -ENETDOWN. Either don't bind() to a specific can
> interface or close the sockets prior to shutdown and reopen them after.

Unbound sockets receive frames from all interfaces, right? Well, this is 
unusable in a test software on a multi channel hardware.

> BTW: If you don't want to use that ugly system("ip link ...") call you
> can use libsocketcan:
> 
> http://www.pengutronix.de/software/libsocketcan/download/
> http://git.pengutronix.de/?p=tools/libsocketcan.git;a=blob;f=include/libsoc
> ketcan.h

Thanks for the hint, I'm already aware of that lib.

Best regards,
Alexander
_______________________________________________
Socketcan-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/socketcan-users

Reply via email to