diff options
author | Benedikt Spranger <b.spranger@linutronix.de> | 2013-01-25 15:50:32 (GMT) |
---|---|---|
committer | Thomas Graf <tgraf@suug.ch> | 2013-01-25 18:51:33 (GMT) |
commit | 6cc5fdc0e915c76d43055bf58e1e133f6ad2f1c8 (patch) | |
tree | ae9a63e51495519182841075a1832603a2ea5fdf /lib/route | |
parent | 4cb375a81231067d19ee13478056e89401227c41 (diff) | |
download | libnl-6cc5fdc0e915c76d43055bf58e1e133f6ad2f1c8.zip libnl-6cc5fdc0e915c76d43055bf58e1e133f6ad2f1c8.tar.gz libnl-6cc5fdc0e915c76d43055bf58e1e133f6ad2f1c8.tar.bz2 |
can: add helper function to get CAN bus state
Add a helper function to get the CAN bus state.
Signed-off-by: Benedikt Spranger <b.spranger@linutronix.de>
Diffstat (limited to 'lib/route')
-rw-r--r-- | lib/route/link/can.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/route/link/can.c b/lib/route/link/can.c index 76bfa1a..307dec0 100644 --- a/lib/route/link/can.c +++ b/lib/route/link/can.c @@ -405,6 +405,25 @@ int rtnl_link_can_freq(struct rtnl_link *link, uint32_t *freq) } /** + * Get CAN state + * @arg link Link object + * @arg state CAN bus state + * @return 0 on success or a negative error code + */ +int rtnl_link_can_state(struct rtnl_link *link, uint32_t *state) +{ + struct can_info *ci = link->l_info; + + IS_CAN_LINK_ASSERT(link); + if (!state) + return -NLE_INVAL; + + *state = ci->ci_state; + + return 0; +} + +/** * Get CAN RX bus error count * @arg link Link object * |