From 60b77912ab3388776fddc7a6389f32ec07b9690f Mon Sep 17 00:00:00 2001 From: Oliver Hartkopp Date: Mon, 5 Mar 2007 21:58:28 +0000 Subject: [PATCH] Fixed Makefiles to compile test-apps and can-utils again. Added new commandline parameter (linediscipline value) to slcan_attach. --- Makefile | 4 +++- slcan_attach.c | 18 ++++++++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index f52defb..221851a 100644 --- a/Makefile +++ b/Makefile @@ -41,7 +41,9 @@ # Send feedback to CFLAGS = -O2 -Wall -Wno-parentheses -I../kernel/2.6/include \ - -fno-strict-aliasing + -fno-strict-aliasing \ + -DPF_CAN=29 \ + -DAF_CAN=PF_CAN PROGRAMS = candump cansniffer cansend canplayer cangen\ log2long log2asc asc2log slcan_attach diff --git a/slcan_attach.c b/slcan_attach.c index 57c6239..0643617 100644 --- a/slcan_attach.c +++ b/slcan_attach.c @@ -52,25 +52,33 @@ #include #include #include +#include /* thanks for cleanup since 2.6.21 */ +//#include /* ldiscs for each arch up to 2.6.20 */ +#ifndef N_SLCAN #define N_SLCAN 16 /* bad hack until it's not inside the Kernel */ +#endif void usage(char *name) { - fprintf(stderr, "Usage: %s [-d] tty\n", name); + fprintf(stderr, "Usage: %s [-d] [-l ldisc] tty\n", name); exit(1); } int main(int argc, char **argv) { int fd; - int ldisc; + int ldisc = N_SLCAN; /* default */ int detach = 0; char *tty; int opt; - while ((opt = getopt(argc, argv, "d")) != -1) { + while ((opt = getopt(argc, argv, "l:d")) != -1) { switch (opt) { + case 'l': + ldisc = atoi(optarg); + break; + case 'd': detach = 1; break; @@ -90,7 +98,9 @@ int main(int argc, char **argv) exit(1); } - ldisc = detach ? N_TTY : N_SLCAN; + if (detach) + ldisc = N_TTY; + if (ioctl (fd, TIOCSETD, &ldisc) < 0) { perror("ioctl"); exit(1);