SocketCAN: Fixed dropping timestamped frames when running in CAN2.0B

This commit is contained in:
Peter van der Perk 2020-06-17 17:24:17 +02:00 committed by David Sidrane
parent ebeeb0d3e8
commit ba5fe5cee3
3 changed files with 11 additions and 0 deletions

View file

@ -165,6 +165,7 @@ int can_getsockopt(FAR struct socket *psock, int option,
}
break;
#ifdef CONFIG_NET_CAN_CANFD
case CAN_RAW_FD_FRAMES:
if (*value_len < sizeof(conn->fd_frames))
{
@ -183,6 +184,7 @@ int can_getsockopt(FAR struct socket *psock, int option,
ret = OK;
}
break;
#endif
case CAN_RAW_JOIN_FILTERS:
break;

View file

@ -436,7 +436,14 @@ static uint16_t can_recvfrom_eventhandler(FAR struct net_driver_s *dev,
if (!conn->fd_frames)
#endif
{
#if defined(CONFIG_NET_TIMESTAMP)
if ((conn->psock->s_timestamp && (dev->d_len >
sizeof(struct can_frame) + sizeof(struct timeval)))
|| (!conn->psock->s_timestamp && (dev->d_len >
sizeof(struct can_frame))))
#else
if (dev->d_len > sizeof(struct can_frame))
#endif
{
/* DO WE NEED TO CLEAR FLAGS?? */

View file

@ -140,6 +140,7 @@ int can_setsockopt(FAR struct socket *psock, int option,
break;
#ifdef CONFIG_NET_CAN_CANFD
case CAN_RAW_FD_FRAMES:
if (value_len != sizeof(conn->fd_frames))
{
@ -149,6 +150,7 @@ int can_setsockopt(FAR struct socket *psock, int option,
conn->fd_frames = *(FAR int32_t *)value;
break;
#endif
case CAN_RAW_JOIN_FILTERS:
break;