I'm trying to write some code to read voltage and ignition from the dcdc-usb powersupply from minibox. I"m using libusb 1.0 and I'm a little lost in this protocol. I seem to be able to write to it but I'm unable to read from it. I wonder if I'm sending the write message. For my test, I'm just writing a simple test for now, setting up the device, writing a "Get all values" command and then trying to read a response. Here's my code:
Here's some links to the window's source code and a "text test": http://resources.mini-box.com/online...SB-Pro-src.zipCode:#define DCDCUSB_GET_ALL_VALUES 0x81
#define DCDCUSB_RECV_ALL_VALUES 0x82
#define READENDPOINT 0x81
#define WRITEENDPOINT 0x01
unsigned char* message = new unsigned char[1];
message[0] = DCDCUSB_GET_ALL_VALUES;
int transfered=0;
int result = libusb_interrupt_transfer(psudev, WRITEENDPOINT, message, 1, &transfered, TIMEOUT);
qDebug()<<"result:"<<result<<" transfered:"<<transfered;
if(result == 0) //success
{
unsigned char *buffer = new unsigned char[500];
result = libusb_interrupt_transfer(psudev, READENDPOINT, buffer, 500, &transfered, TIMEOUT);
qDebug()<<"result:"<<result<<" transfered:"<<transfered;
QByteArray reply = QByteArray::fromRawData((const char*)buffer, transfered);
if(reply.size() && reply.at(0) == DCDCUSB_RECV_ALL_VALUES)
{
double val = reply.at(3)*(float)0.1558;
m_voltageIn = QString("%.2f").arg(val).toDouble();
val = reply.at(4)*(float)0.1558;
m_ignition = QString("%.2f").arg(val).toDouble();
val = reply.at(5)*(float)0.1170;
m_voltageOut = QString("%.2f").arg(val).toDouble();
}
delete buffer;
}
Am i missing anything obvious?

