All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oliver Hartkopp <socketcan@hartkopp.net>
To: Joachim Jaus <jaus@black-photon.de>
Cc: linux-can@vger.kernel.org, Yegor Yefremov <yegorslists@googlemail.com>
Subject: Re: Several sockets on one interface in Python
Date: Fri, 31 May 2013 18:38:58 +0200	[thread overview]
Message-ID: <51A8D222.8000206@hartkopp.net> (raw)
In-Reply-To: <51A87391.6010308@black-photon.de>

Hi Joachim,

On 31.05.2013 11:55, Joachim Jaus wrote:
> Hi all,
> this is my first email to this list, therefore I want start with a big "thank
> you" to all the people involved in the Linux CAN socket development, which has
> opened up a lot of interesting possibilities for sensor and machine control
> for me and my colleagues.

Great! Mind-expansion without drugs but only through SocketCAN :-)

> 
> We would like to bind several sockets with different filter settings to one
> single CAN interface within the same application. Is that generally a safe
> thing to do (both in C and in Python)?

Yes, it's a safe thing to do.

E.g. the candump programm does it in this way.

You may create multiple sockets having each multiple filters.

The only potential drawback that you need to put a select() statement around
it, to manage to read from all created sockets/filedescriptors.

> Is there a way to set filters on a CAN socket in Python similar to the
> implementation in C?

I don't know exactly.
But "CAN_RAW_FILTER" is defined in the Python patch:

http://bugs.python.org/file23234/socketcan_v5.patch

http://libbits.wordpress.com/2012/05/22/socketcan-support-in-python/

so you can hope that the filters are configurable in some way.

Perhaps Yegor knows more about this.

Best ragards,
Oliver



  reply	other threads:[~2013-05-31 16:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-31  9:55 Several sockets on one interface in Python Joachim Jaus
2013-05-31 16:38 ` Oliver Hartkopp [this message]
2013-06-03  7:20   ` Yegor Yefremov

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=51A8D222.8000206@hartkopp.net \
    --to=socketcan@hartkopp.net \
    --cc=jaus@black-photon.de \
    --cc=linux-can@vger.kernel.org \
    --cc=yegorslists@googlemail.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 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.