* Several sockets on one interface in Python
@ 2013-05-31 9:55 Joachim Jaus
2013-05-31 16:38 ` Oliver Hartkopp
0 siblings, 1 reply; 3+ messages in thread
From: Joachim Jaus @ 2013-05-31 9:55 UTC (permalink / raw)
To: linux-can
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.
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)?
Is there a way to set filters on a CAN socket in Python similar to the
implementation in C?
Background:
We are implementing a machine control system with several sensors and
actuators communicating over the same CAN bus using the CAN-open protocol.
There are several control loops running simultaneously, each controlled
by a python sub-process.
It would be convenient if each subprocess had several sockets, with each
socket receiving only messages sent by a certain CAN-open node or a
group of CAN-open nodes. That way, we could most easily receive all
relevant messages (SDOs, PDOs, ...) from a specific node or group of nodes.
Best regards,
Joachim
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Several sockets on one interface in Python
2013-05-31 9:55 Several sockets on one interface in Python Joachim Jaus
@ 2013-05-31 16:38 ` Oliver Hartkopp
2013-06-03 7:20 ` Yegor Yefremov
0 siblings, 1 reply; 3+ messages in thread
From: Oliver Hartkopp @ 2013-05-31 16:38 UTC (permalink / raw)
To: Joachim Jaus; +Cc: linux-can, Yegor Yefremov
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Several sockets on one interface in Python
2013-05-31 16:38 ` Oliver Hartkopp
@ 2013-06-03 7:20 ` Yegor Yefremov
0 siblings, 0 replies; 3+ messages in thread
From: Yegor Yefremov @ 2013-06-03 7:20 UTC (permalink / raw)
To: Oliver Hartkopp; +Cc: Joachim Jaus, linux-can@vger.kernel.org
On Fri, May 31, 2013 at 6:38 PM, Oliver Hartkopp <socketcan@hartkopp.net> wrote:
> 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.
No. Never tried filtering. Was just curious, how Python support feels
like, tried the example and wrote the blog entry. Joachim, please try
and share your experience. I'll then include this into our wiki:
http://elinux.org/Python_Can
You can also try to ask devs involved in this patch
creation/reviewing: http://bugs.python.org/issue10141
Yegor
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-06-03 7:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-31 9:55 Several sockets on one interface in Python Joachim Jaus
2013-05-31 16:38 ` Oliver Hartkopp
2013-06-03 7:20 ` Yegor Yefremov
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.