1.添加一些ota升级调试信息。

This commit is contained in:
luocai 2024-06-21 18:56:48 +08:00
parent a92e6948c3
commit ec34bd50f6
2 changed files with 11 additions and 5 deletions

View File

@ -87,13 +87,17 @@ bool CdcUpdater::write(Command command, const uint8_t *data, uint32_t size) {
void CdcUpdater::timerEvent(QTimerEvent *event) {
const auto serialPortInfos = QSerialPortInfo::availablePorts();
for (const QSerialPortInfo &portInfo : serialPortInfos) {
LOG(info) << "portName:" << portInfo.portName().toStdString()
<< ", vendorIdentifier: " << portInfo.vendorIdentifier();
if (portInfo.vendorIdentifier() == 0xffff) {
LOG(info) << "founded device: " << portInfo.portName().toStdString();
emit deviceDiscovered(portInfo);
killTimer(m_timerId);
m_timerId = -1;
break;
}
}
LOG(info) << "----------";
}
void CdcUpdater::transferBin() {

View File

@ -54,7 +54,7 @@ std::shared_ptr<DeviceDiscovery::Device> DeviceDiscovery::find(const std::string
}
if (index >= 0) {
IMFMediaSource *source = nullptr;
result = devices[0]->ActivateObject(IID_PPV_ARGS(&source));
result = devices[index]->ActivateObject(IID_PPV_ARGS(&source));
if (FAILED(result)) {
} else {
ret = std::make_shared<Device>(source);
@ -80,11 +80,11 @@ std::string DeviceDiscovery::deviceName(IMFActivate *device) {
void DeviceDiscovery::enterOtaMode(const std::shared_ptr<Device> &device, std::error_code &error) {
auto resolutions = deviceResolutions(device);
// for (auto &[w, h] : resolutions) {
// LOG(info) << w << " " << h;
// }
LOG(info) << "device resolutions:";
for (auto &[w, h] : resolutions) {
LOG(info) << "\t" << w << "*" << h;
}
// LOG(info) << "resolutions: " << resolutions.size();
int32_t otaSpecificHeight = -1;
for (auto &[width, height] : resolutions) {
if (width == OtaSpecificWidth) {
@ -95,6 +95,8 @@ void DeviceDiscovery::enterOtaMode(const std::shared_ptr<Device> &device, std::e
if (otaSpecificHeight <= 0) {
LOG(error) << "cannot find ota specific resolution.";
return;
} else {
LOG(info) << "found ota specific resolution: " << OtaSpecificWidth << "x" << otaSpecificHeight;
}
IMFMediaType *type = nullptr;