Linux CAN drivers development
 help / color / mirror / Atom feed
From: Tom Evans <tom_usenet@optusnet.com.au>
To: Paarvai Naai <opensource3141@gmail.com>, linux-can@vger.kernel.org
Subject: Re: getifaddrs and SocketCAN interfaces
Date: Mon, 30 Mar 2015 09:23:08 +1100	[thread overview]
Message-ID: <55187B4C.4070706@optusnet.com.au> (raw)
In-Reply-To: <CAE+ymrs_yWEgR6OVP8rCiqCr4wJtXUGkYVJNMbgZxufTROeZ4Q@mail.gmail.com>

On 29/03/15 07:30, Paarvai Naai wrote:
> Hi,
>
> I recently tried using getifaddrs to list all of the SocketCAN
> interfaces on my system programmatically.

root@triton1:/# find /sys -name "*can*"
/sys/bus/platform/devices/flexcan.0
/sys/bus/platform/devices/flexcan.1
/sys/bus/platform/drivers/flexcan
/sys/bus/platform/drivers/flexcan/flexcan.0
/sys/bus/platform/drivers/flexcan/flexcan.1
/sys/devices/soc.0/50000000.aips/flexcan.0
/sys/devices/soc.0/50000000.aips/flexcan.0/net/can0
/sys/devices/soc.0/50000000.aips/flexcan.1
/sys/devices/soc.0/50000000.aips/flexcan.1/net/can1
/sys/devices/virtual/net/vcan0
...
/sys/class/net/vcan0
/sys/class/net/can0
/sys/class/net/can1

Then I open them by name:

     struct ifreq ifr;
     strcpy(ifr.ifr_name, f_vnCanBusNames[a_eDevice]);
     /* ifr.ifr_ifindex gets filled
     rc = ioctl(pSkt->skt, SIOCGIFINDEX, &ifr);

Or was there something else you needed?

Tom


      parent reply	other threads:[~2015-03-29 22:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-28 20:30 getifaddrs and SocketCAN interfaces Paarvai Naai
2015-03-29 18:36 ` Oliver Hartkopp
2015-03-29 19:40   ` dev.kurt
2015-03-30 21:46     ` Paarvai Naai
2015-03-29 22:23 ` Tom Evans [this message]

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=55187B4C.4070706@optusnet.com.au \
    --to=tom_usenet@optusnet.com.au \
    --cc=linux-can@vger.kernel.org \
    --cc=opensource3141@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox