summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Kleine-Budde <mkl@pengutronix.de>2007-09-21 12:18:16 +0000
committerMarc Kleine-Budde <mkl@pengutronix.de>2007-09-21 12:18:16 +0000
commit6a1f4ab364f230a6880615ac9b220a6a0f42dc67 (patch)
tree32ce39709ad7ed5c773173a94804603750fc6da6
parentffba6d6043865f2e7313e9f53478c0317b8de2ae (diff)
downloadcanutils-6a1f4ab364f230a6880615ac9b220a6a0f42dc67.tar.gz
git-svn-id: https://iocaste.extern.pengutronix.de/svn/canutils/trunks/canutils-2.0-trunk@72 5fd5a299-6ef2-0310-aa18-8b01d7c39d8c
-rw-r--r--src/canconfig.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/canconfig.c b/src/canconfig.c
index 3ce0fb7..685f8a4 100644
--- a/src/canconfig.c
+++ b/src/canconfig.c
@@ -47,11 +47,8 @@ struct ifreq ifr;
static void help(void)
{
fprintf(stderr, "usage:\n\t"
- "canconfig <dev> baudrate { BR | BTR }\n\t\t"
- "BR := { 10 | 20 | 50 | 100 | 125 | 250 | 500 | 800 | 1000 }\n\t\t"
- "BTR := btr_sja1000 <brp> <sjw> <tseg1> <tseg2> <sam>\n\t\t"
- "BTR := btr_c_can <brp> <sjw> <tseg1> <tseg2>\n\t\t"
- "BTR := btr_nios <prescale> <timea> <timeb>\n\t"
+ "canconfig <dev> baudrate { BR }\n\t\t"
+ "BR := <baudrate>\n\t\t"
"canconfig <dev> mode MODE\n\t\t"
"MODE := { start }\n\t"
"canconfig <dev> state\n"
@@ -73,8 +70,13 @@ static void do_show_baudrate(int argc, char* argv[])
exit(EXIT_FAILURE);
}
- fprintf(stdout,
- "%s: baudrate %d\n", ifr.ifr_name, *baudrate);
+ if (*baudrate != -1)
+ fprintf(stdout,
+ "%s: baudrate %d\n", ifr.ifr_name, *baudrate / 1000);
+ else
+ fprintf(stdout,
+ "%s: baudrate unknown\n", ifr.ifr_name);
+
}
@@ -83,7 +85,7 @@ static void do_set_baudrate(int argc, char* argv[])
uint32_t *baudrate = (uint32_t *)&ifr.ifr_ifru;
int i;
- *baudrate = (uint32_t)strtoul(argv[3], NULL, 0);
+ *baudrate = (uint32_t)strtoul(argv[3], NULL, 0) * 1000;
if (*baudrate == 0) {
fprintf(stderr, "invalid baudrate\n");
exit(EXIT_FAILURE);