summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuotao Fu <l.fu@pengutronix.de>2007-10-16 17:47:26 +0000
committerLuotao Fu <l.fu@pengutronix.de>2007-10-16 17:47:26 +0000
commit7b74a1afe9a956e054eab5c0351222656e207178 (patch)
tree3564d08e15f5672f3ba1f8846c4ad46156f201ec
parent0217e15bd4f85141a48850a30ed77065b6037041 (diff)
downloadcanutils-canutils-2.0.x.tar.gz
added show state via ioctlcanutils-2.0.x
git-svn-id: https://iocaste.extern.pengutronix.de/svn/canutils/trunks/canutils-2.0-trunk@86 5fd5a299-6ef2-0310-aa18-8b01d7c39d8c
-rw-r--r--src/canconfig.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/canconfig.c b/src/canconfig.c
index dd1d88e..dc3fbdc 100644
--- a/src/canconfig.c
+++ b/src/canconfig.c
@@ -266,11 +266,9 @@ static void cmd_setentry(int argc, char *argv[])
exit(EXIT_SUCCESS);
}
-#if 0
static void do_show_state(int argc, char *argv[])
{
- union can_settings *settings = (union can_settings *)&ifr.ifr_ifru;
- enum CAN_STATE state;
+ can_state_t *state;
char *str;
int i;
@@ -280,15 +278,18 @@ static void do_show_state(int argc, char *argv[])
exit(EXIT_FAILURE);
}
- state = settings->state;
+ state = (can_state_t *)&ifr.ifr_ifru;
fprintf(stdout, "%s: state ", ifr.ifr_name);
- switch (state) {
+ switch (*state) {
case CAN_STATE_BUS_PASSIVE:
str = "bus passive";
break;
case CAN_STATE_ACTIVE:
str = "active";
break;
+ case CAN_STATE_BUS_WARNING:
+ str = "warning";
+ break;
case CAN_STATE_BUS_OFF:
str = "bus off";
break;
@@ -300,20 +301,17 @@ static void do_show_state(int argc, char *argv[])
exit(EXIT_SUCCESS);
}
-
static void cmd_state(int argc, char *argv[])
{
do_show_state(argc, argv);
exit(EXIT_SUCCESS);
}
-#endif
-
static void cmd_show_interface(int argc, char *argv[])
{
do_show_baudrate(argc, argv);
-/* do_show_state(argc, argv); */
+ do_show_state(argc, argv);
exit(EXIT_SUCCESS);
}