mirror of
https://github.com/Genymobile/scrcpy
synced 2024-12-24 08:02:45 +00:00
Remove log_libusb_error()
This helper did not help a lot, and prevented the client to choose the log level and the prefix error message.
This commit is contained in:
parent
137d2c9791
commit
b0e04aa327
@ -45,11 +45,6 @@ sc_hid_event_destroy(struct sc_hid_event *hid_event) {
|
||||
free(hid_event->buffer);
|
||||
}
|
||||
|
||||
static inline void
|
||||
log_libusb_error(enum libusb_error errcode) {
|
||||
LOGW("libusb error: %s", libusb_strerror(errcode));
|
||||
}
|
||||
|
||||
bool
|
||||
sc_aoa_init(struct sc_aoa *aoa, struct sc_usb *usb,
|
||||
struct sc_acksync *acksync) {
|
||||
@ -99,7 +94,7 @@ sc_aoa_register_hid(struct sc_aoa *aoa, uint16_t accessory_id,
|
||||
request, value, index, buffer, length,
|
||||
DEFAULT_TIMEOUT);
|
||||
if (result < 0) {
|
||||
log_libusb_error((enum libusb_error) result);
|
||||
LOGE("REGISTER_HID: libusb error: %s", libusb_strerror(result));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -135,7 +130,7 @@ sc_aoa_set_hid_report_desc(struct sc_aoa *aoa, uint16_t accessory_id,
|
||||
request, value, index, buffer, length,
|
||||
DEFAULT_TIMEOUT);
|
||||
if (result < 0) {
|
||||
log_libusb_error((enum libusb_error) result);
|
||||
LOGE("SET_HID_REPORT_DESC: libusb error: %s", libusb_strerror(result));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -177,7 +172,7 @@ sc_aoa_send_hid_event(struct sc_aoa *aoa, const struct sc_hid_event *event) {
|
||||
request, value, index, buffer, length,
|
||||
DEFAULT_TIMEOUT);
|
||||
if (result < 0) {
|
||||
log_libusb_error((enum libusb_error) result);
|
||||
LOGE("SEND_HID_EVENT: libusb error: %s", libusb_strerror(result));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -199,7 +194,7 @@ sc_aoa_unregister_hid(struct sc_aoa *aoa, const uint16_t accessory_id) {
|
||||
request, value, index, buffer, length,
|
||||
DEFAULT_TIMEOUT);
|
||||
if (result < 0) {
|
||||
log_libusb_error((enum libusb_error) result);
|
||||
LOGE("UNREGISTER_HID: libusb error: %s", libusb_strerror(result));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -4,11 +4,6 @@
|
||||
|
||||
#include "util/log.h"
|
||||
|
||||
static inline void
|
||||
log_libusb_error(enum libusb_error errcode) {
|
||||
LOGW("libusb error: %s", libusb_strerror(errcode));
|
||||
}
|
||||
|
||||
static char *
|
||||
read_string(libusb_device_handle *handle, uint8_t desc_index) {
|
||||
char buffer[128];
|
||||
@ -96,7 +91,7 @@ sc_usb_find_devices(struct sc_usb *usb, const char *serial,
|
||||
libusb_device **list;
|
||||
ssize_t count = libusb_get_device_list(usb->context, &list);
|
||||
if (count < 0) {
|
||||
log_libusb_error((enum libusb_error) count);
|
||||
LOGE("List USB devices: libusb error: %s", libusb_strerror(count));
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -118,7 +113,7 @@ sc_usb_open_handle(libusb_device *device) {
|
||||
libusb_device_handle *handle;
|
||||
int result = libusb_open(device, &handle);
|
||||
if (result < 0) {
|
||||
log_libusb_error((enum libusb_error) result);
|
||||
LOGE("Open device: libusb error: %s", libusb_strerror(result));
|
||||
return NULL;
|
||||
}
|
||||
return handle;
|
||||
@ -183,8 +178,7 @@ sc_usb_register_callback(struct sc_usb *usb) {
|
||||
struct libusb_device_descriptor desc;
|
||||
int result = libusb_get_device_descriptor(device, &desc);
|
||||
if (result < 0) {
|
||||
log_libusb_error((enum libusb_error) result);
|
||||
LOGW("Could not read USB device descriptor");
|
||||
LOGE("Device descriptor: libusb error: %s", libusb_strerror(result));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -198,8 +192,8 @@ sc_usb_register_callback(struct sc_usb *usb) {
|
||||
sc_usb_libusb_callback, usb,
|
||||
&usb->callback_handle);
|
||||
if (result < 0) {
|
||||
log_libusb_error((enum libusb_error) result);
|
||||
LOGW("Could not register USB callback");
|
||||
LOGE("Register hotplog callback: libusb error: %s",
|
||||
libusb_strerror(result));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user