add can
This commit is contained in:
12808
6/CANsmit2/dump
Normal file
12808
6/CANsmit2/dump
Normal file
File diff suppressed because it is too large
Load Diff
12808
6/CANsmit2/frame
Normal file
12808
6/CANsmit2/frame
Normal file
File diff suppressed because it is too large
Load Diff
189
6/CANsmit2/sortuniq
Normal file
189
6/CANsmit2/sortuniq
Normal file
@@ -0,0 +1,189 @@
|
|||||||
|
89 50 4E 47 0D 0A 1A
|
||||||
|
0A 00 00 00 0D 49 48
|
||||||
|
44 52 00 00 01 68 00
|
||||||
|
00 00 F8 02 03 00 00
|
||||||
|
00 BC 9A 94 B1 00 00
|
||||||
|
00 04 67 41 4D 41 00
|
||||||
|
00 B1 8F 0B FC 61 05
|
||||||
|
00 00 00 20 63 48 52
|
||||||
|
4D 00 00 7A 26 00 00
|
||||||
|
80 84 00 00 FA 00 00
|
||||||
|
00 80 E8 00 00 75 30
|
||||||
|
00 00 EA 60 00 00 3A
|
||||||
|
98 00 00 17 70 9C BA
|
||||||
|
51 3C 00 00 00 09 50
|
||||||
|
4C 54 45 A8 A8 FE 42
|
||||||
|
42 E7 FF FF FE CD 44
|
||||||
|
BB C2 00 00 00 01 62
|
||||||
|
4B 47 44 02 66 0B 7C
|
||||||
|
64 00 00 00 09 70 48
|
||||||
|
59 73 00 00 0B 13 00
|
||||||
|
00 0B 13 01 00 9A 9C
|
||||||
|
18 00 00 00 07 74 49
|
||||||
|
4D 45 07 EA 01 13 0D
|
||||||
|
23 20 89 D8 87 7F 00
|
||||||
|
00 04 0A 49 44 41 54
|
||||||
|
78 DA ED 9B 4D 6E E4
|
||||||
|
38 0C 85 25 A0 B8 F7
|
||||||
|
A2 78 1F 6A D1 7B 0E
|
||||||
|
20 DD FF 2A C3 47 CA
|
||||||
|
2E C7 63 A7 DD E8 6A
|
||||||
|
4C 3A 20 53 55 B1 F5
|
||||||
|
F3 85 7A A4 E8 04 88
|
||||||
|
4A 49 4B 4B 4B 4B 4B
|
||||||
|
4B FB 2E 36 DE 6C 89
|
||||||
|
4E F4 D7 44 2B 29 35
|
||||||
|
6D AA 24 6C 6F 92 8A
|
||||||
|
B6 D1 C6 10 EA 8C 5E
|
||||||
|
BB 1B AD E1 F3 16 BA
|
||||||
|
4D 8B 2B 31 B3 6F 34
|
||||||
|
9B AC 6D D4 C0 B5 D6
|
||||||
|
79 1D B5 9F F5 09 3A
|
||||||
|
BC 71 7F 6C 82 14 29
|
||||||
|
6D 37 AF 8D 5E 27 68
|
||||||
|
18 3A 7E 58 DB CF FA
|
||||||
|
04 FD BA 07 BA 2D F6
|
||||||
|
E5 66 82 30 A4 68 2E
|
||||||
|
88 54 A5 0D 4D FB 59
|
||||||
|
B7 BD 86 D6 13 3D 41
|
||||||
|
52 A6 08 6D 45 EB B8
|
||||||
|
E9 F5 47 AD 27 9A FC
|
||||||
|
BD 2D 3F 46 84 D6 3A
|
||||||
|
DB 6F 68 7D 95 21 E6
|
||||||
|
EF 2E 43 10 C8 F0 B2
|
||||||
|
33 DA BF 4E 5E 27 3A
|
||||||
|
D1 DF 01 8D 9D D6 66
|
||||||
|
35 46 61 50 DF 73 52
|
||||||
|
A5 7A 99 98 75 A2 73
|
||||||
|
E7 8F 15 5B 7C A7 A2
|
||||||
|
60 D9 75 15 9F 71 40
|
||||||
|
A3 16 37 8A 6A 2C B2
|
||||||
|
AB 14 03 77 AF 7B A0
|
||||||
|
8F 15 1B A3 FC DA BD
|
||||||
|
6B 47 AF 51 8B 85 E7
|
||||||
|
23 60 2D AA C3 D1 21
|
||||||
|
57 D4 2B 56 3E 56 EC
|
||||||
|
89 1E 97 68 5F D8 88
|
||||||
|
6A DC 96 97 00 56 4E
|
||||||
|
17 90 3B EE EB 2A C8
|
||||||
|
AB 62 CB 1C E5 82 30
|
||||||
|
EA 3A 1C 3C 08 62 CF
|
||||||
|
14 4C E3 16 45 D8 7C
|
||||||
|
89 AA 1C 5A 8F 59 A5
|
||||||
|
3B 1F 2B 36 DA 5C 0D
|
||||||
|
7B 09 9F 09 82 D5 40
|
||||||
|
6B 0A 74 68 F9 42 7F
|
||||||
|
D4 FA 55 B1 57 F4 D4
|
||||||
|
9A 4E D0 6B 86 84 A4
|
||||||
|
B8 47 16 A0 1E EF 33
|
||||||
|
24 E2 BF AF D8 E2 59
|
||||||
|
13 19 E2 CF D3 FF 66
|
||||||
|
C8 DF B9 65 12 9D E8
|
||||||
|
FF 09 8D 82 E3 A5 A8
|
||||||
|
FD 3E F6 80 C6 1E B7
|
||||||
|
1A 4C 7F 08 7D FC 95
|
||||||
|
F0 7D 82 A0 10 5D FC
|
||||||
|
F9 F0 7B 68 6E F3 79
|
||||||
|
F1 7E 41 C8 D1 14 F5
|
||||||
|
F8 BD E8 06 39 84 FF
|
||||||
|
00 FA 3D 32 9C A2 DF
|
||||||
|
0D 4F 74 A2 BF 02 FA
|
||||||
|
BD E0 44 27 3A D1 89
|
||||||
|
4E 74 A2 13 9D E8 44
|
||||||
|
27 3A D1 89 4E 74 A2
|
||||||
|
13 9D E8 44 27 3A D1
|
||||||
|
89 4E 74 A2 13 9D E8
|
||||||
|
44 27 3A D1 89 4E 74
|
||||||
|
A2 13 9D E8 44 27 3A
|
||||||
|
D1 89 4E F4 F7 42 77
|
||||||
|
9A AD 3A 86 C4 37 9C
|
||||||
|
82 1B BD C4 F5 F0 7F
|
||||||
|
E2 F7 6B 2D E8 90 6E
|
||||||
|
D3 EA E8 1C DD 5A 07
|
||||||
|
0E 4A C8 2F A0 B5 F0
|
||||||
|
6B FC 11 4D 05 68 EF
|
||||||
|
96 E2 C7 20 80 BF 81
|
||||||
|
F6 26 B1 CF 89 AE B3
|
||||||
|
3D 16 F1 4F E7 4E 85
|
||||||
|
57 74 8D C3 11 FD 17
|
||||||
|
D0 38 54 17 A1 E8 04
|
||||||
|
97 36 34 28 D5 D1 DE
|
||||||
|
4D 9D 2E D1 8F 3A A4
|
||||||
|
E2 B4 07 BC 2B A4 62
|
||||||
|
83 3B D4 74 B9 6D EE
|
||||||
|
83 3A 7B 77 A0 C5 D1
|
||||||
|
D6 66 DD 5A 89 C6 A3
|
||||||
|
70 59 4E D1 F6 E1 2F
|
||||||
|
ED 64 32 56 13 D4 DC
|
||||||
|
2C 36 65 74 3F 7A 52
|
||||||
|
1E E6 61 74 97 0D 5D
|
||||||
|
71 16 65 31 A1 1D FD
|
||||||
|
2C E5 14 5D F5 49 98
|
||||||
|
A7 CA A2 8C 03 39 F8
|
||||||
|
19 F4 30 9F DC 4D 9B
|
||||||
|
D5 9F D1 5D 22 08 A6
|
||||||
|
75 6D 9D 15 0B 31 34
|
||||||
|
35 E5 73 34 F5 27 AB
|
||||||
|
BD 54 86 A8 BD 58 A1
|
||||||
|
1E 95 C2 71 3E 04 FE
|
||||||
|
CD EE E7 96 21 55 FC
|
||||||
|
B8 91 69 67 6B B4 0B
|
||||||
|
B9 40 5B 86 3E ED 5D
|
||||||
|
10 46 A3 DB 4D 03 91
|
||||||
|
EA 0E 8D 6E 3F F6 E9
|
||||||
|
68 B6 A5 DA 1B 68 5B
|
||||||
|
8A A3 E9 1C 2D 65 45
|
||||||
|
9B A6 43 17 47 0F A2
|
||||||
|
03 DA 8F DD 84 83 D5
|
||||||
|
9A C8 D1 16 49 A0 47
|
||||||
|
3D 47 17 47 2F 0C 87
|
||||||
|
80 06 02 E1 F1 2D B2
|
||||||
|
A2 17 FE 80 7E 58 EC
|
||||||
|
2A C1 D9 40 B7 73 AD
|
||||||
|
C9 96 D7 3D 94 0C 41
|
||||||
|
2C 98 E3 C7 0E 8D 68
|
||||||
|
A0 FB C7 0E 3D 36 74
|
||||||
|
68 3D E8 93 30 2E 40
|
||||||
|
47 18 0D 5D 4D 90 31
|
||||||
|
05 A1 D9 DD F6 E8 82
|
||||||
|
1A B2 0B E3 15 5A CC
|
||||||
|
71 6C 19 1D 25 92 6F
|
||||||
|
E0 73 A2 07 72 D3 BB
|
||||||
|
67 18 1D 2D 40 5B F2
|
||||||
|
55 24 EC 75 F2 A1 DE
|
||||||
|
98 C8 4D B4 94 65 6E
|
||||||
|
19 29 BC A2 C5 77 D4
|
||||||
|
68 BA E6 35 1A 15 DD
|
||||||
|
82 71 A3 F5 72 85 E6
|
||||||
|
62 5B C2 E2 2D 16 46
|
||||||
|
5D E6 46 DF 8A 6A 45
|
||||||
|
51 F5 EE 5E F8 80 D6
|
||||||
|
87 65 88 C9 54 4E F3
|
||||||
|
FA C4 B6 8A F5 73 5B
|
||||||
|
87 BE 1F 4D 41 D4 B1
|
||||||
|
9E 79 F8 E9 03 EC 36
|
||||||
|
BA C6 13 40 B9 DE 45
|
||||||
|
6F A7 7D F5 30 C4 E2
|
||||||
|
55 78 77 3F 4F FC F5
|
||||||
|
42 7A 13 7D FB 18 CA
|
||||||
|
26 F5 FA 98 F8 06 BF
|
||||||
|
2C 24 3A D1 89 4E 74
|
||||||
|
A2 FF 06 74 5A 5A 5A
|
||||||
|
5A 5A 5A 5A DA 85 FD
|
||||||
|
0B DA 17 18 4A 9E 9D
|
||||||
|
FF B0 00 00 00 25 74
|
||||||
|
45 58 74 64 61 74 65
|
||||||
|
3A 63 72 65 61 74 65
|
||||||
|
00 32 30 32 36 2D 30
|
||||||
|
31 2D 31 39 54 31 33
|
||||||
|
3A 33 35 3A 32 39 2B
|
||||||
|
30 30 3A 30 30 7B E1
|
||||||
|
1B E4 00 00 00 25 74
|
||||||
|
45 58 74 64 61 74 65
|
||||||
|
3A 6D 6F 64 69 66 79
|
||||||
|
00 32 30 32 33 2D 30
|
||||||
|
38 2D 31 31 54 31 32
|
||||||
|
3A 32 38 3A 30 30 2B
|
||||||
|
30 30 3A 30 30 D2 3E
|
||||||
|
99 51 00 00 00 00 49
|
||||||
|
45 4E 44 AE 42 60 82
|
||||||
1
6/CANsmit2/test.sh
Executable file
1
6/CANsmit2/test.sh
Executable file
@@ -0,0 +1 @@
|
|||||||
|
cut -d ' ' -f10-18 dump | sort | uniq | cut -d ' ' -f 2-8 | xxd -r -p | feh -
|
||||||
71
6/CANsmit3/Makefile
Normal file
71
6/CANsmit3/Makefile
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
#
|
||||||
|
# Copyright (c) 2002-2005 Volkswagen Group Electronic Research
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
# modification, are permitted provided that the following conditions
|
||||||
|
# are met:
|
||||||
|
# 1. Redistributions of source code must retain the above copyright
|
||||||
|
# notice, this list of conditions, the following disclaimer and
|
||||||
|
# the referenced file 'COPYING'.
|
||||||
|
# 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer in the
|
||||||
|
# documentation and/or other materials provided with the distribution.
|
||||||
|
# 3. Neither the name of Volkswagen nor the names of its contributors
|
||||||
|
# may be used to endorse or promote products derived from this software
|
||||||
|
# without specific prior written permission.
|
||||||
|
#
|
||||||
|
# Alternatively, provided that this notice is retained in full, this
|
||||||
|
# software may be distributed under the terms of the GNU General
|
||||||
|
# Public License ("GPL") version 2 as distributed in the 'COPYING'
|
||||||
|
# file from the main directory of the linux kernel source.
|
||||||
|
#
|
||||||
|
# The provided data structures and external interfaces from this code
|
||||||
|
# are not restricted to be used by modules with a GPL compatible license.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
||||||
|
# DAMAGE.
|
||||||
|
#
|
||||||
|
# Send feedback to <linux-can@vger.kernel.org>
|
||||||
|
|
||||||
|
DESTDIR ?=
|
||||||
|
PREFIX ?= /usr/local
|
||||||
|
|
||||||
|
MAKEFLAGS := -k
|
||||||
|
|
||||||
|
CFLAGS := -O2 -Wall -Wno-parentheses
|
||||||
|
|
||||||
|
CPPFLAGS += \
|
||||||
|
-Iinclude \
|
||||||
|
-DAF_CAN=PF_CAN \
|
||||||
|
-DPF_CAN=29 \
|
||||||
|
-DSO_RXQ_OVFL=40 \
|
||||||
|
-DSCM_TIMESTAMPING_OPT_STATS=54 \
|
||||||
|
-D_FILE_OFFSET_BITS=64 \
|
||||||
|
-D_GNU_SOURCE
|
||||||
|
|
||||||
|
PROGRAMS := isotpterm
|
||||||
|
|
||||||
|
all: $(PROGRAMS)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f $(PROGRAMS) *.o
|
||||||
|
|
||||||
|
install:
|
||||||
|
mkdir -p $(DESTDIR)$(PREFIX)/bin
|
||||||
|
cp -f $(PROGRAMS) $(DESTDIR)$(PREFIX)/bin
|
||||||
|
|
||||||
|
distclean:
|
||||||
|
rm -f $(PROGRAMS) $(LIBRARIES) *.o *~
|
||||||
|
|
||||||
|
$(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@
|
||||||
15
6/CANsmit3/README
Normal file
15
6/CANsmit3/README
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
Watch Offline Profile Reader
|
||||||
|
----
|
||||||
|
|
||||||
|
You've got the latest of entertainment systems in your new car, but the system
|
||||||
|
can only be used while standing still. You want to watch your series in the
|
||||||
|
background while driving though. It won't distract you, since you know all 23
|
||||||
|
seasons by heart.
|
||||||
|
|
||||||
|
The system requires you to prove you're not driving by testing your attention.
|
||||||
|
You can't look away from the road that long, so you decide to write a script to
|
||||||
|
help you unlock the feature for you.
|
||||||
|
|
||||||
|
The system is tightly integrated with the rest of the car and communicates over
|
||||||
|
ISOTP ports 241 and 242 on interface "wopr". Your profile's username is `falken`
|
||||||
|
and your password is `Joshua`.
|
||||||
BIN
6/CANsmit3/isotpterm
Executable file
BIN
6/CANsmit3/isotpterm
Executable file
Binary file not shown.
183
6/CANsmit3/isotpterm.c
Normal file
183
6/CANsmit3/isotpterm.c
Normal file
@@ -0,0 +1,183 @@
|
|||||||
|
/*
|
||||||
|
* isotpterm.c - interactive terminal over isotp
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
#include <libgen.h>
|
||||||
|
#include <linux/can.h>
|
||||||
|
#include <linux/can/isotp.h>
|
||||||
|
#include <net/if.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#include <signal.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/uio.h>
|
||||||
|
#include <sys/wait.h>
|
||||||
|
#include <time.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#define NO_CAN_ID 0xFFFFFFFFU
|
||||||
|
#define MAX_PDU_LENGTH 8000
|
||||||
|
|
||||||
|
void print_usage(char *prg) {
|
||||||
|
fprintf(stderr,
|
||||||
|
"\nUsage: %s -s <can_id> -d <can_id> [options] <CAN interface>\n",
|
||||||
|
prg);
|
||||||
|
fprintf(stderr, "Options:\n");
|
||||||
|
fprintf(stderr,
|
||||||
|
" -s <can_id> * (source can_id. Use 8 digits for extended "
|
||||||
|
"IDs)\n");
|
||||||
|
fprintf(stderr,
|
||||||
|
" -d <can_id> * (destination can_id. Use 8 digits for "
|
||||||
|
"extended IDs)\n");
|
||||||
|
fprintf(stderr, "\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char **argv) {
|
||||||
|
extern int optind, opterr, optopt;
|
||||||
|
int opt;
|
||||||
|
|
||||||
|
int sc = 0; /* (C)AN socket */
|
||||||
|
struct sockaddr_can caddr;
|
||||||
|
static struct can_isotp_options opts;
|
||||||
|
|
||||||
|
socklen_t caddrlen = sizeof(caddr);
|
||||||
|
fd_set readfds;
|
||||||
|
|
||||||
|
int nbytes;
|
||||||
|
int ret = 0;
|
||||||
|
char *fgetsret = NULL;
|
||||||
|
|
||||||
|
char txmsg[MAX_PDU_LENGTH];
|
||||||
|
char rxmsg[MAX_PDU_LENGTH];
|
||||||
|
|
||||||
|
/* mark missing mandatory commandline options as missing */
|
||||||
|
caddr.can_addr.tp.tx_id = caddr.can_addr.tp.rx_id = NO_CAN_ID;
|
||||||
|
|
||||||
|
while ((opt = getopt(argc, argv, "s:d:?")) != -1) {
|
||||||
|
switch (opt) {
|
||||||
|
case 's':
|
||||||
|
caddr.can_addr.tp.tx_id = strtoul(optarg, (char **)NULL, 16);
|
||||||
|
if (strlen(optarg) > 7) caddr.can_addr.tp.tx_id |= CAN_EFF_FLAG;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'd':
|
||||||
|
caddr.can_addr.tp.rx_id = strtoul(optarg, (char **)NULL, 16);
|
||||||
|
if (strlen(optarg) > 7) caddr.can_addr.tp.rx_id |= CAN_EFF_FLAG;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '?':
|
||||||
|
print_usage(basename(argv[0]));
|
||||||
|
ret = 1; /* no proper operation (for non-interactive users) */
|
||||||
|
goto exit;
|
||||||
|
|
||||||
|
default:
|
||||||
|
fprintf(stderr, "Unknown option %c\n", opt);
|
||||||
|
print_usage(basename(argv[0]));
|
||||||
|
ret = 1;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((argc - optind != 1) || (caddr.can_addr.tp.tx_id == NO_CAN_ID) ||
|
||||||
|
(caddr.can_addr.tp.rx_id == NO_CAN_ID)) {
|
||||||
|
print_usage(basename(argv[0]));
|
||||||
|
ret = -EINVAL;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((sc = socket(PF_CAN, SOCK_DGRAM, CAN_ISOTP)) < 0) {
|
||||||
|
perror("socket");
|
||||||
|
ret = sc;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
opts.flags = CAN_ISOTP_WAIT_TX_DONE;
|
||||||
|
setsockopt(sc, SOL_CAN_ISOTP, CAN_ISOTP_OPTS, &opts, sizeof(opts));
|
||||||
|
|
||||||
|
caddr.can_family = AF_CAN;
|
||||||
|
caddr.can_ifindex = if_nametoindex(argv[optind]);
|
||||||
|
|
||||||
|
ret = bind(sc, (struct sockaddr *)&caddr, caddrlen);
|
||||||
|
if (ret < 0) {
|
||||||
|
perror("bind");
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (1) {
|
||||||
|
FD_ZERO(&readfds);
|
||||||
|
FD_SET(STDIN_FILENO, &readfds);
|
||||||
|
FD_SET(sc, &readfds);
|
||||||
|
|
||||||
|
ret = select(sc + 1, &readfds, NULL, NULL, NULL);
|
||||||
|
if (ret < 0) {
|
||||||
|
perror("select");
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (FD_ISSET(sc, &readfds)) {
|
||||||
|
nbytes = read(sc, rxmsg, MAX_PDU_LENGTH - 1);
|
||||||
|
|
||||||
|
if (nbytes < 1) {
|
||||||
|
perror("read from isotp socket");
|
||||||
|
ret = nbytes;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
rxmsg[nbytes] = 0; /* terminate string */
|
||||||
|
printf("%s", rxmsg);
|
||||||
|
|
||||||
|
if(strncmp(rxmsg, "\nwopr", 4)==0){
|
||||||
|
send(sc, "falken\n", 7 , 0);
|
||||||
|
}
|
||||||
|
if(strncmp(rxmsg, "pass", 4)==0){
|
||||||
|
send(sc, "Joshua\n", 7 , 0);
|
||||||
|
}
|
||||||
|
char *s = strstr(rxmsg, "Test#");
|
||||||
|
char c;
|
||||||
|
int j = 0;
|
||||||
|
if(s){
|
||||||
|
printf("detected: %c\n", s[18]);
|
||||||
|
c = s[18];
|
||||||
|
while(s[0] != '\n')
|
||||||
|
s++;
|
||||||
|
|
||||||
|
s = strstr(rxmsg, "\n'");
|
||||||
|
for(int i=0; i<strlen(s); i++)
|
||||||
|
if(s[i] == c)
|
||||||
|
j++;
|
||||||
|
|
||||||
|
char msg[10];
|
||||||
|
sprintf(msg, "%d\n", j);
|
||||||
|
printf("aswering: %d\n", j);
|
||||||
|
|
||||||
|
send(sc, msg, strlen(msg)+1, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
fflush(stdout);
|
||||||
|
|
||||||
|
} else if (FD_ISSET(STDIN_FILENO, &readfds)) {
|
||||||
|
fgetsret = fgets(txmsg, MAX_PDU_LENGTH, stdin);
|
||||||
|
if (fgetsret == NULL) {
|
||||||
|
ret = 0;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
nbytes = send(sc, txmsg, strlen(txmsg) + 1, 0);
|
||||||
|
if (nbytes != strlen(txmsg) + 1) {
|
||||||
|
perror("write to isotp socket");
|
||||||
|
ret = nbytes;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
exit:
|
||||||
|
close(sc);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
1
6/CANstrument1
Normal file
1
6/CANstrument1
Normal file
@@ -0,0 +1 @@
|
|||||||
|
cansend cluster0 100#0000C8
|
||||||
Reference in New Issue
Block a user