On 21.10.2010 16:37, Marc Kleine-Budde wrote:
> On 10/21/2010 03:30 PM, Felix Obenhuber wrote:
>> Hi,
>>
>> When I set two filter as in the example from can.txt:
>>
>> struct can_filter rfilter[2];
>>
>> rfilter[0].can_id   = 0x123;
>> rfilter[0].can_mask = CAN_SFF_MASK;
>> rfilter[1].can_id   = 0x200;
>> rfilter[1].can_mask = 0x700;
>>
>> setsockopt(s, SOL_CAN_RAW, CAN_RAW_FILTER, &rfilter, sizeof(rfilter));
>>
>> During message reception, I'd like to retrieve the indexes of the filters 
>> that match the received frame. Is that possible?
>> Otherwise I've got to check in userspace...
> 
> I don't think that's possible, but you can open a second socket and
> apply a different filter on each socket.

ACK.

The filters are completely independent. You can specify four identical filters
and will get the CAN frame four times when it matches.

Using a switch statement is the usual approach to catch single CAN-IDs.
And - as Marc suggested - using different sockets and select() can be used too.

Regards,
Oliver
_______________________________________________
Socketcan-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/socketcan-users

Reply via email to