From: Michael Gernoth Date: Mon, 7 Jun 2010 22:57:22 +0000 (+0200) Subject: add usbtmc_status X-Git-Url: http://git.zerfleddert.de/cgi-bin/gitweb.cgi/rigol/commitdiff_plain/121b4233e9098232769fb8844cf4caba8a5a5194 add usbtmc_status --- diff --git a/usbtmc.c b/usbtmc.c index 4a23a4f..419d100 100644 --- a/usbtmc.c +++ b/usbtmc.c @@ -59,6 +59,22 @@ static struct scope* usbtmc_find_scope() { return NULL; } +unsigned char usbtmc_status(struct scope *sc) +{ + int r; + unsigned char status[3]; + + sc->usb.bTag++; + + r = usb_control_msg(sc->usb.dev, 0xA1, 128, (sc->usb.bTag & 0x7f), 0, (char*)status, 3, USB_TIMEOUT); + if ((r != 3) || (status[0] != 0x01) || (status[1] != (sc->usb.bTag & 0x7f))) { + printf("READ_STATUS_BYTE failed: %d 0x%x 0x%x 0x%x\n", r, status[0], status[1], status[2]); + return 0xff; + } + + return status[2]; +} + /* * Send a scpi-command to the scope. The response goes into the buffer * called resp, with a size of resplen. If resp==NULL, no response