mirror of
https://github.com/linux-can/can-utils.git
synced 2026-09-22 08:06:34 +02:00
isotp: added support for separate extended address in rx path
As requested by Laurent Vaudoit the extended address can be different in the tx and he rx path: (..) how can i have a segmented transfer like this: 0x6a7 0x55 0x10 0x08 ........ 0x687 0xAA 0x30 0x00 0x00 0x6a7 0x55 0x21 ..... The connection i need is between two ECU, using IDs 0x6a7/687 and one has adress extension 0x55, the other 0xAA (this adressing method is used on some FIAT ECUs for example). http://marc.info/?l=linux-can&m=140354647413513&w=2 Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
This commit is contained in:
+13
-2
@@ -63,7 +63,8 @@ void print_usage(char *prg)
|
||||
fprintf(stderr, "\nUsage: %s [options] <CAN interface>\n", prg);
|
||||
fprintf(stderr, "Options: -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, " -x <addr> (extended addressing mode. Use 'any' for all addresses)\n");
|
||||
fprintf(stderr, " -x <addr> (extended addressing mode)\n");
|
||||
fprintf(stderr, " -X <addr> (extended addressing mode - rx addr)\n");
|
||||
fprintf(stderr, " -p <byte> (set and enable padding byte)\n");
|
||||
fprintf(stderr, " -P <mode> (check padding in FC. (l)ength (c)ontent (a)ll)\n");
|
||||
fprintf(stderr, " -t <time ns> (frame transmit time (N_As) in nanosecs)\n");
|
||||
@@ -90,7 +91,7 @@ int main(int argc, char **argv)
|
||||
|
||||
addr.can_addr.tp.tx_id = addr.can_addr.tp.rx_id = NO_CAN_ID;
|
||||
|
||||
while ((opt = getopt(argc, argv, "s:d:x:p:P:t:f:D:?")) != -1) {
|
||||
while ((opt = getopt(argc, argv, "s:d:x:X:p:P:t:f:D:?")) != -1) {
|
||||
switch (opt) {
|
||||
case 's':
|
||||
addr.can_addr.tp.tx_id = strtoul(optarg, (char **)NULL, 16);
|
||||
@@ -109,6 +110,11 @@ int main(int argc, char **argv)
|
||||
opts.ext_address = strtoul(optarg, (char **)NULL, 16) & 0xFF;
|
||||
break;
|
||||
|
||||
case 'X':
|
||||
opts.flags |= CAN_ISOTP_RX_EXT_ADDR;
|
||||
opts.rx_ext_address = strtoul(optarg, (char **)NULL, 16) & 0xFF;
|
||||
break;
|
||||
|
||||
case 'p':
|
||||
opts.flags |= CAN_ISOTP_TX_PADDING;
|
||||
opts.txpad_content = strtoul(optarg, (char **)NULL, 16) & 0xFF;
|
||||
@@ -165,6 +171,11 @@ int main(int argc, char **argv)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if ((opts.flags & CAN_ISOTP_RX_EXT_ADDR) && (!(opts.flags & CAN_ISOTP_EXTEND_ADDR))) {
|
||||
print_usage(basename(argv[0]));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if ((s = socket(PF_CAN, SOCK_DGRAM, CAN_ISOTP)) < 0) {
|
||||
perror("socket");
|
||||
exit(1);
|
||||
|
||||
Reference in New Issue
Block a user