1 /*
2 * Copyright (c) 2024 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 #include "usb_report_sys_event.h"
17
18 #include "hilog_wrapper.h"
19 #include "usb_errors.h"
20 #include "hisysevent.h"
21
22 using namespace OHOS::HiviewDFX;
23
24 namespace OHOS {
25 namespace USB {
ReportTransforFaultSysEvent(const std::string interfaceName,const HDI::Usb::V1_0::UsbDev & dev,const HDI::Usb::V1_0::UsbPipe & pipe,int32_t ret)26 void UsbReportSysEvent::ReportTransforFaultSysEvent(const std::string interfaceName,
27 const HDI::Usb::V1_0::UsbDev &dev, const HDI::Usb::V1_0::UsbPipe &pipe, int32_t ret)
28 {
29 USB_HILOGI(MODULE_USBD, "report transfor fault sys event");
30 int32_t hiRet = HiSysEventWrite(HiSysEvent::Domain::USB, "USB_MANAGE_TRANSFOR_FAULT",
31 HiSysEvent::EventType::FAULT, "INTFACE_NAME", interfaceName, "BUS_NUM", dev.busNum, "DEV_ADDR", dev.devAddr,
32 "INFT_ID", pipe.intfId, "ENDPOINT_ID", pipe.endpointId, "FAIL_REASON", ret);
33 if (hiRet != UEC_OK) {
34 USB_HILOGI(MODULE_USBD, "HiSysEventWrite ret: %{public}d", hiRet);
35 }
36 }
37 } // OHOS
38 } // USB