Hi, On Thu, Nov 26, 2009 at 01:09:55PM +0100, Wolfgang Grandegger wrote: > Wolfgang Grandegger wrote: > > Hi Fu, > > > > Luotao Fu wrote: > >> Hi Vlasdiv, > >> > >> On Wed, Nov 25, 2009 at 06:30:07PM +0100, [email protected] wrote: <snip> > >>> Such a user space component can make things really easier for me, as a > >>> CANopen SW maintainer under SocketCAN. If I can use someuser space > >>> library > >>> "libsocketcan" to: > >>> > >>> - start/stop CAN > >> yeah, start with > >> scan_do_restart(const char* name) > >> stop alias driving down the interface is there but used as static, I'll > >> make a wrapper with proper name for this. > > > > Hm, the name "restart" is somehow reserved for bus-off recovery. Even if > > the name is not well chosen, we should use another name for down/up, > > e.g. scan_do_down_up() to make that clear, if we need that at all. Or > > have I missed something? > > Just looked to the code. scan_do_restart() just does the bus-off > recovery if appropriate. But I realized that the scan_set_* functions do > stop the device before setting the property. That's dangerous and error > prune and therefore we did not allow it in the kernel. It's up to the > user/application to handle up/down properly.
Certain things like set_bitrate or ctrlmode are anyway not allowed while the device is up and running. I think that it's a question of policy, that we if we take care of if_up down in the library or let the user do it in the application. imho if an application is allowed to change bitrate while there're communication running, the application is all the way errnoues, it won't help much to put the if_up/down into the application. I personally prefer to hide these things from user. Since the usage is this way much simpler. Another possiblitiy is to expose two kind of _set functions, one is in the way of do-it-yourself, where the library relies on that the user has put off the device prioly. The other is the way "we-do-it-for-you", as we have now. > Furthermore, these > functions seem to start the device even if it was not up before. > good point, I didn't thought about this, will add a verification into that. Thanks for reviewing cheers Fu -- Pengutronix e.K. | Dipl.-Ing. Luotao Fu | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
signature.asc
Description: Digital signature
_______________________________________________ Socketcan-users mailing list [email protected] https://lists.berlios.de/mailman/listinfo/socketcan-users
