mirror of
https://github.com/apache/nuttx.git
synced 2026-05-26 18:56:10 +08:00
net/netdev: Change SIOCSCANBITRATE to require interface down.
Previously, SIOCSCANBITRATE brought the iterface up to ensure changes where immediately applied. This was confusing, see https://lists.apache.org/thread/g8d0m6yp7noywhroby5br4hxt3r4og2c Now SIOCSCANBITRATE fails is interface is up. All existing SocketCAN drivers updated. Signed-off-by: Carlos Sanchez <carlossanchez@geotab.com>
This commit is contained in:
committed by
Xiang Xiao
parent
732d811ea9
commit
dd53c34722
@@ -1176,8 +1176,18 @@ static int netdev_ifr_ioctl(FAR struct socket *psock, int cmd,
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_NETDEV_IOCTL) && defined(CONFIG_NETDEV_CAN_BITRATE_IOCTL)
|
||||
case SIOCGCANBITRATE: /* Get bitrate from a CAN controller */
|
||||
case SIOCSCANBITRATE: /* Set bitrate of a CAN controller */
|
||||
if (dev->d_flags & IFF_UP)
|
||||
{
|
||||
/* Cannot set bitrate if the interface is up. */
|
||||
|
||||
ret = -EBUSY;
|
||||
break;
|
||||
}
|
||||
|
||||
/* If down, fall-through to common code in SIOCGCANBITRATE. */
|
||||
|
||||
case SIOCGCANBITRATE: /* Get bitrate from a CAN controller */
|
||||
if (dev->d_ioctl)
|
||||
{
|
||||
FAR struct can_ioctl_data_s *can_bitrate_data =
|
||||
|
||||
Reference in New Issue
Block a user