aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--android/hw-control.c20
-rw-r--r--android/hw-control.h5
-rw-r--r--android/protocol/ui-commands-proxy.c2
-rw-r--r--android/protocol/ui-commands-qemu.c2
-rw-r--r--vl-android.c2
5 files changed, 24 insertions, 7 deletions
diff --git a/android/hw-control.c b/android/hw-control.c
index 9180383..8164bc0 100644
--- a/android/hw-control.c
+++ b/android/hw-control.c
@@ -128,11 +128,23 @@ hw_control_init( HwControl* control,
NULL, NULL);
}
+const AndroidHwControlFuncs defaultControls = {
+ NULL,
+};
+
+static HwControl hwstate[1];
+
void
-android_hw_control_init( void* opaque, const AndroidHwControlFuncs* funcs )
+android_hw_control_init( void )
{
- static HwControl hwstate[1];
-
- hw_control_init(hwstate, opaque, funcs);
+ hw_control_init(hwstate, NULL, &defaultControls);
D("%s: hw-control qemud handler initialized", __FUNCTION__);
}
+
+void
+android_hw_control_set( void* opaque, const AndroidHwControlFuncs* funcs )
+{
+ hwstate->client = opaque;
+ hwstate->client_funcs = funcs[0];
+}
+
diff --git a/android/hw-control.h b/android/hw-control.h
index 6e9874e..67a9bc7 100644
--- a/android/hw-control.h
+++ b/android/hw-control.h
@@ -32,7 +32,10 @@ typedef struct {
} AndroidHwControlFuncs;
/* used to initialize the hardware control support */
-extern void android_hw_control_init( void* opaque,
+extern void android_hw_control_init( void );
+
+/* used to register a new hw-control back-end */
+extern void android_hw_control_set( void* opaque,
const AndroidHwControlFuncs* funcs );
#endif /* _android_hw_control_h */
diff --git a/android/protocol/ui-commands-proxy.c b/android/protocol/ui-commands-proxy.c
index 1aedc62..d16092a 100644
--- a/android/protocol/ui-commands-proxy.c
+++ b/android/protocol/ui-commands-proxy.c
@@ -177,7 +177,7 @@ uiCmdProxy_create(int fd)
// the UI about the event.
AndroidHwControlFuncs funcs;
funcs.light_brightness = _uiCmdProxy_brightness_change_callback;
- android_hw_control_init(&_uiCmdProxy, &funcs);
+ android_hw_control_set(&_uiCmdProxy, &funcs);
}
return 0;
}
diff --git a/android/protocol/ui-commands-qemu.c b/android/protocol/ui-commands-qemu.c
index 3dbed31..2bb22c9 100644
--- a/android/protocol/ui-commands-qemu.c
+++ b/android/protocol/ui-commands-qemu.c
@@ -35,6 +35,6 @@ uicmd_set_brightness_change_callback(AndroidHwLightBrightnessCallback callback,
{
AndroidHwControlFuncs funcs;
funcs.light_brightness = callback;
- android_hw_control_init(opaque, &funcs);
+ android_hw_control_set(opaque, &funcs);
return 0;
}
diff --git a/vl-android.c b/vl-android.c
index 89b0e3f..1d730f5 100644
--- a/vl-android.c
+++ b/vl-android.c
@@ -198,6 +198,7 @@
#include "balloon.h"
#include "android/hw-lcd.h"
#include "android/boot-properties.h"
+#include "android/hw-control.h"
#include "android/core-init-utils.h"
#include "android/audio-test.h"
@@ -4043,6 +4044,7 @@ int main(int argc, char **argv, char **envp)
/* Initialize boot properties. */
boot_property_init_service();
+ android_hw_control_init();
optind = 1;
for(;;) {