All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: gianluca <gianlucarenzi@eurekelettronica.it>,
	"linux-can@vger.kernel.org" <linux-can@vger.kernel.org>
Subject: Re: Socketcan correct way to bootup...
Date: Wed, 09 Jul 2014 13:16:31 +0200	[thread overview]
Message-ID: <53BD248F.5030608@pengutronix.de> (raw)
In-Reply-To: <53BD1BE1.8050403@eurekelettronica.it>

[-- Attachment #1: Type: text/plain, Size: 1561 bytes --]

On 07/09/2014 12:39 PM, gianluca wrote:
> I was wondering if there is some "Offical" way to bring-up a socketcan
> interface during bootup of a Linux System. Actually I write a simple
> script BEFORE running my application in this way:

Depends on your Distribution/init system.

> # run.sh 125000 75 can0
> 
> [ run.sh ]
> #!/bin/sh
> BITRATE=$1
> SAMPLE=".$2"
> INTERFACE=$3
> ip link set $INTERFACE up type can bitrate ${BITRATE} sample-point
> ${SAMPLE}
> ip -details link show $INTERFACE
> while [ true ];
> do
>     ./myapplication
> done
> 
> Are there some guidelines on how to approach this startup? i.e. I was
> thinking about similar to ifup /etc/network/interface but with the
> addendum of the bitrate and sample point...

On recent Debian based Distris you can use ifup/ifdown for CAN
interfaces. See the man page of interfaces.

If you use busybox's ifup/ifdown you can fall back to the "inet manual"
mode and specify /sbin/ip commands to configure and up/down your
interface. On systemd you can add a service that starts CAN and runs
before your actual program.

Marc

BTW: you probably want to integrate your application into the automatic
startup via an init script or in new designs with systemd...and _not_
start it by hand.

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 242 bytes --]

       reply	other threads:[~2014-07-09 11:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <53BD1BE1.8050403@eurekelettronica.it>
2014-07-09 11:16 ` Marc Kleine-Budde [this message]
2014-07-09 12:29   ` Socketcan correct way to bootup Yegor Yefremov
2014-07-09 12:36     ` Marc Kleine-Budde
2014-07-09 12:44       ` Yegor Yefremov
2014-07-09 23:45         ` Oliver Hartkopp

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=53BD248F.5030608@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=gianlucarenzi@eurekelettronica.it \
    --cc=linux-can@vger.kernel.org \
    /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.