Make acksync optional for AOA initialization
Acksync is used to delay HID events until some request (in practice, device clipboard synchronization) is acknowledged by the device. This mechanism will not be necessary for OTG mode. PR #2974 <https://github.com/Genymobile/scrcpy/pull/2974>
This commit is contained in:
parent
8fc9dca8cb
commit
37987b822e
1 changed files with 8 additions and 3 deletions
|
@ -53,8 +53,6 @@ log_libusb_error(enum libusb_error errcode) {
|
||||||
bool
|
bool
|
||||||
sc_aoa_init(struct sc_aoa *aoa, struct sc_usb *usb,
|
sc_aoa_init(struct sc_aoa *aoa, struct sc_usb *usb,
|
||||||
struct sc_acksync *acksync) {
|
struct sc_acksync *acksync) {
|
||||||
assert(acksync);
|
|
||||||
|
|
||||||
cbuf_init(&aoa->queue);
|
cbuf_init(&aoa->queue);
|
||||||
|
|
||||||
if (!sc_mutex_init(&aoa->mutex)) {
|
if (!sc_mutex_init(&aoa->mutex)) {
|
||||||
|
@ -248,6 +246,11 @@ run_aoa_thread(void *data) {
|
||||||
|
|
||||||
if (ack_to_wait != SC_SEQUENCE_INVALID) {
|
if (ack_to_wait != SC_SEQUENCE_INVALID) {
|
||||||
LOGD("Waiting ack from server sequence=%" PRIu64_, ack_to_wait);
|
LOGD("Waiting ack from server sequence=%" PRIu64_, ack_to_wait);
|
||||||
|
|
||||||
|
// If some events have ack_to_wait set, then sc_aoa must have been
|
||||||
|
// initialized with a non NULL acksync
|
||||||
|
assert(aoa->acksync);
|
||||||
|
|
||||||
// Do not block the loop indefinitely if the ack never comes (it
|
// Do not block the loop indefinitely if the ack never comes (it
|
||||||
// should never happen)
|
// should never happen)
|
||||||
sc_tick deadline = sc_tick_now() + SC_TICK_FROM_MS(500);
|
sc_tick deadline = sc_tick_now() + SC_TICK_FROM_MS(500);
|
||||||
|
@ -294,7 +297,9 @@ sc_aoa_stop(struct sc_aoa *aoa) {
|
||||||
sc_cond_signal(&aoa->event_cond);
|
sc_cond_signal(&aoa->event_cond);
|
||||||
sc_mutex_unlock(&aoa->mutex);
|
sc_mutex_unlock(&aoa->mutex);
|
||||||
|
|
||||||
|
if (aoa->acksync) {
|
||||||
sc_acksync_interrupt(aoa->acksync);
|
sc_acksync_interrupt(aoa->acksync);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in a new issue