mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-08-01 20:29:00 +00:00
canutils: use bps units for bitrate in SocketCAN interfaces.
This matches PR https://github.com/apache/nuttx/pull/16225 in Nuttx where units for SocketCAN bitrate ioctls were changed.
This commit is contained in:
parent
ecbd1e964a
commit
8d89d73bb8
2 changed files with 4 additions and 6 deletions
|
|
@ -120,7 +120,7 @@ index ca7e7d95..fed1ae16 100644
|
|||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ *pbitrate = ifr.ifr_ifru.ifru_can_data.arbi_bitrate * 1000;
|
||||
+ *pbitrate = ifr.ifr_ifru.ifru_can_data.arbi_bitrate;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
|
|
@ -141,8 +141,8 @@ index ca7e7d95..fed1ae16 100644
|
|||
+ struct ifreq ifr;
|
||||
+ if_indextoname(can->ifindex, ifr.ifr_name);
|
||||
+
|
||||
+ ifr.ifr_ifru.ifru_can_data.arbi_bitrate = bitrate / 1000;
|
||||
+ ifr.ifr_ifru.ifru_can_data.data_bitrate = bitrate / 1000;
|
||||
+ ifr.ifr_ifru.ifru_can_data.arbi_bitrate = bitrate;
|
||||
+ ifr.ifr_ifru.ifru_can_data.data_bitrate = bitrate;
|
||||
+ ifr.ifr_ifru.ifru_can_data.arbi_samplep = 0;
|
||||
+ ifr.ifr_ifru.ifru_can_data.data_samplep = 0;
|
||||
+
|
||||
|
|
|
|||
|
|
@ -363,9 +363,7 @@ int main(int argc, char *argv[])
|
|||
/* set the device name */
|
||||
|
||||
strlcpy(ifr.ifr_name, argv[1], IFNAMSIZ);
|
||||
|
||||
ifr.ifr_ifru.ifru_can_data.arbi_bitrate =
|
||||
canspeed / 1000; /* Convert bit/s to kbit/s */
|
||||
ifr.ifr_ifru.ifru_can_data.arbi_bitrate = canspeed;
|
||||
ifr.ifr_ifru.ifru_can_data.arbi_samplep = 80;
|
||||
|
||||
if (ioctl(s, SIOCSCANBITRATE, &ifr) < 0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue