On 10/19/2010 06:16 PM, Jargalan Nermunkh wrote:
>> I'm a bit in a hurry....Long story short: it's a bug in the (in-driver)
>> can error frame generation [1]. I'm going to fix this later.

> Forgot to mention in my other e-mails that the ID 000 and 004 messages are
> easier to produce when there is only 1 byte of data is sent.

Oh, that's good.

I've identified the problem, please try this fix:

From cca3ff648bcee45bfc6cd17824fac4d5f75ab45d Mon Sep 17 00:00:00 2001
From: Marc Kleine-Budde <m...@pengutronix.de>
Date: Tue, 19 Oct 2010 17:52:59 +0200
Subject: [PATCH] can: mcp251x: fix generation of error frames

The function "mcp251x_error_skb" should generate error frames, which are
identified by the "CAN_ERR_FLAG" in can_id. The function overwrites the
can_id so that the frames show up as normal instead of error frames.

This patch fixes the problem by or'ing the can_id instead of overwriting.

Signed-off-by: Marc Kleine-Budde <m...@pengutronix.de>
---
 drivers/net/can/mcp251x.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/can/mcp251x.c b/drivers/net/can/mcp251x.c
index 59f40bc..6aadc3e 100644
--- a/drivers/net/can/mcp251x.c
+++ b/drivers/net/can/mcp251x.c
@@ -705,7 +705,7 @@ static void mcp251x_error_skb(struct net_device *net, int 
can_id, int data1)
 
        skb = alloc_can_err_skb(net, &frame);
        if (skb) {
-               frame->can_id = can_id;
+               frame->can_id |= can_id;
                frame->data[1] = data1;
                netif_rx_ni(skb);
        } else {
-- 
1.7.0.4

Marc
-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Socketcan-users mailing list
Socketcan-users@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/socketcan-users

Reply via email to