r641 - trunk/src/target/gsm/src/gsmd
laforge at sita.openmoko.org
laforge at sita.openmoko.org
Wed Jan 31 22:00:56 CET 2007
Author: laforge
Date: 2007-01-31 22:00:56 +0100 (Wed, 31 Jan 2007)
New Revision: 641
Modified:
trunk/src/target/gsm/src/gsmd/gsmd.c
Log:
Introduce new '-F' switch to enable/disable hardware flow control
Modified: trunk/src/target/gsm/src/gsmd/gsmd.c
===================================================================
--- trunk/src/target/gsm/src/gsmd/gsmd.c 2007-01-31 20:37:11 UTC (rev 640)
+++ trunk/src/target/gsm/src/gsmd/gsmd.c 2007-01-31 21:00:56 UTC (rev 641)
@@ -101,7 +101,7 @@
{ 115200, B115200 },
};
-static int set_baudrate(int fd, int baudrate)
+static int set_baudrate(int fd, int baudrate, int hwflow)
{
int i;
u_int32_t bd = 0;
@@ -126,6 +126,11 @@
if (i < 0)
return i;
+ if (hwflow)
+ ti.c_cflag |= CRTSCTS;
+ else
+ ti.c_cflag &= ~CRTSCTS;
+
return tcsetattr(fd, 0, &ti);
}
@@ -146,6 +151,7 @@
{ "device", 1, NULL, 'p' },
{ "speed", 1, NULL, 's' },
{ "logfile", 1, NULL, 'l' },
+ { "hwflow", 0, NULL, 'F' },
{ "leak-report", 0, NULL, 'L' },
{ 0, 0, 0, 0 }
};
@@ -160,6 +166,8 @@
"\t-h\t--help\t\tDisplay this help message\n"
"\t-p dev\t--device dev\tSpecify serial device to be used\n"
"\t-s spd\t--speed spd\tSpecify speed in bps (9600,38400,115200,...)\n"
+ "\t-F\t--hwflow\tHardware Flow Control (RTS/CTS)\n"
+ "\t-L\t--leak-report\tLeak Report of talloc memory allocator\n"
"\t-l file\t--logfile file\tSpecify a logfile to log to\n"
);
}
@@ -184,6 +192,7 @@
int daemonize = 0;
int bps = 115200;
+ int hwflow = 0;
char *device = "/dev/ttyUSB0";
char *logfile = "syslog";
@@ -195,7 +204,7 @@
gsmd_tallocs = talloc_named_const(NULL, 1, "GSMD");
/*FIXME: parse commandline, set daemonize, device, ... */
- while ((argch = getopt_long(argc, argv, "VLdhp:s:l:", opts, NULL)) != -1) {
+ while ((argch = getopt_long(argc, argv, "FVLdhp:s:l:", opts, NULL)) != -1) {
switch (argch) {
case 'V':
/* FIXME */
@@ -203,6 +212,9 @@
case 'L':
talloc_enable_leak_report_full();
break;
+ case 'F':
+ hwflow = 1;
+ break;
case 'd':
daemonize = 1;
break;
@@ -234,7 +246,7 @@
exit(1);
}
- if (set_baudrate(fd, bps) < 0) {
+ if (set_baudrate(fd, bps, hwflow) < 0) {
fprintf(stderr, "can't set baudrate\n");
exit(1);
}
More information about the commitlog
mailing list