/* * canutils/canconfig.c * * Copyright (C) 2005, 2008 Marc Kleine-Budde , Pengutronix * Copyright (C) 2007 Juergen Beisert , Pengutronix * Copyright (C) 2009 Luotao Fu , Pengutronix * * This program is free software; you can redistribute it and/or modify * it under the terms of the version 2 of the GNU General Public License * as published by the Free Software Foundation * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include #include #include #include #include #include #include #include #include #include #include #ifndef MIN #define MIN(a, b) ((a) < (b) ? (a) : (b)) #endif const char *can_states[CAN_STATE_MAX] = { "ERROR-ACTIVE", "ERROR-WARNING", "ERROR-PASSIVE", "BUS-OFF", "STOPPED", "SLEEPING" }; /* this is shamelessly stolen from iproute and slightly modified */ #define NEXT_ARG() \ do { \ argv++; \ if (--argc <= 0) { \ fprintf(stderr, "missing parameter for %s\n", *argv); \ exit(EXIT_FAILURE);\ }\ } while(0) static void help(void) { fprintf(stderr, "usage:\n\t" "canconfig bitrate { BR } [sample-point { SP }]\n\t\t" "BR := \n\t\t" "SP := (optional)\n\t" "canconfig bittiming [ VALs ]\n\t\t" "VALs := \n\t\t" "tq