Skip to content

Instantly share code, notes, and snippets.

@neochapay
Created May 25, 2017 10:37
Show Gist options
  • Save neochapay/a435c144b1835193cd76fbf163feffe6 to your computer and use it in GitHub Desktop.
Save neochapay/a435c144b1835193cd76fbf163feffe6 to your computer and use it in GitHub Desktop.
hardware/libhardware patch
diff --git a/hardware.c b/hardware.c
index 6713ea0..7e33b85 100644
--- a/hardware.c
+++ b/hardware.c
@@ -31,9 +31,11 @@
#if defined(__LP64__)
#define HAL_LIBRARY_PATH1 "/system/lib64/hw"
#define HAL_LIBRARY_PATH2 "/vendor/lib64/hw"
+#define HAL_LIBRARY_PATH3 "/usr/libexec/droid-hybris/system/lib64/hw"
#else
#define HAL_LIBRARY_PATH1 "/system/lib/hw"
#define HAL_LIBRARY_PATH2 "/vendor/lib/hw"
+#define HAL_LIBRARY_PATH3 "/usr/libexec/droid-hybris/system/lib/hw"
#endif
/**
@@ -130,6 +132,12 @@ static int hw_module_exists(char *path, size_t path_len, const char *name,
const char *subname)
{
snprintf(path, path_len, "%s/%s.%s.so",
+ HAL_LIBRARY_PATH3, name, subname);
+ if (access(path, R_OK) == 0)
+ return 0;
+
+
+ snprintf(path, path_len, "%s/%s.%s.so",
HAL_LIBRARY_PATH2, name, subname);
if (access(path, R_OK) == 0)
return 0;
diff --git a/include/hardware/audio.h b/include/hardware/audio.h
index 2389c09..5eae00f 100644
--- a/include/hardware/audio.h
+++ b/include/hardware/audio.h
@@ -29,6 +29,12 @@
#include <system/audio.h>
#include <hardware/audio_effect.h>
+#ifdef __ARM_PCS_VFP
+#define FP_ATTRIB __attribute__((pcs("aapcs")))
+#else
+#define FP_ATTRIB
+#endif
+
__BEGIN_DECLS
/**
@@ -290,7 +296,7 @@ struct audio_stream_out {
* This method might produce multiple PCM outputs or hardware accelerated
* codecs, such as MP3 or AAC.
*/
- int (*set_volume)(struct audio_stream_out *stream, float left, float right);
+ int (*set_volume)(struct audio_stream_out *stream, float left, float right) FP_ATTRIB;
/**
* Write audio buffer to driver. Returns number of bytes written, or a
@@ -408,7 +414,7 @@ struct audio_stream_in {
/** set the input gain for the audio driver. This method is for
* for future use */
- int (*set_gain)(struct audio_stream_in *stream, float gain);
+ int (*set_gain)(struct audio_stream_in *stream, float gain) FP_ATTRIB;
/** Read audio buffer in from audio driver. Returns number of bytes read, or a
* negative status_t. If at least one frame was read prior to the error,
@@ -522,14 +528,14 @@ struct audio_hw_device {
int (*init_check)(const struct audio_hw_device *dev);
/** set the audio volume of a voice call. Range is between 0.0 and 1.0 */
- int (*set_voice_volume)(struct audio_hw_device *dev, float volume);
+ int (*set_voice_volume)(struct audio_hw_device *dev, float volume) FP_ATTRIB;
/**
* set the audio volume for all audio activities other than voice call.
* Range between 0.0 and 1.0. If any value other than 0 is returned,
* the software mixer will emulate this capability.
*/
- int (*set_master_volume)(struct audio_hw_device *dev, float volume);
+ int (*set_master_volume)(struct audio_hw_device *dev, float volume) FP_ATTRIB;
/**
* Get the current master volume value for the HAL, if the HAL supports
@@ -538,7 +544,7 @@ struct audio_hw_device {
* the initial master volume across all HALs. HALs which do not support
* this method may leave it set to NULL.
*/
- int (*get_master_volume)(struct audio_hw_device *dev, float *volume);
+ int (*get_master_volume)(struct audio_hw_device *dev, float *volume) FP_ATTRIB;
/**
* set_mode is called when the audio mode changes. AUDIO_MODE_NORMAL mode
diff --git a/include/hardware/bluetooth.h b/include/hardware/bluetooth.h
index 74cd1fc..3c9a352 100644
--- a/include/hardware/bluetooth.h
+++ b/include/hardware/bluetooth.h
@@ -435,7 +435,7 @@ typedef struct {
int (*init)(bt_callbacks_t* callbacks );
/** Enable Bluetooth. */
- int (*enable)(void);
+ int (*enable)(bool guest_mode);
/** Disable Bluetooth. */
int (*disable)(void);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment