| // Copyright 2024 Google LLC |
| // |
| // 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 "libusb_impl.hpp" |
| |
| namespace google |
| { |
| namespace hoth |
| { |
| |
| int LibusbImpl::release_interface(libusb_device_handle* handle, |
| int interface_num) |
| { |
| return ::libusb_release_interface(handle, interface_num); |
| } |
| int LibusbImpl::claim_interface(libusb_device_handle* handle, int interface_num) |
| { |
| return ::libusb_claim_interface(handle, interface_num); |
| } |
| int LibusbImpl::bulk_transfer(libusb_device_handle* dev_handle, |
| unsigned char endpoint, unsigned char* data, |
| int length, int* transferred, |
| unsigned int timeout) |
| { |
| return ::libusb_bulk_transfer(dev_handle, endpoint, data, length, |
| transferred, timeout); |
| } |
| void LibusbImpl::close(libusb_device_handle* dev_handle) |
| { |
| ::libusb_close(dev_handle); |
| } |
| int LibusbImpl::get_active_config_descriptor(libusb_device* dev, |
| libusb_config_descriptor** config) |
| { |
| return ::libusb_get_active_config_descriptor(dev, config); |
| } |
| int LibusbImpl::get_bus_number(libusb_device* dev) |
| { |
| return ::libusb_get_bus_number(dev); |
| } |
| int LibusbImpl::get_port_numbers(libusb_device* dev, uint8_t* port_numbers, |
| int port_numbers_len) |
| { |
| return ::libusb_get_port_numbers(dev, port_numbers, port_numbers_len); |
| } |
| int LibusbImpl::open(libusb_device* dev, libusb_device_handle** handle) |
| { |
| return ::libusb_open(dev, handle); |
| } |
| libusb_device* LibusbImpl::ref_device(libusb_device* dev) |
| { |
| return ::libusb_ref_device(dev); |
| } |
| void LibusbImpl::unref_device(libusb_device* dev) |
| { |
| return ::libusb_unref_device(dev); |
| } |
| ssize_t LibusbImpl::get_device_list(libusb_context* ctx, libusb_device*** list) |
| { |
| return ::libusb_get_device_list(ctx, list); |
| } |
| void LibusbImpl::free_device_list(libusb_device** list, int unref_devices) |
| { |
| ::libusb_free_device_list(list, unref_devices); |
| } |
| void LibusbImpl::exit(libusb_context* ctx) |
| { |
| ::libusb_exit(ctx); |
| } |
| int LibusbImpl::init(libusb_context** ctx) |
| |
| { |
| return ::libusb_init(ctx); |
| } |
| |
| LibusbImpl libusb_impl; |
| |
| } // namespace hoth |
| } // namespace google |