diff options
-rw-r--r-- | BoardConfig.mk | 10 | ||||
-rw-r--r--[-rwxr-xr-x] | audio/audio_hw.c | 250 | ||||
-rw-r--r-- | audio/audio_hw.h | 82 | ||||
-rwxr-xr-x | audio/ril_interface.c | 10 | ||||
-rwxr-xr-x | audio/ril_interface.h | 6 | ||||
-rw-r--r-- | cm.mk | 5 | ||||
-rw-r--r-- | configs/gps.xml | 16 | ||||
-rw-r--r-- | configs/tiny_hw.xml | 121 | ||||
-rw-r--r-- | fstab.smdk4x12 | 13 | ||||
-rw-r--r-- | gps_daemon.sh | 2 | ||||
-rw-r--r-- | i9300.mk | 31 | ||||
-rw-r--r-- | include/camera/CameraParametersExtra.h | 55 | ||||
-rw-r--r-- | include/hardware/gps.h | 694 | ||||
-rwxr-xr-x | init.smdk4x12.rc | 519 | ||||
-rw-r--r-- | libsamsung_symbols/Android.mk | 28 | ||||
-rw-r--r-- | libsamsung_symbols/samsung_ril.cpp | 21 | ||||
-rw-r--r-- | libsensors/Android.mk (renamed from sensors/Android.mk) | 3 | ||||
-rw-r--r-- | libsensors/ak8975-reg.h (renamed from sensors/ak8975-reg.h) | 0 | ||||
-rw-r--r-- | libsensors/ak8975.h (renamed from sensors/ak8975.h) | 0 | ||||
-rw-r--r-- | libsensors/akm8975.c (renamed from sensors/akm8975.c) | 80 | ||||
-rw-r--r-- | libsensors/akmdfs/AK8975Driver.c (renamed from sensors/akmdfs/AK8975Driver.c) | 0 | ||||
-rw-r--r-- | libsensors/akmdfs/AK8975Driver.h (renamed from sensors/akmdfs/AK8975Driver.h) | 0 | ||||
-rw-r--r-- | libsensors/akmdfs/AKFS_APIs.c (renamed from sensors/akmdfs/AKFS_APIs.c) | 0 | ||||
-rw-r--r-- | libsensors/akmdfs/AKFS_APIs.h (renamed from sensors/akmdfs/AKFS_APIs.h) | 0 | ||||
-rw-r--r-- | libsensors/akmdfs/AKFS_APIs_8975/AKFS_AK8975.c (renamed from sensors/akmdfs/AKFS_APIs_8975/AKFS_AK8975.c) | 0 | ||||
-rw-r--r-- | libsensors/akmdfs/AKFS_APIs_8975/AKFS_AK8975.h (renamed from sensors/akmdfs/AKFS_APIs_8975/AKFS_AK8975.h) | 0 | ||||
-rw-r--r-- | libsensors/akmdfs/AKFS_APIs_8975/AKFS_AOC.c (renamed from sensors/akmdfs/AKFS_APIs_8975/AKFS_AOC.c) | 0 | ||||
-rw-r--r-- | libsensors/akmdfs/AKFS_APIs_8975/AKFS_AOC.h (renamed from sensors/akmdfs/AKFS_APIs_8975/AKFS_AOC.h) | 0 | ||||
-rw-r--r-- | libsensors/akmdfs/AKFS_APIs_8975/AKFS_Configure.h (renamed from sensors/akmdfs/AKFS_APIs_8975/AKFS_Configure.h) | 0 | ||||
-rw-r--r-- | libsensors/akmdfs/AKFS_APIs_8975/AKFS_Device.c (renamed from sensors/akmdfs/AKFS_APIs_8975/AKFS_Device.c) | 0 | ||||
-rw-r--r-- | libsensors/akmdfs/AKFS_APIs_8975/AKFS_Device.h (renamed from sensors/akmdfs/AKFS_APIs_8975/AKFS_Device.h) | 0 | ||||
-rw-r--r-- | libsensors/akmdfs/AKFS_APIs_8975/AKFS_Direction.c (renamed from sensors/akmdfs/AKFS_APIs_8975/AKFS_Direction.c) | 0 | ||||
-rw-r--r-- | libsensors/akmdfs/AKFS_APIs_8975/AKFS_Direction.h (renamed from sensors/akmdfs/AKFS_APIs_8975/AKFS_Direction.h) | 0 | ||||
-rw-r--r-- | libsensors/akmdfs/AKFS_APIs_8975/AKFS_Math.h (renamed from sensors/akmdfs/AKFS_APIs_8975/AKFS_Math.h) | 0 | ||||
-rw-r--r-- | libsensors/akmdfs/AKFS_APIs_8975/AKFS_VNorm.c (renamed from sensors/akmdfs/AKFS_APIs_8975/AKFS_VNorm.c) | 0 | ||||
-rw-r--r-- | libsensors/akmdfs/AKFS_APIs_8975/AKFS_VNorm.h (renamed from sensors/akmdfs/AKFS_APIs_8975/AKFS_VNorm.h) | 0 | ||||
-rw-r--r-- | libsensors/akmdfs/AKFS_CSpec.h (renamed from sensors/akmdfs/AKFS_CSpec.h) | 0 | ||||
-rw-r--r-- | libsensors/akmdfs/AKFS_Common.h (renamed from sensors/akmdfs/AKFS_Common.h) | 0 | ||||
-rw-r--r-- | libsensors/akmdfs/AKFS_Compass.h (renamed from sensors/akmdfs/AKFS_Compass.h) | 0 | ||||
-rw-r--r-- | libsensors/akmdfs/AKFS_Disp.c (renamed from sensors/akmdfs/AKFS_Disp.c) | 0 | ||||
-rw-r--r-- | libsensors/akmdfs/AKFS_Disp.h (renamed from sensors/akmdfs/AKFS_Disp.h) | 0 | ||||
-rw-r--r-- | libsensors/akmdfs/AKFS_FileIO.c (renamed from sensors/akmdfs/AKFS_FileIO.c) | 0 | ||||
-rw-r--r-- | libsensors/akmdfs/AKFS_FileIO.h (renamed from sensors/akmdfs/AKFS_FileIO.h) | 0 | ||||
-rw-r--r-- | libsensors/akmdfs/AKFS_Measure.c (renamed from sensors/akmdfs/AKFS_Measure.c) | 0 | ||||
-rw-r--r-- | libsensors/akmdfs/AKFS_Measure.h (renamed from sensors/akmdfs/AKFS_Measure.h) | 0 | ||||
-rw-r--r-- | libsensors/akmdfs/NOTICE (renamed from sensors/akmdfs/NOTICE) | 0 | ||||
-rw-r--r-- | libsensors/akmdfs/Version.txt (renamed from sensors/akmdfs/Version.txt) | 0 | ||||
-rw-r--r-- | libsensors/akmdfs/main.c (renamed from sensors/akmdfs/main.c) | 0 | ||||
-rw-r--r-- | libsensors/cm36651_light.c (renamed from sensors/cm36651_light.c) | 46 | ||||
-rw-r--r-- | libsensors/cm36651_proximity.c (renamed from sensors/cm36651_proximity.c) | 4 | ||||
-rw-r--r-- | libsensors/input.c (renamed from sensors/input.c) | 5 | ||||
-rw-r--r-- | libsensors/lps331ap.c (renamed from sensors/lps331ap.c) | 11 | ||||
-rw-r--r-- | libsensors/lsm330dlc_accel.h (renamed from sensors/lsm330dlc_accel.h) | 0 | ||||
-rw-r--r-- | libsensors/lsm330dlc_acceleration.c (renamed from sensors/lsm330dlc_acceleration.c) | 23 | ||||
-rw-r--r-- | libsensors/lsm330dlc_gyroscope.c (renamed from sensors/lsm330dlc_gyroscope.c) | 8 | ||||
-rw-r--r-- | libsensors/smdk4x12_sensors.c (renamed from sensors/smdk4x12_sensors.c) | 37 | ||||
-rw-r--r-- | libsensors/smdk4x12_sensors.h (renamed from sensors/smdk4x12_sensors.h) | 13 | ||||
-rw-r--r-- | overlay/frameworks/base/core/res/res/values/config.xml | 213 | ||||
-rw-r--r-- | overlay/frameworks/base/core/res/res/xml/storage_list.xml | 52 | ||||
-rw-r--r-- | overlay/frameworks/base/packages/SystemUI/res/values/config.xml | 6 | ||||
-rw-r--r-- | overlay/packages/apps/Phone/res/values/config.xml | 25 | ||||
-rw-r--r-- | overlay/packages/apps/Torch/res/values/config.xml | 36 | ||||
-rw-r--r-- | proprietary-files.txt | 3 | ||||
-rw-r--r-- | recovery.fstab | 12 | ||||
-rw-r--r-- | ril-wrapper/Android.mk | 9 | ||||
-rw-r--r-- | ril-wrapper/ril-wrapper.c | 99 | ||||
-rw-r--r-- | ril/telephony/java/com/android/internal/telephony/SamsungExynos4RIL.java | 505 | ||||
-rw-r--r-- | rootdir/fstab.smdk4x12 | 21 | ||||
-rw-r--r-- | rootdir/init.target.rc | 62 | ||||
-rw-r--r-- | selinux/bluetooth.te | 6 | ||||
-rw-r--r-- | selinux/cpboot-daemon.te | 25 | ||||
-rw-r--r-- | selinux/device.te | 4 | ||||
-rw-r--r-- | selinux/domain.te | 1 | ||||
-rw-r--r-- | selinux/file.te | 11 | ||||
-rw-r--r-- | selinux/file_contexts | 66 | ||||
-rw-r--r-- | selinux/gpsd.te | 25 | ||||
-rw-r--r-- | selinux/init.te | 15 | ||||
-rw-r--r-- | selinux/log.te | 3 | ||||
-rw-r--r-- | selinux/macloader.te | 9 | ||||
-rw-r--r-- | selinux/mediaserver.te | 11 | ||||
-rw-r--r-- | selinux/netd.te | 3 | ||||
-rw-r--r-- | selinux/nfc.te | 2 | ||||
-rw-r--r-- | selinux/rild.te | 20 | ||||
-rw-r--r-- | selinux/service_contexts | 3 | ||||
-rw-r--r-- | selinux/servicemanager.te | 3 | ||||
-rw-r--r-- | selinux/surfaceflinger.te | 1 | ||||
-rw-r--r-- | selinux/sysinit.te | 7 | ||||
-rw-r--r-- | selinux/system_app.te | 2 | ||||
-rw-r--r-- | selinux/system_server.te | 33 | ||||
-rw-r--r-- | selinux/tinyplay.te | 6 | ||||
-rw-r--r-- | selinux/ueventd.te | 5 | ||||
-rw-r--r-- | selinux/untrusted_app.te | 5 | ||||
-rw-r--r-- | selinux/vold.te | 11 | ||||
-rw-r--r-- | selinux/wpa_supplicant.te | 12 | ||||
-rw-r--r-- | selinux/zygote.te | 1 | ||||
-rw-r--r-- | sensors/orientation.c | 444 | ||||
-rw-r--r-- | system.prop | 3 |
97 files changed, 1716 insertions, 2157 deletions
diff --git a/BoardConfig.mk b/BoardConfig.mk index 5b0333e..25ec327 100644 --- a/BoardConfig.mk +++ b/BoardConfig.mk @@ -23,6 +23,7 @@ BOARD_MODEM_TYPE := xmm6262 TARGET_SPECIFIC_HEADER_PATH := device/samsung/i9300/include +COMMON_GLOBAL_CFLAGS += -DDISABLE_ASHMEM_TRACKING # Bluetooth BOARD_BLUETOOTH_BDROID_BUILDCFG_INCLUDE_DIR := device/samsung/i9300/bluetooth @@ -30,6 +31,15 @@ BOARD_BLUETOOTH_BDROID_BUILDCFG_INCLUDE_DIR := device/samsung/i9300/bluetooth # Kernel TARGET_KERNEL_SOURCE := kernel/samsung/smdk4412 TARGET_KERNEL_CONFIG := cyanogenmod_i9300_defconfig +BOARD_RIL_CLASS := ../../../device/samsung/i9300/ril + +# Recovery +TARGET_RECOVERY_FSTAB := device/samsung/i9300/rootdir/fstab.smdk4x12 +RECOVERY_FSTAB_VERSION := 2 + +# Selinux +BOARD_SEPOLICY_DIRS += \ + device/samsung/i9300/selinux # Charging mode BOARD_CHARGER_RES := device/samsung/i9300/res/charger diff --git a/audio/audio_hw.c b/audio/audio_hw.c index a322386..283fb30 100755..100644 --- a/audio/audio_hw.c +++ b/audio/audio_hw.c @@ -73,7 +73,7 @@ struct pcm_config pcm_config_capture = { struct pcm_config pcm_config_vx = { .channels = 2, - .rate = VX_NB_SAMPLING_RATE, + .rate = VX_WB_SAMPLING_RATE, .period_size = 160, .period_count = 2, .format = PCM_FORMAT_S16_LE, @@ -88,7 +88,6 @@ struct m0_audio_device { struct m0_dev_cfg *dev_cfgs; int num_dev_cfgs; struct mixer *mixer; - struct mixer_ctls mixer_ctls; audio_mode_t mode; int active_out_device; int out_device; @@ -96,12 +95,13 @@ struct m0_audio_device { int in_device; struct pcm *pcm_modem_dl; struct pcm *pcm_modem_ul; + struct pcm *pcm_bt_dl; + struct pcm *pcm_bt_ul; int in_call; float voice_volume; struct m0_stream_in *active_input; struct m0_stream_out *outputs[OUTPUT_TOTAL]; bool mic_mute; - int tty_mode; struct echo_reference_itfe *echo_reference; bool bluetooth_nrec; int wb_amr; @@ -200,6 +200,7 @@ struct m0_dev_cfg { static void select_output_device(struct m0_audio_device *adev); static void select_input_device(struct m0_audio_device *adev); +static void set_noise_supression(struct m0_audio_device *adev, int enable); static int adev_set_voice_volume(struct audio_hw_device *dev, float volume); static int do_input_standby(struct m0_stream_in *in); static int do_output_standby(struct m0_stream_out *out); @@ -312,7 +313,6 @@ static int set_route_by_array(struct mixer *mixer, struct route_setting *route, void select_devices(struct m0_audio_device *adev) { int i; - if (adev->active_out_device == adev->out_device && adev->active_in_device == adev->in_device) return; @@ -322,26 +322,30 @@ void select_devices(struct m0_audio_device *adev) /* Turn on new devices first so we don't glitch due to powerdown... */ for (i = 0; i < adev->num_dev_cfgs; i++) if ((adev->out_device & adev->dev_cfgs[i].mask) && - !(adev->active_out_device & adev->dev_cfgs[i].mask)) + !(adev->active_out_device & adev->dev_cfgs[i].mask) && + !(adev->dev_cfgs[i].mask & AUDIO_DEVICE_BIT_IN)) set_route_by_array(adev->mixer, adev->dev_cfgs[i].on, adev->dev_cfgs[i].on_len); for (i = 0; i < adev->num_dev_cfgs; i++) if ((adev->in_device & adev->dev_cfgs[i].mask) && - !(adev->active_in_device & adev->dev_cfgs[i].mask)) + !(adev->active_in_device & adev->dev_cfgs[i].mask) && + (adev->dev_cfgs[i].mask & AUDIO_DEVICE_BIT_IN)) set_route_by_array(adev->mixer, adev->dev_cfgs[i].on, adev->dev_cfgs[i].on_len); /* ...then disable old ones. */ for (i = 0; i < adev->num_dev_cfgs; i++) if (!(adev->out_device & adev->dev_cfgs[i].mask) && - (adev->active_out_device & adev->dev_cfgs[i].mask)) + (adev->active_out_device & adev->dev_cfgs[i].mask) && + !(adev->dev_cfgs[i].mask & AUDIO_DEVICE_BIT_IN)) set_route_by_array(adev->mixer, adev->dev_cfgs[i].off, adev->dev_cfgs[i].off_len); for (i = 0; i < adev->num_dev_cfgs; i++) if (!(adev->in_device & adev->dev_cfgs[i].mask) && - (adev->active_in_device & adev->dev_cfgs[i].mask)) + (adev->active_in_device & adev->dev_cfgs[i].mask) && + (adev->dev_cfgs[i].mask & AUDIO_DEVICE_BIT_IN)) set_route_by_array(adev->mixer, adev->dev_cfgs[i].off, adev->dev_cfgs[i].off_len); @@ -351,17 +355,21 @@ void select_devices(struct m0_audio_device *adev) static int start_call(struct m0_audio_device *adev) { - ALOGE("Opening modem PCMs"); + ALOGV("Opening modem PCMs"); int bt_on; bt_on = adev->out_device & AUDIO_DEVICE_OUT_ALL_SCO; - pcm_config_vx.rate = adev->wb_amr ? VX_WB_SAMPLING_RATE : VX_NB_SAMPLING_RATE; + + if (bt_on) { + /* use amr-nb for bluetooth */ + pcm_config_vx.rate = VX_NB_SAMPLING_RATE; + } else { + pcm_config_vx.rate = adev->wb_amr ? VX_WB_SAMPLING_RATE : VX_NB_SAMPLING_RATE; + } /* Open modem PCM channels */ if (adev->pcm_modem_dl == NULL) { - if (bt_on) - adev->pcm_modem_dl = pcm_open(CARD_DEFAULT, PORT_BT, PCM_OUT, &pcm_config_vx); - else + ALOGD("Opening PCM modem DL stream"); adev->pcm_modem_dl = pcm_open(CARD_DEFAULT, PORT_MODEM, PCM_OUT, &pcm_config_vx); if (!pcm_is_ready(adev->pcm_modem_dl)) { ALOGE("cannot open PCM modem DL stream: %s", pcm_get_error(adev->pcm_modem_dl)); @@ -370,6 +378,7 @@ static int start_call(struct m0_audio_device *adev) } if (adev->pcm_modem_ul == NULL) { + ALOGD("Opening PCM modem UL stream"); adev->pcm_modem_ul = pcm_open(CARD_DEFAULT, PORT_MODEM, PCM_IN, &pcm_config_vx); if (!pcm_is_ready(adev->pcm_modem_ul)) { ALOGE("cannot open PCM modem UL stream: %s", pcm_get_error(adev->pcm_modem_ul)); @@ -377,34 +386,88 @@ static int start_call(struct m0_audio_device *adev) } } + ALOGD("Starting PCM modem streams"); pcm_start(adev->pcm_modem_dl); pcm_start(adev->pcm_modem_ul); + /* Open bluetooth PCM channels */ + if (bt_on) { + ALOGV("Opening bluetooth PCMs"); + + if (adev->pcm_bt_dl == NULL) { + ALOGD("Opening PCM bluetooth DL stream"); + adev->pcm_bt_dl = pcm_open(CARD_DEFAULT, PORT_BT, PCM_OUT, &pcm_config_vx); + if (!pcm_is_ready(adev->pcm_bt_dl)) { + ALOGE("cannot open PCM bluetooth DL stream: %s", pcm_get_error(adev->pcm_bt_dl)); + goto err_open_dl; + } + } + + if (adev->pcm_bt_ul == NULL) { + ALOGD("Opening PCM bluetooth UL stream"); + adev->pcm_bt_ul = pcm_open(CARD_DEFAULT, PORT_BT, PCM_IN, &pcm_config_vx); + if (!pcm_is_ready(adev->pcm_bt_ul)) { + ALOGE("cannot open PCM bluetooth UL stream: %s", pcm_get_error(adev->pcm_bt_ul)); + goto err_open_ul; + } + } + ALOGD("Starting PCM bluetooth streams"); + pcm_start(adev->pcm_bt_dl); + pcm_start(adev->pcm_bt_ul); + } + return 0; err_open_ul: pcm_close(adev->pcm_modem_ul); adev->pcm_modem_ul = NULL; + pcm_close(adev->pcm_bt_ul); + adev->pcm_bt_ul = NULL; err_open_dl: pcm_close(adev->pcm_modem_dl); adev->pcm_modem_dl = NULL; + pcm_close(adev->pcm_bt_dl); + adev->pcm_bt_dl = NULL; return -ENOMEM; } static void end_call(struct m0_audio_device *adev) { - ALOGE("Closing modem PCMs"); - pcm_stop(adev->pcm_modem_dl); - pcm_stop(adev->pcm_modem_ul); - pcm_close(adev->pcm_modem_dl); - pcm_close(adev->pcm_modem_ul); + int bt_on; + bt_on = adev->out_device & AUDIO_DEVICE_OUT_ALL_SCO; + + if (adev->pcm_modem_dl != NULL) { + ALOGD("Stopping modem DL PCM"); + pcm_stop(adev->pcm_modem_dl); + ALOGV("Closing modem DL PCM"); + pcm_close(adev->pcm_modem_dl); + } + if (adev->pcm_modem_ul != NULL) { + ALOGD("Stopping modem UL PCM"); + pcm_stop(adev->pcm_modem_ul); + ALOGV("Closing modem UL PCM"); + pcm_close(adev->pcm_modem_ul); + } adev->pcm_modem_dl = NULL; adev->pcm_modem_ul = NULL; - /* re-enable +30db boost on mics */ - mixer_ctl_set_value(adev->mixer_ctls.mixinl_in1l_volume, 0, 1); - mixer_ctl_set_value(adev->mixer_ctls.mixinl_in2l_volume, 0, 1); + if (bt_on) { + if (adev->pcm_bt_dl != NULL) { + ALOGD("Stopping bluetooth DL PCM"); + pcm_stop(adev->pcm_bt_dl); + ALOGV("Closing bluetooth DL PCM"); + pcm_close(adev->pcm_bt_dl); + } + if (adev->pcm_bt_ul != NULL) { + ALOGD("Stopping bluetooth UL PCM"); + pcm_stop(adev->pcm_bt_ul); + ALOGV("Closing bluetooth UL PCM"); + pcm_close(adev->pcm_bt_ul); + } + } + adev->pcm_bt_dl = NULL; + adev->pcm_bt_ul = NULL; } static void set_eq_filter(struct m0_audio_device *adev) @@ -438,7 +501,7 @@ static void set_incall_device(struct m0_audio_device *adev) device_type = SOUND_AUDIO_PATH_HANDSET; break; case AUDIO_DEVICE_OUT_SPEAKER: - case AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET: + case AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET: case AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET: case AUDIO_DEVICE_OUT_AUX_DIGITAL: device_type = SOUND_AUDIO_PATH_SPEAKER; @@ -468,15 +531,6 @@ static void set_incall_device(struct m0_audio_device *adev) ril_set_call_audio_path(&adev->ril, device_type); } -static void set_input_volumes(struct m0_audio_device *adev, int main_mic_on, - int headset_mic_on, int sub_mic_on) -{ -} - -static void set_output_volumes(struct m0_audio_device *adev, bool tty_volume) -{ -} - static void force_all_standby(struct m0_audio_device *adev) { struct m0_stream_in *in; @@ -532,9 +586,23 @@ static void select_mode(struct m0_audio_device *adev) adev->in_call, adev->mode); if (adev->in_call) { adev->in_call = 0; + ril_set_call_clock_sync(&adev->ril, SOUND_CLOCK_STOP); end_call(adev); force_all_standby(adev); + + ALOGD("%s: set voicecall route: voicecall_default_disable", __func__); + set_bigroute_by_array(adev->mixer, voicecall_default_disable, 1); + ALOGD("%s: set voicecall route: default_input_disable", __func__); + set_bigroute_by_array(adev->mixer, default_input_disable, 1); + set_noise_supression(adev, 0); + ALOGD("%s: set voicecall route: headset_input_disable", __func__); + set_bigroute_by_array(adev->mixer, headset_input_disable, 1); + ALOGD("%s: set voicecall route: bt_disable", __func__); + set_bigroute_by_array(adev->mixer, bt_disable, 1); + select_output_device(adev); + //Force Input Standby + adev->in_device = AUDIO_DEVICE_NONE; select_input_device(adev); } } @@ -547,7 +615,6 @@ static void select_output_device(struct m0_audio_device *adev) int speaker_on; int earpiece_on; int bt_on; - bool tty_volume = false; unsigned int channel; headset_on = adev->out_device & AUDIO_DEVICE_OUT_WIRED_HEADSET; @@ -594,29 +661,6 @@ static void select_output_device(struct m0_audio_device *adev) set_eq_filter(adev); if (adev->mode == AUDIO_MODE_IN_CALL) { - if (!bt_on) { - /* force tx path according to TTY mode when in call */ - switch(adev->tty_mode) { - case TTY_MODE_FULL: - case TTY_MODE_HCO: - /* tx path from headset mic */ - headphone_on = 0; - headset_on = 1; - speaker_on = 0; - earpiece_on = 0; - break; - case TTY_MODE_VCO: - /* tx path from device sub mic */ - headphone_on = 0; - headset_on = 0; - speaker_on = 1; - earpiece_on = 0; - break; - case TTY_MODE_OFF: - default: - break; - } - } if (headset_on || headphone_on || speaker_on || earpiece_on) { ALOGD("%s: set voicecall route: voicecall_default", __func__); @@ -629,9 +673,11 @@ static void select_output_device(struct m0_audio_device *adev) if (speaker_on || earpiece_on || headphone_on) { ALOGD("%s: set voicecall route: default_input", __func__); set_bigroute_by_array(adev->mixer, default_input, 1); + set_noise_supression(adev, 1); } else { ALOGD("%s: set voicecall route: default_input_disable", __func__); set_bigroute_by_array(adev->mixer, default_input_disable, 1); + set_noise_supression(adev, 0); } if (headset_on) { @@ -643,9 +689,6 @@ static void select_output_device(struct m0_audio_device *adev) } if (bt_on) { - // bt uses a different port (PORT_BT) for playback, reopen the pcms - end_call(adev); - start_call(adev); ALOGD("%s: set voicecall route: bt_input", __func__); set_bigroute_by_array(adev->mixer, bt_input, 1); ALOGD("%s: set voicecall route: bt_output", __func__); @@ -654,7 +697,6 @@ static void select_output_device(struct m0_audio_device *adev) ALOGD("%s: set voicecall route: bt_disable", __func__); set_bigroute_by_array(adev->mixer, bt_disable, 1); } - set_incall_device(adev); } } @@ -668,9 +710,9 @@ static void select_input_device(struct m0_audio_device *adev) ALOGD("%s: AUDIO_DEVICE_IN_BUILTIN_MIC", __func__); break; case AUDIO_DEVICE_IN_BACK_MIC: - ALOGD("%s: AUDIO_DEVICE_IN_BACK_MIC | AUDIO_DEVICE_IN_BUILTIN_MIC", __func__); // Force use both mics for video recording adev->in_device = (AUDIO_DEVICE_IN_BACK_MIC | AUDIO_DEVICE_IN_BUILTIN_MIC) & ~AUDIO_DEVICE_BIT_IN; + ALOGD("%s: AUDIO_DEVICE_IN_BACK_MIC and AUDIO_DEVICE_IN_BUILTIN_MIC", __func__); break; case AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET: ALOGD("%s: AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET", __func__); @@ -685,6 +727,21 @@ static void select_input_device(struct m0_audio_device *adev) select_devices(adev); } +static void set_noise_supression(struct m0_audio_device *adev, int enable) +{ + if (enable) { + // Enable Noise suppression for builtin microphone + ALOGE("%s: enabling two mic control", __func__); + ril_set_two_mic_control(&adev->ril, AUDIENCE, TWO_MIC_SOLUTION_ON); + set_bigroute_by_array(adev->mixer, noise_suppression, 1); + } else { + // Disable Noise suppression for builtin microphone + ALOGE("%s: disabling two mic control", __func__); + ril_set_two_mic_control(&adev->ril, AUDIENCE, TWO_MIC_SOLUTION_OFF); + set_bigroute_by_array(adev->mixer, noise_suppression_disable, 1); + } +} + /* must be called with hw device and output stream mutexes locked */ static int start_output_stream_low_latency(struct m0_stream_out *out) { @@ -730,7 +787,7 @@ static int start_output_stream_low_latency(struct m0_stream_out *out) if (success) { out->buffer_frames = pcm_config_tones.period_size * 2; if (out->buffer == NULL) - out->buffer = malloc(out->buffer_frames * audio_stream_frame_size(&out->stream.common)); + out->buffer = malloc(out->buffer_frames * audio_stream_out_frame_size(&out->stream.common)); if (adev->echo_reference != NULL) out->echo_reference = adev->echo_reference; @@ -930,7 +987,7 @@ static size_t out_get_buffer_size_low_latency(const struct audio_stream *stream) from pcm_config_tones.rate. */ size_t size = (SHORT_PERIOD_SIZE * DEFAULT_OUT_SAMPLING_RATE) / pcm_config_tones.rate; size = ((size + 15) / 16) * 16; - return size * audio_stream_frame_size((struct audio_stream *)stream); + return size * audio_stream_out_frame_size((struct audio_stream *)stream); } static size_t out_get_buffer_size_deep_buffer(const struct audio_stream *stream) @@ -944,7 +1001,7 @@ static size_t out_get_buffer_size_deep_buffer(const struct audio_stream *stream) size_t size = (DEEP_BUFFER_SHORT_PERIOD_SIZE * DEFAULT_OUT_SAMPLING_RATE) / pcm_config_mm.rate; size = ((size + 15) / 16) * 16; - return size * audio_stream_frame_size((struct audio_stream *)stream); + return size * audio_stream_out_frame_size((struct audio_stream *)stream); } static audio_channel_mask_t out_get_channels(const struct audio_stream *stream) @@ -1168,7 +1225,7 @@ static ssize_t out_write_low_latency(struct audio_stream_out *stream, const void int ret; struct m0_stream_out *out = (struct m0_stream_out *)stream; struct m0_audio_device *adev = out->dev; - size_t frame_size = audio_stream_frame_size(&out->stream.common); + size_t frame_size = audio_stream_out_frame_size(&out->stream.common); size_t in_frames = bytes / frame_size; size_t out_frames = in_frames; bool force_input_standby = false; @@ -1236,7 +1293,7 @@ exit: pthread_mutex_unlock(&out->lock); if (ret != 0) { - usleep(bytes * 1000000 / audio_stream_frame_size(&stream->common) / + usleep(bytes * 1000000 / audio_stream_out_frame_size(&stream->common) / out_get_sample_rate(&stream->common)); } @@ -1260,7 +1317,7 @@ static ssize_t out_write_deep_buffer(struct audio_stream_out *stream, const void int ret; struct m0_stream_out *out = (struct m0_stream_out *)stream; struct m0_audio_device *adev = out->dev; - size_t frame_size = audio_stream_frame_size(&out->stream.common); + size_t frame_size = audio_stream_out_frame_size(&out->stream.common); size_t in_frames = bytes / frame_size; size_t out_frames; bool use_long_periods; @@ -1339,7 +1396,7 @@ exit: pthread_mutex_unlock(&out->lock); if (ret != 0) { - usleep(bytes * 1000000 / audio_stream_frame_size(&stream->common) / + usleep(bytes * 1000000 / audio_stream_out_frame_size(&stream->common) / out_get_sample_rate(&stream->common)); } @@ -1951,7 +2008,7 @@ static ssize_t in_read(struct audio_stream_in *stream, void* buffer, int ret = 0; struct m0_stream_in *in = (struct m0_stream_in *)stream; struct m0_audio_device *adev = in->dev; - size_t frames_rq = bytes / audio_stream_frame_size(&stream->common); + size_t frames_rq = bytes / audio_stream_in_frame_size(&stream->common); /* acquiring hw device mutex systematically is useful if a low priority thread is waiting * on the input stream mutex - e.g. executing select_mode() while holding the hw device @@ -1984,7 +2041,7 @@ static ssize_t in_read(struct audio_stream_in *stream, void* buffer, exit: if (ret < 0) - usleep(bytes * 1000000 / audio_stream_frame_size(&stream->common) / + usleep(bytes * 1000000 / audio_stream_in_frame_size(&stream->common) / in_get_sample_rate(&stream->common)); pthread_mutex_unlock(&in->lock); @@ -2486,30 +2543,6 @@ static int adev_set_parameters(struct audio_hw_device *dev, const char *kvpairs) int ret; parms = str_parms_create_str(kvpairs); - ret = str_parms_get_str(parms, AUDIO_PARAMETER_KEY_TTY_MODE, value, sizeof(value)); - if (ret >= 0) { - int tty_mode; - - if (strcmp(value, AUDIO_PARAMETER_VALUE_TTY_OFF) == 0) - tty_mode = TTY_MODE_OFF; - else if (strcmp(value, AUDIO_PARAMETER_VALUE_TTY_VCO) == 0) - tty_mode = TTY_MODE_VCO; - else if (strcmp(value, AUDIO_PARAMETER_VALUE_TTY_HCO) == 0) - tty_mode = TTY_MODE_HCO; - else if (strcmp(value, AUDIO_PARAMETER_VALUE_TTY_FULL) == 0) - tty_mode = TTY_MODE_FULL; - else - return -EINVAL; - - pthread_mutex_lock(&adev->lock); - if (tty_mode != adev->tty_mode) { - adev->tty_mode = tty_mode; - if (adev->mode == AUDIO_MODE_IN_CALL) - select_output_device(adev); - } - pthread_mutex_unlock(&adev->lock); - } - ret = str_parms_get_str(parms, AUDIO_PARAMETER_KEY_BT_NREC, value, sizeof(value)); if (ret >= 0) { if (strcmp(value, AUDIO_PARAMETER_VALUE_ON) == 0) @@ -2526,21 +2559,6 @@ static int adev_set_parameters(struct audio_hw_device *dev, const char *kvpairs) adev->screen_off = true; } - ret = str_parms_get_str(parms, "noise_suppression", value, sizeof(value)); - if (ret >= 0) { - if (strcmp(value, "true") == 0) { - ALOGE("%s: enabling two mic control", __func__); - ril_set_two_mic_control(&adev->ril, AUDIENCE, TWO_MIC_SOLUTION_ON); - /* sub mic */ - set_bigroute_by_array(adev->mixer, noise_suppression, 1); - } else { - ALOGE("%s: disabling two mic control", __func__); - ril_set_two_mic_control(&adev->ril, AUDIENCE, TWO_MIC_SOLUTION_OFF); - /* sub mic */ - set_bigroute_by_array(adev->mixer, noise_suppression_disable, 1); - } - } - str_parms_destroy(parms); return ret; } @@ -2591,6 +2609,9 @@ static int adev_set_mic_mute(struct audio_hw_device *dev, bool state) { struct m0_audio_device *adev = (struct m0_audio_device *)dev; + if (adev->mode == AUDIO_MODE_IN_CALL) + ril_set_mic_mute(&adev->ril, state); + adev->mic_mute = state; return 0; @@ -2760,8 +2781,8 @@ static const struct { { AUDIO_DEVICE_OUT_SPEAKER, "speaker" }, { AUDIO_DEVICE_OUT_WIRED_HEADSET | AUDIO_DEVICE_OUT_WIRED_HEADPHONE, "headphone" }, { AUDIO_DEVICE_OUT_EARPIECE, "earpiece" }, - { AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET, "dock" }, - { AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET, "dock" }, + { AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET, "analogue-dock" }, + { AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET, "digital-dock" }, { AUDIO_DEVICE_OUT_ALL_SCO, "sco-out" }, { AUDIO_DEVICE_OUT_AUX_DIGITAL, "aux-digital" }, @@ -3009,10 +3030,6 @@ static int adev_open(const hw_module_t* module, const char* name, return -EINVAL; } - /* +30db boost for mics */ - adev->mixer_ctls.mixinl_in1l_volume = mixer_get_ctl_by_name(adev->mixer, "MIXINL IN1L Volume"); - adev->mixer_ctls.mixinl_in2l_volume = mixer_get_ctl_by_name(adev->mixer, "MIXINL IN2L Volume"); - ret = adev_config_parse(adev); if (ret != 0) goto err_mixer; @@ -3021,13 +3038,14 @@ static int adev_open(const hw_module_t* module, const char* name, pthread_mutex_lock(&adev->lock); adev->mode = AUDIO_MODE_NORMAL; adev->out_device = AUDIO_DEVICE_OUT_SPEAKER; - adev->in_device = AUDIO_DEVICE_IN_BUILTIN_MIC & ~AUDIO_DEVICE_BIT_IN; + adev->in_device = AUDIO_DEVICE_NONE; select_devices(adev); adev->pcm_modem_dl = NULL; adev->pcm_modem_ul = NULL; + adev->pcm_bt_dl = NULL; + adev->pcm_bt_ul = NULL; adev->voice_volume = 1.0f; - adev->tty_mode = TTY_MODE_OFF; adev->bluetooth_nrec = true; adev->wb_amr = 0; diff --git a/audio/audio_hw.h b/audio/audio_hw.h index 49842ca..7da52bc 100644 --- a/audio/audio_hw.h +++ b/audio/audio_hw.h @@ -97,19 +97,6 @@ enum output_type { OUTPUT_TOTAL }; -enum tty_modes { - TTY_MODE_OFF, - TTY_MODE_VCO, - TTY_MODE_HCO, - TTY_MODE_FULL -}; - -struct mixer_ctls -{ - struct mixer_ctl *mixinl_in1l_volume; - struct mixer_ctl *mixinl_in2l_volume; -}; - struct route_setting { char *ctl_name; @@ -118,6 +105,9 @@ struct route_setting }; struct route_setting voicecall_default[] = { + { .ctl_name = "DAC1L Mixer AIF1.1 Switch", .intval = 1, }, + { .ctl_name = "DAC1R Mixer AIF1.1 Switch", .intval = 1, }, + { .ctl_name = "AIF2ADCL DRC Switch", .intval = 0, }, { .ctl_name = "AIF2DACL Source", .intval = 0, }, { .ctl_name = "AIF2DACR Source", .intval = 0, }, { .ctl_name = "AIF2 Mode", .intval = 0, }, @@ -130,34 +120,28 @@ struct route_setting voicecall_default[] = { }; struct route_setting voicecall_default_disable[] = { - { .ctl_name = "AIF2DACL Source", .intval = 0, }, - { .ctl_name = "AIF2DACR Source", .intval = 1, }, - { .ctl_name = "AIF2 Mode", .intval = 0, }, { .ctl_name = "DAC1L Mixer AIF2 Switch", .intval = 0, }, { .ctl_name = "DAC1R Mixer AIF2 Switch", .intval = 0, }, { .ctl_name = "AIF2DAC Mux", .strval = "AIF3DACDAT", }, - { .ctl_name = "Main Mic Switch", .intval = 0, }, - { .ctl_name = "MIXINL IN1L Switch", .intval = 0, }, - { .ctl_name = "Sub Mic Switch", .intval = 0, }, - { .ctl_name = "MIXINR IN1R Switch", .intval = 0, }, + { .ctl_name = "AIF2 Mode", .intval = 1, }, { .ctl_name = NULL, }, }; struct route_setting default_input[] = { { .ctl_name = "Main Mic Switch", .intval = 1, }, - { .ctl_name = "IN1L Volume", .intval = 30, }, + { .ctl_name = "AIF1ADCL Source", .intval = 0, }, + { .ctl_name = "AIF2ADCL Source", .intval = 0, }, { .ctl_name = "MIXINL IN1L Switch", .intval = 1, }, + { .ctl_name = "IN1L Volume", .intval = 25, }, { .ctl_name = "MIXINL IN1L Volume", .intval = 0, }, - { .ctl_name = "AIF1ADC1 HPF Mode", .intval = 0, }, - { .ctl_name = "AIF1ADC1 HPF Switch", .intval = 1, }, + { .ctl_name = "AIF2ADC Volume", .intval = 96, }, + { .ctl_name = "AIF2ADCL DRC Switch", .intval = 0, }, { .ctl_name = NULL, }, }; struct route_setting default_input_disable[] = { { .ctl_name = "Main Mic Switch", .intval = 0, }, - { .ctl_name = "IN1L Volume", .intval = 22, }, { .ctl_name = "MIXINL IN1L Switch", .intval = 0, }, - { .ctl_name = "AIF1ADC1 HPF Switch", .intval = 0, }, { .ctl_name = NULL, }, }; @@ -167,61 +151,65 @@ struct route_setting noise_suppression[] = { { .ctl_name = "MIXINR IN1R Switch", .intval = 1, }, { .ctl_name = "MIXINR IN1R Volume", .intval = 0, }, { .ctl_name = "AIF1ADCR Source", .intval = 1, }, - { .ctl_name = "AIF2ADCR Source", .intval = 1, }, { .ctl_name = NULL, }, }; struct route_setting noise_suppression_disable[] = { { .ctl_name = "Sub Mic Switch", .intval = 0, }, - { .ctl_name = "IN1R Volume", .intval = 7, }, { .ctl_name = "MIXINR IN1R Switch", .intval = 0, }, { .ctl_name = "MIXINR IN1R Volume", .intval = 0, }, { .ctl_name = NULL, }, }; struct route_setting headset_input[] = { + { .ctl_name = "AIF2DAC2L Mixer AIF2 Switch", .intval = 0, }, + { .ctl_name = "AIF2DAC2R Mixer AIF2 Switch", .intval = 0, }, + { .ctl_name = "Headphone ZC Switch", .intval = 0, }, + { .ctl_name = "AIF1DAC1 Volume", .intval = 96, }, + { .ctl_name = "AIF2DAC Volume", .intval = 96, }, + { .ctl_name = "AIF1 Boost Volume", .intval = 0, }, + { .ctl_name = "AIF2 Boost Volume", .intval = 0, }, + { .ctl_name = "DAC1 Volume", .intval = 96, }, + { .ctl_name = "Headphone Volume", .intval = 49, }, { .ctl_name = "MIXINL IN1L Switch", .intval = 0, }, { .ctl_name = "MIXINR IN1R Switch", .intval = 0, }, { .ctl_name = "Headset Mic Switch", .intval = 1, }, - { .ctl_name = "IN2L Volume", .intval = 30, }, - { .ctl_name = "MIXINL IN2L Switch", .intval = 1, }, - { .ctl_name = "MIXINL IN2L Volume", .intval = 0, }, - { .ctl_name = "AIF1ADC1 HPF Mode", .intval = 0, }, - { .ctl_name = "AIF1ADC1 HPF Switch", .intval = 1, }, - { .ctl_name = "AIF1ADC1 Volume", .intval = 96, }, { .ctl_name = "AIF1ADCL Source", .intval = 0, }, { .ctl_name = "AIF1ADCR Source", .intval = 0, }, { .ctl_name = "AIF2ADCL Source", .intval = 0, }, + { .ctl_name = "MIXINL IN2L Switch", .intval = 1, }, + { .ctl_name = "IN2L Volume", .intval = 28, }, + { .ctl_name = "MIXINL IN2L Volume", .intval = 0, }, + { .ctl_name = "DAC2 Left Sidetone Volume", .intval = 12, }, + { .ctl_name = "AIF2ADC Volume", .intval = 96, }, + { .ctl_name = "AIF2ADCL DRC Switch", .intval = 0, }, { .ctl_name = NULL, }, }; struct route_setting headset_input_disable[] = { { .ctl_name = "Headset Mic Switch", .intval = 0, }, { .ctl_name = "MIXINL IN2L Switch", .intval = 0, }, - { .ctl_name = "AIF1ADC1 HPF Mode", .intval = 0, }, - { .ctl_name = "AIF1ADC1 HPF Switch", .intval = 0, }, { .ctl_name = NULL, }, }; struct route_setting bt_output[] = { + { .ctl_name = "AIF1DAC1 Volume", .intval = 96, }, + { .ctl_name = "AIF1 Boost Volume", .intval = 0, }, + { .ctl_name = "DAC2 Volume", .intval = 96, }, + { .ctl_name = "AIF2ADC Volume", .intval = 96, }, { .ctl_name = "DAC1L Mixer AIF1.1 Switch", .intval = 1, }, { .ctl_name = "DAC1R Mixer AIF1.1 Switch", .intval = 1, }, { .ctl_name = "AIF3ADC Mux", .intval = 1, }, { .ctl_name = "AIF2DAC2L Mixer AIF1.1 Switch", .intval = 1, }, { .ctl_name = "AIF2DAC2R Mixer AIF1.1 Switch", .intval = 1, }, { .ctl_name = "AIF2DAC Volume", .intval = 96, }, - { .ctl_name = "DAC2 Volume", .intval = 96, }, - { .ctl_name = "AIF2ADC Volume", .intval = 96, }, - { .ctl_name = "Speaker Mixer Volume", .intval = 1, }, - { .ctl_name = "MIXINL IN2L Volume", .intval = 1, }, - { .ctl_name = "IN1L Volume", .intval = 25, }, - { .ctl_name = "IN1R Volume", .intval = 25, }, - { .ctl_name = "Speaker Boost Volume", .intval = 4, }, + { .ctl_name = "MIXINL IN1L Volume", .intval = 1, }, + { .ctl_name = "IN1L Volume", .intval = 28, }, + { .ctl_name = "IN1R Volume", .intval = 28, }, { .ctl_name = "LINEOUT1N Switch", .intval = 0, }, { .ctl_name = "LINEOUT1P Switch", .intval = 0, }, - { .ctl_name = "AIF2DACR Source", .intval = 0, }, { .ctl_name = "AIF1ADC1 HPF Switch", .intval = 0, }, - { .ctl_name = "AIF2ADC HPF Mode", .intval = 1, }, + { .ctl_name = "AIF2ADC HPF Mode", .intval = 3, }, { .ctl_name = "AIF2ADC HPF Switch", .intval = 1, }, { .ctl_name = "AIF2DAC Mux", .strval = "AIF2DACDAT", }, { .ctl_name = "AIF2DAC2R Mixer AIF2 Switch", .intval = 1, }, @@ -233,8 +221,6 @@ struct route_setting bt_input[] = { { .ctl_name = "AIF2ADC Mux", .intval = 1, }, { .ctl_name = "AIF1ADCL Source", .intval = 0, }, { .ctl_name = "AIF1ADCR Source", .intval = 1, }, - { .ctl_name = "AIF2ADCL Source", .intval = 0, }, - { .ctl_name = "AIF2ADCR Source", .intval = 1, }, { .ctl_name = "DAC1L Mixer AIF2 Switch", .intval = 1, }, { .ctl_name = "DAC1R Mixer AIF2 Switch", .intval = 1, }, { .ctl_name = "AIF1ADC1R Mixer AIF2 Switch", .intval = 1, }, @@ -245,6 +231,10 @@ struct route_setting bt_input[] = { }; struct route_setting bt_disable[] = { + { .ctl_name = "AIF1DAC1 Volume", .intval = 96, }, + { .ctl_name = "AIF1 Boost Volume", .intval = 0, }, + { .ctl_name = "DAC2 Volume", .intval = 96, }, + { .ctl_name = "AIF2ADC Volume", .intval = 96, }, { .ctl_name = "AIF2ADC Mux", .intval = 0, }, { .ctl_name = "MIXINL IN2L Volume", .intval = 0, }, { .ctl_name = "LINEOUT1N Switch", .intval = 1, }, diff --git a/audio/ril_interface.c b/audio/ril_interface.c index a77efc0..78e60b2 100755 --- a/audio/ril_interface.c +++ b/audio/ril_interface.c @@ -38,6 +38,7 @@ int (*_ril_set_call_volume)(void *, enum ril_sound_type, int); int (*_ril_set_call_audio_path)(void *, enum ril_audio_path); int (*_ril_set_call_clock_sync)(void *, enum ril_clock_state); int (*_ril_set_two_mic_control)(void *, enum ril_two_mic_device, enum ril_two_mic_state); +int (*_ril_set_mic_mute)(void *, enum ril_mic_mute); int (*_ril_register_unsolicited_handler)(void *, int, void *); int (*_ril_get_wb_amr)(void *, void *); @@ -108,6 +109,7 @@ int ril_open(struct ril_handle *ril) _ril_set_call_audio_path = dlsym(ril->handle, "SetCallAudioPath"); _ril_set_call_clock_sync = dlsym(ril->handle, "SetCallClockSync"); _ril_set_two_mic_control = dlsym(ril->handle, "SetTwoMicControl"); + _ril_set_mic_mute = dlsym(ril->handle, "SetMute"); _ril_register_unsolicited_handler = dlsym(ril->handle, "RegisterUnsolicitedHandler"); /* since this function is not supported in all RILs, don't require it */ @@ -191,3 +193,11 @@ int ril_set_two_mic_control(struct ril_handle *ril, enum ril_two_mic_device devi return _ril_set_two_mic_control(ril->client, device, state); } + +int ril_set_mic_mute(struct ril_handle *ril, enum ril_mic_mute state) +{ + if (ril_connect_if_required(ril)) + return 0; + + return _ril_set_mic_mute(ril->client, state); +} diff --git a/audio/ril_interface.h b/audio/ril_interface.h index 3d99d8d..a5bf480 100755 --- a/audio/ril_interface.h +++ b/audio/ril_interface.h @@ -70,6 +70,11 @@ enum ril_two_mic_state { TWO_MIC_SOLUTION_ON }; +enum ril_mic_mute { + MIC_UNMUTE, + MIC_MUTE +}; + /* Function prototypes */ int ril_open(struct ril_handle *ril); int ril_close(struct ril_handle *ril); @@ -79,5 +84,6 @@ int ril_set_call_audio_path(struct ril_handle *ril, enum ril_audio_path path); int ril_set_call_clock_sync(struct ril_handle *ril, enum ril_clock_state state); void ril_register_set_wb_amr_callback(void *function, void *data); int ril_set_two_mic_control(struct ril_handle *ril, enum ril_two_mic_device device, enum ril_two_mic_state state); +int ril_set_mic_mute(struct ril_handle *ril, enum ril_mic_mute state); #endif @@ -1,6 +1,3 @@ -# Specify phone tech before including full_phone -$(call inherit-product, vendor/replicant/config/gsm.mk) - # Release name PRODUCT_RELEASE_NAME := i9300 @@ -21,4 +18,4 @@ PRODUCT_MODEL := GT-I9300 PRODUCT_MANUFACTURER := samsung # Set build fingerprint / ID / Product Name ect. -PRODUCT_BUILD_PROP_OVERRIDES += PRODUCT_NAME=m0xx TARGET_DEVICE=m0 BUILD_FINGERPRINT="samsung/m0xx/m0:4.1.1/JRO03C/I9300XXDLIB:user/release-keys" PRIVATE_BUILD_DESC="m0xx-user 4.1.1 JRO03C I9300XXDLIB release-keys" +PRODUCT_BUILD_PROP_OVERRIDES += PRODUCT_NAME=m0xx TARGET_DEVICE=m0 BUILD_FINGERPRINT="samsung/m0xx/m0:4.3/JSS15J/I9300XXUGMJ9:user/release-keys" PRIVATE_BUILD_DESC="m0xx-user 4.3 JSS15J I9300XXUGMJ9 release-keys" diff --git a/configs/gps.xml b/configs/gps.xml index 0289635..acbcef2 100644 --- a/configs/gps.xml +++ b/configs/gps.xml @@ -7,16 +7,12 @@ gpioNStdbyPath="/sys/class/sec/gps/GPS_PWR_EN/value" gpioNResetPath="/sys/class/sec/gps/GPS_nRST/value" gpioDelayMs="250" - acNvStoDir="/data/" - FactoryTestFilePath="/data/" + acNvStoDir="/data/gps/" + acNmeaOutName="/data/gps/nmea_out" + ctrlPipe="/data/gps/glgpsctrl" acLogDirectory="/sdcard/gps/broadcom/" - TISEnabled="true" - LPmode="false" - cp-cold-start="false" - cp-guard-time-sec="1" - arp-supl-enable="true" arp-supl-cap-msb="true" arp-supl-cap-msa="true" @@ -32,17 +28,11 @@ SuplUT3Seconds="20" SuplVersion="1" - LbsEnable="true" - LbsLocal="false" - LbsServer="BCMLS2.glpals.com" - LbsPort="7275" LbsSyncLto="false" SyncLto="true" ltoFileName="lto2.dat" acLtoDir="/data/gps/" LbsSyncLtoThresholdDays="3" - LbsTAC="10101222" - LbsWlanEnable="false" IgnoreJniTime="true" AssertEnabled="false" diff --git a/configs/tiny_hw.xml b/configs/tiny_hw.xml index c9fba6b..89dc361 100644 --- a/configs/tiny_hw.xml +++ b/configs/tiny_hw.xml @@ -4,9 +4,16 @@ We are able to have most of our routing static so do that --> <path> + <!-- do not change the adc & dac source of AIF2 --> + <ctl name="AIF2DACL Source" val="0"/> + <ctl name="AIF2DACR Source" val="0"/> + <ctl name="AIF2ADCL Source" val="0"/> + <ctl name="AIF2ADCR Source" val="1"/> + <!-- AIF1->DAC1 --> <ctl name="DAC1 Switch" val="1"/> + <!-- general --> <ctl name="IN1L ZC Switch" val="0"/> <ctl name="IN1R ZC Switch" val="0"/> <ctl name="IN2L ZC Switch" val="0"/> @@ -105,7 +112,7 @@ We are able to have most of our routing static so do that <ctl name="SPK Switch" val="0"/> <ctl name="RCV Switch" val="0"/> <ctl name="LINE Switch" val="0"/> - <ctl name="HDMI Switch" val="1"/> + <ctl name="HDMI Switch" val="0"/> <!-- Default all inputs off --> <ctl name="Main Mic Switch" val="0"/> @@ -113,6 +120,14 @@ We are able to have most of our routing static so do that <ctl name="Headset Mic Switch" val="0"/> <ctl name="FM In Switch" val="0"/> + <!-- EQ Switches --> + <ctl name="AIF1DAC1 EQ Switch" val="1"/> + <ctl name="AIF1DAC1 EQ1 Volume" val="9"/> + <ctl name="AIF1DAC1 EQ2 Volume" val="7"/> + <ctl name="AIF1DAC1 EQ3 Volume" val="10"/> + <ctl name="AIF1DAC1 EQ4 Volume" val="13"/> + <ctl name="AIF1DAC1 EQ5 Volume" val="12"/> + </path> <device name="speaker"> <path name="on"> @@ -127,69 +142,47 @@ We are able to have most of our routing static so do that <ctl name="Speaker Mixer Volume" val="3"/> <ctl name="Speaker Boost Volume" val="4"/> <ctl name="Speaker Volume" val="57"/> - <ctl name="AIF1DAC1 EQ Switch" val="1"/> - <ctl name="AIF1DAC1 EQ1 Volume" val="9"/> - <ctl name="AIF1DAC1 EQ2 Volume" val="7"/> - <ctl name="AIF1DAC1 EQ3 Volume" val="10"/> - <ctl name="AIF1DAC1 EQ4 Volume" val="13"/> - <ctl name="AIF1DAC1 EQ5 Volume" val="12"/> </path> <path name="off"> <ctl name="SPK Switch" val="0"/> - <ctl name="AIF1DAC1 Volume" val="96"/> - <ctl name="AIF1 Boost Volume" val="0"/> - <ctl name="DAC1 Volume" val="96"/> - <ctl name="SPKL DAC1 Volume" val="1"/> - <ctl name="SPKR DAC1 Volume" val="1"/> - <ctl name="Speaker Mixer Volume" val="0"/> + <ctl name="Speaker Mixer Volume" val="1"/> <ctl name="Speaker Volume" val="0"/> - <ctl name="Speaker Boost Volume" val="0"/> - <ctl name="AIF1DAC1 EQ Switch" val="0"/> </path> </device> <device name="earpiece"> <path name="on"> <ctl name="RCV Switch" val="1"/> + <ctl name="AIF2DAC2L Mixer AIF2 Switch" val="0"/> + <ctl name="AIF2DAC2R Mixer AIF2 Switch" val="0"/> + <ctl name="AIF2ADC HPF Mode" val="1"/> + <ctl name="AIF2ADC HPF Switch" val="1"/> <ctl name="AIF1DAC1 Volume" val="96"/> + <ctl name="AIF2DAC Volume" val="96"/> <ctl name="AIF1 Boost Volume" val="0"/> - <ctl name="DAC1 Volume" val="96"/> + <ctl name="AIF2 Boost Volume" val="0"/> + <ctl name="DAC1 Volume" val="104"/> <ctl name="Left Output Mixer DAC Volume" val="7"/> <ctl name="Right Output Mixer DAC Volume" val="7"/> <ctl name="Output Volume" val="57"/> <ctl name="Earpiece Volume" val="1"/> - <ctl name="Speaker Mixer Volume" val="1"/> </path> <path name="off"> <ctl name="RCV Switch" val="0"/> - <ctl name="AIF1DAC1 Volume" val="96"/> - <ctl name="AIF1 Boost Volume" val="0"/> - <ctl name="DAC1 Volume" val="96"/> - <ctl name="Left Output Mixer DAC Volume" val="7"/> - <ctl name="Right Output Mixer DAC Volume" val="7"/> - <ctl name="Output Volume" val="57"/> - <ctl name="Earpiece Volume" val="1"/> </path> </device> <device name="headphone"> <path name="on"> <ctl name="HP Switch" val="1"/> - <ctl name="Headphone Volume" val="60"/> + <ctl name="Headphone Volume" val="50"/> <ctl name="Headphone ZC Switch" val="0"/> <ctl name="AIF1DAC1 Volume" val="96"/> <ctl name="AIF1 Boost Volume" val="0"/> <ctl name="DAC1 Volume" val="96"/> <ctl name="Left Output Mixer DAC Volume" val="7"/> <ctl name="Right Output Mixer DAC Volume" val="7"/> - <ctl name="AIF1DAC1 EQ Switch" val="1"/> - <ctl name="AIF1DAC1 EQ1 Volume" val="16"/> - <ctl name="AIF1DAC1 EQ2 Volume" val="14"/> - <ctl name="AIF1DAC1 EQ3 Volume" val="12"/> - <ctl name="AIF1DAC1 EQ4 Volume" val="14"/> - <ctl name="AIF1DAC1 EQ5 Volume" val="16"/> </path> <path name="off"> <ctl name="HP Switch" val="0"/> - <ctl name="AIF1DAC1 EQ Switch" val="0"/> </path> </device> <device name="sco-out"> @@ -197,8 +190,6 @@ We are able to have most of our routing static so do that <ctl name="AIF3ADC Mux" val="1"/> <ctl name="AIF2DAC2L Mixer AIF1.1 Switch" val="1"/> <ctl name="AIF2DAC2R Mixer AIF1.1 Switch" val="1"/> - <ctl name="AIF2ADCL Source" val="0"/> - <ctl name="AIF2ADCR Source" val="0"/> <ctl name="AIF2DAC Volume" val="96"/> <ctl name="DAC2 Volume" val="96"/> <ctl name="AIF2ADC Volume" val="96"/> @@ -209,32 +200,42 @@ We are able to have most of our routing static so do that <ctl name="AIF2DAC2R Mixer AIF1.1 Switch" val="0"/> </path> </device> -<device name="dock"> +<device name="analogue-dock"> <path name="on"> <ctl name="LINEOUT2N Switch" val="1"/> <ctl name="LINEOUT2P Switch" val="1"/> <ctl name="LINEOUT2N Mixer Left Output Switch" val="1"/> + <ctl name="LINEOUT2N Mixer Right Output Switch" val="0"/> <ctl name="LINEOUT2P Mixer Right Output Switch" val="1"/> <ctl name="LINE Switch" val="1"/> - <ctl name="AIF1DAC1 Volume" val="96"/> - <ctl name="AIF1 Boost Volume" val="0"/> - <ctl name="DAC1 Volume" val="96"/> + <ctl name="LineoutSwitch Mode" val="1"/> <ctl name="Left Output Mixer DAC Volume" val="7"/> <ctl name="Right Output Mixer DAC Volume" val="7"/> - <ctl name="Output Volume" val="55"/> - <ctl name="Earpiece Volume" val="1"/> </path> <path name="off"> + <ctl name="LineoutSwitch Mode" val="0"/> <ctl name="LINEOUT2N Switch" val="0"/> <ctl name="LINEOUT2P Switch" val="0"/> <ctl name="LINE Switch" val="0"/> - <ctl name="AIF1DAC1 Volume" val="96"/> - <ctl name="AIF1 Boost Volume" val="0"/> - <ctl name="DAC1 Volume" val="96"/> + </path> +</device> +<device name="digital-dock"> + <path name="on"> + <ctl name="LINEOUT2N Switch" val="1"/> + <ctl name="LINEOUT2P Switch" val="1"/> + <ctl name="LINEOUT2N Mixer Left Output Switch" val="1"/> + <ctl name="LINEOUT2N Mixer Right Output Switch" val="0"/> + <ctl name="LINEOUT2P Mixer Right Output Switch" val="1"/> + <ctl name="LINE Switch" val="1"/> + <ctl name="LineoutSwitch Mode" val="1"/> <ctl name="Left Output Mixer DAC Volume" val="7"/> <ctl name="Right Output Mixer DAC Volume" val="7"/> - <ctl name="Output Volume" val="57"/> - <ctl name="LINEOUT2 Volume" val="1"/> + </path> + <path name="off"> + <ctl name="LineoutSwitch Mode" val="0"/> + <ctl name="LINEOUT2N Switch" val="0"/> + <ctl name="LINEOUT2P Switch" val="0"/> + <ctl name="LINE Switch" val="0"/> </path> </device> <device name="aux-digital"> @@ -255,17 +256,17 @@ We are able to have most of our routing static so do that <ctl name="IN1L Volume" val="22"/> <ctl name="MIXINL IN1L Switch" val="1"/> <ctl name="MIXINL IN1L Volume" val="1"/> - <ctl name="AIF1ADCL Source" val="0"/> - <ctl name="AIF2ADCL Source" val="0"/> - <ctl name="AIF1ADC1 HPF Mode" val="0"/> + <ctl name="AIF1ADCL Source" val="Left"/> + <ctl name="AIF1ADCR Source" val="Left"/> + <ctl name="AIF1ADC1L Mixer ADC/DMIC Switch" val="1"/> + <ctl name="AIF1ADC1R Mixer ADC/DMIC Switch" val="1"/> + <ctl name="AIF1ADC1 HPF Mode" val="1"/> <ctl name="AIF1ADC1 HPF Switch" val="1"/> <ctl name="AIF1ADC1 Volume" val="96"/> </path> <path name="off"> <ctl name="Main Mic Switch" val="0"/> <ctl name="MIXINL IN1L Switch" val="0"/> - <ctl name="MIXINL IN1L Volume" val="0"/> - <ctl name="IN1L Volume" val="10"/> </path> </device> <device name="back-mic"> @@ -275,7 +276,6 @@ We are able to have most of our routing static so do that <ctl name="MIXINR IN1R Switch" val="1"/> <ctl name="MIXINR IN1R Volume" val="1"/> <ctl name="AIF1ADCR Source" val="1"/> - <ctl name="AIF2ADCR Source" val="1"/> <ctl name="AIF1ADC1 HPF Mode" val="1"/> <ctl name="AIF1ADC1 HPF Switch" val="1"/> <ctl name="AIF1ADC1 Volume" val="96"/> @@ -291,33 +291,28 @@ We are able to have most of our routing static so do that <ctl name="MIXINL IN1L Switch" val="0"/> <ctl name="MIXINR IN1R Switch" val="0"/> <ctl name="Headset Mic Switch" val="1"/> + <ctl name="AIF1ADCL Source" val="0"/> + <ctl name="AIF1ADCR Source" val="0"/> + <ctl name="AIF2ADCL Source" val="0"/> + <ctl name="AIF1ADCL Source" val="Left"/> + <ctl name="AIF1ADCL Source" val="Right"/> + <ctl name="AIF1ADC1L Mixer ADC/DMIC Switch" val="1"/> + <ctl name="AIF1ADC1L Mixer ADC/DMIC Switch" val="1"/> <ctl name="IN2L Volume" val="22"/> <ctl name="MIXINL IN2L Switch" val="1"/> <ctl name="MIXINL IN2L Volume" val="1"/> <ctl name="AIF1ADC1 HPF Mode" val="1"/> <ctl name="AIF1ADC1 HPF Switch" val="1"/> <ctl name="AIF1ADC1 Volume" val="96"/> - <ctl name="AIF1ADCL Source" val="0"/> - <ctl name="AIF1ADCR Source" val="0"/> - <ctl name="AIF2ADCL Source" val="0"/> </path> <path name="off"> <ctl name="Headset Mic Switch" val="0"/> - <ctl name="IN2L Volume" val="10"/> <ctl name="MIXINL IN2L Switch" val="0"/> - <ctl name="MIXINL IN2L Volume" val="1"/> - <ctl name="AIF1ADC1 HPF Mode" val="0"/> - <ctl name="AIF1ADC1 HPF Switch" val="0"/> - <ctl name="AIF1ADC1 Volume" val="96"/> </path> </device> <device name="sco-in"> <path name="on"> <ctl name="AIF2ADC Mux" val="1"/> - <ctl name="AIF1ADCL Source" val="0"/> - <ctl name="AIF1ADCR Source" val="1"/> - <ctl name="AIF2ADCL Source" val="0"/> - <ctl name="AIF2ADCR Source" val="1"/> <ctl name="AIF1ADC1R Mixer AIF2 Switch" val="1"/> <ctl name="AIF1ADC1L Mixer AIF2 Switch" val="1"/> <ctl name="AIF1ADC1 Volume" val="96"/> diff --git a/fstab.smdk4x12 b/fstab.smdk4x12 deleted file mode 100644 index 713d550..0000000 --- a/fstab.smdk4x12 +++ /dev/null @@ -1,13 +0,0 @@ -# Android fstab file. -#<src> <mnt_point> <type> <mnt_flags and options> <fs_mgr_flags> -# The filesystem that contains the filesystem checker binary (typically /system) cannot -# specify MF_CHECK, and must come before any filesystems that do specify MF_CHECK - - -/dev/block/mmcblk0p3 /efs ext4 noatime,nosuid,nodev,journal_async_commit,errors=panic wait -/dev/block/mmcblk0p9 /system ext4 ro,noatime wait -/dev/block/mmcblk0p8 /cache ext4 noatime,nosuid,nodev,journal_async_commit,errors=panic wait - -# data partition must be located at the bottom for supporting device encryption -/dev/block/mmcblk0p12 /data ext4 noatime,nosuid,nodev,discard,noauto_da_alloc,journal_async_commit,errors=panic wait,check,encryptable=footer - diff --git a/gps_daemon.sh b/gps_daemon.sh new file mode 100644 index 0000000..7cd6b64 --- /dev/null +++ b/gps_daemon.sh @@ -0,0 +1,2 @@ +#shellscript as this is the only way selinux will allow this to proceed +/system/bin/glgps -c /system/etc/gps.xml @@ -22,17 +22,14 @@ LOCAL_PATH := device/samsung/i9300 # Overlay DEVICE_PACKAGE_OVERLAYS += $(LOCAL_PATH)/overlay -# This device is xhdpi. However the platform doesn't -# currently contain all of the bitmaps at xhdpi density so -# we do this little trick to fall back to the hdpi version -# if the xhdpi doesn't exist. -PRODUCT_AAPT_CONFIG := normal hdpi xhdpi +# Screen density +PRODUCT_AAPT_CONFIG := normal PRODUCT_AAPT_PREF_CONFIG := xhdpi # Init files PRODUCT_COPY_FILES += \ - $(LOCAL_PATH)/fstab.smdk4x12:root/fstab.smdk4x12 \ - $(LOCAL_PATH)/init.smdk4x12.rc:root/init.smdk4x12.rc + $(LOCAL_PATH)/rootdir/fstab.smdk4x12:root/fstab.smdk4x12 \ + $(LOCAL_PATH)/rootdir/init.target.rc:root/init.target.rc # Keylayout PRODUCT_COPY_FILES += \ @@ -50,22 +47,27 @@ PRODUCT_PACKAGES += \ libaudio-ril-interface PRODUCT_COPY_FILES += \ - $(LOCAL_PATH)/configs/tiny_hw.xml:system/etc/sound/m0 \ + $(LOCAL_PATH)/configs/tiny_hw.xml:system/etc/sound/m0 $(LOCAL_PATH)/audio/silence.wav:system/etc/sound/silence.wav +# Sensors +PRODUCT_PACKAGES += \ + sensors.smdk4x12 + # Gps PRODUCT_COPY_FILES += \ - $(LOCAL_PATH)/configs/gps.xml:system/etc/gps.xml + $(LOCAL_PATH)/configs/gps.xml:system/etc/gps.xml \ + $(LOCAL_PATH)/gps_daemon.sh:system/bin/gps_daemon.sh # Product specific Packages PRODUCT_PACKAGES += \ - DeviceSettings \ SamsungServiceMode \ tinyplay -# Sensors +# RIL PRODUCT_PACKAGES += \ - sensors.smdk4x12 + libsamsung_symbols \ + ril-wrapper # NFC PRODUCT_PACKAGES += \ @@ -75,6 +77,10 @@ PRODUCT_PACKAGES += \ Nfc \ Tag +# Camera +PRODUCT_PACKAGES += \ + camera.smdk4x12 + PRODUCT_COPY_FILES += \ packages/apps/Nfc/migrate_nfc.txt:system/etc/updatecmds/migrate_nfc.txt \ frameworks/base/nfc-extras/com.android.nfc_extras.xml:system/etc/permissions/com.android.nfc_extras.xml \ @@ -100,7 +106,6 @@ PRODUCT_PACKAGES += \ libsamsung-ril PRODUCT_PROPERTY_OVERRIDES += \ - mobiledata.interfaces=pdp0,wlan0,gprs,ppp0 \ ro.telephony.call_ring.multiple=false \ ro.telephony.call_ring.delay=3000 diff --git a/include/camera/CameraParametersExtra.h b/include/camera/CameraParametersExtra.h new file mode 100644 index 0000000..3542b59 --- /dev/null +++ b/include/camera/CameraParametersExtra.h @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2014 The CyanogenMod Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + #ifndef ANDROID_CAMERA_PARAMETERS_EXTRA_H + #define ANDROID_CAMERA_PARAMETERS_EXTRA_H + +// parameters adopted from omnirom 4.4 +#define CAMERA_PARAMETERS_EXTRA_C \ +const char CameraParameters::KEY_SUPPORTED_ISO_MODES[] = "iso-values"; \ +const char CameraParameters::KEY_ISO_MODE[] = "iso"; \ +const char CameraParameters::KEY_ANTI_SHAKE_MODE[] = "anti-shake"; \ +const char CameraParameters::KEY_METERING[] = "metering"; \ +const char CameraParameters::KEY_WDR[] = "wdr"; \ +const char CameraParameters::KEY_WEATHER[] = "weather"; \ +const char CameraParameters::KEY_CITYID[] = "contextualtag-cityid"; \ +const char CameraParameters::EFFECT_CARTOONIZE[] = "cartoonize"; \ +const char CameraParameters::EFFECT_POINT_RED_YELLOW[] = "point-red-yellow"; \ +const char CameraParameters::EFFECT_POINT_GREEN[] = "point-green"; \ +const char CameraParameters::EFFECT_POINT_BLUE[] = "point-blue"; \ +const char CameraParameters::EFFECT_VINTAGE_COLD[] = "vintage-cold"; \ +const char CameraParameters::EFFECT_VINTAGE_WARM[] = "vintage-warm"; \ +const char CameraParameters::EFFECT_WASHED[] = "washed"; \ +int CameraParameters::getInt64(const char *key) const { return -1; }; + +#define CAMERA_PARAMETERS_EXTRA_H \ + int getInt64(const char *key) const; \ + static const char KEY_SUPPORTED_ISO_MODES[]; \ + static const char KEY_ISO_MODE[]; \ + static const char KEY_ANTI_SHAKE_MODE[]; \ + static const char KEY_METERING[]; \ + static const char KEY_WDR[]; \ + static const char KEY_WEATHER[]; \ + static const char KEY_CITYID[]; \ + static const char EFFECT_CARTOONIZE[]; \ + static const char EFFECT_POINT_RED_YELLOW[]; \ + static const char EFFECT_POINT_GREEN[]; \ + static const char EFFECT_POINT_BLUE[]; \ + static const char EFFECT_VINTAGE_COLD[]; \ + static const char EFFECT_VINTAGE_WARM[]; \ + static const char EFFECT_WASHED[]; + +#endif diff --git a/include/hardware/gps.h b/include/hardware/gps.h deleted file mode 100644 index 4f91ffb..0000000 --- a/include/hardware/gps.h +++ /dev/null @@ -1,694 +0,0 @@ -/* - * Copyright (C) 2010 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_INCLUDE_HARDWARE_GPS_H -#define ANDROID_INCLUDE_HARDWARE_GPS_H - -#include <stdint.h> -#include <sys/cdefs.h> -#include <sys/types.h> -#include <pthread.h> - -#include <hardware/hardware.h> - -__BEGIN_DECLS - -/** - * The id of this module - */ -#define GPS_HARDWARE_MODULE_ID "gps" - - -/** Milliseconds since January 1, 1970 */ -typedef int64_t GpsUtcTime; - -/** Maximum number of SVs for gps_sv_status_callback(). */ -#define GPS_MAX_SVS 32 - -/** Requested operational mode for GPS operation. */ -typedef uint32_t GpsPositionMode; -// IMPORTANT: Note that the following values must match -// constants in GpsLocationProvider.java. -/** Mode for running GPS standalone (no assistance). */ -#define GPS_POSITION_MODE_STANDALONE 0 -/** AGPS MS-Based mode. */ -#define GPS_POSITION_MODE_MS_BASED 1 -/** AGPS MS-Assisted mode. */ -#define GPS_POSITION_MODE_MS_ASSISTED 2 - -/** Requested recurrence mode for GPS operation. */ -typedef uint32_t GpsPositionRecurrence; -// IMPORTANT: Note that the following values must match -// constants in GpsLocationProvider.java. -/** Receive GPS fixes on a recurring basis at a specified period. */ -#define GPS_POSITION_RECURRENCE_PERIODIC 0 -/** Request a single shot GPS fix. */ -#define GPS_POSITION_RECURRENCE_SINGLE 1 - -/** GPS status event values. */ -typedef uint16_t GpsStatusValue; -// IMPORTANT: Note that the following values must match -// constants in GpsLocationProvider.java. -/** GPS status unknown. */ -#define GPS_STATUS_NONE 0 -/** GPS has begun navigating. */ -#define GPS_STATUS_SESSION_BEGIN 1 -/** GPS has stopped navigating. */ -#define GPS_STATUS_SESSION_END 2 -/** GPS has powered on but is not navigating. */ -#define GPS_STATUS_ENGINE_ON 3 -/** GPS is powered off. */ -#define GPS_STATUS_ENGINE_OFF 4 - -/** Flags to indicate which values are valid in a GpsLocation. */ -typedef uint16_t GpsLocationFlags; -// IMPORTANT: Note that the following values must match -// constants in GpsLocationProvider.java. -/** GpsLocation has valid latitude and longitude. */ -#define GPS_LOCATION_HAS_LAT_LONG 0x0001 -/** GpsLocation has valid altitude. */ -#define GPS_LOCATION_HAS_ALTITUDE 0x0002 -/** GpsLocation has valid speed. */ -#define GPS_LOCATION_HAS_SPEED 0x0004 -/** GpsLocation has valid bearing. */ -#define GPS_LOCATION_HAS_BEARING 0x0008 -/** GpsLocation has valid accuracy. */ -#define GPS_LOCATION_HAS_ACCURACY 0x0010 - -/** Flags for the gps_set_capabilities callback. */ - -/** GPS HAL schedules fixes for GPS_POSITION_RECURRENCE_PERIODIC mode. - If this is not set, then the framework will use 1000ms for min_interval - and will start and call start() and stop() to schedule the GPS. - */ -#define GPS_CAPABILITY_SCHEDULING 0x0000001 -/** GPS supports MS-Based AGPS mode */ -#define GPS_CAPABILITY_MSB 0x0000002 -/** GPS supports MS-Assisted AGPS mode */ -#define GPS_CAPABILITY_MSA 0x0000004 -/** GPS supports single-shot fixes */ -#define GPS_CAPABILITY_SINGLE_SHOT 0x0000008 -/** GPS supports on demand time injection */ -#define GPS_CAPABILITY_ON_DEMAND_TIME 0x0000010 - -/** Flags used to specify which aiding data to delete - when calling delete_aiding_data(). */ -typedef uint16_t GpsAidingData; -// IMPORTANT: Note that the following values must match -// constants in GpsLocationProvider.java. -#define GPS_DELETE_EPHEMERIS 0x0001 -#define GPS_DELETE_ALMANAC 0x0002 -#define GPS_DELETE_POSITION 0x0004 -#define GPS_DELETE_TIME 0x0008 -#define GPS_DELETE_IONO 0x0010 -#define GPS_DELETE_UTC 0x0020 -#define GPS_DELETE_HEALTH 0x0040 -#define GPS_DELETE_SVDIR 0x0080 -#define GPS_DELETE_SVSTEER 0x0100 -#define GPS_DELETE_SADATA 0x0200 -#define GPS_DELETE_RTI 0x0400 -#define GPS_DELETE_CELLDB_INFO 0x8000 -#define GPS_DELETE_ALL 0xFFFF - -/** AGPS type */ -typedef uint16_t AGpsType; -#define AGPS_TYPE_SUPL 1 -#define AGPS_TYPE_C2K 2 - -typedef uint16_t AGpsSetIDType; -#define AGPS_SETID_TYPE_NONE 0 -#define AGPS_SETID_TYPE_IMSI 1 -#define AGPS_SETID_TYPE_MSISDN 2 - -/** - * String length constants - */ -#define GPS_NI_SHORT_STRING_MAXLEN 256 -#define GPS_NI_LONG_STRING_MAXLEN 2048 - -/** - * GpsNiType constants - */ -typedef uint32_t GpsNiType; -#define GPS_NI_TYPE_VOICE 1 -#define GPS_NI_TYPE_UMTS_SUPL 2 -#define GPS_NI_TYPE_UMTS_CTRL_PLANE 3 - -/** - * GpsNiNotifyFlags constants - */ -typedef uint32_t GpsNiNotifyFlags; -/** NI requires notification */ -#define GPS_NI_NEED_NOTIFY 0x0001 -/** NI requires verification */ -#define GPS_NI_NEED_VERIFY 0x0002 -/** NI requires privacy override, no notification/minimal trace */ -#define GPS_NI_PRIVACY_OVERRIDE 0x0004 - -/** - * GPS NI responses, used to define the response in - * NI structures - */ -typedef int GpsUserResponseType; -#define GPS_NI_RESPONSE_ACCEPT 1 -#define GPS_NI_RESPONSE_DENY 2 -#define GPS_NI_RESPONSE_NORESP 3 - -/** - * NI data encoding scheme - */ -typedef int GpsNiEncodingType; -#define GPS_ENC_NONE 0 -#define GPS_ENC_SUPL_GSM_DEFAULT 1 -#define GPS_ENC_SUPL_UTF8 2 -#define GPS_ENC_SUPL_UCS2 3 -#define GPS_ENC_UNKNOWN -1 - -/** AGPS status event values. */ -typedef uint16_t AGpsStatusValue; -/** GPS requests data connection for AGPS. */ -#define GPS_REQUEST_AGPS_DATA_CONN 1 -/** GPS releases the AGPS data connection. */ -#define GPS_RELEASE_AGPS_DATA_CONN 2 -/** AGPS data connection initiated */ -#define GPS_AGPS_DATA_CONNECTED 3 -/** AGPS data connection completed */ -#define GPS_AGPS_DATA_CONN_DONE 4 -/** AGPS data connection failed */ -#define GPS_AGPS_DATA_CONN_FAILED 5 - -#define AGPS_REF_LOCATION_TYPE_GSM_CELLID 1 -#define AGPS_REF_LOCATION_TYPE_UMTS_CELLID 2 -#define AGPS_REG_LOCATION_TYPE_MAC 3 - -/** Network types for update_network_state "type" parameter */ -#define AGPS_RIL_NETWORK_TYPE_MOBILE 0 -#define AGPS_RIL_NETWORK_TYPE_WIFI 1 -#define AGPS_RIL_NETWORK_TYPE_MOBILE_MMS 2 -#define AGPS_RIL_NETWORK_TYPE_MOBILE_SUPL 3 -#define AGPS_RIL_NETWORK_TTYPE_MOBILE_DUN 4 -#define AGPS_RIL_NETWORK_TTYPE_MOBILE_HIPRI 5 -#define AGPS_RIL_NETWORK_TTYPE_WIMAX 6 - -/** - * Name for the GPS XTRA interface. - */ -#define GPS_XTRA_INTERFACE "gps-xtra" - -/** - * Name for the GPS DEBUG interface. - */ -#define GPS_DEBUG_INTERFACE "gps-debug" - -/** - * Name for the AGPS interface. - */ -#define AGPS_INTERFACE "agps" - -/** - * Name for NI interface - */ -#define GPS_NI_INTERFACE "gps-ni" - -/** - * Name for the AGPS-RIL interface. - */ -#define AGPS_RIL_INTERFACE "agps_ril" - -/** - * The GPS chipset can use Psc for AGPS. - */ -#define AGPS_USE_PSC - -/** Represents a location. */ -typedef struct { - /** set to sizeof(GpsLocation) */ - size_t size; - /** Contains GpsLocationFlags bits. */ - uint16_t flags; - /** Represents latitude in degrees. */ - double latitude; - /** Represents longitude in degrees. */ - double longitude; - /** Represents altitude in meters above the WGS 84 reference - * ellipsoid. */ - double altitude; - /** Represents speed in meters per second. */ - float speed; - /** Represents heading in degrees. */ - float bearing; - /** Represents expected accuracy in meters. */ - float accuracy; - /** Timestamp for the location fix. */ - GpsUtcTime timestamp; -} GpsLocation; - -/** Represents the status. */ -typedef struct { - /** set to sizeof(GpsStatus) */ - size_t size; - GpsStatusValue status; -} GpsStatus; - -/** Represents SV information. */ -typedef struct { - /** set to sizeof(GpsSvInfo) */ - size_t size; - /** Pseudo-random number for the SV. */ - int prn; - /** Signal to noise ratio. */ - float snr; - /** Elevation of SV in degrees. */ - float elevation; - /** Azimuth of SV in degrees. */ - float azimuth; - /** Unknown field in Samsung I9100 libgps - May be an indicator for constellation type - (GPS, GLONASS, Galileo)? - Used on GT-I9100, likely also present on GT-N7000, - SGH-I717, SGH-I727 but this needs confirmation. - */ - int unknown_samsung_field; -} GpsSvInfo; - -/** Represents SV status. */ -typedef struct { - /** set to sizeof(GpsSvStatus) */ - size_t size; - - /** Number of SVs currently visible. */ - int num_svs; - - /** Contains an array of SV information. */ - GpsSvInfo sv_list[GPS_MAX_SVS]; - - /** Represents a bit mask indicating which SVs - * have ephemeris data. - */ - uint32_t ephemeris_mask; - - /** Represents a bit mask indicating which SVs - * have almanac data. - */ - uint32_t almanac_mask; - - /** - * Represents a bit mask indicating which SVs - * were used for computing the most recent position fix. - */ - uint32_t used_in_fix_mask; -} GpsSvStatus; - -/* 2G and 3G */ -/* In 3G lac is discarded */ -typedef struct { - uint16_t type; - uint16_t mcc; - uint16_t mnc; - uint16_t lac; -#ifdef AGPS_USE_PSC - uint16_t psc; -#endif - uint32_t cid; -} AGpsRefLocationCellID; - -typedef struct { - uint8_t mac[6]; -} AGpsRefLocationMac; - -/** Represents ref locations */ -typedef struct { - uint16_t type; - union { - AGpsRefLocationCellID cellID; - AGpsRefLocationMac mac; - } u; -} AGpsRefLocation; - -/** Callback with location information. - * Can only be called from a thread created by create_thread_cb. - */ -typedef void (* gps_location_callback)(GpsLocation* location); - -/** Callback with status information. - * Can only be called from a thread created by create_thread_cb. - */ -typedef void (* gps_status_callback)(GpsStatus* status); - -/** Callback with SV status information. - * Can only be called from a thread created by create_thread_cb. - */ -typedef void (* gps_sv_status_callback)(GpsSvStatus* sv_info); - -/** Callback for reporting NMEA sentences. - * Can only be called from a thread created by create_thread_cb. - */ -typedef void (* gps_nmea_callback)(GpsUtcTime timestamp, const char* nmea, int length); - -/** Callback to inform framework of the GPS engine's capabilities. - * Capability parameter is a bit field of GPS_CAPABILITY_* flags. - */ -typedef void (* gps_set_capabilities)(uint32_t capabilities); - -/** Callback utility for acquiring the GPS wakelock. - * This can be used to prevent the CPU from suspending while handling GPS events. - */ -typedef void (* gps_acquire_wakelock)(); - -/** Callback utility for releasing the GPS wakelock. */ -typedef void (* gps_release_wakelock)(); - -/** Callback for requesting NTP time */ -typedef void (* gps_request_utc_time)(); - -/** Callback for creating a thread that can call into the Java framework code. - * This must be used to create any threads that report events up to the framework. - */ -typedef pthread_t (* gps_create_thread)(const char* name, void (*start)(void *), void* arg); - -/** GPS callback structure. */ -typedef struct { - /** set to sizeof(GpsCallbacks) */ - size_t size; - gps_location_callback location_cb; - gps_status_callback status_cb; - gps_sv_status_callback sv_status_cb; - gps_nmea_callback nmea_cb; - gps_set_capabilities set_capabilities_cb; - gps_acquire_wakelock acquire_wakelock_cb; - gps_release_wakelock release_wakelock_cb; - gps_create_thread create_thread_cb; - gps_request_utc_time request_utc_time_cb; -} GpsCallbacks; - - -/** Represents the standard GPS interface. */ -typedef struct { - /** set to sizeof(GpsInterface) */ - size_t size; - /** - * Opens the interface and provides the callback routines - * to the implemenation of this interface. - */ - int (*init)( GpsCallbacks* callbacks ); - - /** Starts navigating. */ - int (*start)( void ); - - /** Stops navigating. */ - int (*stop)( void ); - - /** Closes the interface. */ - void (*cleanup)( void ); - - /** Injects the current time. */ - int (*inject_time)(GpsUtcTime time, int64_t timeReference, - int uncertainty); - - /** Injects current location from another location provider - * (typically cell ID). - * latitude and longitude are measured in degrees - * expected accuracy is measured in meters - */ - int (*inject_location)(double latitude, double longitude, float accuracy); - - /** - * Specifies that the next call to start will not use the - * information defined in the flags. GPS_DELETE_ALL is passed for - * a cold start. - */ - void (*delete_aiding_data)(GpsAidingData flags); - - /** - * min_interval represents the time between fixes in milliseconds. - * preferred_accuracy represents the requested fix accuracy in meters. - * preferred_time represents the requested time to first fix in milliseconds. - */ - int (*set_position_mode)(GpsPositionMode mode, GpsPositionRecurrence recurrence, - uint32_t min_interval, uint32_t preferred_accuracy, uint32_t preferred_time); - - /** Get a pointer to extension information. */ - const void* (*get_extension)(const char* name); -} GpsInterface; - -/** Callback to request the client to download XTRA data. - * The client should download XTRA data and inject it by calling inject_xtra_data(). - * Can only be called from a thread created by create_thread_cb. - */ -typedef void (* gps_xtra_download_request)(); - -/** Callback structure for the XTRA interface. */ -typedef struct { - gps_xtra_download_request download_request_cb; - gps_create_thread create_thread_cb; -} GpsXtraCallbacks; - -/** Extended interface for XTRA support. */ -typedef struct { - /** set to sizeof(GpsXtraInterface) */ - size_t size; - /** - * Opens the XTRA interface and provides the callback routines - * to the implemenation of this interface. - */ - int (*init)( GpsXtraCallbacks* callbacks ); - /** Injects XTRA data into the GPS. */ - int (*inject_xtra_data)( char* data, int length ); -} GpsXtraInterface; - -/** Extended interface for DEBUG support. */ -typedef struct { - /** set to sizeof(GpsDebugInterface) */ - size_t size; - - /** - * This function should return any information that the native - * implementation wishes to include in a bugreport. - */ - size_t (*get_internal_state)(char* buffer, size_t bufferSize); -} GpsDebugInterface; - -/** Represents the status of AGPS. */ -typedef struct { - /** set to sizeof(AGpsStatus) */ - size_t size; - - AGpsType type; - AGpsStatusValue status; - uint32_t ipaddr; -} AGpsStatus; - -/** Callback with AGPS status information. - * Can only be called from a thread created by create_thread_cb. - */ -typedef void (* agps_status_callback)(AGpsStatus* status); - -/** Callback structure for the AGPS interface. */ -typedef struct { - agps_status_callback status_cb; - gps_create_thread create_thread_cb; -} AGpsCallbacks; - - -/** Extended interface for AGPS support. */ -typedef struct { - /** set to sizeof(AGpsInterface) */ - size_t size; - - /** - * Opens the AGPS interface and provides the callback routines - * to the implemenation of this interface. - */ - void (*init)( AGpsCallbacks* callbacks ); - /** - * Notifies that a data connection is available and sets - * the name of the APN to be used for SUPL. - */ - int (*data_conn_open)( const char* apn ); - /** - * Notifies that the AGPS data connection has been closed. - */ - int (*data_conn_closed)(); - /** - * Notifies that a data connection is not available for AGPS. - */ - int (*data_conn_failed)(); - /** - * Sets the hostname and port for the AGPS server. - */ - int (*set_server)( AGpsType type, const char* hostname, int port ); -} AGpsInterface; - - -/** Represents an NI request */ -typedef struct { - /** set to sizeof(GpsNiNotification) */ - size_t size; - - /** - * An ID generated by HAL to associate NI notifications and UI - * responses - */ - int notification_id; - - /** - * An NI type used to distinguish different categories of NI - * events, such as GPS_NI_TYPE_VOICE, GPS_NI_TYPE_UMTS_SUPL, ... - */ - GpsNiType ni_type; - - /** - * Notification/verification options, combinations of GpsNiNotifyFlags constants - */ - GpsNiNotifyFlags notify_flags; - - /** - * Timeout period to wait for user response. - * Set to 0 for no time out limit. - */ - int timeout; - - /** - * Default response when time out. - */ - GpsUserResponseType default_response; - - /** - * Requestor ID - */ - char requestor_id[GPS_NI_SHORT_STRING_MAXLEN]; - - /** - * Notification message. It can also be used to store client_id in some cases - */ - char text[GPS_NI_LONG_STRING_MAXLEN]; - - /** - * Client name decoding scheme - */ - GpsNiEncodingType requestor_id_encoding; - - /** - * Client name decoding scheme - */ - GpsNiEncodingType text_encoding; - - /** - * A pointer to extra data. Format: - * key_1 = value_1 - * key_2 = value_2 - */ - char extras[GPS_NI_LONG_STRING_MAXLEN]; - -} GpsNiNotification; - -/** Callback with NI notification. - * Can only be called from a thread created by create_thread_cb. - */ -typedef void (*gps_ni_notify_callback)(GpsNiNotification *notification); - -/** GPS NI callback structure. */ -typedef struct -{ - /** - * Sends the notification request from HAL to GPSLocationProvider. - */ - gps_ni_notify_callback notify_cb; - gps_create_thread create_thread_cb; -} GpsNiCallbacks; - -/** - * Extended interface for Network-initiated (NI) support. - */ -typedef struct -{ - /** set to sizeof(GpsNiInterface) */ - size_t size; - - /** Registers the callbacks for HAL to use. */ - void (*init) (GpsNiCallbacks *callbacks); - - /** Sends a response to HAL. */ - void (*respond) (int notif_id, GpsUserResponseType user_response); -} GpsNiInterface; - -struct gps_device_t { - struct hw_device_t common; - - /** - * Set the provided lights to the provided values. - * - * Returns: 0 on succes, error code on failure. - */ - const GpsInterface* (*get_gps_interface)(struct gps_device_t* dev); -}; - -#define AGPS_RIL_REQUEST_SETID_IMSI (1<<0L) -#define AGPS_RIL_REQUEST_SETID_MSISDN (1<<1L) - -#define AGPS_RIL_REQUEST_REFLOC_CELLID (1<<0L) -#define AGPS_RIL_REQUEST_REFLOC_MAC (1<<1L) - -typedef void (*agps_ril_request_set_id)(uint32_t flags); -typedef void (*agps_ril_request_ref_loc)(uint32_t flags); - -typedef struct { - agps_ril_request_set_id request_setid; - agps_ril_request_ref_loc request_refloc; - gps_create_thread create_thread_cb; -} AGpsRilCallbacks; - -/** Extended interface for AGPS_RIL support. */ -typedef struct { - /** set to sizeof(AGpsRilInterface) */ - size_t size; - /** - * Opens the AGPS interface and provides the callback routines - * to the implemenation of this interface. - */ - void (*init)( AGpsRilCallbacks* callbacks ); - - /** - * Sets the reference location. - */ - void (*set_ref_location) (const AGpsRefLocation *agps_reflocation, size_t sz_struct); - /** - * Sets the set ID. - */ - void (*set_set_id) (AGpsSetIDType type, const char* setid); - - /** - * Send network initiated message. - */ - void (*ni_message) (uint8_t *msg, size_t len); - - /** - * Notify GPS of network status changes. - * These parameters match values in the android.net.NetworkInfo class. - */ - void (*update_network_state) (int connected, int type, int roaming, const char* extra_info); - - /** - * Notify GPS of network status changes. - * These parameters match values in the android.net.NetworkInfo class. - */ - void (*update_network_availability) (int avaiable, const char* apn); -} AGpsRilInterface; - -__END_DECLS - -#endif /* ANDROID_INCLUDE_HARDWARE_GPS_H */ - diff --git a/init.smdk4x12.rc b/init.smdk4x12.rc deleted file mode 100755 index dc67ed6..0000000 --- a/init.smdk4x12.rc +++ /dev/null @@ -1,519 +0,0 @@ -import init.smdk4x12.usb.rc - -on init - mkdir /mnt/shell/emulated 0700 shell shell - mkdir /storage 0550 system sdcard_r - mkdir /storage/emulated 0555 root root - mkdir /storage/sdcard1 0775 system system - mkdir /storage/usbdisk0 0775 system system - - export EXTERNAL_STORAGE /storage/emulated/legacy - export SECONDARY_STORAGE /storage/sdcard1 - export EMULATED_STORAGE_SOURCE /mnt/shell/emulated - export EMULATED_STORAGE_TARGET /storage/emulated - - # for backwards compatibility - symlink /storage/emulated/legacy /sdcard - symlink /storage/emulated/legacy /mnt/sdcard - symlink /storage/emulated/legacy /storage/sdcard0 - symlink /mnt/shell/emulated/0 /storage/emulated/legacy - symlink /storage/sdcard1 /extSdCard - symlink /storage/sdcard1 /mnt/extSdCard - symlink /storage/usbdisk0 /usbdisk0 - symlink /storage/usbdisk0 /mnt/usbdisk0 - - mkdir /efs 0771 radio system - -# ko files for FM Radio - insmod /system/lib/modules/Si4709_driver.ko - -on fs - mount_all /fstab.smdk4x12 - - setprop ro.crypto.fuse_sdcard true - - chown radio system /efs - chmod 0771 /efs - -on post-fs-data - # we will remap this as /mnt/sdcard with the sdcard fuse tool - mkdir /data/media 0775 media_rw media_rw - chown media_rw media_rw /data/media - -# data/log - mkdir /data/log 0775 system log - chown system log /data/log - chmod 0775 /data/log - chmod 0775 /data/anr - - # create data/gps for GPS demon - chown root system /dev/ttySAC1 - chmod 0660 /dev/ttySAC1 - chown root system /sys/class/sec/gps/GPS_PWR_EN/value - chmod 0664 /sys/class/sec/gps/GPS_PWR_EN/value - chown root system /sys/class/sec/gps/GPS_nRST/value - chmod 0664 /sys/class/sec/gps/GPS_nRST/value - mkdir /data/gps 771 system system - chown system system /data/gps - -# icd - exec icd_check - chown system system /dev/icd - chmod 0644 /dev/icd - write /dev/icdr 0 - chown system system /dev/icdr - chmod 0644 /dev/icdr - chown system system /dev/tzic - -# HDCP 2.x - mkdir /data/system/hdcp2 0775 system system - -# h2k permission - chmod 0644 /efs/redata.bin - chmod 0644 /efs/h2k.dat - -# Camera firmware - mkdir /data/cfw 0775 system system - chown system media /data/cfw/SlimISP_GD.bin - chmod 0775 /data/cfw/SlimISP_GD.bin - chown system media /data/cfw/SlimISP_ZD.bin - chmod 0775 /data/cfw/SlimISP_ZD.bin - -# Camera - chown system radio /sys/class/camera/rear/rear_camfw - chown system radio /sys/class/camera/rear/rear_camtype - chown system radio /sys/class/camera/rear/rear_flash - chmod 0666 /sys/class/camera/rear/rear_flash - chown system radio /sys/class/camera/rear/isp_core - chown system radio /sys/class/camera/front/front_camfw - chown system radio /sys/class/camera/front/front_camtype - write /data/ISP_CV 1 - - symlink /dev/block/mmcblk0p4 /dev/block/param - -# Permissions for bluetooth - setprop ro.bt.bdaddr_path "/efs/bluetooth/bt_addr" - chown bluetooth bluetooth ro.bt.bdaddr_path - chown bluetooth bluetooth /dev/ttySAC0 - chmod 0600 /dev/ttySAC0 - chmod 0660 /sys/class/rfkill/rfkill0/state - chown bluetooth bluetooth /sys/class/rfkill/rfkill0/state - chown bluetooth bluetooth /sys/class/rfkill/rfkill0/type - -# NFC - setprop ro.nfc.port "I2C" - chmod 0600 /dev/pn544 - chown nfc nfc /dev/pn544 - -# Vibrator - chmod 0660 /dev/tspdrv - chown root shell /dev/tspdrv - chmod 0660 /sys/vibrator/pwm_val - chown system system /sys/vibrator/pwm_val - -# LED - chmod 0660 /sys/class/sec/led/led_fade - chown system system /sys/class/sec/led/led_fade - -# Touchkey - chmod 0660 /sys/class/sec/sec_touchkey/timeout - chown system system /sys/class/sec/sec_touchkey/timeout - chmod 0660 /sys/class/sec/sec_touchkey/force_disable - chown system system /sys/class/sec/sec_touchkey/force_disable - -# Permissions for LCD - chown system radio /sys/class/lcd/panel/lcd_power - chown system radio /sys/class/lcd/panel/lcd_type - chown system radio /sys/class/lcd/panel/device/hs_toggle - chown system media_rw /sys/class/lcd/panel/power_reduce - chown system system /sys/class/backlight/panel/auto_brightness - chown system system /sys/class/backlight/panel/brightness - chown system system /sys/class/graphics/fb0/lcdfreq/level - -# Permissions for mDNIe - chown system media_rw /sys/class/mdnie/mdnie/mode - chown system media_rw /sys/class/mdnie/mdnie/outdoor - chown system media_rw /sys/class/mdnie/mdnie/scenario - chown system system /sys/class/mdnie/mdnie/negative - write /sys/class/mdnie/mdnie/scenario 0 - write /sys/class/mdnie/mdnie/mode 0 - -# Permissions for System Server and daemons. - chown radio system /sys/android_power/state - chown radio system /sys/android_power/request_state - chown radio system /sys/android_power/acquire_full_wake_lock - chown radio system /sys/android_power/acquire_partial_wake_lock - chown radio system /sys/android_power/release_wake_lock - chown radio system /sys/power/state - chown radio system /sys/power/wake_lock - chown radio system /sys/power/wake_unlock - chown radio system /sys/power/cpufreq_table - chown radio system /sys/power/cpufreq_max_limit - chown radio system /sys/power/cpufreq_min_limit - chown radio system /sys/power/mali_lock - chown radio system /sys/class/power_supply/battery/siop_activated - chown radio system /sys/devices/system/cpu/cpufreq/pegasusq/max_cpu_lock - chown radio system /sys/devices/system/cpu/cpufreq/pegasusq/hotplug_lock - chown radio system /sys/devices/system/cpu/busfreq/curr_freq - chown radio system /sys/module/mali/parameters/mali_dvfs_control - chown radio system /sys/devices/platform/s5p-ehci/ehci_power - chown radio system /sys/devices/platform/s5p-ohci/ohci_power - chown system radio /sys/bus/platform/devices/s5p-tmu/lot_id - chmod 0660 /sys/power/state - chmod 0660 /sys/power/wake_lock - chmod 0660 /sys/power/wake_unlock - chmod 0660 /sys/power/cpufreq_table - chmod 0660 /sys/power/cpufreq_max_limit - chmod 0660 /sys/power/cpufreq_min_limit - chmod 0660 /sys/power/mali_lock - chmod 0660 /sys/class/power_supply/battery/siop_activated - chmod 0660 /sys/devices/system/cpu/cpufreq/pegasusq/max_cpu_lock - chmod 0660 /sys/devices/system/cpu/cpufreq/pegasusq/hotplug_lock - chmod 0660 /sys/devices/system/cpu/busfreq/curr_freq - chmod 0660 /sys/module/mali/parameters/mali_dvfs_control - chmod 0664 /sys/bus/platform/devices/s5p-tmu/lot_id - chown system system /sys/class/timed_output/vibrator/enable - chown system system /sys/class/leds/keyboard-backlight/brightness - chown system system /sys/class/leds/lcd-backlight/brightness - chown system system /sys/class/backlight/panel/brightness - chown system system /sys/class/leds/button-backlight/brightness - chown system system /sys/class/sec/sec_touchkey/brightness - chown system system /sys/class/leds/jogball-backlight/brightness - chown system system /sys/class/leds/red/brightness - chown system system /sys/class/leds/green/brightness - chown system system /sys/class/leds/blue/brightness - chown system system /sys/class/leds/red/device/grpfreq - chown system system /sys/class/leds/red/device/grppwm - chown system system /sys/class/leds/red/device/blink - chown system system /sys/class/leds/red/brightness - chown system system /sys/class/leds/green/brightness - chown system system /sys/class/leds/blue/brightness - chown system system /sys/class/leds/red/device/grpfreq - chown system system /sys/class/leds/red/device/grppwm - chown system system /sys/class/leds/red/device/blink - chown system system /sys/class/timed_output/vibrator/enable - chown system system /sys/module/sco/parameters/disable_esco - chown system system /sys/kernel/ipv4/tcp_wmem_min - chown system system /sys/kernel/ipv4/tcp_wmem_def - chown system system /sys/kernel/ipv4/tcp_wmem_max - chown system system /sys/kernel/ipv4/tcp_rmem_min - chown system system /sys/kernel/ipv4/tcp_rmem_def - chown system system /sys/kernel/ipv4/tcp_rmem_max - chown root radio /proc/cmdline - -# Audio (Earjack) - chown system radio /sys/class/audio/earjack/select_jack - chown system radio /sys/class/audio/earjack/key_state - chown system radio /sys/class/audio/earjack/state - chown media system /sys/class/audio/earjack/reselect_jack - -# Battery node - chown system radio /sys/class/power_supply/battery/batt_reset_soc - chown system radio /sys/class/power_supply/battery/batt_read_raw_soc - chown system radio /sys/class/power_supply/battery/batt_read_adj_soc - chown system radio /sys/class/power_supply/battery/batt_type - chown system radio /sys/class/power_supply/battery/batt_temp_adc - chown system radio /sys/class/power_supply/battery/batt_temp_aver - chown system radio /sys/class/power_supply/battery/batt_temp_adc_aver - chown system radio /sys/class/power_supply/battery/batt_vfocv - chown system radio /sys/class/power_supply/battery/batt_lp_charging - chown system radio /sys/class/power_supply/battery/batt_charging_source - chown system radio /sys/class/power_supply/battery/test_mode - chown system radio /sys/class/power_supply/battery/wc_status - chown system radio /sys/class/power_supply/battery/wpc_pin_state - -# Thermistor node - chown radio system /sys/devices/platform/sec-thermistor/temp_adc - chown radio system /sys/devices/platform/sec-thermistor/temperature - -# Permissions for touch - chown system radio /sys/class/sec/tsp/cmd - -# Permissions for Touchkey - chown system radio /sys/class/sec/sec_touchkey/enable_disable - chown system radio /sys/class/sec/sec_touchkey/touchkey_brightness - chown system radio /sys/class/sec/sec_touchkey/touchkey_menu - chown system radio /sys/class/sec/sec_touchkey/touchkey_back - chown system radio /sys/class/sec/sec_touchkey/touch_update - chown system radio /sys/class/sec/sec_touchkey/touch_version - chown system radio /sys/class/sec/sec_touchkey/touchkey_firm_version_panel - chown system radio /sys/class/sec/sec_touchkey/touchkey_firm_version_phone - chown system radio /sys/class/sec/sec_touchkey/touchkey_firm_update_status - chown system radio /sys/class/sec/sec_touchkey/touchkey_firm_update - chown system radio /sys/class/sec/sec_touchkey/touch_sensitivity - chown system radio /sys/class/sec/sec_touchkey/touchkey_threshold - chown system system /sys/devices/virtual/sec/sec_touchkey/brightness - -# Permissions for gpio_keys - chown radio system /sys/class/sec/sec_key/wakeup_keys - write /sys/class/sec/sec_key/wakeup_keys 116,172 - -# Switch Device - chown system system /sys/class/sec/switch/uart_sel - chown system system /sys/class/sec/switch/usb_sel - chown system system /sys/class/sec/switch/otg_test - chown system radio /sys/class/sec/switch/adc - -# SVC LED - chown system system /sys/class/sec/led/led_r - chown system system /sys/class/sec/led/led_g - chown system system /sys/class/sec/led/led_b - - chown system system /sys/class/leds/led_r/brightness - chown system system /sys/class/leds/led_g/brightness - chown system system /sys/class/leds/led_b/brightness - chown system system /sys/class/leds/led_r/delay_on - chown system system /sys/class/leds/led_g/delay_on - chown system system /sys/class/leds/led_b/delay_on - chown system system /sys/class/leds/led_r/delay_off - chown system system /sys/class/leds/led_g/delay_off - chown system system /sys/class/leds/led_b/delay_off - chown system system /sys/class/leds/led_r/blink - chown system system /sys/class/leds/led_g/blink - chown system system /sys/class/leds/led_b/blink - - chown system system /sys/class/sec/led/led_pattern - chown system system /sys/class/sec/led/led_blink - chown system system /sys/class/sec/led/led_br_lev - -# <Sensors & NFC> -# Input Events - chown system radio /sys/class/input/input2/enable - chown system radio /sys/class/input/input2/poll_delay - chown system radio /sys/class/input/input3/enable - chown system radio /sys/class/input/input3/poll_delay - chown system radio /sys/class/input/input4/enable - chown system radio /sys/class/input/input4/poll_delay - chown system radio /sys/class/input/input5/enable - chown system radio /sys/class/input/input5/poll_delay - chown system radio /sys/class/input/input6/enable - chown system radio /sys/class/input/input6/poll_delay - chown system radio /sys/class/input/input7/enable - chown system radio /sys/class/input/input7/poll_delay - chown system radio /sys/class/input/input8/enable - chown system radio /sys/class/input/input8/poll_delay - chown system radio /sys/class/input/input9/enable - chown system radio /sys/class/input/input9/poll_delay -# Accelerometer_sensor - chown system radio /dev/accelerometer - chown system radio /sys/class/sensors/accelerometer_sensor - chown system radio /sys/class/sensors/accelerometer_sensor/raw_data - chown system radio /sys/class/sensors/accelerometer_sensor/calibration - chown system radio /sys/class/sensors/accelerometer_sensor/reactive_alert - chown system radio /sys/class/sensors/accelerometer_sensor/vendor - chown system radio /sys/class/sensors/accelerometer_sensor/name -# Proximity_sensor - chown system radio /sys/class/sensors/proximity_sensor/state - chown system radio /sys/class/sensors/proximity_sensor/prox_avg - chown system radio /sys/class/sensors/proximity_sensor/prox_cal - chown system radio /sys/class/sensors/proximity_sensor/vendor - chown system radio /sys/class/sensors/proximity_sensor/name - chown system radio /sys/class/sensors/proximity_sensor/prox_thresh -# Light_sensor - chown system radio /sys/class/input/input7/enable - chown system radio /sys/class/input/input7/poll_delay - chown system radio /sys/class/sensors/light_sensor/lux - chown system radio /sys/class/sensors/light_sensor/raw_data - chown system radio /sys/class/sensors/light_sensor/vendor - chown system radio /sys/class/sensors/light_sensor/name -# Gyro_sensor - chown system radio /dev/lsm330dlc_gyro_misc - chown system radio /sys/class/sensors/gyro_sensor/power_on - chown system radio /sys/class/sensors/gyro_sensor/power_off - chown system radio /sys/class/sensors/gyro_sensor/temperature - chown system radio /sys/class/sensors/gyro_sensor/selftest - chown system radio /sys/class/sensors/gyro_sensor/selftest_dps - chown system radio /sys/class/sensors/gyro_sensor/vendor - chown system radio /sys/class/sensors/gyro_sensor/name -# Barometer_sensor - chown system radio /sys/class/input/input5/pressure_reference_level - chown system radio /sys/class/input/input5/temperature_reference_level - chown system radio /sys/class/input/input5/enable_autozero - chown system radio /sys/class/input/input5/compensation_param - chown system radio /sys/class/input/input5/reg_value - chown system radio /sys/class/input/input5/reg_addr - chown system radio /sys/class/sensors/barometer_sensor/sea_level_pressure - chown system radio /sys/class/sensors/barometer_sensor/vendor - chown system radio /sys/class/sensors/barometer_sensor/name - chown system radio /sys/class/sensors/barometer_sensor/calibration -# Magnetic_sensor - chown system radio /dev/akm8975 - chown system radio /sys/class/sensors/magnetic_sensor/raw_data - chown system radio /sys/class/sensors/magnetic_sensor/vendor - chown system radio /sys/class/sensors/magnetic_sensor/name - -# for datarouter - chown system system /dev/dun - chown system system /dev/ttyGS0 - chown system system /dev/ttyGS1 - chown system system /dev/ttyGS2 - chown system system /dev/ttyGS3 - -# for wifi - mkdir /data/misc/wifi/sockets 0770 wifi wifi - mkdir /data/misc/dhcp 0775 dhcp dhcp - chown dhcp dhcp /data/misc/dhcp - -# for TRP/TIS - write /data/.psm.info 1 - chown system root /data/.psm.info - chmod 0660 /data/.psm.info - - # Set indication (checked by vold) that we have finished this action - setprop vold.post_fs_data_done 1 - -on boot - mount debugfs /sys/kernel/debug /sys/kernel/debug - - setprop ro.build.product smdk4x12 - setprop ro.product.device smdk4x12 - setprop ro.radio.noril yes - setprop wifi.interface wlan0 - -# fake some battery state - setprop status.battery.state Slow - setprop status.battery.level 5 - setprop status.battery.level_raw 50 - setprop status.battery.level_scale 9 - -# wifi display - write /proc/sys/net/core/wmem_max 262144 - - # Set permission for Widevine DRM temporarily - chmod 0777 /dev/s5p-smem - rm /data/app/tlcd_sock - - # make param block device link for SysScope - symlink /dev/block/mmcblk0p4 /dev/block/param - -# serial keyboard port - chown root system /dev/ttySAC2 - chmod 0660 /dev/ttySAC2 - -# touchscreen - chown radio system /sys/class/sec/tsp/cmd - chown media_rw media_rw /sys/class/sec/tsp/set_jitter - -# epen - chown radio system /sys/class/sec/sec_epen/epen_firm_update - chown radio system /sys/class/sec/sec_epen/epen_checksum - chown radio system /sys/class/sec/sec_epen/epen_checksum_result - chown radio system /sys/class/sec/sec_epen/epen_reset - -# wakeup keys - chown radio system /sys/class/sec/sec_key/wakeup_keys - write /sys/class/sec/sec_key/wakeup_keys 116,172 - -# serial keyboard daemon -service sec_keyboard /system/bin/sec_keyboard /dev/ttySAC2 - class late_start - disabled - group system - -on property:ro.uart_debug=0 - start sec_keyboard - -# create virtual SD card at /mnt/sdcard, based on the /data/media directory -# daemon will drop to user/group system/media_rw after initializing -# underlying files in /data/media wil be created with user and group media_rw (1023) -service sdcard /system/bin/sdcard /data/media /mnt/shell/emulated 1023 1023 - class late_start - -# icd -service icd /system/bin/icd - class main - user system - group system log - onrestart exec icd_check - -service cpboot-daemon /sbin/cbd -d - class main - user root - group radio cache inet misc audio sdcard_rw log - -service p2p_supplicant /system/bin/wpa_supplicant \ - -iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf -N \ - -ip2p0 -Dnl80211 -c/data/misc/wifi/p2p_supplicant.conf -e/data/misc/wifi/entropy.bin \ - -puse_p2p_group_interface=1 - # we will start as root and wpa_supplicant will switch to user wifi - # after setting up the capabilities required for WEXT - # user wifi - # group wifi inet keystore - class main - socket wpa_wlan0 dgram 660 wifi wifi - disabled - oneshot - -service wpa_supplicant /system/bin/wpa_supplicant \ - -Dnl80211 -iwlan0 -e/data/misc/wifi/entropy.bin \ - -c/data/misc/wifi/wpa_supplicant.conf - # we will start as root and wpa_supplicant will switch to user wifi - # after setting up the capabilities required for WEXT - # user wifi - # group wifi inet keystore - class main - socket wpa_wlan0 dgram 660 wifi wifi - disabled - oneshot - -service dhcpcd_wlan0 /system/bin/dhcpcd -ABKL - class main - disabled - oneshot - -service dhcpcd_p2p /system/bin/dhcpcd -aABKL - class main - disabled - oneshot - -service dhcpcd_bnep0 /system/bin/dhcpcd -ABKL - class main - disabled - oneshot - -service iprenew_wlan0 /system/bin/dhcpcd -n - class main - disabled - oneshot - -service iprenew_p2p /system/bin/dhcpcd -n - class main - disabled - oneshot - -service iprenew_bnep0 /system/bin/dhcpcd -n - class main - disabled - oneshot - -service macloader /system/bin/macloader - class main - oneshot - -# GPS -service gpsd /system/bin/gpsd -c /system/etc/gps.xml - class main - socket gps seqpacket 0660 gps system - user gps - group system inet sdcard_rw - -service dmb /system/bin/dmbserver - class main - user system - group radio inet misc audio camera graphics net_bt net_bt_admin sdcard_rw - -# TVout -service TvoutService_C /system/bin/bintvoutservice - class main - user system - group graphics - -on property:ro.tvout.enable=false - stop TvoutService_C - -# Workaround for broken incall audio -service bootsnd /system/bin/tinyplay /system/etc/sound/silence.wav -D 0 -d 0 -p 880 - class late_start - user root - group audio - oneshot diff --git a/libsamsung_symbols/Android.mk b/libsamsung_symbols/Android.mk new file mode 100644 index 0000000..c2e942e --- /dev/null +++ b/libsamsung_symbols/Android.mk @@ -0,0 +1,28 @@ +# Copyright (C) 2015 The CyanogenMod Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +LOCAL_PATH := $(call my-dir) + +include $(CLEAR_VARS) + +LOCAL_SRC_FILES := \ + samsung_ril.cpp + +LOCAL_SHARED_LIBRARIES := libbinder + +LOCAL_MODULE := libsamsung_symbols +LOCAL_MODULE_TAGS := optional +LOCAL_MODULE_CLASS := SHARED_LIBRARIES + +include $(BUILD_SHARED_LIBRARY) diff --git a/libsamsung_symbols/samsung_ril.cpp b/libsamsung_symbols/samsung_ril.cpp new file mode 100644 index 0000000..404616d --- /dev/null +++ b/libsamsung_symbols/samsung_ril.cpp @@ -0,0 +1,21 @@ +/* + * Copyright (C) 2015 The CyanogenMod Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* status_t Parcel::writeString16 */ +extern "C" int _ZN7android6Parcel13writeString16EPKDsj(); +extern "C" int _ZN7android6Parcel13writeString16EPKtj() { + return _ZN7android6Parcel13writeString16EPKDsj(); +} diff --git a/sensors/Android.mk b/libsensors/Android.mk index 6abc56a..8d15195 100644 --- a/sensors/Android.mk +++ b/libsensors/Android.mk @@ -20,7 +20,6 @@ include $(CLEAR_VARS) LOCAL_SRC_FILES := \ smdk4x12_sensors.c \ input.c \ - orientation.c \ akm8975.c \ akmdfs/AKFS_APIs_8975/AKFS_AK8975.c \ akmdfs/AKFS_APIs_8975/AKFS_AOC.c \ @@ -42,7 +41,7 @@ LOCAL_C_INCLUDES := \ LOCAL_SHARED_LIBRARIES := libutils libcutils liblog libhardware LOCAL_PRELINK_MODULE := false -LOCAL_MODULE := sensors.smdk4x12 +LOCAL_MODULE := sensors.$(TARGET_BOOTLOADER_BOARD_NAME) LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw LOCAL_MODULE_TAGS := optional diff --git a/sensors/ak8975-reg.h b/libsensors/ak8975-reg.h index 1a78a27..1a78a27 100644 --- a/sensors/ak8975-reg.h +++ b/libsensors/ak8975-reg.h diff --git a/sensors/ak8975.h b/libsensors/ak8975.h index 79a5de4..79a5de4 100644 --- a/sensors/ak8975.h +++ b/libsensors/ak8975.h diff --git a/sensors/akm8975.c b/libsensors/akm8975.c index 420c790..47771fb 100644 --- a/sensors/akm8975.c +++ b/libsensors/akm8975.c @@ -39,12 +39,10 @@ #define AKFS_PAT PAT3 struct akm8975_data { - struct smdk4x12_sensors_handlers *orientation_sensor; - AK8975PRMS akfs_params; sensors_vec_t magnetic; - long int delay; + int64_t delay; int device_fd; int uinput_fd; @@ -56,7 +54,8 @@ struct akm8975_data { int akfs_get_magnetic_field(struct akm8975_data *akm8975_data, short *magnetic_data) { AK8975PRMS *params; - int rc; + int rc, aocret; + float radius; if (akm8975_data == NULL || magnetic_data == NULL) return -EINVAL; @@ -80,7 +79,7 @@ int akfs_get_magnetic_field(struct akm8975_data *akm8975_data, short *magnetic_d // AOC for magnetometer // Offset estimation is done in this function - AKFS_AOC(¶ms->m_aocv, params->mfv_hdata, ¶ms->mfv_ho); + aocret = AKFS_AOC(¶ms->m_aocv, params->mfv_hdata, ¶ms->mfv_ho); // Subtract offset // Then, a magnetic vector, the unit is uT, is stored in mfv_hvbuf. @@ -99,9 +98,25 @@ int akfs_get_magnetic_field(struct akm8975_data *akm8975_data, short *magnetic_d return -1; } + // Check the size of magnetic vector + radius = sqrtf( + (params->mfv_hvec.u.x * params->mfv_hvec.u.x) + + (params->mfv_hvec.u.y * params->mfv_hvec.u.y) + + (params->mfv_hvec.u.z * params->mfv_hvec.u.z)); + + // Sanity check result and set accuracy + if ((radius > MAGNETIC_FIELD_EARTH_MAX + 10) || (radius < MAGNETIC_FIELD_EARTH_MIN - 10)) { + params->mi_hstatus = SENSOR_STATUS_UNRELIABLE; + } else if(params->mi_hstatus == SENSOR_STATUS_UNRELIABLE) { + params->mi_hstatus = SENSOR_STATUS_ACCURACY_MEDIUM; + } else if (aocret == AKFS_SUCCESS) { + params->mi_hstatus = SENSOR_STATUS_ACCURACY_HIGH; + } + akm8975_data->magnetic.x = params->mfv_hvec.u.x; akm8975_data->magnetic.y = params->mfv_hvec.u.y; akm8975_data->magnetic.z = params->mfv_hvec.u.z; + akm8975_data->magnetic.status = params->mi_hstatus; return 0; } @@ -151,7 +166,7 @@ void *akm8975_thread(void *thread_data) char i2c_data[SENSOR_DATA_SIZE] = { 0 }; short magnetic_data[3]; short mode; - long int before, after; + int64_t before, after; int diff; int device_fd; int uinput_fd; @@ -223,6 +238,8 @@ void *akm8975_thread(void *thread_data) write(uinput_fd, &event, sizeof(event)); input_event_set(&event, EV_REL, REL_Z, (int) (data->magnetic.z * 1000)); write(uinput_fd, &event, sizeof(event)); + input_event_set(&event, EV_REL, REL_MISC, (int) data->magnetic.status); + write(uinput_fd, &event, sizeof(event)); input_event_set(&event, EV_SYN, 0, 0); write(uinput_fd, &event, sizeof(event)); @@ -259,14 +276,6 @@ int akm8975_init(struct smdk4x12_sensors_handlers *handlers, data = (struct akm8975_data *) calloc(1, sizeof(struct akm8975_data)); - for (i = 0; i < device->handlers_count; i++) { - if (device->handlers[i] == NULL) - continue; - - if (device->handlers[i]->handle == SENSOR_TYPE_ORIENTATION) - data->orientation_sensor = device->handlers[i]; - } - device_fd = open("/dev/akm8975", O_RDONLY); if (device_fd < 0) { ALOGE("%s: Unable to open device", __func__); @@ -308,7 +317,7 @@ int akm8975_init(struct smdk4x12_sensors_handlers *handlers, i2c_data[1] = AK8975_REG_WIA; rc = ioctl(device_fd, ECS_IOCTL_READ, &i2c_data); if (rc < 0) { - ALOGE("%s: Unable to read akm8975 FUSE data", __func__); + ALOGE("%s: Unable to read akm8975 WIA data", __func__); goto error; } @@ -434,8 +443,15 @@ int akm8975_activate(struct smdk4x12_sensors_handlers *handlers) // Read settings from a file rc = AKFS_LoadParameters(akfs_params, AKFS_CONFIG_PATH); - if (rc != AKM_SUCCESS) - ALOGE("%s: Unable to read AKFS parameters", __func__); + if (rc != AKM_SUCCESS) { + ALOGE("%s: Unable to read AKFS HO parameters", __func__); + akfs_params->mfv_ho.u.x = 0.0f; + akfs_params->mfv_ho.u.y = 0.0f; + akfs_params->mfv_ho.u.z = 0.0f; + } else { + ALOGD("AKM8975 HO (Offset Adjustment) parameters read are: (%f, %f, %f)", + akfs_params->mfv_ho.u.x, akfs_params->mfv_ho.u.y, akfs_params->mfv_ho.u.z); + } // Initialize buffer AKFS_InitBuffer(AKFS_HDATA_SIZE, akfs_params->mfv_hdata); @@ -446,7 +462,7 @@ int akm8975_activate(struct smdk4x12_sensors_handlers *handlers) // Initialize for AOC AKFS_InitAOC(&akfs_params->m_aocv); // Initialize magnetic status - akfs_params->mi_hstatus = 0; + akfs_params->mi_hstatus = SENSOR_STATUS_UNRELIABLE; handlers->activated = 1; pthread_mutex_unlock(&data->mutex); @@ -478,18 +494,20 @@ int akm8975_deactivate(struct smdk4x12_sensors_handlers *handlers) empty = 1; - for (i = 0; i < 3; i++) { - if (akfs_params->mfv_ho.v[i] != 0) { - empty = 0; - break; - } + if ((akfs_params->mfv_ho.u.x != 0.0f) || (akfs_params->mfv_ho.u.y != 0.0f) || + (akfs_params->mfv_ho.u.z != 0.0f)) { + empty = 0; } if (!empty) { // Write settings to a file rc = AKFS_SaveParameters(akfs_params, AKFS_CONFIG_PATH); - if (rc != AKM_SUCCESS) - ALOGE("%s: Unable to write AKFS parameters", __func__); + if (rc != AKM_SUCCESS) { + ALOGE("%s: Unable to write AKFS HO parameters", __func__); + } else { + ALOGD("AKM8975 HO (Offset Adjustment) parameters written are: (%f, %f, %f)", + akfs_params->mfv_ho.u.x, akfs_params->mfv_ho.u.y, akfs_params->mfv_ho.u.z); + } } mode = AK8975_MODE_POWER_DOWN; @@ -502,11 +520,11 @@ int akm8975_deactivate(struct smdk4x12_sensors_handlers *handlers) return 0; } -int akm8975_set_delay(struct smdk4x12_sensors_handlers *handlers, long int delay) +int akm8975_set_delay(struct smdk4x12_sensors_handlers *handlers, int64_t delay) { struct akm8975_data *data; - ALOGD("%s(%p, %ld)", __func__, handlers, delay); + ALOGD("%s(%p, %" PRId64 ")", __func__, handlers, delay); if (handlers == NULL || handlers->data == NULL) return -EINVAL; @@ -547,8 +565,6 @@ int akm8975_get_data(struct smdk4x12_sensors_handlers *handlers, event->sensor = handlers->handle; event->type = handlers->handle; - event->magnetic.status = SENSOR_STATUS_ACCURACY_MEDIUM; - do { rc = read(input_fd, &input_event, sizeof(input_event)); if (rc < (int) sizeof(input_event)) @@ -565,6 +581,9 @@ int akm8975_get_data(struct smdk4x12_sensors_handlers *handlers, case REL_Z: event->magnetic.z = akm8975_convert(input_event.value); break; + case REL_MISC: + event->magnetic.status = input_event.value; + break; default: continue; } @@ -574,9 +593,6 @@ int akm8975_get_data(struct smdk4x12_sensors_handlers *handlers, } } while (input_event.type != EV_SYN); - if (data->orientation_sensor != NULL) - orientation_fill(data->orientation_sensor, NULL, &event->magnetic); - return 0; } diff --git a/sensors/akmdfs/AK8975Driver.c b/libsensors/akmdfs/AK8975Driver.c index 003c8d2..003c8d2 100644 --- a/sensors/akmdfs/AK8975Driver.c +++ b/libsensors/akmdfs/AK8975Driver.c diff --git a/sensors/akmdfs/AK8975Driver.h b/libsensors/akmdfs/AK8975Driver.h index 731210d..731210d 100644 --- a/sensors/akmdfs/AK8975Driver.h +++ b/libsensors/akmdfs/AK8975Driver.h diff --git a/sensors/akmdfs/AKFS_APIs.c b/libsensors/akmdfs/AKFS_APIs.c index ace9bc1..ace9bc1 100644 --- a/sensors/akmdfs/AKFS_APIs.c +++ b/libsensors/akmdfs/AKFS_APIs.c diff --git a/sensors/akmdfs/AKFS_APIs.h b/libsensors/akmdfs/AKFS_APIs.h index e4d1e48..e4d1e48 100644 --- a/sensors/akmdfs/AKFS_APIs.h +++ b/libsensors/akmdfs/AKFS_APIs.h diff --git a/sensors/akmdfs/AKFS_APIs_8975/AKFS_AK8975.c b/libsensors/akmdfs/AKFS_APIs_8975/AKFS_AK8975.c index 7bac9a1..7bac9a1 100644 --- a/sensors/akmdfs/AKFS_APIs_8975/AKFS_AK8975.c +++ b/libsensors/akmdfs/AKFS_APIs_8975/AKFS_AK8975.c diff --git a/sensors/akmdfs/AKFS_APIs_8975/AKFS_AK8975.h b/libsensors/akmdfs/AKFS_APIs_8975/AKFS_AK8975.h index 25459e3..25459e3 100644 --- a/sensors/akmdfs/AKFS_APIs_8975/AKFS_AK8975.h +++ b/libsensors/akmdfs/AKFS_APIs_8975/AKFS_AK8975.h diff --git a/sensors/akmdfs/AKFS_APIs_8975/AKFS_AOC.c b/libsensors/akmdfs/AKFS_APIs_8975/AKFS_AOC.c index 62b2361..62b2361 100644 --- a/sensors/akmdfs/AKFS_APIs_8975/AKFS_AOC.c +++ b/libsensors/akmdfs/AKFS_APIs_8975/AKFS_AOC.c diff --git a/sensors/akmdfs/AKFS_APIs_8975/AKFS_AOC.h b/libsensors/akmdfs/AKFS_APIs_8975/AKFS_AOC.h index ffaaa88..ffaaa88 100644 --- a/sensors/akmdfs/AKFS_APIs_8975/AKFS_AOC.h +++ b/libsensors/akmdfs/AKFS_APIs_8975/AKFS_AOC.h diff --git a/sensors/akmdfs/AKFS_APIs_8975/AKFS_Configure.h b/libsensors/akmdfs/AKFS_APIs_8975/AKFS_Configure.h index 1f80f48..1f80f48 100644 --- a/sensors/akmdfs/AKFS_APIs_8975/AKFS_Configure.h +++ b/libsensors/akmdfs/AKFS_APIs_8975/AKFS_Configure.h diff --git a/sensors/akmdfs/AKFS_APIs_8975/AKFS_Device.c b/libsensors/akmdfs/AKFS_APIs_8975/AKFS_Device.c index 3d99ab1..3d99ab1 100644 --- a/sensors/akmdfs/AKFS_APIs_8975/AKFS_Device.c +++ b/libsensors/akmdfs/AKFS_APIs_8975/AKFS_Device.c diff --git a/sensors/akmdfs/AKFS_APIs_8975/AKFS_Device.h b/libsensors/akmdfs/AKFS_APIs_8975/AKFS_Device.h index 0292d54..0292d54 100644 --- a/sensors/akmdfs/AKFS_APIs_8975/AKFS_Device.h +++ b/libsensors/akmdfs/AKFS_APIs_8975/AKFS_Device.h diff --git a/sensors/akmdfs/AKFS_APIs_8975/AKFS_Direction.c b/libsensors/akmdfs/AKFS_APIs_8975/AKFS_Direction.c index f47e930..f47e930 100644 --- a/sensors/akmdfs/AKFS_APIs_8975/AKFS_Direction.c +++ b/libsensors/akmdfs/AKFS_APIs_8975/AKFS_Direction.c diff --git a/sensors/akmdfs/AKFS_APIs_8975/AKFS_Direction.h b/libsensors/akmdfs/AKFS_APIs_8975/AKFS_Direction.h index c08338d..c08338d 100644 --- a/sensors/akmdfs/AKFS_APIs_8975/AKFS_Direction.h +++ b/libsensors/akmdfs/AKFS_APIs_8975/AKFS_Direction.h diff --git a/sensors/akmdfs/AKFS_APIs_8975/AKFS_Math.h b/libsensors/akmdfs/AKFS_APIs_8975/AKFS_Math.h index dfe48b3..dfe48b3 100644 --- a/sensors/akmdfs/AKFS_APIs_8975/AKFS_Math.h +++ b/libsensors/akmdfs/AKFS_APIs_8975/AKFS_Math.h diff --git a/sensors/akmdfs/AKFS_APIs_8975/AKFS_VNorm.c b/libsensors/akmdfs/AKFS_APIs_8975/AKFS_VNorm.c index ffa934a..ffa934a 100644 --- a/sensors/akmdfs/AKFS_APIs_8975/AKFS_VNorm.c +++ b/libsensors/akmdfs/AKFS_APIs_8975/AKFS_VNorm.c diff --git a/sensors/akmdfs/AKFS_APIs_8975/AKFS_VNorm.h b/libsensors/akmdfs/AKFS_APIs_8975/AKFS_VNorm.h index c3c9bed..c3c9bed 100644 --- a/sensors/akmdfs/AKFS_APIs_8975/AKFS_VNorm.h +++ b/libsensors/akmdfs/AKFS_APIs_8975/AKFS_VNorm.h diff --git a/sensors/akmdfs/AKFS_CSpec.h b/libsensors/akmdfs/AKFS_CSpec.h index 380f06f..380f06f 100644 --- a/sensors/akmdfs/AKFS_CSpec.h +++ b/libsensors/akmdfs/AKFS_CSpec.h diff --git a/sensors/akmdfs/AKFS_Common.h b/libsensors/akmdfs/AKFS_Common.h index 7780801..7780801 100644 --- a/sensors/akmdfs/AKFS_Common.h +++ b/libsensors/akmdfs/AKFS_Common.h diff --git a/sensors/akmdfs/AKFS_Compass.h b/libsensors/akmdfs/AKFS_Compass.h index aa59285..aa59285 100644 --- a/sensors/akmdfs/AKFS_Compass.h +++ b/libsensors/akmdfs/AKFS_Compass.h diff --git a/sensors/akmdfs/AKFS_Disp.c b/libsensors/akmdfs/AKFS_Disp.c index 4e7c501..4e7c501 100644 --- a/sensors/akmdfs/AKFS_Disp.c +++ b/libsensors/akmdfs/AKFS_Disp.c diff --git a/sensors/akmdfs/AKFS_Disp.h b/libsensors/akmdfs/AKFS_Disp.h index 4769e3c..4769e3c 100644 --- a/sensors/akmdfs/AKFS_Disp.h +++ b/libsensors/akmdfs/AKFS_Disp.h diff --git a/sensors/akmdfs/AKFS_FileIO.c b/libsensors/akmdfs/AKFS_FileIO.c index 92c2ce9..92c2ce9 100644 --- a/sensors/akmdfs/AKFS_FileIO.c +++ b/libsensors/akmdfs/AKFS_FileIO.c diff --git a/sensors/akmdfs/AKFS_FileIO.h b/libsensors/akmdfs/AKFS_FileIO.h index 62f6e77..62f6e77 100644 --- a/sensors/akmdfs/AKFS_FileIO.h +++ b/libsensors/akmdfs/AKFS_FileIO.h diff --git a/sensors/akmdfs/AKFS_Measure.c b/libsensors/akmdfs/AKFS_Measure.c index 84c0843..84c0843 100644 --- a/sensors/akmdfs/AKFS_Measure.c +++ b/libsensors/akmdfs/AKFS_Measure.c diff --git a/sensors/akmdfs/AKFS_Measure.h b/libsensors/akmdfs/AKFS_Measure.h index d156b95..d156b95 100644 --- a/sensors/akmdfs/AKFS_Measure.h +++ b/libsensors/akmdfs/AKFS_Measure.h diff --git a/sensors/akmdfs/NOTICE b/libsensors/akmdfs/NOTICE index d645695..d645695 100644 --- a/sensors/akmdfs/NOTICE +++ b/libsensors/akmdfs/NOTICE diff --git a/sensors/akmdfs/Version.txt b/libsensors/akmdfs/Version.txt index 3d56b30..3d56b30 100644 --- a/sensors/akmdfs/Version.txt +++ b/libsensors/akmdfs/Version.txt diff --git a/sensors/akmdfs/main.c b/libsensors/akmdfs/main.c index a3df0bc..a3df0bc 100644 --- a/sensors/akmdfs/main.c +++ b/libsensors/akmdfs/main.c diff --git a/sensors/cm36651_light.c b/libsensors/cm36651_light.c index bab689a..6781797 100644 --- a/sensors/cm36651_light.c +++ b/libsensors/cm36651_light.c @@ -150,19 +150,19 @@ int cm36651_light_deactivate(struct smdk4x12_sensors_handlers *handlers) return 0; } -int cm36651_light_set_delay(struct smdk4x12_sensors_handlers *handlers, long int delay) +int cm36651_light_set_delay(struct smdk4x12_sensors_handlers *handlers, int64_t delay) { struct cm36651_light_data *data; int rc; - ALOGD("%s(%p, %ld)", __func__, handlers, delay); + ALOGD("%s(%p, %" PRId64 ")", __func__, handlers, delay); if (handlers == NULL || handlers->data == NULL) return -EINVAL; data = (struct cm36651_light_data *) handlers->data; - rc = sysfs_value_write(data->path_delay, (int) delay); + rc = sysfs_value_write(data->path_delay, delay); if (rc < 0) { ALOGE("%s: Unable to write sysfs value", __func__); return -1; @@ -171,9 +171,37 @@ int cm36651_light_set_delay(struct smdk4x12_sensors_handlers *handlers, long int return 0; } -float cm36651_light_convert(int value) +float cm36651_light_convert(int white, int green) { - return (float) value * 1.7f - 0.5f; + float gwrel = 1.0f; + float aux; + float r1, r2, r3, r4; + + if (green <= 4) + return 0.0f; + else { + if (white > 0) + gwrel = (float) green / (float) white; + + r1 = floorf( (float) (pow((double) green, 1.3341) * 0.0258) ); + + aux = floorf( ((float) green * 0.18f * 9.44f) / gwrel); + r2 = aux; + r3 = aux * 0.77f; + + r4 = floorf( (float) green * ( (gwrel * 1.546) - 0.46) ); + + if (gwrel <= 0.5f) { + return r1; + } else if (gwrel >= 0.9f) { + if (white <= 5999) + return r2; + else + return r3; + } else { + return r4; + } + } } int cm36651_light_get_data(struct smdk4x12_sensors_handlers *handlers, @@ -181,6 +209,8 @@ int cm36651_light_get_data(struct smdk4x12_sensors_handlers *handlers, { struct input_event input_event; int input_fd; + int green = 0; + int white = 0; int rc; // ALOGD("%s(%p, %p)", __func__, handlers, event); @@ -203,14 +233,18 @@ int cm36651_light_get_data(struct smdk4x12_sensors_handlers *handlers, break; if (input_event.type == EV_REL) { + if (input_event.code == REL_Y) + green = input_event.value; if (input_event.code == REL_MISC) - event->light = cm36651_light_convert(input_event.value); + white = input_event.value; } else if (input_event.type == EV_SYN) { if (input_event.code == SYN_REPORT) event->timestamp = input_timestamp(&input_event); } } while (input_event.type != EV_SYN); + event->light = cm36651_light_convert(white, green); + return 0; } diff --git a/sensors/cm36651_proximity.c b/libsensors/cm36651_proximity.c index b102f9a..6529543 100644 --- a/sensors/cm36651_proximity.c +++ b/libsensors/cm36651_proximity.c @@ -147,9 +147,9 @@ int cm36651_proximity_deactivate(struct smdk4x12_sensors_handlers *handlers) return 0; } -int cm36651_proximity_set_delay(struct smdk4x12_sensors_handlers *handlers, long int delay) +int cm36651_proximity_set_delay(struct smdk4x12_sensors_handlers *handlers, int64_t delay) { - ALOGD("%s(%p, %ld)", __func__, handlers, delay); + ALOGD("%s(%p, %" PRId64 ")", __func__, handlers, delay); return 0; } diff --git a/sensors/input.c b/libsensors/input.c index 5a58b45..eef2a8d 100644 --- a/sensors/input.c +++ b/libsensors/input.c @@ -44,7 +44,7 @@ void input_event_set(struct input_event *event, int type, int code, int value) gettimeofday(&event->time, NULL); } -long int timestamp(struct timeval *time) +int64_t timestamp(struct timeval *time) { if (time == NULL) return -1; @@ -52,7 +52,7 @@ long int timestamp(struct timeval *time) return time->tv_sec * 1000000000LL + time->tv_usec * 1000; } -long int input_timestamp(struct input_event *event) +int64_t input_timestamp(struct input_event *event) { if (event == NULL) return -1; @@ -88,6 +88,7 @@ int uinput_rel_create(const char *name) rc |= ioctl(uinput_fd, UI_SET_RELBIT, REL_X); rc |= ioctl(uinput_fd, UI_SET_RELBIT, REL_Y); rc |= ioctl(uinput_fd, UI_SET_RELBIT, REL_Z); + rc |= ioctl(uinput_fd, UI_SET_RELBIT, REL_MISC); rc |= ioctl(uinput_fd, UI_SET_EVBIT, EV_SYN); if (rc < 0) { diff --git a/sensors/lps331ap.c b/libsensors/lps331ap.c index 5c3007b..a8ef55a 100644 --- a/sensors/lps331ap.c +++ b/libsensors/lps331ap.c @@ -150,13 +150,12 @@ int lps331ap_deactivate(struct smdk4x12_sensors_handlers *handlers) return 0; } -int lps331ap_set_delay(struct smdk4x12_sensors_handlers *handlers, long int delay) +int lps331ap_set_delay(struct smdk4x12_sensors_handlers *handlers, int64_t delay) { struct lps331ap_data *data; - int d; int rc; - ALOGD("%s(%p, %ld)", __func__, handlers, delay); + ALOGD("%s(%p, %" PRId64 ")", __func__, handlers, delay); if (handlers == NULL || handlers->data == NULL) return -EINVAL; @@ -164,11 +163,11 @@ int lps331ap_set_delay(struct smdk4x12_sensors_handlers *handlers, long int dela data = (struct lps331ap_data *) handlers->data; if (delay < 10000000) - d = 10; + delay = 10; else - d = delay / 1000000; + delay = delay / 1000000; - rc = sysfs_value_write(data->path_delay, d); + rc = sysfs_value_write(data->path_delay, delay); if (rc < 0) { ALOGE("%s: Unable to write sysfs value", __func__); return -1; diff --git a/sensors/lsm330dlc_accel.h b/libsensors/lsm330dlc_accel.h index ff5f666..ff5f666 100644 --- a/sensors/lsm330dlc_accel.h +++ b/libsensors/lsm330dlc_accel.h diff --git a/sensors/lsm330dlc_acceleration.c b/libsensors/lsm330dlc_acceleration.c index 4289eaf..7f6985b 100644 --- a/sensors/lsm330dlc_acceleration.c +++ b/libsensors/lsm330dlc_acceleration.c @@ -31,9 +31,7 @@ #include "lsm330dlc_accel.h" struct lsm330dlc_acceleration_data { - struct smdk4x12_sensors_handlers *orientation_sensor; - - long int delay; + int64_t delay; int device_fd; int uinput_fd; @@ -49,7 +47,7 @@ void *lsm330dlc_acceleration_thread(void *thread_data) struct input_event event; struct timeval time; struct lsm330dlc_acc acceleration_data; - long int before, after; + int64_t before, after; int diff; int device_fd; int uinput_fd; @@ -130,14 +128,6 @@ int lsm330dlc_acceleration_init(struct smdk4x12_sensors_handlers *handlers, data = (struct lsm330dlc_acceleration_data *) calloc(1, sizeof(struct lsm330dlc_acceleration_data)); - for (i = 0; i < device->handlers_count; i++) { - if (device->handlers[i] == NULL) - continue; - - if (device->handlers[i]->handle == SENSOR_TYPE_ORIENTATION) - data->orientation_sensor = device->handlers[i]; - } - device_fd = open("/dev/accelerometer", O_RDONLY); if (device_fd < 0) { ALOGE("%s: Unable to open device", __func__); @@ -295,14 +285,14 @@ int lsm330dlc_acceleration_deactivate(struct smdk4x12_sensors_handlers *handlers return 0; } -int lsm330dlc_acceleration_set_delay(struct smdk4x12_sensors_handlers *handlers, long int delay) +int lsm330dlc_acceleration_set_delay(struct smdk4x12_sensors_handlers *handlers, int64_t delay) { struct lsm330dlc_acceleration_data *data; int64_t d; int device_fd; int rc; - ALOGD("%s(%p, %ld)", __func__, handlers, delay); + ALOGD("%s(%p, %" PRId64 ")", __func__, handlers, delay); if (handlers == NULL || handlers->data == NULL) return -EINVAL; @@ -354,7 +344,7 @@ int lsm330dlc_acceleration_get_data(struct smdk4x12_sensors_handlers *handlers, event->sensor = handlers->handle; event->type = handlers->handle; - event->magnetic.status = SENSOR_STATUS_ACCURACY_MEDIUM; + event->acceleration.status = SENSOR_STATUS_ACCURACY_MEDIUM; do { rc = read(input_fd, &input_event, sizeof(input_event)); @@ -381,9 +371,6 @@ int lsm330dlc_acceleration_get_data(struct smdk4x12_sensors_handlers *handlers, } } while (input_event.type != EV_SYN); - if (data->orientation_sensor != NULL) - orientation_fill(data->orientation_sensor, &event->acceleration, NULL); - return 0; } diff --git a/sensors/lsm330dlc_gyroscope.c b/libsensors/lsm330dlc_gyroscope.c index 6a7f98d..b91b433 100644 --- a/sensors/lsm330dlc_gyroscope.c +++ b/libsensors/lsm330dlc_gyroscope.c @@ -152,19 +152,19 @@ int lsm330dlc_gyroscope_deactivate(struct smdk4x12_sensors_handlers *handlers) return 0; } -int lsm330dlc_gyroscope_set_delay(struct smdk4x12_sensors_handlers *handlers, long int delay) +int lsm330dlc_gyroscope_set_delay(struct smdk4x12_sensors_handlers *handlers, int64_t delay) { struct lsm330dlc_gyroscope_data *data; int rc; - ALOGD("%s(%p, %ld)", __func__, handlers, delay); + ALOGD("%s(%p, %" PRId64 ")", __func__, handlers, delay); if (handlers == NULL || handlers->data == NULL) return -EINVAL; data = (struct lsm330dlc_gyroscope_data *) handlers->data; - rc = sysfs_value_write(data->path_delay, (int) delay); + rc = sysfs_value_write(data->path_delay, delay); if (rc < 0) { ALOGE("%s: Unable to write sysfs value", __func__); return -1; @@ -206,6 +206,8 @@ int lsm330dlc_gyroscope_get_data(struct smdk4x12_sensors_handlers *handlers, event->gyro.y = data->gyro.y; event->gyro.z = data->gyro.z; + event->gyro.status = SENSOR_STATUS_ACCURACY_MEDIUM; + do { rc = read(input_fd, &input_event, sizeof(input_event)); if (rc < (int) sizeof(input_event)) diff --git a/sensors/smdk4x12_sensors.c b/libsensors/smdk4x12_sensors.c index e6f4500..bd79a48 100644 --- a/sensors/smdk4x12_sensors.c +++ b/libsensors/smdk4x12_sensors.c @@ -35,20 +35,24 @@ */ struct sensor_t smdk4x12_sensors[] = { - { "LSM330DLC Acceleration Sensor", "STMicroelectronics", 1, SENSOR_TYPE_ACCELEROMETER, - SENSOR_TYPE_ACCELEROMETER, 2 * GRAVITY_EARTH, 0.0096f, 0.23f, 10000, {}, }, - { "AKM8975 Magnetic Sensor", "Asahi Kasei Microdevices", 1, SENSOR_TYPE_MAGNETIC_FIELD, - SENSOR_TYPE_MAGNETIC_FIELD, 2000.0f, 1.0f / 16, 6.8f, 10000, {}, }, - { "Orientation Sensor", "SMDK4x12 Sensors", 1, SENSOR_TYPE_ORIENTATION, - SENSOR_TYPE_ORIENTATION, 360.0f, 0.1f, 0.0f, 10000, {}, }, - { "CM36651 Light Sensor", "Capella Microsystems", 1, SENSOR_TYPE_LIGHT, - SENSOR_TYPE_LIGHT, 121240.0f, 1.0f, 0.2f, 0, {}, }, - { "CM36651 Proximity Sensor", "Capella Microsystems", 1, SENSOR_TYPE_PROXIMITY, - SENSOR_TYPE_PROXIMITY, 6.0f, 6.0f, 1.3f, 0, {}, }, - { "LSM330DLC Gyroscope Sensor", "STMicroelectronics", 1, SENSOR_TYPE_GYROSCOPE, - SENSOR_TYPE_GYROSCOPE, 500.0f * (3.1415926535f / 180.0f), (70.0f / 4000.0f) * (3.1415926535f / 180.0f), 6.1f, 5000, {}, }, - { "LPS331AP Pressure Sensor", "STMicroelectronics", 1, SENSOR_TYPE_PRESSURE, - SENSOR_TYPE_PRESSURE, 1260.0f, 1.0f / 4096, 0.045f, 40000, {}, }, + { "LSM330DLC Acceleration Sensor", "STMicroelectronics", 1, SENSOR_TYPE_ACCELEROMETER, + SENSOR_TYPE_ACCELEROMETER, 2 * GRAVITY_EARTH, 0.0096f, 0.23f, 10000, 0, 0, SENSOR_STRING_TYPE_ACCELEROMETER, 0, 0, + SENSOR_FLAG_ON_CHANGE_MODE, {}, }, + { "AKM8975 Magnetic Sensor", "Asahi Kasei", 1, SENSOR_TYPE_MAGNETIC_FIELD, + SENSOR_TYPE_MAGNETIC_FIELD, 2000.0f, 1.0f / 16, 6.8f, 10000, 0, 0, SENSOR_STRING_TYPE_MAGNETIC_FIELD, 0, 0, + SENSOR_FLAG_ON_CHANGE_MODE, {}, }, + { "CM36651 Light Sensor", "Capella", 1, SENSOR_TYPE_LIGHT, + SENSOR_TYPE_LIGHT, 121240.0f, 1.0f, 0.2f, 0, 0, 0, SENSOR_STRING_TYPE_LIGHT, 0, 0, + SENSOR_FLAG_ON_CHANGE_MODE, {}, }, + { "CM36651 Proximity Sensor", "Capella", 1, SENSOR_TYPE_PROXIMITY, + SENSOR_TYPE_PROXIMITY, 8.0f, 8.0f, 1.3f, 0, 0, 0, SENSOR_STRING_TYPE_PROXIMITY, 0, 0, + SENSOR_FLAG_WAKE_UP | SENSOR_FLAG_ON_CHANGE_MODE, {}, }, + { "LSM330DLC Gyroscope Sensor", "STMicroelectronics", 1, SENSOR_TYPE_GYROSCOPE, + SENSOR_TYPE_GYROSCOPE, 500.0f * (3.1415926535f / 180.0f), (70.0f / 4000.0f) * (3.1415926535f / 180.0f), 6.1f, 5000, 0, 0, SENSOR_STRING_TYPE_GYROSCOPE, 0, 0, + SENSOR_FLAG_ON_CHANGE_MODE, {}, }, + { "LPS331AP Pressure Sensor", "STMicroelectronics", 1, SENSOR_TYPE_PRESSURE, + SENSOR_TYPE_PRESSURE, 1260.0f, 1.0f / 4096, 0.045f, 40000, 0, 0, SENSOR_STRING_TYPE_PRESSURE, 0, 20000, + SENSOR_FLAG_CONTINUOUS_MODE, {}, }, }; int smdk4x12_sensors_count = sizeof(smdk4x12_sensors) / sizeof(struct sensor_t); @@ -56,7 +60,6 @@ int smdk4x12_sensors_count = sizeof(smdk4x12_sensors) / sizeof(struct sensor_t); struct smdk4x12_sensors_handlers *smdk4x12_sensors_handlers[] = { &lsm330dlc_acceleration, &akm8975, - &orientation, &cm36651_proximity, &cm36651_light, &lsm330dlc_gyroscope, @@ -116,7 +119,7 @@ int smdk4x12_sensors_set_delay(struct sensors_poll_device_t *dev, int handle, struct smdk4x12_sensors_device *device; int i; - ALOGD("%s(%p, %d, %ld)", __func__, dev, handle, (long int) ns); + ALOGD("%s(%p, %d, %" PRId64 ")", __func__, dev, handle, ns); if (dev == NULL) return -EINVAL; @@ -131,7 +134,7 @@ int smdk4x12_sensors_set_delay(struct sensors_poll_device_t *dev, int handle, continue; if (device->handlers[i]->handle == handle && device->handlers[i]->set_delay != NULL) - return device->handlers[i]->set_delay(device->handlers[i], (long int) ns); + return device->handlers[i]->set_delay(device->handlers[i], ns); } return 0; diff --git a/sensors/smdk4x12_sensors.h b/libsensors/smdk4x12_sensors.h index 984834a..da3d173 100644 --- a/sensors/smdk4x12_sensors.h +++ b/libsensors/smdk4x12_sensors.h @@ -18,6 +18,8 @@ #include <stdint.h> #include <poll.h> #include <linux/input.h> +#define __STDC_FORMAT_MACROS +#include <inttypes.h> #include <hardware/sensors.h> #include <hardware/hardware.h> @@ -26,7 +28,6 @@ #define _SMDK4x12_SENSORS_H_ #define SMDK4x12_SENSORS_NEEDED_API (1 << 0) -#define SMDK4x12_SENSORS_NEEDED_ORIENTATION (1 << 1) struct smdk4x12_sensors_device; @@ -40,7 +41,7 @@ struct smdk4x12_sensors_handlers { int (*activate)(struct smdk4x12_sensors_handlers *handlers); int (*deactivate)(struct smdk4x12_sensors_handlers *handlers); int (*set_delay)(struct smdk4x12_sensors_handlers *handlers, - long int delay); + int64_t delay); int (*get_data)(struct smdk4x12_sensors_handlers *handlers, struct sensors_event_t *event); @@ -76,8 +77,8 @@ int smdk4x12_sensors_poll(struct sensors_poll_device_t *dev, */ void input_event_set(struct input_event *event, int type, int code, int value); -long int timestamp(struct timeval *time); -long int input_timestamp(struct input_event *event); +int64_t timestamp(struct timeval *time); +int64_t input_timestamp(struct input_event *event); int uinput_rel_create(const char *name); void uinput_destroy(int uinput_fd); int input_open(char *name); @@ -91,12 +92,8 @@ int sysfs_string_write(char *path, char *buffer, size_t length); * Sensors */ -int orientation_fill(struct smdk4x12_sensors_handlers *handlers, - sensors_vec_t *acceleration, sensors_vec_t *magnetic); - extern struct smdk4x12_sensors_handlers lsm330dlc_acceleration; extern struct smdk4x12_sensors_handlers akm8975; -extern struct smdk4x12_sensors_handlers orientation; extern struct smdk4x12_sensors_handlers cm36651_proximity; extern struct smdk4x12_sensors_handlers cm36651_light; extern struct smdk4x12_sensors_handlers lsm330dlc_gyroscope; diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml index b26164f..bd64df1 100644 --- a/overlay/frameworks/base/core/res/res/values/config.xml +++ b/overlay/frameworks/base/core/res/res/values/config.xml @@ -25,8 +25,156 @@ autodetected from the Configuration. --> <bool name="config_showNavigationBar">false</bool> - <!-- XXXXX NOTE THE FOLLOWING RESOURCES USE THE WRONG NAMING CONVENTION. - Please don't copy them, copy anything else. --> + <!-- Array of light sensor LUX values to define our levels for auto backlight brightness support. + The N entries of this array define N + 1 zones as follows: + + Zone 0: 0 <= LUX < array[0] + Zone 1: array[0] <= LUX < array[1] + ... + Zone N: array[N - 1] <= LUX < array[N] + Zone N + 1: array[N] <= LUX < infinity + + Must be overridden in platform specific overlays + --> + <integer-array name="config_autoBrightnessLevels"> + <item>150</item> + <item>300</item> + <item>600</item> + <item>1000</item> + <item>3000</item> + <item>8000</item> + <item>15000</item> + <item>28000</item> + <item>41000</item> + <item>54000</item> + <item>67000</item> + <item>80000</item> + <item>100000</item> + <item>150000</item> + <item>200000</item> + </integer-array> + + <!-- Array of output values for LCD backlight corresponding to the LUX values + in the config_autoBrightnessLevels array. This array should have size one greater + than the size of the config_autoBrightnessLevels array. + --> + <integer-array name="config_autoBrightnessLcdBacklightValues"> + <item>20</item> + <item>30</item> + <item>40</item> + <item>50</item> + <item>60</item> + <item>70</item> + <item>80</item> + <item>100</item> + <item>120</item> + <item>140</item> + <item>160</item> + <item>180</item> + <item>200</item> + <item>220</item> + <item>240</item> + <item>255</item> + </integer-array> + + <!-- Array of output values for button backlight corresponding to the LUX values + in the config_autoBrightnessLevels array. This array should have size one greater + than the size of the config_autoBrightnessLevels array. + --> + <integer-array name="config_autoBrightnessButtonBacklightValues"> + <item>0</item> + <item>0</item> + <item>0</item> + <item>0</item> + <item>0</item> + <item>0</item> + <item>0</item> + <item>0</item> + <item>0</item> + <item>0</item> + <item>0</item> + <item>0</item> + <item>0</item> + <item>0</item> + <item>0</item> + <item>0</item> + <item>0</item> + <item>0</item> + <item>0</item> + <item>0</item> + <item>0</item> + </integer-array> + + <!-- Array of output values for keyboard backlight corresponding to the LUX values + in the config_autoBrightnessLevels array. This array should have size one greater + than the size of the config_autoBrightnessLevels array. + i9300 has no keyboard so all values are zero. + --> + <integer-array name="config_autoBrightnessKeyboardBacklightValues"> + <item>0</item> + <item>0</item> + <item>0</item> + <item>0</item> + <item>0</item> + <item>0</item> + <item>0</item> + <item>0</item> + <item>0</item> + <item>0</item> + <item>0</item> + <item>0</item> + <item>0</item> + <item>0</item> + <item>0</item> + <item>0</item> + <item>0</item> + <item>0</item> + <item>0</item> + <item>0</item> + <item>0</item> + </integer-array> + + <!-- Screen brightness when dozing. --> + <integer name="config_screenBrightnessDoze">20</integer> + + <!-- Dream of notifications --> + <string name="config_dozeComponent">com.android.systemui/com.android.systemui.doze.DozeService</string> + + <!-- If true, the doze component is not started until after the screen has been + turned off and the screen off animation has been performed. --> + <bool name="config_dozeAfterScreenOff">true</bool> + + <!-- Power Management: Specifies whether to decouple the interactive state of the + device from the display on/off state. + + When false, setInteractive(..., true) will be called before the display is turned on + and setInteractive(..., false) will be called after the display is turned off. + This mode provides best compatibility for devices that expect the interactive + state to be tied to the display state. + + When true, setInteractive(...) will be called independently of whether the display + is being turned on or off. This mode enables the power manager to reduce + clocks and disable the touch controller while the display is on. + + This resource should be set to "true" when a doze component has been specified + to maximize power savings but not all devices support it. + + Refer to power.h for details. + --> + <bool name="config_powerDecoupleInteractiveModeFromDisplay">true</bool> + + <!-- Specifies whether the dreams feature should be supported. + When true, the system will allow the user to configure dreams (screensavers) + to launch when a user activity timeout occurs or the system is told to nap. + When false, the dreams feature will be disabled (this does not affect dozing). + + Consider setting this resource to false or disabling dreams by default when a + doze component is specified below since dreaming will supercede dozing and + will prevent the system from entering a low power state until the dream ends. --> + <bool name="config_dreamsSupported">true</bool> + + <!-- If supported, are dreams enabled? (by default) --> + <bool name="config_dreamsEnabledByDefault">false</bool> <!-- An Array of "[Connection name],[ConnectivityManager.TYPE_xxxx], [associated radio-type],[priority],[restoral-timer(ms)],[dependencyMet] --> @@ -70,16 +218,24 @@ <item>7</item> </integer-array> + <!-- Indicate whether the SD card is accessible without removing the battery. --> + <bool name="config_batterySdCardAccessibility">true</bool> + <!-- The default iface on which to monitor data use --> <string name="config_datause_iface">pdp0</string> <!-- Is the notification LED intrusive? Used to decide if there should be a disable option --> <bool name="config_intrusiveNotificationLed">true</bool> + <!-- Does the notification LED support multiple colors? + Used to decide if the user can change the colors --> + <bool name="config_multiColorNotificationLed">true</bool> + <!-- Is the battery LED intrusive? Used to decide if there should be a disable option --> <bool name="config_intrusiveBatteryLed">true</bool> - <!-- Does the battery LED support multiple colors? Used to decide if the user can change the colors --> + <!-- Does the battery LED support multiple colors? + Used to decide if the user can change the colors --> <bool name="config_multiColorBatteryLed">true</bool> <!-- Default color for notification LED is white. --> @@ -95,12 +251,12 @@ <bool name="config_disableMenuKeyInLockScreen">true</bool> <!-- Disable the home key unlock setting --> - <bool name="config_disableHomeUnlockSetting">false</bool> + <!--bool name="config_disableHomeUnlockSetting">false</bool--> <!-- Workaround for devices with broken keyboards --> - <bool name="config_forceDisableHardwareKeyboard">true</bool> + <!--bool name="config_forceDisableHardwareKeyboard">true</bool--> - <!-- Hardware 'face' keys present on the device, stored as a bit field. + <!-- Hardware keys present on the device, stored as a bit field. This integer should equal the sum of the corresponding value for each of the following keys present: 1 - Home @@ -108,13 +264,56 @@ 4 - Menu 8 - Assistant (search) 16 - App switch + 32 - Camera + 64 - Volume rocker For example, a device with Home, Back and Menu keys would set this config to 7. --> - <integer name="config_deviceHardwareKeys">7</integer> + <integer name="config_deviceHardwareKeys">71</integer> + + <!-- Hardware keys present on the device with the ability to wake, stored as a bit field. + This integer should equal the sum of the corresponding value for each + of the following keys present: + 1 - Home + 2 - Back + 4 - Menu + 8 - Assistant (search) + 16 - App switch + 32 - Camera + 64 - Volume rocker + For example, a device with Home, Back and Menu keys would set this + config to 7. --> + <integer name="config_deviceHardwareWakeKeys">65</integer> <!-- Boolean to enable stk functionality on Samsung phones --> <bool name="config_samsung_stk">true</bool> + <!-- Maximum number of supported users --> + <integer name="config_multiuserMaximumUsers">4</integer> + + <!-- Whether UI for multi user should be shown --> + <bool name="config_enableMultiUserUI">true</bool> + + <!-- Whether WiFi display is supported by this device. + There are many prerequisites for this feature to work correctly. + Here are a few of them: + * The WiFi radio must support WiFi P2P. + * The WiFi radio must support concurrent connections to the WiFi display and + to an access point. + * The Audio Flinger audio_policy.conf file must specify a rule for the "r_submix" + remote submix module. This module is used to record and stream system + audio output to the WiFi display encoder in the media server. + * The remote submix module "audio.r_submix.default" must be installed on the device. + * The device must be provisioned with HDCP keys (for protected content). + --> + <bool name="config_enableWifiDisplay">true</bool> + + <!-- The RadioAccessFamilies supported by the device. + Empty is viewed as "all". Only used on devices which + don't support RIL_REQUEST_GET_RADIO_CAPABILITY + format is UMTS|LTE|... + --> + <string translatable="false" name="config_radio_access_family">GPRS|EDGE|WCDMA</string> + <!-- Flag indicating whether we should enable the automatic brightness in Settings. config_hardware_automatic_brightness_available is not set, so we will use software implementation --> <bool name="config_automatic_brightness_available">true</bool> diff --git a/overlay/frameworks/base/core/res/res/xml/storage_list.xml b/overlay/frameworks/base/core/res/res/xml/storage_list.xml deleted file mode 100644 index d9247c5..0000000 --- a/overlay/frameworks/base/core/res/res/xml/storage_list.xml +++ /dev/null @@ -1,52 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -** -** Copyright 2011, The Android Open Source Project -** -** Licensed under the Apache License, Version 2.0 (the "License") -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ ---> - -<!-- The <device> element should contain one or more <storage> elements. - Exactly one of these should have the attribute primary="true". - This storage will be the primary external storage and should have mountPoint="/mnt/sdcard". - Each storage should have both a mountPoint and storageDescription attribute. - The following attributes are optional: - - primary: (boolean) this storage is the primary external storage - removable: (boolean) this is removable storage (for example, a real SD card) - emulated: (boolean) the storage is emulated via the FUSE sdcard daemon - mtpReserve: (integer) number of megabytes of storage MTP should reserve for free storage - (used for emulated storage that is shared with system's data partition) - - A storage should not have both emulated and removable set to true ---> - -<StorageList xmlns:android="http://schemas.android.com/apk/res/android"> - <storage android:mountPoint="/storage/sdcard0" - android:storageDescription="@string/storage_internal" - android:primary="true" - android:emulated="true" - android:mtpReserve="100" /> - - <storage android:mountPoint="/storage/sdcard1" - android:storageDescription="@string/storage_sd_card" - android:primary="false" - android:removable="true" - android:allowMassStorage="true" /> - - <storage android:mountPoint="/storage/usbdisk0" - android:storageDescription="@string/storage_usb" - android:primary="false" - android:removable="true" /> -</StorageList> diff --git a/overlay/frameworks/base/packages/SystemUI/res/values/config.xml b/overlay/frameworks/base/packages/SystemUI/res/values/config.xml index 88851f7..717384b 100644 --- a/overlay/frameworks/base/packages/SystemUI/res/values/config.xml +++ b/overlay/frameworks/base/packages/SystemUI/res/values/config.xml @@ -22,5 +22,11 @@ <resources> <!-- Control whether status bar should distinguish HSPA data icon form UMTS data icon on devices --> <bool name="config_hspa_data_distinguishable">true</bool> + + <!-- Doze: does this device support STATE_DOZE and STATE_DOZE_SUSPEND? --> + <bool name="doze_display_state_supported">true</bool> + + <!-- Doze: should the pickup sensor be used as a pulse signal? --> + <bool name="doze_pulse_on_pick_up">false</bool> </resources> diff --git a/overlay/packages/apps/Phone/res/values/config.xml b/overlay/packages/apps/Phone/res/values/config.xml deleted file mode 100644 index 23ec4e4..0000000 --- a/overlay/packages/apps/Phone/res/values/config.xml +++ /dev/null @@ -1,25 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2009 The Android Open Source Project - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> - -<!-- Phone app resources that may need to be customized - for different hardware or product builds. --> -<resources> - <!-- Determines if device implements a noise suppression device for in call audio--> - <bool name="has_in_call_noise_suppression">true</bool> - - <!-- Audio parameter for setting noise suppression--> - <string name="in_call_noise_suppression_audioparameter">noise_suppression=true=false</string> -</resources> diff --git a/overlay/packages/apps/Torch/res/values/config.xml b/overlay/packages/apps/Torch/res/values/config.xml deleted file mode 100644 index 6325065..0000000 --- a/overlay/packages/apps/Torch/res/values/config.xml +++ /dev/null @@ -1,36 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/* -** Copyright 2011, The CyanogenMod Project -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ ---> - -<!-- These resources are around just to allow their values to be customized - for different hardware and product builds. --> -<resources> - <!-- If there is no sysfs-based control mechanism, enable this --> - <bool name="useCameraInterface">false</bool> - - <!-- Full path to the sysfs toggle --> - <string name="flashDevice">/sys/class/camera/rear/rear_flash</string> - - <!-- Lowest setting --> - <integer name="valueOn">159</integer> - <!-- Middle setting --> - <integer name="valueHigh">10</integer> - <!-- Highest setting, leave -1 if it doesn't exist --> - <integer name="valueDeathRay">1</integer> - -</resources> diff --git a/proprietary-files.txt b/proprietary-files.txt index e382d7a..56fe3d8 100644 --- a/proprietary-files.txt +++ b/proprietary-files.txt @@ -1,8 +1,5 @@ system/bin/gpsd system/lib/hw/gps.exynos4.so -system/lib/hw/vendor-camera.exynos4.so -system/lib/hw/sensors.smdk4x12.so -system/lib/libakm.so system/lib/libsec-ril.so system/usr/idc/sec_touchscreen.idc system/usr/keylayout/sec_touchkey.kl diff --git a/recovery.fstab b/recovery.fstab deleted file mode 100644 index 63ab14c..0000000 --- a/recovery.fstab +++ /dev/null @@ -1,12 +0,0 @@ -# mount point fstype device -/efs ext4 /dev/block/mmcblk0p3 -/boot emmc /dev/block/mmcblk0p5 -/recovery emmc /dev/block/mmcblk0p6 -/cache ext4 /dev/block/mmcblk0p8 -/system ext4 /dev/block/mmcblk0p9 -/data ext4 /dev/block/mmcblk0p12 length=-16384 -/preload ext4 /dev/block/mmcblk0p10 -/modem emmc /dev/block/mmcblk0p7 - -/sdcard datamedia /dev/null -/external_sd auto /dev/block/mmcblk1p1 /dev/block/mmcblk1 diff --git a/ril-wrapper/Android.mk b/ril-wrapper/Android.mk new file mode 100644 index 0000000..698e1d3 --- /dev/null +++ b/ril-wrapper/Android.mk @@ -0,0 +1,9 @@ +LOCAL_PATH:= $(call my-dir) + +include $(CLEAR_VARS) + +LOCAL_SRC_FILES:= ril-wrapper.c +LOCAL_SHARED_LIBRARIES := liblog libbinder +LOCAL_MODULE:= ril-wrapper + +include $(BUILD_SHARED_LIBRARY) diff --git a/ril-wrapper/ril-wrapper.c b/ril-wrapper/ril-wrapper.c new file mode 100644 index 0000000..76308c6 --- /dev/null +++ b/ril-wrapper/ril-wrapper.c @@ -0,0 +1,99 @@ +#define LOG_TAG "RilWrapper" +#define RIL_SHLIB +#include <telephony/ril_cdma_sms.h> +#include <sys/system_properties.h> +#include <telephony/librilutils.h> +#include <cutils/sockets.h> +#include <telephony/ril.h> +#include <sys/socket.h> +#include <sys/types.h> +#include <sys/cdefs.h> +#include <utils/Log.h> +#include <sys/stat.h> +#include <pthread.h> +#include <termios.h> +#include <alloca.h> +#include <assert.h> +#include <getopt.h> +#include <string.h> +#include <unistd.h> +#include <dlfcn.h> +#include <errno.h> +#include <fcntl.h> +#include <stdio.h> + +#define REAL_RIL_NAME "/system/lib/libsamsung-ril.so" + + +static RIL_RadioFunctions const *mRealRadioFuncs; +static const struct RIL_Env *mEnv; + +static void rilOnRequest(int request, void *data, size_t datalen, RIL_Token t) +{ + switch (request) { + case RIL_REQUEST_GET_RADIO_CAPABILITY: + RLOGW("Returning NOT_SUPPORTED on GET_RADIO_CAPABILITY"); + mEnv->OnRequestComplete(t, RIL_E_REQUEST_NOT_SUPPORTED, NULL, 0); + break; + default: + mRealRadioFuncs->onRequest(request, data, datalen, t); + } +} + +const RIL_RadioFunctions* RIL_Init(const struct RIL_Env *env, int argc, char **argv) +{ + RIL_RadioFunctions const* (*fRealRilInit)(const struct RIL_Env *env, int argc, char **argv); + static RIL_RadioFunctions rilInfo; + void *realRilLibHandle; + int i; + + + //save the env; + mEnv = env; + + //get the real RIL + realRilLibHandle = dlopen(REAL_RIL_NAME, RTLD_LOCAL); + if (!realRilLibHandle) { + RLOGE("Failed to load the real RIL '" REAL_RIL_NAME "': %s\n", dlerror()); + return NULL; + } + + //remove "-c" command line as Samsung's RIL does not understand it - it just barfs instead + for (i = 0; i < argc; i++) { + if (!strcmp(argv[i], "-c") && i != argc -1) { //found it + memcpy(argv + i, argv + i + 2, sizeof(char*[argc - i - 2])); + argc -= 2; + } + } + + //load the real RIL + fRealRilInit = dlsym(realRilLibHandle, "RIL_Init"); + if (!fRealRilInit) { + RLOGE("Failed to find the real RIL's entry point\n"); + goto out_fail; + } + + RLOGD("Calling the real RIL's entry point with %u args\n", argc); + for (i = 0; i < argc; i++) + RLOGD(" argv[%2d] = '%s'\n", i, argv[i]); + + //try to init the real ril + mRealRadioFuncs = fRealRilInit(env, argc, argv); + if (!mRealRadioFuncs) { + RLOGE("The real RIL's entry point failed\n"); + goto out_fail; + } + + //copy the real RIL's info struct, then replace the onRequest pointer with our own + rilInfo = *mRealRadioFuncs; + rilInfo.onRequest = rilOnRequest; + + RLOGD("Wrapped RIL version is '%s'\n", mRealRadioFuncs->getVersion()); + + //we're all good - return to caller + return &rilInfo; + +out_fail: + dlclose(realRilLibHandle); + return NULL; +} diff --git a/ril/telephony/java/com/android/internal/telephony/SamsungExynos4RIL.java b/ril/telephony/java/com/android/internal/telephony/SamsungExynos4RIL.java new file mode 100644 index 0000000..5501efc --- /dev/null +++ b/ril/telephony/java/com/android/internal/telephony/SamsungExynos4RIL.java @@ -0,0 +1,505 @@ +/* + * Copyright (C) 2011 The CyanogenMod Project <http://www.cyanogenmod.org> + * Copyright (C) 2014 The OmniROM Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.internal.telephony; + +import static com.android.internal.telephony.RILConstants.*; + +import android.content.Context; +import android.os.AsyncResult; +import android.os.Handler; +import android.os.Message; +import android.os.Parcel; +import android.os.Registrant; +import android.telephony.ModemActivityInfo; +import android.telephony.Rlog; + +import android.telephony.PhoneNumberUtils; + +public class SamsungExynos4RIL extends RIL implements CommandsInterface { + + //SAMSUNG STATES + static final int RIL_REQUEST_GET_CELL_BROADCAST_CONFIG = 10002; + + static final int RIL_REQUEST_SEND_ENCODED_USSD = 10005; + static final int RIL_REQUEST_SET_PDA_MEMORY_STATUS = 10006; + static final int RIL_REQUEST_GET_PHONEBOOK_STORAGE_INFO = 10007; + static final int RIL_REQUEST_GET_PHONEBOOK_ENTRY = 10008; + static final int RIL_REQUEST_ACCESS_PHONEBOOK_ENTRY = 10009; + static final int RIL_REQUEST_DIAL_VIDEO_CALL = 10010; + static final int RIL_REQUEST_CALL_DEFLECTION = 10011; + static final int RIL_REQUEST_READ_SMS_FROM_SIM = 10012; + static final int RIL_REQUEST_USIM_PB_CAPA = 10013; + static final int RIL_REQUEST_LOCK_INFO = 10014; + + static final int RIL_REQUEST_DIAL_EMERGENCY = 10016; + static final int RIL_REQUEST_GET_STOREAD_MSG_COUNT = 10017; + static final int RIL_REQUEST_STK_SIM_INIT_EVENT = 10018; + static final int RIL_REQUEST_GET_LINE_ID = 10019; + static final int RIL_REQUEST_SET_LINE_ID = 10020; + static final int RIL_REQUEST_GET_SERIAL_NUMBER = 10021; + static final int RIL_REQUEST_GET_MANUFACTURE_DATE_NUMBER = 10022; + static final int RIL_REQUEST_GET_BARCODE_NUMBER = 10023; + static final int RIL_REQUEST_UICC_GBA_AUTHENTICATE_BOOTSTRAP = 10024; + static final int RIL_REQUEST_UICC_GBA_AUTHENTICATE_NAF = 10025; + static final int RIL_REQUEST_SIM_TRANSMIT_BASIC = 10026; + static final int RIL_REQUEST_SIM_OPEN_CHANNEL = 10027; + static final int RIL_REQUEST_SIM_CLOSE_CHANNEL = 10028; + static final int RIL_REQUEST_SIM_TRANSMIT_CHANNEL = 10029; + static final int RIL_REQUEST_SIM_AUTH = 10030; + static final int RIL_REQUEST_PS_ATTACH = 10031; + static final int RIL_REQUEST_PS_DETACH = 10032; + static final int RIL_REQUEST_ACTIVATE_DATA_CALL = 10033; + static final int RIL_REQUEST_CHANGE_SIM_PERSO = 10034; + static final int RIL_REQUEST_ENTER_SIM_PERSO = 10035; + static final int RIL_REQUEST_GET_TIME_INFO = 10036; + static final int RIL_REQUEST_OMADM_SETUP_SESSION = 10037; + static final int RIL_REQUEST_OMADM_SERVER_START_SESSION = 10038; + static final int RIL_REQUEST_OMADM_CLIENT_START_SESSION = 10039; + static final int RIL_REQUEST_OMADM_SEND_DATA = 10040; + static final int RIL_REQUEST_CDMA_GET_DATAPROFILE = 10041; + static final int RIL_REQUEST_CDMA_SET_DATAPROFILE = 10042; + static final int RIL_REQUEST_CDMA_GET_SYSTEMPROPERTIES = 10043; + static final int RIL_REQUEST_CDMA_SET_SYSTEMPROPERTIES = 10044; + static final int RIL_REQUEST_SEND_SMS_COUNT = 10045; + static final int RIL_REQUEST_SEND_SMS_MSG = 10046; + static final int RIL_REQUEST_SEND_SMS_MSG_READ_STATUS = 10047; + static final int RIL_REQUEST_MODEM_HANGUP = 10048; + static final int RIL_REQUEST_SET_SIM_POWER = 10049; + static final int RIL_REQUEST_SET_PREFERRED_NETWORK_LIST = 10050; + static final int RIL_REQUEST_GET_PREFERRED_NETWORK_LIST = 10051; + static final int RIL_REQUEST_HANGUP_VT = 10052; + + static final int RIL_UNSOL_RELEASE_COMPLETE_MESSAGE = 11001; + static final int RIL_UNSOL_STK_SEND_SMS_RESULT = 11002; + static final int RIL_UNSOL_STK_CALL_CONTROL_RESULT = 11003; + static final int RIL_UNSOL_DUN_CALL_STATUS = 11004; + + static final int RIL_UNSOL_O2_HOME_ZONE_INFO = 11007; + static final int RIL_UNSOL_DEVICE_READY_NOTI = 11008; + static final int RIL_UNSOL_GPS_NOTI = 11009; + static final int RIL_UNSOL_AM = 11010; + static final int RIL_UNSOL_DUN_PIN_CONTROL_SIGNAL = 11011; + static final int RIL_UNSOL_DATA_SUSPEND_RESUME = 11012; + static final int RIL_UNSOL_SAP = 11013; + + static final int RIL_UNSOL_SIM_SMS_STORAGE_AVAILALE = 11015; + static final int RIL_UNSOL_HSDPA_STATE_CHANGED = 11016; + static final int RIL_UNSOL_WB_AMR_STATE = 11017; + static final int RIL_UNSOL_TWO_MIC_STATE = 11018; + static final int RIL_UNSOL_DHA_STATE = 11019; + static final int RIL_UNSOL_UART = 11020; + static final int RIL_UNSOL_RESPONSE_HANDOVER = 11021; + static final int RIL_UNSOL_IPV6_ADDR = 11022; + static final int RIL_UNSOL_NWK_INIT_DISC_REQUEST = 11023; + static final int RIL_UNSOL_RTS_INDICATION = 11024; + static final int RIL_UNSOL_OMADM_SEND_DATA = 11025; + static final int RIL_UNSOL_DUN = 11026; + static final int RIL_UNSOL_SYSTEM_REBOOT = 11027; + static final int RIL_UNSOL_VOICE_PRIVACY_CHANGED = 11028; + static final int RIL_UNSOL_UTS_GETSMSCOUNT = 11029; + static final int RIL_UNSOL_UTS_GETSMSMSG = 11030; + static final int RIL_UNSOL_UTS_GET_UNREAD_SMS_STATUS = 11031; + static final int RIL_UNSOL_MIP_CONNECT_STATUS = 11032; + + private Object mCatProCmdBuffer; + /* private Message mPendingGetSimStatus; */ + + public SamsungExynos4RIL(Context context, int networkMode, int cdmaSubscription, Integer instanceId) { + super(context, networkMode, cdmaSubscription, instanceId); + } + + static String + requestToString(int request) { + switch (request) { + case RIL_REQUEST_DIAL_EMERGENCY: return "DIAL_EMERGENCY"; + default: return RIL.requestToString(request); + } + } + + @Override + protected RILRequest processSolicited (Parcel p) { + int serial, error; + boolean found = false; + + serial = p.readInt(); + error = p.readInt(); + + RILRequest rr; + + rr = findAndRemoveRequestFromList(serial); + + if (rr == null) { + Rlog.w(RILJ_LOG_TAG, "Unexpected solicited response! sn: " + + serial + " error: " + error); + return null; + } + + Object ret = null; + + if (error == 0 || p.dataAvail() > 0) { + // either command succeeds or command fails but with data payload + try {switch (rr.mRequest) { + /* + cat libs/telephony/ril_commands.h \ + | egrep "^ *{RIL_" \ + | sed -re 's/\{([^,]+),[^,]+,([^}]+).+/case \1: ret = \2(p); break;/' + */ + case RIL_REQUEST_GET_SIM_STATUS: ret = responseIccCardStatus(p); break; + case RIL_REQUEST_ENTER_SIM_PIN: ret = responseInts(p); break; + case RIL_REQUEST_ENTER_SIM_PUK: ret = responseInts(p); break; + case RIL_REQUEST_ENTER_SIM_PIN2: ret = responseInts(p); break; + case RIL_REQUEST_ENTER_SIM_PUK2: ret = responseInts(p); break; + case RIL_REQUEST_CHANGE_SIM_PIN: ret = responseInts(p); break; + case RIL_REQUEST_CHANGE_SIM_PIN2: ret = responseInts(p); break; + case RIL_REQUEST_ENTER_NETWORK_DEPERSONALIZATION: ret = responseInts(p); break; + case RIL_REQUEST_GET_CURRENT_CALLS: ret = responseCallList(p); break; + case RIL_REQUEST_DIAL: ret = responseVoid(p); break; + case RIL_REQUEST_DIAL_EMERGENCY: ret = responseVoid(p); break; + case RIL_REQUEST_GET_IMSI: ret = responseString(p); break; + case RIL_REQUEST_HANGUP: ret = responseVoid(p); break; + case RIL_REQUEST_HANGUP_WAITING_OR_BACKGROUND: ret = responseVoid(p); break; + case RIL_REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND: { + if (mTestingEmergencyCall.getAndSet(false)) { + if (mEmergencyCallbackModeRegistrant != null) { + riljLog("testing emergency call, notify ECM Registrants"); + mEmergencyCallbackModeRegistrant.notifyRegistrant(); + } + } + ret = responseVoid(p); + break; + } + case RIL_REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE: ret = responseVoid(p); break; + case RIL_REQUEST_CONFERENCE: ret = responseVoid(p); break; + case RIL_REQUEST_UDUB: ret = responseVoid(p); break; + case RIL_REQUEST_LAST_CALL_FAIL_CAUSE: ret = responseFailCause(p); break; + case RIL_REQUEST_SIGNAL_STRENGTH: ret = responseSignalStrength(p); break; + case RIL_REQUEST_VOICE_REGISTRATION_STATE: ret = responseStrings(p); break; + case RIL_REQUEST_DATA_REGISTRATION_STATE: ret = responseStrings(p); break; + case RIL_REQUEST_OPERATOR: ret = responseStrings(p); break; + case RIL_REQUEST_RADIO_POWER: ret = responseVoid(p); break; + case RIL_REQUEST_DTMF: ret = responseVoid(p); break; + case RIL_REQUEST_SEND_SMS: ret = responseSMS(p); break; + case RIL_REQUEST_SEND_SMS_EXPECT_MORE: ret = responseSMS(p); break; + case RIL_REQUEST_SETUP_DATA_CALL: ret = responseSetupDataCall(p); break; + case RIL_REQUEST_SIM_IO: ret = responseICC_IO(p); break; + case RIL_REQUEST_SEND_USSD: ret = responseVoid(p); break; + case RIL_REQUEST_CANCEL_USSD: ret = responseVoid(p); break; + case RIL_REQUEST_GET_CLIR: ret = responseInts(p); break; + case RIL_REQUEST_SET_CLIR: ret = responseVoid(p); break; + case RIL_REQUEST_QUERY_CALL_FORWARD_STATUS: ret = responseCallForward(p); break; + case RIL_REQUEST_SET_CALL_FORWARD: ret = responseVoid(p); break; + case RIL_REQUEST_QUERY_CALL_WAITING: ret = responseInts(p); break; + case RIL_REQUEST_SET_CALL_WAITING: ret = responseVoid(p); break; + case RIL_REQUEST_SMS_ACKNOWLEDGE: ret = responseVoid(p); break; + case RIL_REQUEST_GET_IMEI: ret = responseString(p); break; + case RIL_REQUEST_GET_IMEISV: ret = responseString(p); break; + case RIL_REQUEST_ANSWER: ret = responseVoid(p); break; + case RIL_REQUEST_DEACTIVATE_DATA_CALL: ret = responseVoid(p); break; + case RIL_REQUEST_QUERY_FACILITY_LOCK: ret = responseInts(p); break; + case RIL_REQUEST_SET_FACILITY_LOCK: ret = responseInts(p); break; + case RIL_REQUEST_CHANGE_BARRING_PASSWORD: ret = responseVoid(p); break; + case RIL_REQUEST_QUERY_NETWORK_SELECTION_MODE: ret = responseInts(p); break; + case RIL_REQUEST_SET_NETWORK_SELECTION_AUTOMATIC: ret = responseVoid(p); break; + case RIL_REQUEST_SET_NETWORK_SELECTION_MANUAL: ret = responseVoid(p); break; + case RIL_REQUEST_QUERY_AVAILABLE_NETWORKS : ret = responseOperatorInfos(p); break; + case RIL_REQUEST_DTMF_START: ret = responseVoid(p); break; + case RIL_REQUEST_DTMF_STOP: ret = responseVoid(p); break; + case RIL_REQUEST_BASEBAND_VERSION: ret = responseString(p); break; + case RIL_REQUEST_SEPARATE_CONNECTION: ret = responseVoid(p); break; + case RIL_REQUEST_SET_MUTE: ret = responseVoid(p); break; + case RIL_REQUEST_GET_MUTE: ret = responseInts(p); break; + case RIL_REQUEST_QUERY_CLIP: ret = responseInts(p); break; + case RIL_REQUEST_LAST_DATA_CALL_FAIL_CAUSE: ret = responseInts(p); break; + case RIL_REQUEST_DATA_CALL_LIST: ret = responseDataCallList(p); break; + case RIL_REQUEST_RESET_RADIO: ret = responseVoid(p); break; + case RIL_REQUEST_OEM_HOOK_RAW: ret = responseRaw(p); break; + case RIL_REQUEST_OEM_HOOK_STRINGS: ret = responseStrings(p); break; + case RIL_REQUEST_SCREEN_STATE: ret = responseVoid(p); break; + case RIL_REQUEST_SET_SUPP_SVC_NOTIFICATION: ret = responseVoid(p); break; + case RIL_REQUEST_WRITE_SMS_TO_SIM: ret = responseInts(p); break; + case RIL_REQUEST_DELETE_SMS_ON_SIM: ret = responseVoid(p); break; + case RIL_REQUEST_SET_BAND_MODE: ret = responseVoid(p); break; + case RIL_REQUEST_QUERY_AVAILABLE_BAND_MODE: ret = responseInts(p); break; + case RIL_REQUEST_STK_GET_PROFILE: ret = responseString(p); break; + case RIL_REQUEST_STK_SET_PROFILE: ret = responseVoid(p); break; + case RIL_REQUEST_STK_SEND_ENVELOPE_COMMAND: ret = responseString(p); break; + case RIL_REQUEST_STK_SEND_TERMINAL_RESPONSE: ret = responseVoid(p); break; + case RIL_REQUEST_STK_HANDLE_CALL_SETUP_REQUESTED_FROM_SIM: ret = responseInts(p); break; + case RIL_REQUEST_EXPLICIT_CALL_TRANSFER: ret = responseVoid(p); break; + case RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE: ret = responseVoid(p); break; + case RIL_REQUEST_GET_PREFERRED_NETWORK_TYPE: ret = responseGetPreferredNetworkType(p); break; + case RIL_REQUEST_GET_NEIGHBORING_CELL_IDS: ret = responseCellList(p); break; + case RIL_REQUEST_SET_LOCATION_UPDATES: ret = responseVoid(p); break; + case RIL_REQUEST_CDMA_SET_SUBSCRIPTION_SOURCE: ret = responseVoid(p); break; + case RIL_REQUEST_CDMA_SET_ROAMING_PREFERENCE: ret = responseVoid(p); break; + case RIL_REQUEST_CDMA_QUERY_ROAMING_PREFERENCE: ret = responseInts(p); break; + case RIL_REQUEST_SET_TTY_MODE: ret = responseVoid(p); break; + case RIL_REQUEST_QUERY_TTY_MODE: ret = responseInts(p); break; + case RIL_REQUEST_CDMA_SET_PREFERRED_VOICE_PRIVACY_MODE: ret = responseVoid(p); break; + case RIL_REQUEST_CDMA_QUERY_PREFERRED_VOICE_PRIVACY_MODE: ret = responseInts(p); break; + case RIL_REQUEST_CDMA_FLASH: ret = responseVoid(p); break; + case RIL_REQUEST_CDMA_BURST_DTMF: ret = responseVoid(p); break; + case RIL_REQUEST_CDMA_SEND_SMS: ret = responseSMS(p); break; + case RIL_REQUEST_CDMA_SMS_ACKNOWLEDGE: ret = responseVoid(p); break; + case RIL_REQUEST_GSM_GET_BROADCAST_CONFIG: ret = responseGmsBroadcastConfig(p); break; + case RIL_REQUEST_GSM_SET_BROADCAST_CONFIG: ret = responseVoid(p); break; + case RIL_REQUEST_GSM_BROADCAST_ACTIVATION: ret = responseVoid(p); break; + case RIL_REQUEST_CDMA_GET_BROADCAST_CONFIG: ret = responseCdmaBroadcastConfig(p); break; + case RIL_REQUEST_CDMA_SET_BROADCAST_CONFIG: ret = responseVoid(p); break; + case RIL_REQUEST_CDMA_BROADCAST_ACTIVATION: ret = responseVoid(p); break; + case RIL_REQUEST_CDMA_VALIDATE_AND_WRITE_AKEY: ret = responseVoid(p); break; + case RIL_REQUEST_CDMA_SUBSCRIPTION: ret = responseStrings(p); break; + case RIL_REQUEST_CDMA_WRITE_SMS_TO_RUIM: ret = responseInts(p); break; + case RIL_REQUEST_CDMA_DELETE_SMS_ON_RUIM: ret = responseVoid(p); break; + case RIL_REQUEST_DEVICE_IDENTITY: ret = responseStrings(p); break; + case RIL_REQUEST_GET_SMSC_ADDRESS: ret = responseString(p); break; + case RIL_REQUEST_SET_SMSC_ADDRESS: ret = responseVoid(p); break; + case RIL_REQUEST_EXIT_EMERGENCY_CALLBACK_MODE: ret = responseVoid(p); break; + case RIL_REQUEST_REPORT_SMS_MEMORY_STATUS: ret = responseVoid(p); break; + case RIL_REQUEST_REPORT_STK_SERVICE_IS_RUNNING: ret = responseVoid(p); break; + case RIL_REQUEST_CDMA_GET_SUBSCRIPTION_SOURCE: ret = responseInts(p); break; + case RIL_REQUEST_ISIM_AUTHENTICATION: ret = responseString(p); break; + case RIL_REQUEST_ACKNOWLEDGE_INCOMING_GSM_SMS_WITH_PDU: ret = responseVoid(p); break; + case RIL_REQUEST_STK_SEND_ENVELOPE_WITH_STATUS: ret = responseICC_IO(p); break; + case RIL_REQUEST_VOICE_RADIO_TECH: ret = responseInts(p); break; + case RIL_REQUEST_GET_CELL_INFO_LIST: ret = responseCellInfoList(p); break; + case RIL_REQUEST_SET_UNSOL_CELL_INFO_LIST_RATE: ret = responseVoid(p); break; + case RIL_REQUEST_SET_INITIAL_ATTACH_APN: ret = responseVoid(p); break; + case RIL_REQUEST_SET_DATA_PROFILE: ret = responseVoid(p); break; + case RIL_REQUEST_IMS_REGISTRATION_STATE: ret = responseInts(p); break; + case RIL_REQUEST_IMS_SEND_SMS: ret = responseSMS(p); break; + case RIL_REQUEST_SIM_TRANSMIT_APDU_BASIC: ret = responseICC_IO(p); break; + case RIL_REQUEST_SIM_OPEN_CHANNEL: ret = responseInts(p); break; + case RIL_REQUEST_SIM_CLOSE_CHANNEL: ret = responseVoid(p); break; + case RIL_REQUEST_SIM_TRANSMIT_APDU_CHANNEL: ret = responseICC_IO(p); break; + case RIL_REQUEST_SIM_GET_ATR: ret = responseString(p); break; + case RIL_REQUEST_NV_READ_ITEM: ret = responseString(p); break; + case RIL_REQUEST_NV_WRITE_ITEM: ret = responseVoid(p); break; + case RIL_REQUEST_NV_WRITE_CDMA_PRL: ret = responseVoid(p); break; + case RIL_REQUEST_NV_RESET_CONFIG: ret = responseVoid(p); break; + case RIL_REQUEST_SET_UICC_SUBSCRIPTION: ret = responseVoid(p); break; + case RIL_REQUEST_ALLOW_DATA: ret = responseVoid(p); break; + case RIL_REQUEST_GET_HARDWARE_CONFIG: ret = responseHardwareConfig(p); break; + case RIL_REQUEST_SIM_AUTHENTICATION: ret = responseICC_IOBase64(p); break; + case RIL_REQUEST_SHUTDOWN: ret = responseVoid(p); break; + case RIL_REQUEST_GET_RADIO_CAPABILITY: ret = responseRadioCapability(p); break; + case RIL_REQUEST_SET_RADIO_CAPABILITY: ret = responseRadioCapability(p); break; + case RIL_REQUEST_START_LCE: ret = responseLceStatus(p); break; + case RIL_REQUEST_STOP_LCE: ret = responseLceStatus(p); break; + case RIL_REQUEST_PULL_LCEDATA: ret = responseLceData(p); break; + case RIL_REQUEST_GET_ACTIVITY_INFO: ret = responseActivityData(p); break; + default: + throw new RuntimeException("Unrecognized solicited response: " + rr.mRequest); + //break; + }} catch (Throwable tr) { + // Exceptions here usually mean invalid RIL responses + + Rlog.w(RILJ_LOG_TAG, rr.serialString() + "< " + + requestToString(rr.mRequest) + + " exception, possible invalid RIL response", tr); + + if (rr.mResult != null) { + AsyncResult.forMessage(rr.mResult, null, tr); + rr.mResult.sendToTarget(); + } + return rr; + } + } + + if (rr.mRequest == RIL_REQUEST_SHUTDOWN) { + // Set RADIO_STATE to RADIO_UNAVAILABLE to continue shutdown process + // regardless of error code to continue shutdown procedure. + riljLog("Response to RIL_REQUEST_SHUTDOWN received. Error is " + + error + " Setting Radio State to Unavailable regardless of error."); + setRadioState(RadioState.RADIO_UNAVAILABLE); + } + + // Here and below fake RIL_UNSOL_RESPONSE_SIM_STATUS_CHANGED, see b/7255789. + // This is needed otherwise we don't automatically transition to the main lock + // screen when the pin or puk is entered incorrectly. + switch (rr.mRequest) { + case RIL_REQUEST_ENTER_SIM_PUK: + case RIL_REQUEST_ENTER_SIM_PUK2: + if (mIccStatusChangedRegistrants != null) { + if (RILJ_LOGD) { + riljLog("ON enter sim puk fakeSimStatusChanged: reg count=" + + mIccStatusChangedRegistrants.size()); + } + mIccStatusChangedRegistrants.notifyRegistrants(); + } + break; + } + + if (error != 0) { + switch (rr.mRequest) { + case RIL_REQUEST_ENTER_SIM_PIN: + case RIL_REQUEST_ENTER_SIM_PIN2: + case RIL_REQUEST_CHANGE_SIM_PIN: + case RIL_REQUEST_CHANGE_SIM_PIN2: + case RIL_REQUEST_SET_FACILITY_LOCK: + if (mIccStatusChangedRegistrants != null) { + if (RILJ_LOGD) { + riljLog("ON some errors fakeSimStatusChanged: reg count=" + + mIccStatusChangedRegistrants.size()); + } + mIccStatusChangedRegistrants.notifyRegistrants(); + } + break; + case RIL_REQUEST_GET_RADIO_CAPABILITY: { + // Ideally RIL's would support this or at least give NOT_SUPPORTED + // but the hammerhead RIL reports GENERIC :( + // TODO - remove GENERIC_FAILURE catching: b/21079604 + if (REQUEST_NOT_SUPPORTED == error || + GENERIC_FAILURE == error) { + // we should construct the RAF bitmask the radio + // supports based on preferred network bitmasks + ret = makeStaticRadioCapability(); + error = 0; + } + break; + } + case RIL_REQUEST_GET_ACTIVITY_INFO: + ret = new ModemActivityInfo(0, 0, 0, + new int [ModemActivityInfo.TX_POWER_LEVELS], 0, 0); + error = 0; + break; + } + + if (error != 0) rr.onError(error, ret); + } + if (error == 0) { + if (RILJ_LOGD) riljLog(rr.serialString() + "< " + requestToString(rr.mRequest) + + " " + retToString(rr.mRequest, ret)); + + if (rr.mResult != null) { + AsyncResult.forMessage(rr.mResult, ret, null); + rr.mResult.sendToTarget(); + } + } + + return rr; + } + + @Override + public void + dial(String address, int clirMode, UUSInfo uusInfo, Message result) { + if (PhoneNumberUtils.isEmergencyNumber(address)) { + dialEmergencyCall(address, clirMode, result); + return; + } + + RILRequest rr = RILRequest.obtain(RIL_REQUEST_DIAL, result); + rr.mParcel.writeString(address); + rr.mParcel.writeInt(clirMode); + + if (uusInfo == null) { + rr.mParcel.writeInt(0); // UUS information is absent + } else { + rr.mParcel.writeInt(1); // UUS information is present + rr.mParcel.writeInt(uusInfo.getType()); + rr.mParcel.writeInt(uusInfo.getDcs()); + rr.mParcel.writeByteArray(uusInfo.getUserData()); + } + + if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); + + send(rr); + } + + public void + dialEmergencyCall(String address, int clirMode, Message result) { + Rlog.v(RILJ_LOG_TAG, "Emergency dial: " + address); + + RILRequest rr = RILRequest.obtain(RIL_REQUEST_DIAL_EMERGENCY, result); + rr.mParcel.writeString(address + "/"); + rr.mParcel.writeInt(clirMode); + rr.mParcel.writeInt(0); // UUS information is absent + + if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); + + send(rr); + } + + @Override + protected void + processUnsolicited (Parcel p) { + int dataPosition = p.dataPosition(); + int response = p.readInt(); + + switch(response) { + case RIL_UNSOL_STK_PROACTIVE_COMMAND: + Object ret = responseString(p); + if (RILJ_LOGD) unsljLogRet(response, ret); + + if (mCatProCmdRegistrant != null) { + mCatProCmdRegistrant.notifyRegistrant( + new AsyncResult (null, ret, null)); + } else { + // The RIL will send a CAT proactive command before the + // registrant is registered. Buffer it to make sure it + // does not get ignored (and breaks CatService). + mCatProCmdBuffer = ret; + } + break; + + default: + // Rewind the Parcel + p.setDataPosition(dataPosition); + + // Forward responses that we are not overriding to the super class + super.processUnsolicited(p); + return; + } + + } + + @Override + public void setOnCatProactiveCmd(Handler h, int what, Object obj) { + mCatProCmdRegistrant = new Registrant (h, what, obj); + if (mCatProCmdBuffer != null) { + mCatProCmdRegistrant.notifyRegistrant( + new AsyncResult (null, mCatProCmdBuffer, null)); + mCatProCmdBuffer = null; + } + } + + private void + constructGsmSendSmsRilRequest (RILRequest rr, String smscPDU, String pdu) { + rr.mParcel.writeInt(2); + rr.mParcel.writeString(smscPDU); + rr.mParcel.writeString(pdu); + } + + /** + * The RIL can't handle the RIL_REQUEST_SEND_SMS_EXPECT_MORE + * request properly, so we use RIL_REQUEST_SEND_SMS instead. + */ + @Override + public void + sendSMSExpectMore (String smscPDU, String pdu, Message result) { + RILRequest rr + = RILRequest.obtain(RIL_REQUEST_SEND_SMS, result); + + constructGsmSendSmsRilRequest(rr, smscPDU, pdu); + + if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); + + send(rr); + } + +} diff --git a/rootdir/fstab.smdk4x12 b/rootdir/fstab.smdk4x12 new file mode 100644 index 0000000..507d3ed --- /dev/null +++ b/rootdir/fstab.smdk4x12 @@ -0,0 +1,21 @@ +# Android fstab file. +# <src> <mnt_point> <type> <mnt_flags and options> <fs_mgr_flags> +# The filesystem that contains the filesystem checker binary (typically /system) cannot +# specify MF_CHECK, and must come before any filesystems that do specify MF_CHECK +/dev/block/mmcblk0p3 /efs ext4 noatime,nosuid,nodev,journal_async_commit,errors=panic wait +/dev/block/mmcblk0p9 /system ext4 ro,noatime wait +/dev/block/mmcblk0p8 /cache ext4 noatime,nosuid,nodev,journal_async_commit,errors=panic wait +/dev/block/mmcblk0p10 /preload ext4 noatime,nosuid,nodev,journal_async_commit wait +/dev/block/mmcblk0p12 /data ext4 noatime,nosuid,nodev,noauto_da_alloc,journal_async_commit,errors=panic wait,check,encryptable=footer + +# vold-managed volumes ("block device" is actually a sysfs devpath) +/devices/platform/s3c-sdhci.2/mmc_host/mmc1* /storage/sdcard1 auto defaults voldmanaged=sdcard1:auto,encryptable=userdata +/devices/platform/s5p-ehci* /storage/usbdisk0 auto defaults voldmanaged=usb:auto,noemulatesd + +# recovery +/dev/block/mmcblk0p5 /boot emmc defaults recoveryonly +/dev/block/mmcblk0p6 /recovery emmc defaults recoveryonly +/dev/block/mmcblk0p7 /modem emmc defaults recoveryonly + +# zram +/dev/block/zram0 none swap defaults zramsize=268435456 diff --git a/rootdir/init.target.rc b/rootdir/init.target.rc new file mode 100644 index 0000000..1762bd7 --- /dev/null +++ b/rootdir/init.target.rc @@ -0,0 +1,62 @@ +on init + export LD_SHIM_LIBS /system/lib/libsamsung-ril.so|libsamsung_symbols.so +# ko files for FM Radio + insmod /system/lib/modules/Si4709_driver.ko + +on post-fs-data +# icd + exec icd_check + chown system system /dev/icd + chmod 0644 /dev/icd + write /dev/icdr 0 + chown system system /dev/icdr + chmod 0644 /dev/icdr + chown system system /dev/tzic + +# make param block device link for SysScope + symlink /dev/block/mmcblk0p4 /dev/block/param + +# Restorecon + restorecon_recursive /efs + +# GPS init + mkdir /data/gps + chown gps system /data/gps + chmod 1770 /data/gps + write /sys/class/sec/gps/GPS_PWR_EN/export 162 + write /sys/class/sec/gps/GPS_PWR_EN/value 0 + write /sys/class/sec/gps/GPS_PWR_EN/direction out + chown gps system /sys/class/sec/gps/GPS_PWR_EN/value + chmod 0664 /sys/class/sec/gps/GPS_PWR_EN/value + chown gps system /dev/ttySAC1 + chmod 0660 /dev/ttySAC1 + restorecon /sys/class/sec/gps/export + restorecon /sys/class/sec/gps/GPS_PWR_EN/value + restorecon /sys/class/sec/gps/GPS_PWR_EN/direction + + write /data/.cid.info 0 + restorecon /data/.cid.info + restorecon /data/ISP_CV + +on fs + # zram + swapon_all /fstab.smdk4x12 + +on boot +# cbd +service cpboot-daemon /sbin/cbd -d + class main + user root + group radio cache inet misc audio sdcard_rw log + seclabel u:r:cpboot-daemon:s0 + + +# Start GPS daemon +service gps-daemon /system/bin/sh /system/bin/gps_daemon.sh + class main + socket gps seqpacket 0660 gps system + user gps + group system inet sdcard_rw gps + seclabel u:r:glgps:s0 + + diff --git a/selinux/bluetooth.te b/selinux/bluetooth.te new file mode 100644 index 0000000..9d11918 --- /dev/null +++ b/selinux/bluetooth.te @@ -0,0 +1,6 @@ +allow bluetooth bluetooth_efs_file:dir search; +allow bluetooth bluetooth_efs_file:file read; +allow bluetooth firmware_exynos:dir { open read search }; +allow bluetooth firmware_exynos:file { open read }; +allow bluetooth sysfs:file write; +allow bluetooth efs_device_file:dir search; diff --git a/selinux/cpboot-daemon.te b/selinux/cpboot-daemon.te new file mode 100644 index 0000000..9974ff2 --- /dev/null +++ b/selinux/cpboot-daemon.te @@ -0,0 +1,25 @@ +type cpboot-daemon, domain; + +permissive cpboot-daemon; + +allow cpboot-daemon cgroup:dir { create add_name }; +allow cpboot-daemon device:dir { write remove_name add_name }; +allow cpboot-daemon efs_block_device:blk_file { read open }; +allow cpboot-daemon efs_device_file:dir search; +allow cpboot-daemon efs_file:file { read write open }; +allow cpboot-daemon init:unix_stream_socket connectto; +allow cpboot-daemon log_device:chr_file { write open }; +allow cpboot-daemon log_device:dir search; +allow cpboot-daemon property_socket:sock_file write; +allow cpboot-daemon radio_device:chr_file { read write ioctl open }; +allow cpboot-daemon radio_prop:property_service set; +allow cpboot-daemon self:capability { setuid }; +allow cpboot-daemon sysfs_radio:file { read write open }; +allow cpboot-daemon usbfs:dir search; +allow cpboot-daemon self:capability dac_override; +allow cpboot-daemon cbd_device:chr_file create_file_perms; + +# FIX ME +# allow cpboot-daemon usbfs:filesystem mount; +# allow cpboot-daemon self:capability { mknod }; + diff --git a/selinux/device.te b/selinux/device.te new file mode 100644 index 0000000..854958d --- /dev/null +++ b/selinux/device.te @@ -0,0 +1,4 @@ +type rfkill_device, dev_type; +type efs_block_device, dev_type; +type hpd_device, dev_type; +type mfc_device, dev_type; diff --git a/selinux/domain.te b/selinux/domain.te new file mode 100644 index 0000000..c8d8d53 --- /dev/null +++ b/selinux/domain.te @@ -0,0 +1 @@ +dontaudit domain kernel:system module_request; diff --git a/selinux/file.te b/selinux/file.te new file mode 100644 index 0000000..12b280a --- /dev/null +++ b/selinux/file.te @@ -0,0 +1,11 @@ +type firmware_mfc, file_type; +type firmware_exynos, file_type; + +type sensors_data_file, file_type, data_file_type; +type sysfs_display, fs_type, sysfs_type; + +type efs_device_file, file_type; +type radio_data, file_type; +type sysfs_radio, fs_type, sysfs_type; +type sysfs_sensor, fs_type, sysfs_type; +type cbd_device, dev_type; diff --git a/selinux/file_contexts b/selinux/file_contexts new file mode 100644 index 0000000..12bbd51 --- /dev/null +++ b/selinux/file_contexts @@ -0,0 +1,66 @@ +# GFX +/dev/mali u:object_r:gpu_device:s0 +/dev/ump u:object_r:gpu_device:s0 +/dev/fimg2d u:object_r:gpu_device:s0 + +# RIL +/dev/link_pm u:object_r:radio_device:s0 +/dev/umts_boot0 u:object_r:radio_device:s0 +/dev/umts_boot1 u:object_r:radio_device:s0 +/dev/umts_ipc0 u:object_r:radio_device:s0 +/dev/umts_ramdump0 u:object_r:radio_device:s0 +/dev/umts_rfs0 u:object_r:radio_device:s0 +/dev/__cbd_msg_ u:object_r:cbd_device:s0 + +/efs u:object_r:efs_device_file:s0 +/data/misc/radio(/.*)? u:object_r:radio_data:s0 +/sys/devices/platform/s5p-ohci/ohci_power u:object_r:sysfs_radio:s0 +/sys/devices/platform/s5p-ehci/ehci_power u:object_r:sysfs_radio:s0 + +# Partitions +/dev/block/mmcblk0p7 u:object_r:efs_block_device:s0 +/dev/block/mmcblk0p9 u:object_r:system_block_device:s0 +/dev/block/mmcblk0p12 u:object_r:userdata_block_device:s0 + +# Camera +/data/ISP_CV u:object_r:camera_data_file:s0 +/dev/exynos-mem u:object_r:video_device:s0 +/dev/s3c-mfc u:object_r:mfc_device:s0 + +# Bluetooth +/dev/ttySAC0 u:object_r:hci_attach_dev:s0 +/efs/bluetooth(/.*)? u:object_r:bluetooth_efs_file:s0 + +# Display +/sys/class/mdnie/mdnie(/.*)? u:object_r:sysfs_display:s0 +/sys/devices/platform/samsung-pd.2/mdnie/mdnie(/.*)? u:object_r:sysfs_display:s0 + +# GPS +/dev/ttySAC1 u:object_r:gps_device:s0 +/system/bin/gps_daemon.sh u:object_r:glgps_exec:s0 + +# Sensors +/dev/akm8975 u:object_r:sensors_device:s0 +/efs/gyro_cal_data u:object_r:sensors_data_file:s0 +/sys/class/sensors/accelerometer_sensor u:object_r:sysfs_sensor:s0 + +# Wifi +/dev/rfkill u:object_r:rfkill_device:s0 +/data/.cid.info u:object_r:wifi_data_file:s0 +/efs/wifi/.mac.info u:object_r:wifi_data_file:s0 + +# Firmwares +/system/vendor/firmware(/.*)? u:object_r:firmware_exynos:s0 +/system/vendor/firmware/mfc_fw.bin u:object_r:firmware_mfc:s0 +/data/cfw(/.*)? u:object_r:firmware_exynos:s0 + +# Vibrator +/dev/tspdrv u:object_r:input_device:s0 + +# Swap +/dev/block/zram(.*) u:object_r:swap_block_device:s0 + +# Misc +/dev/HPD u:object_r:hpd_device:s0 +/system/bin/macloader u:object_r:macloader_exec:s0 +/system/bin/tinyplay u:object_r:tinyplay_exec:s0 diff --git a/selinux/gpsd.te b/selinux/gpsd.te new file mode 100644 index 0000000..589d15f --- /dev/null +++ b/selinux/gpsd.te @@ -0,0 +1,25 @@ +type glgps, domain; +type glgps_exec, exec_type, file_type; + +init_daemon_domain(glgps) + +allow glgps shell_exec:file { rx_file_perms entrypoint }; + +#for text relocs & execution +allow glgps system_file:file { execute_no_trans execmod }; +allow glgps gps_device:chr_file { getattr setattr }; +allow glgps gps_data_file:dir { search write add_name remove_name }; +allow glgps gps_data_file:file { create rw_file_perms }; +allow glgps gps_data_file:fifo_file { unlink create setattr getattr rw_file_perms }; + +allow glgps node:udp_socket { node_bind name_bind }; +allow glgps port:tcp_socket name_connect; +allow glgps self:tcp_socket { getopt write read }; + +allow glgps sysfs:file { setattr write }; +allow glgps gps_device:chr_file { ioctl open read write }; +allow glgps glgps:udp_socket { create bind }; +allow glgps glgps:tcp_socket { create connect }; +allow glgps fwmarkd_socket:sock_file write; +allow glgps dnsproxyd_socket:sock_file write; +allow glgps netd:unix_stream_socket connectto; diff --git a/selinux/init.te b/selinux/init.te new file mode 100644 index 0000000..795e077 --- /dev/null +++ b/selinux/init.te @@ -0,0 +1,15 @@ +allow init wpa_socket:unix_dgram_socket { bind create }; +allow init init:process { execmem }; +allow init init:tcp_socket { create }; + +allow init sysfs_display:lnk_file { read setattr }; + +allow init tmpfs:lnk_file create; +allow init sysfs_sensor:lnk_file { setattr read }; + +allow init rild:process noatsecure; + +domain_trans(init, rootfs, glgps) +domain_trans(init, rootfs, cpboot-daemon) +domain_trans(init, rootfs, tinyplay) +domain_trans(init, rootfs, macloader) diff --git a/selinux/log.te b/selinux/log.te new file mode 100644 index 0000000..c3dfc80 --- /dev/null +++ b/selinux/log.te @@ -0,0 +1,3 @@ +allow domain log_device:chr_file { open write }; +allow domain log_device:dir { search }; +allow { shell debuggerd } log_device:chr_file { read }; diff --git a/selinux/macloader.te b/selinux/macloader.te new file mode 100644 index 0000000..464f201 --- /dev/null +++ b/selinux/macloader.te @@ -0,0 +1,9 @@ +type macloader, domain; +type macloader_exec, exec_type, file_type; +init_daemon_domain(macloader); + +allow macloader efs_file:dir search; +allow macloader efs_device_file:dir search; +allow macloader wifi_data_file:file { read getattr open write setattr }; +allow macloader self:capability { dac_override chown fowner fsetid }; +allow macloader system_data_file:dir w_dir_perms; diff --git a/selinux/mediaserver.te b/selinux/mediaserver.te new file mode 100644 index 0000000..cbcdcb8 --- /dev/null +++ b/selinux/mediaserver.te @@ -0,0 +1,11 @@ +allow mediaserver { firmware_exynos }:file r_file_perms; +allow mediaserver firmware_exynos:dir r_dir_perms; +allow mediaserver camera_data_file:file rw_file_perms; +allow mediaserver mfc_device:chr_file rw_file_perms; + +# Bluetooth audio +allow mediaserver bluetooth:unix_stream_socket { connectto }; + +allow mediaserver { storage_file mnt_user_file }:dir { search read }; +allow mediaserver storage_file:lnk_file read; +allow mediaserver mnt_user_file:lnk_file read; diff --git a/selinux/netd.te b/selinux/netd.te new file mode 100644 index 0000000..eff1d89 --- /dev/null +++ b/selinux/netd.te @@ -0,0 +1,3 @@ +allow netd init:tcp_socket { read write getopt }; +allow netd glgps:fd use; +allow netd glgps:tcp_socket { read write getopt setopt }; diff --git a/selinux/nfc.te b/selinux/nfc.te new file mode 100644 index 0000000..b5afda7 --- /dev/null +++ b/selinux/nfc.te @@ -0,0 +1,2 @@ +allow nfc firmware_exynos:dir search; +allow nfc log_device:chr_file write; diff --git a/selinux/rild.te b/selinux/rild.te new file mode 100644 index 0000000..5da4924 --- /dev/null +++ b/selinux/rild.te @@ -0,0 +1,20 @@ +allow rild self:netlink_socket { create bind read write }; +allow rild self:netlink_route_socket { write }; +allow rild self:netlink_kobject_uevent_socket { create bind read write setopt }; +allow rild rild:process { execmem }; + +allow rild radio_data_file:dir setattr; +allow rild unlabeled:dir search; + +allow radio log_device:chr_file w_file_perms; +allow rild log_device:chr_file w_file_perms; +allow rild system_file:file execmod; +allow rild radio_data:file create_file_perms; +allow rild radio_data:dir create_dir_perms; + +allow rild radio_device:chr_file rw_file_perms; +allow rild efs_block_device:blk_file rw_file_perms; +allow rild efs_file:file { read open write setattr }; + +allow rild efs_device_file:dir create_dir_perms; +allow rild efs_device_file:file { setattr create create_file_perms }; diff --git a/selinux/service_contexts b/selinux/service_contexts new file mode 100644 index 0000000..fb14cf2 --- /dev/null +++ b/selinux/service_contexts @@ -0,0 +1,3 @@ +SecTVOutService u:object_r:surfaceflinger_service:s0 +Exynos.HWCService u:object_r:surfaceflinger_service:s0 +Exynos.IPService u:object_r:surfaceflinger_service:s0 diff --git a/selinux/servicemanager.te b/selinux/servicemanager.te new file mode 100644 index 0000000..65337ed --- /dev/null +++ b/selinux/servicemanager.te @@ -0,0 +1,3 @@ +allow servicemanager glgps:dir { search read write }; +allow servicemanager glgps:file { open read write }; +allow servicemanager glgps:process getattr; diff --git a/selinux/surfaceflinger.te b/selinux/surfaceflinger.te new file mode 100644 index 0000000..00fa1e9 --- /dev/null +++ b/selinux/surfaceflinger.te @@ -0,0 +1 @@ +allow surfaceflinger hpd_device:chr_file rw_file_perms; diff --git a/selinux/sysinit.te b/selinux/sysinit.te new file mode 100644 index 0000000..0436ffe --- /dev/null +++ b/selinux/sysinit.te @@ -0,0 +1,7 @@ +allow sysinit firmware_exynos:dir { read search open getattr }; +allow sysinit userinit_exec:file { getattr execute execute_no_trans read open }; +allow sysinit firmware_exynos:dir { read search open getattr write remove_name add_name }; +allow sysinit firmware_exynos:file { read open write getattr setattr create unlink }; +allow sysinit sysinit:capability { dac_override chown fowner fsetid }; +allow sysinit unlabeled:dir { search }; +allow sysinit surfaceflinger_exec:file { getattr }; diff --git a/selinux/system_app.te b/selinux/system_app.te new file mode 100644 index 0000000..8542dc2 --- /dev/null +++ b/selinux/system_app.te @@ -0,0 +1,2 @@ +allow system_app sysfs_display:{ file lnk_file } { getattr open read write }; +allow system_app sysfs_display:dir { search }; diff --git a/selinux/system_server.te b/selinux/system_server.te new file mode 100644 index 0000000..b9cc2f2 --- /dev/null +++ b/selinux/system_server.te @@ -0,0 +1,33 @@ +allow system_server input_device:chr_file { read ioctl write open }; +allow system_server sensors_device:chr_file { read open }; +allow system_server sensors_data_file:file r_file_perms; +allow system_server wpa_socket:unix_dgram_socket sendto; + +allow system_server sysfs:file { read open write }; +allow system_server self:capability { sys_module }; + +allow system_server efs_file:dir search; +allow system_server efs_file:file read; +allow system_server efs_device_file:dir search; +allow system_server uhid_device:chr_file { read ioctl write open }; +allow system_server storage_stub_file:dir getattr; + + +# for sensors +allow system_server system_file:file execmod; + +# /efs/wifi/.mac.info +allow system_server wifi_data_file:file { read open }; + +allow system_server glgps:binder transfer; +type_transition system_server system_data_file:fifo_file gps_data_file ".gps.interface.pipe.to_jni"; + +# Access .gps.interface.pipe.to_gpsd. +allow system_server gps_data_file:dir rw_dir_perms; +allow system_server gps_data_file:fifo_file { setattr rw_file_perms create }; + +# Access /data/sensors/gps* socket +allow system_server gps_data_file:sock_file create_file_perms; +allow system_server gps_data_file:dir rw_dir_perms; +allow system_server gps_data_file:file rw_file_perms; + diff --git a/selinux/tinyplay.te b/selinux/tinyplay.te new file mode 100644 index 0000000..ef7de81 --- /dev/null +++ b/selinux/tinyplay.te @@ -0,0 +1,6 @@ +type tinyplay, domain; +type tinyplay_exec, exec_type, file_type; +init_daemon_domain(tinyplay) + +allow tinyplay audio_device:chr_file { open read write ioctl }; +allow tinyplay audio_device:dir search; diff --git a/selinux/ueventd.te b/selinux/ueventd.te new file mode 100644 index 0000000..315ccb3 --- /dev/null +++ b/selinux/ueventd.te @@ -0,0 +1,5 @@ +# Firmwares +allow ueventd { firmware_mfc }:file r_file_perms; +allow ueventd { firmware_exynos }:dir search; +allow ueventd { firmware_exynos }:file { read getattr open }; +allow ueventd sysfs_display:file { write open }; diff --git a/selinux/untrusted_app.te b/selinux/untrusted_app.te new file mode 100644 index 0000000..f9c5bde --- /dev/null +++ b/selinux/untrusted_app.te @@ -0,0 +1,5 @@ +allow untrusted_app storage_stub_file:dir getattr; +allow untrusted_app log_device:chr_file { read write }; +allow untrusted_app self:udp_socket ioctl; +allow untrusted_app app_data_file:file create_file_perms; +allow untrusted_app app_data_file:dir create_dir_perms; diff --git a/selinux/vold.te b/selinux/vold.te new file mode 100644 index 0000000..b39e3e3 --- /dev/null +++ b/selinux/vold.te @@ -0,0 +1,11 @@ +allow vold kernel:process setsched; +allow vold sdcardd_exec:file { read open execute execute_no_trans }; + +allow vold log_device:dir search; +allow vold storage_stub_file:dir { read open }; +allow vold blkid_exec:file { getattr execute read open execute_no_trans }; + +allow vold log_device:chr_file { write open }; + +allow vold efs_device_file:dir rw_file_perms; +allow vold efs_device_file:file rw_file_perms; diff --git a/selinux/wpa_supplicant.te b/selinux/wpa_supplicant.te new file mode 100644 index 0000000..9b806e0 --- /dev/null +++ b/selinux/wpa_supplicant.te @@ -0,0 +1,12 @@ +allow wpa init:unix_dgram_socket { read write }; + +# logwrapper used with wpa_supplicant +allow wpa devpts:chr_file { read write }; +allow wpa log_device:chr_file { write }; + +allow wpa wpa_socket:unix_dgram_socket { read write }; +allow wpa_socket system_app:unix_dgram_socket sendto; + +allow wpa_socket wifi_data_file:sock_file unlink; + +allow wpa rfkill_device:chr_file rw_file_perms; diff --git a/selinux/zygote.te b/selinux/zygote.te new file mode 100644 index 0000000..4de92c2 --- /dev/null +++ b/selinux/zygote.te @@ -0,0 +1 @@ +allow zygote log_device:dir search; diff --git a/sensors/orientation.c b/sensors/orientation.c deleted file mode 100644 index e3529bd..0000000 --- a/sensors/orientation.c +++ /dev/null @@ -1,444 +0,0 @@ -/* - * Copyright (C) 2013 Paul Kocialkowski <contact@paulk.fr> - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#include <stdlib.h> -#include <unistd.h> -#include <stddef.h> -#include <fcntl.h> -#include <errno.h> -#include <math.h> -#include <linux/ioctl.h> -#include <linux/uinput.h> -#include <linux/input.h> - -#include <hardware/sensors.h> -#include <hardware/hardware.h> - -#define LOG_TAG "smdk4x12_sensors" -#include <utils/Log.h> - -#include "smdk4x12_sensors.h" - -struct orientation_data { - struct smdk4x12_sensors_handlers *acceleration_sensor; - struct smdk4x12_sensors_handlers *magnetic_sensor; - - sensors_vec_t orientation; - sensors_vec_t acceleration; - sensors_vec_t magnetic; - - long int delay; - int uinput_fd; - - pthread_t thread; - pthread_mutex_t mutex; - int thread_continue; -}; - -static float rad2deg(float v) -{ - return (v * 180.0f / 3.1415926535f); -} - -static float vector_scalar(sensors_vec_t *v, sensors_vec_t *d) -{ - return v->x * d->x + v->y * d->y + v->z * d->z; -} - -static float vector_length(sensors_vec_t *v) -{ - return sqrtf(vector_scalar(v, v)); -} - -void orientation_calculate(sensors_vec_t *a, sensors_vec_t *m, sensors_vec_t *o) -{ - float azimuth, pitch, roll; - float la, sinp, cosp, sinr, cosr, x, y; - - if (a == NULL || m == NULL || o == NULL) - return; - - la = vector_length(a); - pitch = asinf(-(a->y) / la); - roll = asinf((a->x) / la); - - sinp = sinf(pitch); - cosp = cosf(pitch); - sinr = sinf(roll); - cosr = cosf(roll); - - y = -(m->x) * cosr + m->z * sinr; - x = m->x * sinp * sinr + m->y * cosp + m->z * sinp * cosr; - azimuth = atan2f(y, x); - - o->azimuth = rad2deg(azimuth); - o->pitch = rad2deg(pitch); - o->roll = rad2deg(roll); - - if (o->azimuth < 0) - o->azimuth += 360.0f; -} - -void *orientation_thread(void *thread_data) -{ - struct smdk4x12_sensors_handlers *handlers = NULL; - struct orientation_data *data = NULL; - struct input_event event; - struct timeval time; - long int before, after; - int diff; - int uinput_fd; - - if (thread_data == NULL) - return NULL; - - handlers = (struct smdk4x12_sensors_handlers *) thread_data; - if (handlers->data == NULL) - return NULL; - - data = (struct orientation_data *) handlers->data; - - uinput_fd = data->uinput_fd; - if (uinput_fd < 0) - return NULL; - - while (data->thread_continue) { - pthread_mutex_lock(&data->mutex); - if (!data->thread_continue) - break; - - while (handlers->activated) { - gettimeofday(&time, NULL); - before = timestamp(&time); - - orientation_calculate(&data->acceleration, &data->magnetic, &data->orientation); - - input_event_set(&event, EV_REL, REL_X, (int) (data->orientation.azimuth * 1000)); - write(uinput_fd, &event, sizeof(event)); - input_event_set(&event, EV_REL, REL_Y, (int) (data->orientation.pitch * 1000)); - write(uinput_fd, &event, sizeof(event)); - input_event_set(&event, EV_REL, REL_Z, (int) (data->orientation.roll * 1000)); - write(uinput_fd, &event, sizeof(event)); - input_event_set(&event, EV_SYN, 0, 0); - write(uinput_fd, &event, sizeof(event)); - - gettimeofday(&time, NULL); - after = timestamp(&time); - - diff = (int) (data->delay - (after - before)) / 1000; - if (diff <= 0) - continue; - - usleep(diff); - } - } - - return NULL; -} - -int orientation_fill(struct smdk4x12_sensors_handlers *handlers, - sensors_vec_t *acceleration, sensors_vec_t *magnetic) -{ - struct orientation_data *data; - -// ALOGD("%s(%p, %p, %p)", __func__, handlers, acceleration, magnetic); - - if (handlers == NULL || handlers->data == NULL) - return -EINVAL; - - data = (struct orientation_data *) handlers->data; - - if (acceleration != NULL) { - data->acceleration.x = acceleration->x; - data->acceleration.y = acceleration->y; - data->acceleration.z = acceleration->z; - } - - if (magnetic != NULL) { - data->magnetic.x = magnetic->x; - data->magnetic.y = magnetic->y; - data->magnetic.z = magnetic->z; - } - - return 0; -} - -int orientation_init(struct smdk4x12_sensors_handlers *handlers, - struct smdk4x12_sensors_device *device) -{ - struct orientation_data *data = NULL; - pthread_attr_t thread_attr; - int uinput_fd = -1; - int input_fd = -1; - int rc; - int i; - - ALOGD("%s(%p, %p)", __func__, handlers, device); - - if (handlers == NULL || device == NULL) - return -EINVAL; - - data = (struct orientation_data *) calloc(1, sizeof(struct orientation_data)); - - for (i = 0; i < device->handlers_count; i++) { - if (device->handlers[i] == NULL) - continue; - - if (device->handlers[i]->handle == SENSOR_TYPE_ACCELEROMETER) - data->acceleration_sensor = device->handlers[i]; - else if (device->handlers[i]->handle == SENSOR_TYPE_MAGNETIC_FIELD) - data->magnetic_sensor = device->handlers[i]; - } - - if (data->acceleration_sensor == NULL || data->magnetic_sensor == NULL) { - ALOGE("%s: Missing sensors for orientation", __func__); - goto error; - } - - uinput_fd = uinput_rel_create("orientation"); - if (uinput_fd < 0) { - ALOGD("%s: Unable to create uinput", __func__); - goto error; - } - - input_fd = input_open("orientation"); - if (input_fd < 0) { - ALOGE("%s: Unable to open orientation input", __func__); - goto error; - } - - data->thread_continue = 1; - - pthread_mutex_init(&data->mutex, NULL); - pthread_mutex_lock(&data->mutex); - - pthread_attr_init(&thread_attr); - pthread_attr_setdetachstate(&thread_attr, PTHREAD_CREATE_DETACHED); - - rc = pthread_create(&data->thread, &thread_attr, orientation_thread, (void *) handlers); - if (rc < 0) { - ALOGE("%s: Unable to create orientation thread", __func__); - pthread_mutex_destroy(&data->mutex); - goto error; - } - - data->uinput_fd = uinput_fd; - handlers->poll_fd = input_fd; - handlers->data = (void *) data; - - return 0; - -error: - if (data != NULL) - free(data); - - if (uinput_fd >= 0) - close(uinput_fd); - - if (input_fd >= 0) - close(input_fd); - - handlers->poll_fd = -1; - handlers->data = NULL; - - return -1; -} - -int orientation_deinit(struct smdk4x12_sensors_handlers *handlers) -{ - struct orientation_data *data; - - ALOGD("%s(%p)", __func__, handlers); - - if (handlers == NULL || handlers->data == NULL) - return -EINVAL; - - data = (struct orientation_data *) handlers->data; - - handlers->activated = 0; - data->thread_continue = 0; - pthread_mutex_unlock(&data->mutex); - - pthread_mutex_destroy(&data->mutex); - - if (data->uinput_fd >= 0) { - uinput_destroy(data->uinput_fd); - close(data->uinput_fd); - } - data->uinput_fd = -1; - - if (handlers->poll_fd >= 0) - close(handlers->poll_fd); - handlers->poll_fd = -1; - - free(handlers->data); - handlers->data = NULL; - - return 0; -} - -int orientation_activate(struct smdk4x12_sensors_handlers *handlers) -{ - struct orientation_data *data; - - ALOGD("%s(%p)", __func__, handlers); - - if (handlers == NULL || handlers->data == NULL) - return -EINVAL; - - data = (struct orientation_data *) handlers->data; - - if (data->acceleration_sensor == NULL || data->magnetic_sensor == NULL) - return -1; - - data->acceleration_sensor->needed |= SMDK4x12_SENSORS_NEEDED_ORIENTATION; - if (data->acceleration_sensor->needed == SMDK4x12_SENSORS_NEEDED_ORIENTATION) - data->acceleration_sensor->activate(data->acceleration_sensor); - - data->magnetic_sensor->needed |= SMDK4x12_SENSORS_NEEDED_ORIENTATION; - if (data->magnetic_sensor->needed == SMDK4x12_SENSORS_NEEDED_ORIENTATION) - data->magnetic_sensor->activate(data->magnetic_sensor); - - handlers->activated = 1; - pthread_mutex_unlock(&data->mutex); - - return 0; -} - -int orientation_deactivate(struct smdk4x12_sensors_handlers *handlers) -{ - struct orientation_data *data; - - ALOGD("%s(%p)", __func__, handlers); - - if (handlers == NULL || handlers->data == NULL) - return -EINVAL; - - data = (struct orientation_data *) handlers->data; - - if (data->acceleration_sensor == NULL || data->magnetic_sensor == NULL) - return -1; - - data->acceleration_sensor->needed &= ~(SMDK4x12_SENSORS_NEEDED_ORIENTATION); - if (data->acceleration_sensor->needed == 0) - data->acceleration_sensor->deactivate(data->acceleration_sensor); - - data->magnetic_sensor->needed &= ~(SMDK4x12_SENSORS_NEEDED_ORIENTATION); - if (data->magnetic_sensor->needed == 0) - data->magnetic_sensor->deactivate(data->magnetic_sensor); - - handlers->activated = 0; - - return 0; -} - -int orientation_set_delay(struct smdk4x12_sensors_handlers *handlers, - long int delay) -{ - struct orientation_data *data; - - ALOGD("%s(%p)", __func__, handlers); - - if (handlers == NULL || handlers->data == NULL) - return -EINVAL; - - data = (struct orientation_data *) handlers->data; - - if (data->acceleration_sensor == NULL || data->magnetic_sensor == NULL) - return -1; - - if (data->acceleration_sensor->needed == SMDK4x12_SENSORS_NEEDED_ORIENTATION) - data->acceleration_sensor->set_delay(data->acceleration_sensor, delay); - - if (data->magnetic_sensor->needed == SMDK4x12_SENSORS_NEEDED_ORIENTATION) - data->magnetic_sensor->set_delay(data->magnetic_sensor, delay); - - data->delay = delay; - - return 0; -} - -float orientation_convert(int value) -{ - return (float) value / 1000.0f; -} - -int orientation_get_data(struct smdk4x12_sensors_handlers *handlers, - struct sensors_event_t *event) -{ - struct input_event input_event; - int input_fd = -1; - int rc; - -// ALOGD("%s(%p, %p)", __func__, handlers, event); - - if (handlers == NULL || event == NULL) - return -EINVAL; - - input_fd = handlers->poll_fd; - if (input_fd < 0) - return -EINVAL; - - memset(event, 0, sizeof(struct sensors_event_t)); - event->version = sizeof(struct sensors_event_t); - event->sensor = handlers->handle; - event->type = handlers->handle; - - event->orientation.status = SENSOR_STATUS_ACCURACY_MEDIUM; - - do { - rc = read(input_fd, &input_event, sizeof(input_event)); - if (rc < (int) sizeof(input_event)) - break; - - if (input_event.type == EV_REL) { - switch (input_event.code) { - case REL_X: - event->orientation.azimuth = orientation_convert(input_event.value); - break; - case REL_Y: - event->orientation.pitch = orientation_convert(input_event.value); - break; - case REL_Z: - event->orientation.roll = orientation_convert(input_event.value); - break; - default: - continue; - } - } else if (input_event.type == EV_SYN) { - if (input_event.code == SYN_REPORT) - event->timestamp = input_timestamp(&input_event); - } - } while (input_event.type != EV_SYN); - - return 0; -} - -struct smdk4x12_sensors_handlers orientation = { - .name = "Orientation", - .handle = SENSOR_TYPE_ORIENTATION, - .init = orientation_init, - .deinit = orientation_deinit, - .activate = orientation_activate, - .deactivate = orientation_deactivate, - .set_delay = orientation_set_delay, - .get_data = orientation_get_data, - .activated = 0, - .needed = 0, - .poll_fd = -1, - .data = NULL, -}; diff --git a/system.prop b/system.prop index 7f5be16..975f696 100644 --- a/system.prop +++ b/system.prop @@ -3,7 +3,8 @@ # dalvik.vm.dexopt-data-only=1 -rild.libpath=/system/lib/libsamsung-ril.so +rild.libpath=/system/lib/ril-wrapper.so rild.libargs=-d /dev/ttyS0 +ro.ril.telephony.mqanelements=5 ro.sf.lcd_density=320 ro.lcd_min_brightness=20 |