!1666 usb断链回显优化

Merge pull request !1666 from liupeng298/master
This commit is contained in:
openharmony_ci 2024-11-21 02:19:48 +00:00 committed by Gitee
commit 40d8610ee6
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -611,6 +611,11 @@ void HdcHostUSB::BeginUsbRead(HSession hSession)
--hSession->ref;
auto server = reinterpret_cast<HdcServer *>(clsMainBase);
hUSB->hostBulkIn.isShutdown = true;
if (server != nullptr && server->clsServerForClient != nullptr) {
HdcServerForClient *sfc = (HdcServerForClient *)server->clsServerForClient;
const string msg("[Fail][E001003] USB communication abnormal, please check the USB communication link.");
sfc->EchoToAllChannelsViaSessionId(hSession->sessionId, msg);
}
server->FreeSession(hSession->sessionId);
RemoveIgnoreDevice(hUSB->usbMountPoint);
WRITE_LOG(LOG_INFO, "Usb loop read finish sid:%u", hSession->sessionId);
@ -660,12 +665,6 @@ int HdcHostUSB::SendUSBRaw(HSession hSession, uint8_t *data, const int length)
WRITE_LOG(LOG_FATAL, "Send usb failed, sid:%u ret:%d", hSession->sessionId, ret);
CancelUsbIo(hSession);
hSession->hUSB->hostBulkOut.isShutdown = true;
HdcServer* serverClass = (HdcServer *)server;
if (serverClass != nullptr && serverClass->clsServerForClient != nullptr) {
HdcServerForClient *sfc = (HdcServerForClient *)serverClass->clsServerForClient;
const string msg("[Fail][E001003] USB communication abnormal, please check the USB communication link.");
sfc->EchoToAllChannelsViaSessionId(hSession->sessionId, msg);
}
server->FreeSession(hSession->sessionId);
}
--hSession->ref;