From 603a64757d30ef4e3ece0b34777f7b116d8b0545 Mon Sep 17 00:00:00 2001 From: Pali Rohár Date: Thu, 9 Aug 2012 21:13:13 +0200 Subject: Remove old serial.c code --- src/Makefile | 2 +- src/main.c | 6 ++--- src/main.h | 2 +- src/serial.c | 86 ------------------------------------------------------------ 4 files changed, 5 insertions(+), 91 deletions(-) delete mode 100644 src/serial.c (limited to 'src') diff --git a/src/Makefile b/src/Makefile index 39199b0..edce894 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,5 +1,5 @@ include ../config.mk -OBJ=main.o hexdump.o dump.o nolo.o serial.o qmode.o +OBJ=main.o hexdump.o dump.o nolo.o qmode.o OBJ+=utils.o console.o OBJ+=squeue/squeue.o OBJ+=image.o fiasco.o device.o usb-device.o cold-flash.o diff --git a/src/main.c b/src/main.c index e05e06a..6e9338d 100644 --- a/src/main.c +++ b/src/main.c @@ -200,7 +200,7 @@ void show_usage() printf(" -Q enter shared queues server mode (for gui or remote)\n"); #endif printf ("Local stuff:\n" - " -s [serial] serial port console (minicom like terminal)\n" +// " -s [serial] serial port console (minicom like terminal)\n" " -h show this help message\n" " -S [subversion] unpacks/flash pieces matching this sub-version information\n" " -n do not flash or write to disk (simulation)\n" @@ -480,8 +480,8 @@ int main(int argc, char **argv) case 'e': reverseto = optarg; break; - case 's': - return console(optarg); +// case 's': +// return console(optarg); // case 'u': // fiasco_image = optarg; // unpack = 1; diff --git a/src/main.h b/src/main.h index 3234cea..df94cc2 100644 --- a/src/main.h +++ b/src/main.h @@ -44,7 +44,7 @@ extern struct usb_dev_handle *dev; int is_valid_device(struct usb_device_descriptor *udd); //void list_valid_devices(); //int usb_device_found(struct usb_device_descriptor *udd, struct devices *it_device); -int console(const char *device); +//int console(const char *device); int connect_via_usb(); #endif diff --git a/src/serial.c b/src/serial.c deleted file mode 100644 index aaac61e..0000000 --- a/src/serial.c +++ /dev/null @@ -1,86 +0,0 @@ -/* - * 0xFFFF - Open Free Fiasco Firmware Flasher - * Copyright (C) 2007 pancake - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include "main.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -int open_serial(const char *file) -{ - struct termios tc; - int fd = open (file, O_RDWR | O_SYNC); - if (fd < 0) { - perror (file); - return -1; - } - // 115200 baud, 8n1, no flow control - tcgetattr(fd, &tc); - tc.c_iflag = IGNPAR; - tc.c_oflag = 0; - tc.c_cflag = CS8 | CREAD | CLOCAL; - tc.c_lflag = 0; - cfsetispeed(&tc, B115200); - cfsetospeed(&tc, B115200); - tcsetattr(fd, TCSANOW, &tc); - return fd; -} - -int console(const char *device) -{ - char str[513]; - int fd = open_serial(device); - int pid; - - if (fd == -1) { - fprintf(stderr, "Cannot open serial device %s\n", device); - return 1; - } - - pid = fork(); - if (pid) { - while(1) { - fgets(str, 512, stdin); - if (write(fd, str, strlen(str)-1) == -1) { - perror("write"); - exit (1); - } - } - } else { - char buf; - while(1) { - if (read(fd, &buf,1) == -1) { - perror("read"); - exit (1); - } - write(1, &buf, 1); - } - } - - close(fd); - - return 0; -} -- cgit v1.2.3