Changeset 641


Ignore:
Timestamp:
01/31/07 22:00:56 (6 years ago)
Author:
laforge
Message:

Introduce new '-F' switch to enable/disable hardware flow control

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/target/gsm/src/gsmd/gsmd.c

    r546 r641  
    102102}; 
    103103 
    104 static int set_baudrate(int fd, int baudrate) 
     104static int set_baudrate(int fd, int baudrate, int hwflow) 
    105105{ 
    106106        int i; 
     
    127127                return i; 
    128128         
     129        if (hwflow) 
     130                ti.c_cflag |= CRTSCTS; 
     131        else 
     132                ti.c_cflag &= ~CRTSCTS; 
     133 
    129134        return tcsetattr(fd, 0, &ti); 
    130135} 
     
    147152        { "speed", 1, NULL, 's' }, 
    148153        { "logfile", 1, NULL, 'l' }, 
     154        { "hwflow", 0, NULL, 'F' }, 
    149155        { "leak-report", 0, NULL, 'L' }, 
    150156        { 0, 0, 0, 0 } 
     
    161167               "\t-p dev\t--device dev\tSpecify serial device to be used\n" 
    162168               "\t-s spd\t--speed spd\tSpecify speed in bps (9600,38400,115200,...)\n" 
     169               "\t-F\t--hwflow\tHardware Flow Control (RTS/CTS)\n" 
     170               "\t-L\t--leak-report\tLeak Report of talloc memory allocator\n" 
    163171               "\t-l file\t--logfile file\tSpecify a logfile to log to\n" 
    164172               ); 
     
    185193        int daemonize = 0; 
    186194        int bps = 115200; 
     195        int hwflow = 0; 
    187196        char *device = "/dev/ttyUSB0"; 
    188197        char *logfile = "syslog"; 
     
    196205 
    197206        /*FIXME: parse commandline, set daemonize, device, ... */ 
    198         while ((argch = getopt_long(argc, argv, "VLdhp:s:l:", opts, NULL)) != -1) { 
     207        while ((argch = getopt_long(argc, argv, "FVLdhp:s:l:", opts, NULL)) != -1) { 
    199208                switch (argch) { 
    200209                case 'V': 
     
    203212                case 'L': 
    204213                        talloc_enable_leak_report_full(); 
     214                        break; 
     215                case 'F': 
     216                        hwflow = 1; 
    205217                        break; 
    206218                case 'd': 
     
    235247        } 
    236248 
    237         if (set_baudrate(fd, bps) < 0) { 
     249        if (set_baudrate(fd, bps, hwflow) < 0) { 
    238250                fprintf(stderr, "can't set baudrate\n"); 
    239251                exit(1); 
Note: See TracChangeset for help on using the changeset viewer.