Extract USB handling from AOA

The AOA code handled both USB initialization and AOA commands/events.
Extract USB-related code to a separate file and structure.

PR #2974 <https://github.com/Genymobile/scrcpy/pull/2974>
This commit is contained in:
Romain Vimont
2022-01-24 22:56:12 +01:00
parent d48d191262
commit 1d6f9952ee
5 changed files with 143 additions and 95 deletions

View File

@@ -6,6 +6,7 @@
#include <libusb-1.0/libusb.h>
#include "usb.h"
#include "util/acksync.h"
#include "util/cbuf.h"
#include "util/thread.h"
@@ -29,9 +30,7 @@ sc_hid_event_destroy(struct sc_hid_event *hid_event);
struct sc_hid_event_queue CBUF(struct sc_hid_event, 64);
struct sc_aoa {
libusb_context *usb_context;
libusb_device *usb_device;
libusb_device_handle *usb_handle;
struct sc_usb usb;
sc_thread thread;
sc_mutex mutex;
sc_cond event_cond;