Jan Kiszka wrote:
Wolfgang Grandegger wrote:
Hi Jan,

Jan Kiszka wrote:
Hi Wolfgang,
[...deletions...]

Last remark: For the sake of completeness, tx-loopback should also be
implemented in the virtual CAN driver.
The virtual CAN driver already works like TX loopback. It routes TX
messages to local foreign sockets (but without sending them to any bus).

There is a minor difference: When application A is attached to a socket
on virtual CAN device 1, B to device 2, and C to 1 again, a message sent
by A will only be received by B. TX loopback as you are introducing it
should make C receive it as well - in order to have a fully compatible
test environment.

Ah, I missed the case (rx_dev == tx_dev). This should work then:

        /* Deliver to all other devices on the virtual bus */
        for (i = 0; i < devices; i++) {
                rx_dev = rtcan_virt_devs[i];
                if (rx_dev->state == CAN_STATE_ACTIVE) {
                        if (tx_dev != rx_dev) {
                                rx_frame->can_ifindex = rx_dev->ifindex;
                                rtcan_rcv(rx_dev, &skb);
                        } else if (rtcan_tx_loopback_pending(tx_dev))
                                rtcan_tx_loopback(tx_dev);
                }
        }

Thanks.

Wolfgang.

_______________________________________________
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core

Reply via email to