All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tom Evans <tom_usenet@optusnet.com.au>
To: Guillaume Picquet <guillaume@picquet.fr>,
	Oliver Hartkopp <socketcan@hartkopp.net>,
	Marc Kleine-Budde <mkl@pengutronix.de>,
	linux-can@vger.kernel.org
Subject: Re: Setting bitrate from user-space application
Date: Sat, 28 Nov 2015 13:28:12 +1100	[thread overview]
Message-ID: <5659113C.20000@optusnet.com.au> (raw)
In-Reply-To: <5655DF32.5090505@picquet.fr>

On 26/11/2015 3:17 AM, Guillaume Picquet wrote:
> Le 25/11/2015 17:04, Oliver Hartkopp a écrit :
>> Hi Guillaume,
>>
>> On 11/25/2015 03:58 PM, Marc Kleine-Budde wrote:
>>> On 11/25/2015 03:02 PM, Guillaume Picquet wrote:
>>>> Hi all,
>>>>
>>>> I prefer to ask first to those who know.
>>>>
>>>> What is the 'normal' way of setting CAN bitrate from user-space
>>>> application ?

The "abnormal" way I do it is basically:

     char *pName = (a_eDevice == CAN_BUS_CAN_0) ? "can0" : "can1";
     sprintf(vBuf,
             "/usr/local/sbin/canconfig %s stop > /dev/null ; "
             "/usr/local/sbin/canconfig %s bitrate %d > /dev/null ; "
             "/usr/local/sbin/canconfig %s start > /dev/null\n",
             pName, pName, a_nKbaud * 1000, pName);
             nRc = system(vBuf);

Or if using Freescale's 2.6.35 driver, "ifconfig can0 down/up" and
"echo 500000 > /sys/class/devices/platform/FlexCAN.0/bitrate" in the 
above "system()" call.

I realise the above may be horrible, but I'd like some more information 
on why it might be bad.

Tom


  reply	other threads:[~2015-11-28  2:56 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-25 14:02 Setting bitrate from user-space application Guillaume Picquet
2015-11-25 14:24 ` Misra Pankaj Kumar (RBEI/EEA2)
2015-11-25 14:58 ` Marc Kleine-Budde
2015-11-25 16:04   ` Oliver Hartkopp
2015-11-25 16:10     ` Marc Kleine-Budde
2015-11-25 16:17     ` Guillaume Picquet
2015-11-28  2:28       ` Tom Evans [this message]
2015-12-23 12:07         ` Holger Schurig
2015-12-23 14:03       ` Guillaume Picquet
2015-12-23 14:10         ` Marc Kleine-Budde

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5659113C.20000@optusnet.com.au \
    --to=tom_usenet@optusnet.com.au \
    --cc=guillaume@picquet.fr \
    --cc=linux-can@vger.kernel.org \
    --cc=mkl@pengutronix.de \
    --cc=socketcan@hartkopp.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.