slcanpty: remove redundant asc2nibble()
asc2nibble() is already defined in lib.h. Include lib.h in slcnpty.c so that asc2nibble() does not need to be redefined a second time and adjust the Makefile accordingly. Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr> Acked-by: Oliver Hartkopp <socketcan@hartkopp.net> Link: https://lore.kernel.org/all/20221114163848.3398-2-mailhol.vincent@wanadoo.fr Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>pull/387/head
parent
71a0156bd5
commit
4c9f046615
|
|
@ -33,6 +33,7 @@ set(PROGRAMS_CANLIB
|
||||||
cansequence
|
cansequence
|
||||||
log2asc
|
log2asc
|
||||||
log2long
|
log2long
|
||||||
|
slcanpty
|
||||||
)
|
)
|
||||||
|
|
||||||
set(PROGRAMS_J1939
|
set(PROGRAMS_J1939
|
||||||
|
|
@ -58,7 +59,6 @@ set(PROGRAMS
|
||||||
isotptun
|
isotptun
|
||||||
slcan_attach
|
slcan_attach
|
||||||
slcand
|
slcand
|
||||||
slcanpty
|
|
||||||
)
|
)
|
||||||
|
|
||||||
add_executable(can-calc-bit-timing
|
add_executable(can-calc-bit-timing
|
||||||
|
|
|
||||||
2
Makefile
2
Makefile
|
|
@ -119,6 +119,7 @@ canplayer.o: lib.h
|
||||||
cansend.o: lib.h
|
cansend.o: lib.h
|
||||||
log2asc.o: lib.h
|
log2asc.o: lib.h
|
||||||
log2long.o: lib.h
|
log2long.o: lib.h
|
||||||
|
slcanpty.o: lib.h
|
||||||
j1939acd.o: libj1939.h
|
j1939acd.o: libj1939.h
|
||||||
j1939cat.o: libj1939.h
|
j1939cat.o: libj1939.h
|
||||||
j1939spy.o: libj1939.h
|
j1939spy.o: libj1939.h
|
||||||
|
|
@ -135,6 +136,7 @@ cansend: cansend.o lib.o
|
||||||
cansequence: cansequence.o lib.o
|
cansequence: cansequence.o lib.o
|
||||||
log2asc: log2asc.o lib.o
|
log2asc: log2asc.o lib.o
|
||||||
log2long: log2long.o lib.o
|
log2long: log2long.o lib.o
|
||||||
|
slcanpty: slcanpty.o lib.o
|
||||||
j1939acd: j1939acd.o libj1939.o
|
j1939acd: j1939acd.o libj1939.o
|
||||||
j1939cat: j1939cat.o libj1939.o
|
j1939cat: j1939cat.o libj1939.o
|
||||||
j1939spy: j1939spy.o libj1939.o
|
j1939spy: j1939spy.o libj1939.o
|
||||||
|
|
|
||||||
17
slcanpty.c
17
slcanpty.c
|
|
@ -43,27 +43,14 @@
|
||||||
#include <linux/can/raw.h>
|
#include <linux/can/raw.h>
|
||||||
#include <linux/sockios.h>
|
#include <linux/sockios.h>
|
||||||
|
|
||||||
|
#include "lib.h"
|
||||||
|
|
||||||
/* maximum rx buffer len: extended CAN frame with timestamp */
|
/* maximum rx buffer len: extended CAN frame with timestamp */
|
||||||
#define SLC_MTU (sizeof("T1111222281122334455667788EA5F\r")+1)
|
#define SLC_MTU (sizeof("T1111222281122334455667788EA5F\r")+1)
|
||||||
#define DEVICE_NAME_PTMX "/dev/ptmx"
|
#define DEVICE_NAME_PTMX "/dev/ptmx"
|
||||||
|
|
||||||
#define DEBUG
|
#define DEBUG
|
||||||
|
|
||||||
static int asc2nibble(char c)
|
|
||||||
{
|
|
||||||
|
|
||||||
if ((c >= '0') && (c <= '9'))
|
|
||||||
return c - '0';
|
|
||||||
|
|
||||||
if ((c >= 'A') && (c <= 'F'))
|
|
||||||
return c - 'A' + 10;
|
|
||||||
|
|
||||||
if ((c >= 'a') && (c <= 'f'))
|
|
||||||
return c - 'a' + 10;
|
|
||||||
|
|
||||||
return 16; /* error */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* read data from pty, send CAN frames to CAN socket and answer commands */
|
/* read data from pty, send CAN frames to CAN socket and answer commands */
|
||||||
int pty2can(int pty, int socket, struct can_filter *fi,
|
int pty2can(int pty, int socket, struct can_filter *fi,
|
||||||
int *is_open, int *tstamp)
|
int *is_open, int *tstamp)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue