-
Notifications
You must be signed in to change notification settings - Fork 159
add option to print serial stats on start #57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -72,6 +72,7 @@ int _cl_tx_timeout_ms = 2000; | |
| int _cl_error_on_timeout = 0; | ||
| int _cl_no_icount = 0; | ||
| int _cl_flush_buffers = 0; | ||
| int _cl_stats_start = 0; | ||
|
|
||
| // Module variables | ||
| unsigned char _write_count_value = 0; | ||
|
|
@@ -325,6 +326,7 @@ static void display_help(void) | |
| " -Z, --error-on-timeout Treat timeouts as errors\n" | ||
| " -n, --no-icount Do not request driver for counts of input serial line interrupts (TIOCGICOUNT)\n" | ||
| " -f, --flush-buffers Flush RX and TX buffers before starting\n" | ||
| " -g, --stats-start Print TIOCGICOUNT stats on script startup before sending or receiveing data\n" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wonder if there is a better place so we can group options that are semantically bound to each other.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, this makes sense it could be moved below or above the |
||
| "\n" | ||
| ); | ||
| } | ||
|
|
@@ -369,6 +371,7 @@ static void process_options(int argc, char * argv[]) | |
| {"error-on-timeout", no_argument, 0, 'Z'}, | ||
| {"no-icount", no_argument, 0, 'n'}, | ||
| {"flush-buffers", no_argument, 0, 'f'}, | ||
| {"stats-start", no_argument, 0, 'g'}, | ||
| {0,0,0,0}, | ||
| }; | ||
|
|
||
|
|
@@ -506,6 +509,9 @@ static void process_options(int argc, char * argv[]) | |
| case 'f': | ||
| _cl_flush_buffers = 1; | ||
| break; | ||
| case 'g': | ||
| _cl_stats_start = 1; | ||
| break; | ||
| } | ||
| } | ||
| } | ||
|
|
@@ -792,6 +798,9 @@ int main(int argc, char * argv[]) | |
|
|
||
| set_modem_lines(_fd, _cl_loopback ? TIOCM_LOOP : 0, TIOCM_LOOP); | ||
|
|
||
| if(_cl_stats_start) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Style issue (missing space). |
||
| dump_serial_port_stats(); | ||
|
|
||
| if (_cl_single_byte >= 0) { | ||
| unsigned char data[2]; | ||
| int bytes = 1; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haven't checked the code, but why
-g? And do we actually need a short option for this? Seems to me like a debugging feature.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not have a specific reason for -g other than it being available. I considered the following which made more sense, but were unavailable -s, -S, -t, -T.
I am okay with it being only available as a long option. My main purpose for this is to be able to determine the difference in error counts during a test run, as currently it is a running total at then end and it is not clear if the counters were incremented during the test case, or a previous one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should go in the similar way to
--stats(AFAIU it exists only as long option).