mirror of
https://github.com/UzixLS/picocom.git
synced 2025-07-19 07:21:18 +03:00
added custom baudrate support for OSX
This commit is contained in:
40
Makefile
40
Makefile
@ -36,11 +36,41 @@ CPPFLAGS += -DHISTFILE=\"$(HISTFILE)\" \
|
||||
OBJS += linenoise-1.0/linenoise.o
|
||||
linenoise-1.0/linenoise.o : linenoise-1.0/linenoise.c linenoise-1.0/linenoise.h
|
||||
|
||||
## Comment these IN to enable custom baudrate support.
|
||||
## Currently works *only* with Linux (kernels > 2.6).
|
||||
#CPPFLAGS += -DUSE_CUSTOM_BAUD
|
||||
#OBJS += termios2.o
|
||||
#termios2.o : termios2.c termios2.h termbits2.h
|
||||
## Detect host machine / OS and store it into a make variable named "HOST_SYSTEM" for later use
|
||||
OS ?=
|
||||
OSTYPE ?=
|
||||
ifeq ($(OS),Windows_NT)
|
||||
ifeq ($(OSTYPE),cygwin)
|
||||
HOST_SYSTEM := Cygwin
|
||||
else
|
||||
HOST_SYSTEM := Windows
|
||||
endif
|
||||
else
|
||||
UNAME_S := $(shell uname -s)
|
||||
ifeq ($(UNAME_S),Linux)
|
||||
HOST_SYSTEM := Linux
|
||||
else ifeq ($(UNAME_S),Darwin)
|
||||
HOST_SYSTEM := Darwin
|
||||
else
|
||||
$(warning Warning: Unknown host system '$(UNAME_S)')
|
||||
HOST_SYSTEM := Unknown
|
||||
endif
|
||||
endif
|
||||
|
||||
## Set USE_CUSTOM_BAUD=1 to enable custom baudrate support.
|
||||
## Currently works *only* with Linux (kernels > 2.6) and OSX (Tiger and above)
|
||||
USE_CUSTOM_BAUD ?=
|
||||
ifeq ($(USE_CUSTOM_BAUD),1)
|
||||
ifeq ($(HOST_SYSTEM),Linux)
|
||||
CPPFLAGS += -DUSE_CUSTOM_BAUD
|
||||
OBJS += termios2.o
|
||||
termios2.o : termios2.c termios2.h termbits2.h
|
||||
else ifeq ($(HOST_SYSTEM),Darwin)
|
||||
CPPFLAGS += -DUSE_CUSTOM_BAUD
|
||||
else
|
||||
$(warning Warning: Custom baudrates not supported for your platform, yet.)
|
||||
endif
|
||||
endif
|
||||
|
||||
## Comment this IN to remove help strings (saves ~ 4-6 Kb).
|
||||
#CPPFLAGS += -DNO_HELP
|
||||
|
24
term.c
24
term.c
@ -56,7 +56,7 @@
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
|
||||
#ifdef USE_CUSTOM_BAUD
|
||||
#if defined(__linux__) && defined(USE_CUSTOM_BAUD)
|
||||
/* only works for linux, recent kernels */
|
||||
#include "termios2.h"
|
||||
#endif
|
||||
@ -200,7 +200,27 @@ term_perror (const char *prefix)
|
||||
#ifndef B4000000
|
||||
#define B4000000 4000000
|
||||
#endif
|
||||
#endif
|
||||
#endif /* __APPLE__ */
|
||||
|
||||
/***************************************************************************/
|
||||
/* Custom baudrates support for OSX */
|
||||
#if defined(__APPLE__) && defined (USE_CUSTOM_BAUD)
|
||||
int cfsetospeed_custom(struct termios *tiop, int speed) {
|
||||
return cfsetospeed(tiop, speed);
|
||||
}
|
||||
|
||||
int cfsetispeed_custom(struct termios *tiop, int speed) {
|
||||
return cfsetispeed(tiop, speed);
|
||||
}
|
||||
|
||||
int cfgetospeed_custom(struct termios *tiop) {
|
||||
return cfgetospeed(tiop);
|
||||
}
|
||||
|
||||
int cfgetispeed_custom(struct termios *tiop) {
|
||||
return cfgetispeed(tiop);
|
||||
}
|
||||
#endif /* __APPLE__ && USE_CUSTOM_BAUD */
|
||||
|
||||
/***************************************************************************/
|
||||
|
||||
|
Reference in New Issue
Block a user