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) { void CdcUpdater::timerEvent(QTimerEvent *event) {
const auto serialPortInfos = QSerialPortInfo::availablePorts(); const auto serialPortInfos = QSerialPortInfo::availablePorts();
for (const QSerialPortInfo &portInfo : serialPortInfos) { for (const QSerialPortInfo &portInfo : serialPortInfos) {
LOG(info) << "portName:" << portInfo.portName().toStdString()
<< ", vendorIdentifier: " << portInfo.vendorIdentifier();
if (portInfo.vendorIdentifier() == 0xffff) { if (portInfo.vendorIdentifier() == 0xffff) {
LOG(info) << "founded device: " << portInfo.portName().toStdString(); LOG(info) << "founded device: " << portInfo.portName().toStdString();
emit deviceDiscovered(portInfo); emit deviceDiscovered(portInfo);
killTimer(m_timerId); killTimer(m_timerId);
m_timerId = -1; m_timerId = -1;
break;
} }
} }
LOG(info) << "----------";
} }
void CdcUpdater::transferBin() { void CdcUpdater::transferBin() {

View File

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