Re: [PATCH] can: kvaser_usb_leaf: Implement CAN 2.0 raw DLC functionality.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2023-05-08 18:40, Jimmy Assarsson wrote:
Hi Carsten,
Hi Oliver,

On 5/6/23 21:10, Oliver Hartkopp wrote:
Thanks for your patch Carsten!

There should be at least one sentence in the commit message even when the subject almost covers the story ;-)

@Carsten, thanks for the patch!

Acked-by: Jimmy Assarsson <extja@xxxxxxxxxx>
Tested-by: Jimmy Assarsson <extja@xxxxxxxxxx>

Can you also please change the subject to

can: kvaser_usb: add len8_dlc support for kvaser_usb_leaf

to follow up with the other len8_dlc patches?

@Jimmy: AFAIK Carsten only has a Kvaser USB Leaf for testing. Can you probably provide and test a similar improvement for the Kvaser USB Hydra hardware?


@Oliver, yes, I'll fix this for the remaining Kvaser USB devices.
I'll try to send a patch for it by the end of the week.

Best regards,
jimmy

Hi Carsten,

I've implemented cc-len8-dlc support for the Kvaser USB Hydra devices.
Is it OK if I add my changes to your patch, and send it is as a V2?

Best regards,
jimmy

Many thanks,
Oliver

On 06.05.23 12:55, Carsten Schmidt wrote:
Signed-off-by: Carsten Schmidt <carsten.schmidt-achim@xxxxxxxxxxx>
---
  drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c | 7 ++++---
  1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c b/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c
index 1c2f99ce4c6c..713b633773b1 100644
--- a/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c
+++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c
@@ -573,7 +573,7 @@ kvaser_usb_leaf_frame_to_cmd(const struct kvaser_usb_net_priv *priv,
              cmd->u.tx_can.data[1] = cf->can_id & 0x3f;
          }
-        cmd->u.tx_can.data[5] = cf->len;
+        cmd->u.tx_can.data[5] = can_get_cc_dlc(cf, priv->can.ctrlmode);
          memcpy(&cmd->u.tx_can.data[6], cf->data, cf->len);
          if (cf->can_id & CAN_RTR_FLAG)
@@ -1349,7 +1349,7 @@ static void kvaser_usb_leaf_rx_can_msg(const struct kvaser_usb *dev,
          else
              cf->can_id &= CAN_SFF_MASK;
-        cf->len = can_cc_dlc2len(cmd->u.leaf.log_message.dlc);
+        can_frame_set_cc_len(cf, cmd->u.leaf.log_message.dlc & 0xF, priv->can.ctrlmode);
          if (cmd->u.leaf.log_message.flags & MSG_FLAG_REMOTE_FRAME)
              cf->can_id |= CAN_RTR_FLAG;
@@ -1367,7 +1367,7 @@ static void kvaser_usb_leaf_rx_can_msg(const struct kvaser_usb *dev,
              cf->can_id |= CAN_EFF_FLAG;
          }
-        cf->len = can_cc_dlc2len(rx_data[5]);
+        can_frame_set_cc_len(cf, rx_data[5] & 0xF, priv->can.ctrlmode);
          if (cmd->u.rx_can_header.flag & MSG_FLAG_REMOTE_FRAME)
              cf->can_id |= CAN_RTR_FLAG;
@@ -1702,6 +1702,7 @@ static int kvaser_usb_leaf_init_card(struct kvaser_usb *dev)
      struct kvaser_usb_dev_card_data *card_data = &dev->card_data;
      card_data->ctrlmode_supported |= CAN_CTRLMODE_3_SAMPLES;
+    card_data->ctrlmode_supported |= CAN_CTRLMODE_CC_LEN8_DLC;
      return 0;
  }



[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux