diff --git a/src/pc/protocols/wrap_libusb.cpp b/src/pc/protocols/wrap_libusb.cpp new file mode 100755 index 0000000..0aed103 --- /dev/null +++ b/src/pc/protocols/wrap_libusb.cpp @@ -0,0 +1,27 @@ +/* + dp::libusb - C++ wrapper for libusb-1.0 (focused on use with the XLink protocol) + + Copyright 2023 Dale Phurrough + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include "wrap_libusb.hpp" + +std::mutex dp::libusb::device_list::mtx; + +// definition outside class to workaround Clang constexpr failures +constexpr int dp::libusb::device_handle::DEFAULT_CHUNK_SIZE; +constexpr int dp::libusb::device_handle::DEFAULT_CHUNK_SIZE_USB1; +constexpr decltype(libusb_endpoint_descriptor::wMaxPacketSize) dp::libusb::device_handle::DEFAULT_MAX_PACKET_SIZE; +constexpr std::array dp::libusb::device_handle::DEFAULT_MAX_PACKET_ARRAY; diff --git a/src/pc/protocols/wrap_libusb.hpp b/src/pc/protocols/wrap_libusb.hpp index 9cac4fb..274a010 100755 --- a/src/pc/protocols/wrap_libusb.hpp +++ b/src/pc/protocols/wrap_libusb.hpp @@ -21,6 +21,7 @@ // project #define MVLOG_UNIT_NAME xLinkUsb +#include "XLink/XLinkLog.h" // libraries #ifdef XLINK_LIBUSB_LOCAL @@ -273,9 +274,6 @@ class device_list { pointer deviceList{}; }; -// TODO move to dedicated cpp file to avoid multiple definitions -std::mutex device_list::mtx; - // wraps libusb_config_descriptor* and automatically libusb_free_config_descriptor() on destruction class config_descriptor : public unique_resource_ptr { public: @@ -534,7 +532,7 @@ class device_handle : public unique_resource_ptr(__func__, __LINE__, libusb_control_transfer, get(), requestType, request, value, index, static_cast(data), length, static_cast(timeout.count())); } - }; +}; class usb_device : public unique_resource_ptr { private: