summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorStefan Richter <stefanr@s5r6.in-berlin.de>2010-07-22 11:58:05 +0200
committerStefan Richter <stefanr@s5r6.in-berlin.de>2010-07-27 11:04:12 +0200
commitddbfe74958ec21c3d58d5a46dd6f4048bc7969a4 (patch)
tree23ecb495ef85e439ea3b8b9b5b3b8277fe976085 /tools
parent83ef7c75939f45f8da46976cdca4db0727276a2d (diff)
downloadlinux-ddbfe74958ec21c3d58d5a46dd6f4048bc7969a4.tar.gz
linux-ddbfe74958ec21c3d58d5a46dd6f4048bc7969a4.tar.bz2
linux-ddbfe74958ec21c3d58d5a46dd6f4048bc7969a4.zip
tools/firewire: nosy-dump: remove unused code
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'tools')
-rw-r--r--tools/firewire/nosy-dump.c105
1 files changed, 49 insertions, 56 deletions
diff --git a/tools/firewire/nosy-dump.c b/tools/firewire/nosy-dump.c
index 5241cb402d6b..f93b776370b6 100644
--- a/tools/firewire/nosy-dump.c
+++ b/tools/firewire/nosy-dump.c
@@ -903,11 +903,12 @@ set_input_mode(void)
int main(int argc, const char *argv[])
{
+ uint32_t buf[128 * 1024];
+ uint32_t filter;
+ int length, retval, view;
int fd = -1;
FILE *output = NULL, *input = NULL;
poptContext con;
- int retval;
- int view;
char c;
struct pollfd pollfds[2];
@@ -961,70 +962,62 @@ int main(int argc, const char *argv[])
setvbuf(stdout, NULL, _IOLBF, BUFSIZ);
- if (1) {
- uint32_t buf[128 * 1024];
- uint32_t filter;
- int length;
+ filter = ~0;
+ if (!option_iso)
+ filter &= ~(1 << TCODE_STREAM_DATA);
+ if (!option_cycle_start)
+ filter &= ~(1 << TCODE_CYCLE_START);
+ if (view == VIEW_STATS)
+ filter = ~(1 << TCODE_CYCLE_START);
- filter = ~0;
- if (!option_iso)
- filter &= ~(1 << TCODE_STREAM_DATA);
- if (!option_cycle_start)
- filter &= ~(1 << TCODE_CYCLE_START);
- if (view == VIEW_STATS)
- filter = ~(1 << TCODE_CYCLE_START);
+ ioctl(fd, NOSY_IOC_FILTER, filter);
- ioctl(fd, NOSY_IOC_FILTER, filter);
+ ioctl(fd, NOSY_IOC_START);
- ioctl(fd, NOSY_IOC_START);
+ pollfds[0].fd = fd;
+ pollfds[0].events = POLLIN;
+ pollfds[1].fd = STDIN_FILENO;
+ pollfds[1].events = POLLIN;
- pollfds[0].fd = fd;
- pollfds[0].events = POLLIN;
- pollfds[1].fd = STDIN_FILENO;
- pollfds[1].events = POLLIN;
-
- while (run) {
- if (input != NULL) {
- if (fread(&length, sizeof length, 1, input) != 1)
+ while (run) {
+ if (input != NULL) {
+ if (fread(&length, sizeof length, 1, input) != 1)
+ return 0;
+ fread(buf, 1, length, input);
+ } else {
+ poll(pollfds, 2, -1);
+ if (pollfds[1].revents) {
+ read(STDIN_FILENO, &c, sizeof c);
+ switch (c) {
+ case 'q':
+ if (output != NULL)
+ fclose(output);
return 0;
- fread(buf, 1, length, input);
- } else {
- poll(pollfds, 2, -1);
- if (pollfds[1].revents) {
- read(STDIN_FILENO, &c, sizeof c);
- switch (c) {
- case 'q':
- if (output != NULL)
- fclose(output);
- return 0;
- }
}
-
- if (pollfds[0].revents)
- length = read(fd, buf, sizeof buf);
- else
- continue;
}
- if (output != NULL) {
- fwrite(&length, sizeof length, 1, output);
- fwrite(buf, 1, length, output);
- }
+ if (pollfds[0].revents)
+ length = read(fd, buf, sizeof buf);
+ else
+ continue;
+ }
- switch (view) {
- case VIEW_TRANSACTION:
- handle_packet(buf, length);
- break;
- case VIEW_PACKET:
- print_packet(buf, length);
- break;
- case VIEW_STATS:
- print_stats(buf, length);
- break;
- }
+ if (output != NULL) {
+ fwrite(&length, sizeof length, 1, output);
+ fwrite(buf, 1, length, output);
+ }
+
+ switch (view) {
+ case VIEW_TRANSACTION:
+ handle_packet(buf, length);
+ break;
+ case VIEW_PACKET:
+ print_packet(buf, length);
+ break;
+ case VIEW_STATS:
+ print_stats(buf, length);
+ break;
}
- } else {
- poptPrintUsage(con, stdout, 0);
}
if (output != NULL)