# HG changeset patch # User Mychaela Falconia # Date 1600144183 0 # Node ID 5b8287c655cfc327bf2516ea9c2b1d57c4e212fe # Parent 23f41a61ff7a459c09e7bd43fc13caff3abdd40c fc-pulse-dtr and fc-pulse-rts utilities implemented diff -r 23f41a61ff7a -r 5b8287c655cf .hgignore --- a/.hgignore Fri Aug 28 18:23:36 2020 +0000 +++ b/.hgignore Tue Sep 15 04:29:43 2020 +0000 @@ -30,6 +30,8 @@ ^miscutil/fc-fr2tch$ ^miscutil/fc-gsm2vm$ +^miscutil/fc-pulse-dtr$ +^miscutil/fc-pulse-rts$ ^miscutil/fc-rgbconv$ ^miscutil/fc-serterm$ ^miscutil/fc-tch2fr$ diff -r 23f41a61ff7a -r 5b8287c655cf miscutil/Makefile --- a/miscutil/Makefile Fri Aug 28 18:23:36 2020 +0000 +++ b/miscutil/Makefile Tue Sep 15 04:29:43 2020 +0000 @@ -1,7 +1,7 @@ CC= gcc CFLAGS= -O2 -PROGS= fc-fr2tch fc-gsm2vm fc-rgbconv fc-serterm fc-tch2fr fc-vm2hex imei-luhn\ - mokosrec2bin srec-regions +PROGS= fc-fr2tch fc-gsm2vm fc-pulse-dtr fc-pulse-rts fc-rgbconv fc-serterm \ + fc-tch2fr fc-vm2hex imei-luhn mokosrec2bin srec-regions SCRIPTS=c139explore pirexplore INSTALL_PREFIX= /opt/freecalypso @@ -21,6 +21,12 @@ fc-gsm2vm: ${GSM2VM_OBJS} ${CC} ${CFLAGS} -o $@ ${GSM2VM_OBJS} +fc-pulse-dtr: fc-pulse-dtr.c + ${CC} ${CFLAGS} -o $@ $@.c + +fc-pulse-rts: fc-pulse-rts.c + ${CC} ${CFLAGS} -o $@ $@.c + fc-rgbconv: fc-rgbconv.c ${CC} ${CFLAGS} -o $@ $@.c diff -r 23f41a61ff7a -r 5b8287c655cf miscutil/fc-pulse-dtr.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/miscutil/fc-pulse-dtr.c Tue Sep 15 04:29:43 2020 +0000 @@ -0,0 +1,32 @@ +/* + * This utility opens a serial port, asserts DTR for 50 ms, then negates it + * and exits. It is intended for use with FreeCalypso DUART28C adapters. + */ + +#include +#include +#include +#include +#include +#include + +main(argc, argv) + char **argv; +{ + int target_fd; + int mctl_arg = TIOCM_DTR; + + if (argc != 2) { + fprintf(stderr, "usage: %s ttyname\n", argv[0]); + exit(1); + } + target_fd = open(argv[1], O_RDWR|O_NONBLOCK); + if (target_fd < 0) { + perror(argv[1]); + exit(1); + } + ioctl(target_fd, TIOCMBIS, &mctl_arg); + usleep(50000); + ioctl(target_fd, TIOCMBIC, &mctl_arg); + exit(0); +} diff -r 23f41a61ff7a -r 5b8287c655cf miscutil/fc-pulse-rts.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/miscutil/fc-pulse-rts.c Tue Sep 15 04:29:43 2020 +0000 @@ -0,0 +1,32 @@ +/* + * This utility opens a serial port, asserts RTS for 50 ms, then negates it + * and exits. It is intended for use with FreeCalypso DUART28C adapters. + */ + +#include +#include +#include +#include +#include +#include + +main(argc, argv) + char **argv; +{ + int target_fd; + int mctl_arg = TIOCM_RTS; + + if (argc != 2) { + fprintf(stderr, "usage: %s ttyname\n", argv[0]); + exit(1); + } + target_fd = open(argv[1], O_RDWR|O_NONBLOCK); + if (target_fd < 0) { + perror(argv[1]); + exit(1); + } + ioctl(target_fd, TIOCMBIS, &mctl_arg); + usleep(50000); + ioctl(target_fd, TIOCMBIC, &mctl_arg); + exit(0); +}