Skip to content

Display and control your Android device

Reorder AOA functions

Romain Vimont3e9c89c535e0
diff --git a/app/src/usb/aoa_hid.c b/app/src/usb/aoa_hid.c
index 8eee4d3f..f4ff8b8d 100644
--- a/app/src/usb/aoa_hid.c
+++ b/app/src/usb/aoa_hid.c
@@ -126,26 +126,6 @@ sc_aoa_set_hid_report_desc(struct sc_aoa *aoa, uint16_t accessory_id,
return true;
}
-bool
-sc_aoa_setup_hid(struct sc_aoa *aoa, uint16_t accessory_id,
- const uint8_t *report_desc, uint16_t report_desc_size) {
- bool ok = sc_aoa_register_hid(aoa, accessory_id, report_desc_size);
- if (!ok) {
- return false;
- }
-
- ok = sc_aoa_set_hid_report_desc(aoa, accessory_id, report_desc,
- report_desc_size);
- if (!ok) {
- if (!sc_aoa_unregister_hid(aoa, accessory_id)) {
- LOGW("Could not unregister HID");
- }
- return false;
- }
-
- return true;
-}
-
static bool
sc_aoa_send_hid_event(struct sc_aoa *aoa, const struct sc_hid_event *event) {
uint8_t request_type = LIBUSB_ENDPOINT_OUT | LIBUSB_REQUEST_TYPE_VENDOR;
@@ -192,6 +172,26 @@ sc_aoa_unregister_hid(struct sc_aoa *aoa, uint16_t accessory_id) {
return true;
}
+bool
+sc_aoa_setup_hid(struct sc_aoa *aoa, uint16_t accessory_id,
+ const uint8_t *report_desc, uint16_t report_desc_size) {
+ bool ok = sc_aoa_register_hid(aoa, accessory_id, report_desc_size);
+ if (!ok) {
+ return false;
+ }
+
+ ok = sc_aoa_set_hid_report_desc(aoa, accessory_id, report_desc,
+ report_desc_size);
+ if (!ok) {
+ if (!sc_aoa_unregister_hid(aoa, accessory_id)) {
+ LOGW("Could not unregister HID");
+ }
+ return false;
+ }
+
+ return true;
+}
+
bool
sc_aoa_push_hid_event_with_ack_to_wait(struct sc_aoa *aoa,
const struct sc_hid_event *event,