Main thread using FreeRTOS notifications, added missing commands for firmware update

This commit is contained in:
Jan Käberich 2020-08-31 17:57:24 +02:00
parent 07ba714f1f
commit 8c33ae523a
11 changed files with 209 additions and 134 deletions

View file

@ -157,6 +157,30 @@ bool Device::SendFirmwareChunk(Protocol::FirmwarePacket &fw)
}
}
bool Device::SendCommandWithoutPayload(Protocol::PacketType type)
{
if(m_connected) {
unsigned char buffer[32];
Protocol::PacketInfo p;
p.type = type;
unsigned int length = Protocol::EncodePacket(p, buffer, sizeof(buffer));
if(!length) {
qCritical() << "Failed to encode packet";
return false;
}
int actual_length;
auto ret = libusb_bulk_transfer(m_handle, EP_Data_Out_Addr, buffer, length, &actual_length, 0);
if(ret < 0) {
qCritical() << "Error sending data: "
<< libusb_strerror((libusb_error) ret);
return false;
}
return true;
} else {
return false;
}
}
std::vector<QString> Device::GetDevices()
{
std::vector<QString> serials;