1
0
mirror of git://projects.qi-hardware.com/ben-wpan.git synced 2024-11-22 13:54:59 +02:00

tools/atrf-txrx/atrf-txrx.c: new option -q for quiet capture

This commit is contained in:
Werner Almesberger 2013-07-30 13:48:55 -03:00
parent 0706773e38
commit d1b65cb058

View File

@ -11,6 +11,7 @@
*/
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
@ -74,6 +75,7 @@ enum mode {
static volatile int run = 1;
static bool quiet = 0;
/* ----- Helper functions -------------------------------------------------- */
@ -237,7 +239,8 @@ static void receive_pcap(struct atrf_dsc *dsc, const char *name)
write_pcap_hdr(file);
while (run) {
wait_for_interrupt(dsc,
IRQ_TRX_END, IRQ_TRX_END | IRQ_RX_START | IRQ_AMI, 0);
IRQ_TRX_END,
quiet ? 0xff : IRQ_TRX_END | IRQ_RX_START | IRQ_AMI, 0);
if (!run)
break;
gettimeofday(&now, NULL);
@ -249,6 +252,7 @@ static void receive_pcap(struct atrf_dsc *dsc, const char *name)
continue;
}
write_pcap_rec(file, &now, buf, n-1);
if (!quiet)
(void) write(2, ".", 1);
count++;
}
@ -666,7 +670,7 @@ static void usage(const char *name)
" command shell command to run while transmitting (default: wait for\n"
" SIGINT instead)\n\n"
" common options: [-c channel|-f freq] [-C mhz] [-d driver[:arg]] [-o file]\n"
" [-p power] [-r rate] [-t trim]\n"
" [-p power] [-q] [-r rate] [-t trim]\n"
" -c channel channel number, 11 to 26 (default %d)\n"
" -C mhz output clock at 1, 2, 4, 8, or 16 MHz (default: off)\n"
" -d driver[:arg]\n"
@ -674,6 +678,8 @@ static void usage(const char *name)
" -f freq frequency in MHz, 2405 to 2480 (default %d)\n"
" -o file write received data to a file in pcap format\n"
" -p power transmit power, -17.2 to 3.0 dBm (default %.1f)\n"
" -q quiet - suppress progress reports and warnings\n"
" (currently only used when capturing)\n"
" -r rate data rate, 250k, 500k, 1M, or 2M (default: 250k)\n"
" -t trim trim capacitor, 0 to 15 (default %d)\n"
, name, name, name, name, name, name,
@ -718,7 +724,7 @@ int main(int argc, char *const *argv)
const char *pcap_file = NULL;
struct atrf_dsc *dsc;
while ((c = getopt(argc, argv, "c:C:d:E:f:Ho:p:Pr:Rt:T:x")) != EOF)
while ((c = getopt(argc, argv, "c:C:d:E:f:Ho:p:Pqr:Rt:T:x")) != EOF)
switch (c) {
case 'c':
channel = strtoul(optarg, &end, 0);
@ -767,6 +773,9 @@ int main(int argc, char *const *argv)
case 'P':
set_mode(&mode, mode_ping);
break;
case 'q':
quiet = 1;
break;
case 'r':
if (!strcmp(optarg, "250k"))
rate = OQPSK_DATA_RATE_250;