mirror of
https://github.com/apache/nuttx.git
synced 2025-01-13 09:49:21 +08:00
SocketCAN: Fixed dropping timestamped frames when running in CAN2.0B
This commit is contained in:
parent
ebeeb0d3e8
commit
ba5fe5cee3
3 changed files with 11 additions and 0 deletions
|
@ -165,6 +165,7 @@ int can_getsockopt(FAR struct socket *psock, int option,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#ifdef CONFIG_NET_CAN_CANFD
|
||||||
case CAN_RAW_FD_FRAMES:
|
case CAN_RAW_FD_FRAMES:
|
||||||
if (*value_len < sizeof(conn->fd_frames))
|
if (*value_len < sizeof(conn->fd_frames))
|
||||||
{
|
{
|
||||||
|
@ -183,6 +184,7 @@ int can_getsockopt(FAR struct socket *psock, int option,
|
||||||
ret = OK;
|
ret = OK;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
case CAN_RAW_JOIN_FILTERS:
|
case CAN_RAW_JOIN_FILTERS:
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -436,7 +436,14 @@ static uint16_t can_recvfrom_eventhandler(FAR struct net_driver_s *dev,
|
||||||
if (!conn->fd_frames)
|
if (!conn->fd_frames)
|
||||||
#endif
|
#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))
|
if (dev->d_len > sizeof(struct can_frame))
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
/* DO WE NEED TO CLEAR FLAGS?? */
|
/* DO WE NEED TO CLEAR FLAGS?? */
|
||||||
|
|
||||||
|
|
|
@ -140,6 +140,7 @@ int can_setsockopt(FAR struct socket *psock, int option,
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#ifdef CONFIG_NET_CAN_CANFD
|
||||||
case CAN_RAW_FD_FRAMES:
|
case CAN_RAW_FD_FRAMES:
|
||||||
if (value_len != sizeof(conn->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;
|
conn->fd_frames = *(FAR int32_t *)value;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
case CAN_RAW_JOIN_FILTERS:
|
case CAN_RAW_JOIN_FILTERS:
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue