Date:2011-07-06 00:40:43 (8 years 6 months ago)
Author:Werner Almesberger
Commit:50595979f5cad37743779019930ebe6ffe24d981
Message:Revert "tools/atrf-id/atrf-id.c: new option -D to read atusb debug log"

This reverts commit 391c37f58757c4a60c7a47752d4ecc55cf513a55.

The log isn't so useful in its present state because we may have to
unplug/replug to get out of a troublesome condition.
Files: tools/atrf-id/atrf-id.c (5 diffs)

Change Details

tools/atrf-id/atrf-id.c
112112}
113113
114114
115static void do_dump_debug(struct atrf_dsc *dsc)
116{
117    usb_dev_handle *dev;
118    uint8_t buf[1024];
119    int res;
120    struct log {
121        uint16_t n;
122        uint8_t bmRequestType;
123        uint8_t bRequest;
124        uint16_t wValue;
125        uint16_t wIndex;
126        uint16_t wLength;
127    } *p;
128
129    dev = atrf_usb_handle(dsc);
130    if (!dev)
131        return;
132
133    res = usb_control_msg(dev, FROM_DEV, ATUSB_READ_LOG, 0, 0,
134        (void *) buf, sizeof(buf), 1000);
135    if (res < 0) {
136        fprintf(stderr, "ATUSB_READ_LOG: %s\n", usb_strerror());
137        return;
138    }
139
140    printf("Number\tbmRequestType\tbRequest\twValue\twIndex\twLength\n");
141    for (p = (void *) buf; (uint8_t *) (p+1) <= buf+res; p++) {
142        printf("%u\t", p->n);
143        printf("0x%02x\t\t", p->bmRequestType);
144        printf("0x%02x\t\t", p->bRequest);
145        printf("0x%04x\t", p->wValue);
146        printf("0x%04x\t", p->wIndex);
147        printf("0x%04x\n", p->wLength);
148
149    }
150}
151
152
153115#else /* HAVE_USB */
154116
155117
...... 
158120}
159121
160122
161static void do_dump_debug(struct atrf_dsc *dsc)
162{
163}
164
165
166123#endif /* !HAVE_USB */
167124
168125
...... 
204161    fprintf(stderr,
205162"usage: %s [-d driver[:arg]] [-s [-s]]\n\n"
206163" -d driver[:arg] use the specified driver (default: %s)\n"
207" -D dump atusb debug buffer\n"
208164" -s print only the local driver specification\n"
209165" -s -s print only the remote driver specification\n"
210166    , name, atrf_default_driver_name());
...... 
217173    const char *driver = NULL;
218174    struct atrf_dsc *dsc;
219175    int spec_only = 0;
220    int dump_debug = 0;
221176    int c;
222177
223    while ((c = getopt(argc, argv, "d:Ds")) != EOF)
178    while ((c = getopt(argc, argv, "d:s")) != EOF)
224179        switch (c) {
225180        case 'd':
226181            driver = optarg;
227182            break;
228        case 'D':
229            dump_debug = 1;
230            break;
231183        case 's':
232184            spec_only++;
233185            break;
...... 
253205    } else {
254206        show_info(dsc);
255207    }
256    if (dump_debug)
257        do_dump_debug(dsc);
258208
259209    atrf_close(dsc);
260210

Archive Download the corresponding diff file



interactive