can getstate
Hi,
Can somebody provide me with a programming example on how to retrieve state using rt_dev_ioctl .
Best Regards
thanks
steph
Quoted 3 lines · Stéphane ANCELOT
Hi,
Can somebody provide me with a programming example on how to retrieve state usingrt_dev_ioctl.
What state? The state of a CAN controller, ie. the following IOCTL?
http://www.rts.uni-hannover.de/xenomai/lxr/source/include/rtdm/rtcan.h?a=i386#824
Jan
Quoted 2 lines · Stéphane ANCELOT
Hi,
Can somebody provide me with a programming example on how to retrieve state usingrt_dev_ioctl.
The following (untested) code snippet should work:
struct ifreq ifr;
can_state_t *pstate;
...
pstate = (can_state_t *)&ifr.ifr_ifru;
ret = rt_dev_ioctl(fd, SIOCGCANSTATE, &ifr);
if (ret) {
perror("rt_dev_ioctl");
return;
}
printf("Current state = %d\n", *pstate);RT-Socket-CAN allows a very flexible error handling. Please have a look to http://www.xenomai.org/documentation/trunk/html/api/group__rtcan.html#g451ba35aa4d0bef48cb7b0416f5b4367
Wolfgang,
yes, it rocks, thanks
Quoted 24 lines · Wolfgang Grandegger
Quoted 2 lines · Stéphane ANCELOT
Hi,
Can somebody provide me with a programming example on how to retrieve state usingrt_dev_ioctl.The following (untested) code snippet should work:
struct ifreq ifr; can_state_t *pstate; ... pstate = (can_state_t *)&ifr.ifr_ifru; ret = rt_dev_ioctl(fd, SIOCGCANSTATE, &ifr); if (ret) { perror("rt_dev_ioctl"); return; } printf("Current state = %d\n", *pstate);RT-Socket-CAN allows a very flexible error handling. Please have a look to http://www.xenomai.org/documentation/trunk/html/api/group__rtcan.html#g451ba35aa4d0bef48cb7b0416f5b4367
Wolfgang,