1 /* 2 * Copyright (c) 2023 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 #ifndef MOCK_LINUX_ADAPTER_H 17 #define MOCK_LINUX_ADAPTER_H 18 19 #include <gmock/gmock.h> 20 #include <gtest/gtest.h> 21 #include "linux_adapter.h" 22 23 int32_t FuncAdapterInit(const UsbSession *session); 24 void FuncAdapterExit(const UsbSession *session); 25 UsbDeviceHandle *FuncAdapterOpenDevice(UsbSession *session, uint8_t busNum, uint8_t usbAddr); 26 void FuncAdapterCloseDevice(UsbDeviceHandle *handle); 27 int32_t FuncAdapterGetConfigDescriptor(const UsbDevice *dev, uint8_t configIndex, void *buffer, size_t len); 28 int32_t FuncAdapterGetConfiguration(const UsbDeviceHandle *handle, uint8_t *activeConfig); 29 int32_t FuncAdapterSetConfiguration(UsbDeviceHandle *handle, int32_t activeConfig); 30 int32_t FuncAdapterClaimInterface(const UsbDeviceHandle *handle, uint32_t interfaceNumber); 31 int32_t FuncAdapterReleaseInterface(const UsbDeviceHandle *handle, uint32_t interfaceNumber); 32 int32_t FuncAdapterSetInterface(const UsbDeviceHandle *handle, uint8_t interface, uint8_t altSetting); 33 int32_t FuncAdapterClearHalt(const UsbDeviceHandle *handle, uint32_t endPoint); 34 int32_t FuncAdapterResetDevice(const UsbDeviceHandle *handle); 35 UsbHostRequest *FuncAdapterAllocRequest(const UsbDeviceHandle *handle, int32_t isoPackets, size_t len); 36 int32_t FuncAdapterFreeRequest(UsbHostRequest *request); 37 int32_t FuncAdapterSubmitRequest(UsbHostRequest *request); 38 int32_t FuncAdapterCancelRequest(UsbHostRequest * const request); 39 int32_t FuncAdapterUrbCompleteHandle(const UsbDeviceHandle *devHandle); 40 41 #endif 42