"rx_timeouts",
"rx_bad_crc",
"rx_ok",
+ "tx_overruns",
+ "tx_rejects",
+ "tx_timeouts",
+ "tx_collisions",
+ "tx_ok",
};
static void show_stats(byte *resp, uint len)
static void show_packet(byte *pkt, uint len)
{
+ if (len == 1) {
+ printf("Received status %u\n", pkt[0]);
+ return;
+ }
+
#if 1
printf(":");
for (uint i=0; i<len; i++)
// libusb_set_debug(usb_ctxt, 3);
open_device();
+ time_t now = time(NULL);
time_t last_stats = 0;
+ time_t last_query = now;
int received;
byte resp[64];
}
}
- time_t now = time(NULL);
+ now = time(NULL);
if (last_stats + 60 < now) {
if ((received = libusb_control_transfer(devh, 0xc0, 0x00, 0, 0, resp, sizeof(resp), 1000)) < 0) {
usb_error("Receive failed: error %d", received);
last_stats = now;
}
+ if (last_query + 10 < now) {
+ byte pkt[] = { 0xdc, 0xc2, 0x00, 0x0b, 0x06, 0x3d, 0x2e, 0x11, 0x25 };
+ if (err = libusb_bulk_transfer(devh, 0x01, pkt, sizeof(pkt), &received, 2000)) {
+ printf("Send failed: error %d\n", err);
+ // usb_error("Receive failed: error %d", received);
+ // continue;
+ } else {
+ printf("Send OK: %d bytes\n", received);
+ }
+ last_query = now;
+ }
+
#if 0
if (err = libusb_bulk_transfer(devh, 0x81, resp, 64, &received, 2000)) {
usb_error("Receive failed: error %d", err);