summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKalimochoAz <calimochoazucarado@gmail.com>2012-04-03 21:25:23 +0200
committerKalimochoAz <calimochoazucarado@gmail.com>2012-04-03 21:25:23 +0200
commit2a8b3a06026758f08062c68041a6fe194e982aa9 (patch)
treebc044cf8098a8cd0fa43f07dd65925035c75e731
parent7c2f80683a3c22a26be6e9ccc535cf6045b380da (diff)
parente9df5ccf43ebac547647921965968781ef3980b4 (diff)
downloaddevice_samsung_tuna-2a8b3a06026758f08062c68041a6fe194e982aa9.zip
device_samsung_tuna-2a8b3a06026758f08062c68041a6fe194e982aa9.tar.gz
device_samsung_tuna-2a8b3a06026758f08062c68041a6fe194e982aa9.tar.bz2
Merge remote branch 'remotes/google/master' into HEAD
Conflicts: kernel
-rwxr-xr-xaudio/audio_hw.c177
-rw-r--r--board-info.txt2
-rw-r--r--device.mk4
-rwxr-xr-xinit.tuna.usb.rc11
-rw-r--r--mms144_ts_rev31.fwbin31760 -> 31760 bytes
-rw-r--r--mms144_ts_rev32.fwbin31760 -> 31760 bytes
-rw-r--r--recovery/Android.mk4
-rw-r--r--recovery/recovery_updater.c65
-rw-r--r--releasetools.py8
-rw-r--r--sec_jack.kcm15
-rw-r--r--sec_jack.kl17
-rw-r--r--ueventd.tuna.rc3
12 files changed, 252 insertions, 54 deletions
diff --git a/audio/audio_hw.c b/audio/audio_hw.c
index b5b8114..310bce7 100755
--- a/audio/audio_hw.c
+++ b/audio/audio_hw.c
@@ -228,6 +228,8 @@ struct pcm_config pcm_config_mm = {
.period_size = LONG_PERIOD_SIZE,
.period_count = PLAYBACK_LONG_PERIOD_COUNT,
.format = PCM_FORMAT_S16_LE,
+ .start_threshold = SHORT_PERIOD_SIZE * 2,
+ .avail_min = LONG_PERIOD_SIZE,
};
struct pcm_config pcm_config_mm_ul = {
@@ -502,12 +504,19 @@ struct tuna_audio_device {
struct ril_handle ril;
};
+enum pcm_type {
+ PCM_NORMAL = 0,
+ PCM_SPDIF,
+ PCM_HDMI,
+ PCM_TOTAL,
+};
+
struct tuna_stream_out {
struct audio_stream_out stream;
pthread_mutex_t lock; /* see note below on mutex acquisition order */
- struct pcm_config config;
- struct pcm *pcm;
+ struct pcm_config config[PCM_TOTAL];
+ struct pcm *pcm[PCM_TOTAL];
struct resampler_itfe *resampler;
char *buffer;
int standby;
@@ -1097,8 +1106,9 @@ static void select_input_device(struct tuna_audio_device *adev)
static int start_output_stream(struct tuna_stream_out *out)
{
struct tuna_audio_device *adev = out->dev;
- unsigned int card = CARD_TUNA_DEFAULT;
- unsigned int port = PORT_MM;
+ unsigned int flags = PCM_OUT | PCM_MMAP | PCM_NOIRQ;
+ int i;
+ bool success = true;
adev->active_output = out;
@@ -1106,39 +1116,55 @@ static int start_output_stream(struct tuna_stream_out *out)
/* FIXME: only works if only one output can be active at a time */
select_output_device(adev);
}
- /* S/PDIF takes priority over HDMI audio. In the case of multiple
- * devices, this will cause use of S/PDIF or HDMI only */
- out->config.rate = MM_FULL_POWER_SAMPLING_RATE;
- if (adev->devices & AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET)
- port = PORT_SPDIF;
- else if(adev->devices & AUDIO_DEVICE_OUT_AUX_DIGITAL) {
- card = CARD_OMAP4_HDMI;
- port = PORT_HDMI;
- out->config.rate = MM_LOW_POWER_SAMPLING_RATE;
- }
+
/* default to low power: will be corrected in out_write if necessary before first write to
* tinyalsa.
*/
out->write_threshold = PLAYBACK_LONG_PERIOD_COUNT * LONG_PERIOD_SIZE;
- out->config.start_threshold = SHORT_PERIOD_SIZE * 2;
- out->config.avail_min = LONG_PERIOD_SIZE;
out->low_power = 1;
- out->pcm = pcm_open(card, port, PCM_OUT | PCM_MMAP | PCM_NOIRQ, &out->config);
+ if (adev->devices & (AUDIO_DEVICE_OUT_ALL &
+ ~(AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET | AUDIO_DEVICE_OUT_AUX_DIGITAL))) {
+ /* Something not a dock in use */
+ out->config[PCM_NORMAL] = pcm_config_mm;
+ out->config[PCM_NORMAL].rate = MM_FULL_POWER_SAMPLING_RATE;
+ out->pcm[PCM_NORMAL] = pcm_open(CARD_TUNA_DEFAULT, PORT_MM, flags, &out->config[PCM_NORMAL]);
+ }
- if (!pcm_is_ready(out->pcm)) {
- LOGE("cannot open pcm_out driver: %s", pcm_get_error(out->pcm));
- pcm_close(out->pcm);
- adev->active_output = NULL;
- return -ENOMEM;
+ if (adev->devices & AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET) {
+ /* SPDIF output in use */
+ out->config[PCM_SPDIF] = pcm_config_mm;
+ out->config[PCM_SPDIF].rate = MM_FULL_POWER_SAMPLING_RATE;
+ out->pcm[PCM_SPDIF] = pcm_open(CARD_TUNA_DEFAULT, PORT_SPDIF, flags, &out->config[PCM_SPDIF]);
+ }
+
+ if(adev->devices & AUDIO_DEVICE_OUT_AUX_DIGITAL) {
+ /* HDMI output in use */
+ out->config[PCM_HDMI] = pcm_config_mm;
+ out->config[PCM_HDMI].rate = MM_LOW_POWER_SAMPLING_RATE;
+ out->pcm[PCM_HDMI] = pcm_open(CARD_OMAP4_HDMI, PORT_HDMI, flags, &out->config[PCM_HDMI]);
}
- if (adev->echo_reference != NULL)
- out->echo_reference = adev->echo_reference;
+ /* Close any PCMs that could not be opened properly and return an error */
+ for (i = 0; i < PCM_TOTAL; i++) {
+ if (out->pcm[i] && !pcm_is_ready(out->pcm[i])) {
+ LOGE("cannot open pcm_out driver: %s", pcm_get_error(out->pcm[i]));
+ pcm_close(out->pcm[i]);
+ out->pcm[i] = NULL;
+ success = false;
+ }
+ }
- out->resampler->reset(out->resampler);
+ if (success) {
+ if (adev->echo_reference != NULL)
+ out->echo_reference = adev->echo_reference;
+ out->resampler->reset(out->resampler);
- return 0;
+ return 0;
+ }
+
+ adev->active_output = NULL;
+ return -ENOMEM;
}
static int check_input_parameters(uint32_t sample_rate, int format, int channel_count)
@@ -1245,8 +1271,13 @@ static int get_playback_delay(struct tuna_stream_out *out,
{
size_t kernel_frames;
int status;
+ int primary_pcm = 0;
+
+ /* Find the first active PCM to act as primary */
+ while ((primary_pcm < PCM_TOTAL) && !out->pcm[primary_pcm])
+ primary_pcm++;
- status = pcm_get_htimestamp(out->pcm, &kernel_frames, &buffer->time_stamp);
+ status = pcm_get_htimestamp(out->pcm[primary_pcm], &kernel_frames, &buffer->time_stamp);
if (status < 0) {
buffer->time_stamp.tv_sec = 0;
buffer->time_stamp.tv_nsec = 0;
@@ -1256,7 +1287,7 @@ static int get_playback_delay(struct tuna_stream_out *out,
return status;
}
- kernel_frames = pcm_get_buffer_size(out->pcm) - kernel_frames;
+ kernel_frames = pcm_get_buffer_size(out->pcm[primary_pcm]) - kernel_frames;
/* adjust render time stamp with delay added by current driver buffer.
* Add the duration of current frame as we want the render time of the last
@@ -1283,8 +1314,9 @@ static size_t out_get_buffer_size(const struct audio_stream *stream)
/* take resampling into account and return the closest majoring
multiple of 16 frames, as audioflinger expects audio buffers to
- be a multiple of 16 frames */
- size_t size = (SHORT_PERIOD_SIZE * DEFAULT_OUT_SAMPLING_RATE) / out->config.rate;
+ be a multiple of 16 frames. Note: we use the default rate here
+ from pcm_config_mm.rate. */
+ size_t size = (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);
}
@@ -1308,10 +1340,15 @@ static int out_set_format(struct audio_stream *stream, int format)
static int do_output_standby(struct tuna_stream_out *out)
{
struct tuna_audio_device *adev = out->dev;
+ int i;
if (!out->standby) {
- pcm_close(out->pcm);
- out->pcm = NULL;
+ for (i = 0; i < PCM_TOTAL; i++) {
+ if (out->pcm[i]) {
+ pcm_close(out->pcm[i]);
+ out->pcm[i] = NULL;
+ }
+ }
adev->active_output = 0;
@@ -1377,11 +1414,26 @@ static int out_set_parameters(struct audio_stream *stream, const char *kvpairs)
adev->active_input->source == AUDIO_SOURCE_VOICE_COMMUNICATION) {
force_input_standby = true;
}
- /* force standby if moving to/from HDMI */
+ /* force standby if moving to/from HDMI/SPDIF or if the output
+ * device changes when in HDMI/SPDIF mode */
+
+ /* FIXME workaround for audio being dropped when switching path without forcing standby
+ * (several hundred ms of audio can be lost: e.g beginning of a ringtone. We must understand
+ * the root cause in audio HAL, driver or ABE.
+ if (((val & AUDIO_DEVICE_OUT_AUX_DIGITAL) ^
+ (adev->devices & AUDIO_DEVICE_OUT_AUX_DIGITAL)) ||
+ ((val & AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET) ^
+ (adev->devices & AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET)) ||
+ (adev->devices & (AUDIO_DEVICE_OUT_AUX_DIGITAL |
+ AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET)))
+ */
if (((val & AUDIO_DEVICE_OUT_AUX_DIGITAL) ^
(adev->devices & AUDIO_DEVICE_OUT_AUX_DIGITAL)) ||
((val & AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET) ^
- (adev->devices & AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET)))
+ (adev->devices & AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET)) ||
+ (adev->devices & (AUDIO_DEVICE_OUT_AUX_DIGITAL |
+ AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET)) ||
+ (val == AUDIO_DEVICE_OUT_SPEAKER))
do_output_standby(out);
}
adev->devices &= ~AUDIO_DEVICE_OUT_ALL;
@@ -1411,7 +1463,8 @@ static uint32_t out_get_latency(const struct audio_stream_out *stream)
{
struct tuna_stream_out *out = (struct tuna_stream_out *)stream;
- return (SHORT_PERIOD_SIZE * PLAYBACK_SHORT_PERIOD_COUNT * 1000) / out->config.rate;
+ /* Note: we use the default rate here from pcm_config_mm.rate */
+ return (SHORT_PERIOD_SIZE * PLAYBACK_SHORT_PERIOD_COUNT * 1000) / pcm_config_mm.rate;
}
static int out_set_volume(struct audio_stream_out *stream, float left,
@@ -1434,6 +1487,11 @@ static ssize_t out_write(struct audio_stream_out *stream, const void* buffer,
bool low_power;
int kernel_frames;
void *buf;
+ /* If we're in out_write, we will find at least one pcm active */
+ int primary_pcm = -1;
+ int i;
+ bool use_resampler = false;
+ int period_size = 0;
/* acquiring hw device mutex systematically is useful if a low priority thread is waiting
* on the output stream mutex - e.g. executing select_mode() while holding the hw device
@@ -1459,27 +1517,39 @@ static ssize_t out_write(struct audio_stream_out *stream, const void* buffer,
if (low_power != out->low_power) {
if (low_power) {
out->write_threshold = LONG_PERIOD_SIZE * PLAYBACK_LONG_PERIOD_COUNT;
- out->config.avail_min = LONG_PERIOD_SIZE;
+ period_size = LONG_PERIOD_SIZE;
} else {
out->write_threshold = SHORT_PERIOD_SIZE * PLAYBACK_SHORT_PERIOD_COUNT;
- out->config.avail_min = SHORT_PERIOD_SIZE;
+ period_size = SHORT_PERIOD_SIZE;
+
}
- pcm_set_avail_min(out->pcm, out->config.avail_min);
out->low_power = low_power;
}
+ for (i = 0; i < PCM_TOTAL; i++) {
+ if (out->pcm[i]) {
+ /* Make the first active PCM act as primary */
+ if (primary_pcm < 0)
+ primary_pcm = i;
+
+ if (period_size)
+ pcm_set_avail_min(out->pcm[i], period_size);
+
+ if (out->config[i].rate != DEFAULT_OUT_SAMPLING_RATE)
+ use_resampler = true;
+ }
+ }
+
/* only use resampler if required */
- if (out->config.rate != DEFAULT_OUT_SAMPLING_RATE) {
+ if (use_resampler)
out->resampler->resample_from_input(out->resampler,
(int16_t *)buffer,
&in_frames,
(int16_t *)out->buffer,
&out_frames);
- buf = out->buffer;
- } else {
+ else
out_frames = in_frames;
- buf = (void *)buffer;
- }
+
if (out->echo_reference != NULL) {
struct echo_reference_buffer b;
b.raw = (void *)buffer;
@@ -1493,9 +1563,9 @@ static ssize_t out_write(struct audio_stream_out *stream, const void* buffer,
do {
struct timespec time_stamp;
- if (pcm_get_htimestamp(out->pcm, (unsigned int *)&kernel_frames, &time_stamp) < 0)
+ if (pcm_get_htimestamp(out->pcm[primary_pcm], (unsigned int *)&kernel_frames, &time_stamp) < 0)
break;
- kernel_frames = pcm_get_buffer_size(out->pcm) - kernel_frames;
+ kernel_frames = pcm_get_buffer_size(out->pcm[primary_pcm]) - kernel_frames;
if (kernel_frames > out->write_threshold) {
unsigned long time = (unsigned long)
@@ -1507,7 +1577,20 @@ static ssize_t out_write(struct audio_stream_out *stream, const void* buffer,
}
} while (kernel_frames > out->write_threshold);
- ret = pcm_mmap_write(out->pcm, (void *)buf, out_frames * frame_size);
+ /* Write to all active PCMs */
+ for (i = 0; i < PCM_TOTAL; i++) {
+ if (out->pcm[i]) {
+ if (out->config[i].rate == DEFAULT_OUT_SAMPLING_RATE) {
+ /* PCM uses native sample rate */
+ ret = pcm_mmap_write(out->pcm[i], (void *)buffer, bytes);
+ } else {
+ /* PCM needs resampler */
+ ret = pcm_mmap_write(out->pcm[i], (void *)out->buffer, out_frames * frame_size);
+ }
+ if (ret)
+ break;
+ }
+ }
exit:
pthread_mutex_unlock(&out->lock);
@@ -2205,8 +2288,6 @@ static int adev_open_output_stream(struct audio_hw_device *dev,
out->stream.write = out_write;
out->stream.get_render_position = out_get_render_position;
- out->config = pcm_config_mm;
-
out->dev = ladev;
out->standby = 1;
diff --git a/board-info.txt b/board-info.txt
index 73dad7f..e906c5e 100644
--- a/board-info.txt
+++ b/board-info.txt
@@ -1,3 +1,3 @@
require board=tuna
-require version-bootloader=PRIMEKL01
+require version-bootloader=PRIMELA03
diff --git a/device.mk b/device.mk
index e5da58c..962d7b5 100644
--- a/device.mk
+++ b/device.mk
@@ -99,7 +99,9 @@ PRODUCT_PACKAGES += \
# Key maps
PRODUCT_COPY_FILES += \
device/samsung/tuna/tuna-gpio-keypad.kl:system/usr/keylayout/tuna-gpio-keypad.kl \
- device/samsung/tuna/tuna-gpio-keypad.kcm:system/usr/keychars/tuna-gpio-keypad.kcm
+ device/samsung/tuna/tuna-gpio-keypad.kcm:system/usr/keychars/tuna-gpio-keypad.kcm \
+ device/samsung/tuna/sec_jack.kl:system/usr/keylayout/sec_jack.kl \
+ device/samsung/tuna/sec_jack.kcm:system/usr/keychars/sec_jack.kcm
# Input device calibration files
PRODUCT_COPY_FILES += \
diff --git a/init.tuna.usb.rc b/init.tuna.usb.rc
index 9d3d336..20bf090 100755
--- a/init.tuna.usb.rc
+++ b/init.tuna.usb.rc
@@ -64,7 +64,16 @@ on property:sys.usb.config=ptp,adb
on property:sys.usb.config=rndis,dm
write /sys/class/android_usb/android0/enable 0
write /sys/class/android_usb/android0/idVendor 04e8
- write /sys/class/android_usb/android0/idProduct 6862
+ write /sys/class/android_usb/android0/idProduct 6864
+ write /sys/class/android_usb/android0/functions $sys.usb.config
+ write /sys/class/android_usb/android0/enable 1
+ setprop sys.usb.state $sys.usb.config
+
+on property:sys.usb.config=rndis,acm,dm
+ write /sys/class/android_usb/android0/enable 0
+ write /sys/class/android_usb/android0/idVendor 04e8
+ write /sys/class/android_usb/android0/idProduct 6864
write /sys/class/android_usb/android0/functions $sys.usb.config
+ write /sys/class/android_usb/android0/f_acm/instances 1
write /sys/class/android_usb/android0/enable 1
setprop sys.usb.state $sys.usb.config
diff --git a/mms144_ts_rev31.fw b/mms144_ts_rev31.fw
index 367709f..a5c7c78 100644
--- a/mms144_ts_rev31.fw
+++ b/mms144_ts_rev31.fw
Binary files differ
diff --git a/mms144_ts_rev32.fw b/mms144_ts_rev32.fw
index a4b5310..80acfd1 100644
--- a/mms144_ts_rev32.fw
+++ b/mms144_ts_rev32.fw
Binary files differ
diff --git a/recovery/Android.mk b/recovery/Android.mk
index 585db84..2fc8313 100644
--- a/recovery/Android.mk
+++ b/recovery/Android.mk
@@ -1,4 +1,4 @@
-ifneq (,$(findstring $(TARGET_DEVICE),tuna toro maguro))
+ifneq (,$(findstring $(TARGET_DEVICE),tuna toro torospr maguro))
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
@@ -17,7 +17,7 @@ include $(CLEAR_VARS)
# Edify extension functions for doing bootloader updates on Tuna devices.
LOCAL_MODULE_TAGS := optional
-LOCAL_C_INCLUDES += bootable/recovery
+LOCAL_C_INCLUDES += bootable/recovery system/vold
LOCAL_SRC_FILES := recovery_updater.c bootloader.c
# should match TARGET_RECOVERY_UPDATER_LIBS set in BoardConfig.mk
diff --git a/recovery/recovery_updater.c b/recovery/recovery_updater.c
index 02963f5..0c49f9a 100644
--- a/recovery/recovery_updater.c
+++ b/recovery/recovery_updater.c
@@ -19,6 +19,11 @@
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <cryptfs.h>
#include "edify/expr.h"
#include "bootloader.h"
@@ -55,8 +60,68 @@ Value* WriteBootloaderFn(const char* name, State* state, int argc, Expr* argv[])
return StringValue(strdup(result == 0 ? "t" : ""));
}
+/*
+ * The size of the userdata partition for HSPA Galaxy Nexus devices is incorrect
+ * in the partition as it comes from the factory. Updating the bootloader fixes
+ * the partition table, and makes the size of the userdata partition 1 sector
+ * smaller. However, if the user had encrypted their device with the original
+ * incorrect size of the partition table, the crypto footer has saved that
+ * size, and tries to map that much data when decrypting. However, with the
+ * new partition table, that size is too big to be mapped, and the kernel
+ * throws an error, and the user can't decrypt and boot the device after the
+ * OTA is installed. Oops!
+ *
+ * The fix here is to recognize a crypto footer that has the wrong size, and
+ * update it to the new correct size. This program should be run as part of
+ * the recovery script for HSPA Galaxy Nexus devices.
+ */
+
+#define BAD_SIZE 0x01b14fdfULL
+#define GOOD_SIZE 0x01b14fdeULL
+
+#define HSPA_PRIME_KEY_PARTITION "/dev/block/platform/omap/omap_hsmmc.0/by-name/metadata"
+
+Value* FsSizeFixFn(const char* name, State* state, int argc, Expr* argv[])
+{
+ struct crypt_mnt_ftr ftr;
+ int fd;
+
+ if (argc != 0) {
+ return ErrorAbort(state, "%s() expects 0 args, got %d", name, argc);
+ }
+
+ if ((fd = open(HSPA_PRIME_KEY_PARTITION, O_RDWR)) == -1) {
+ return ErrorAbort(state, "%s() Cannot open %s\n", name, HSPA_PRIME_KEY_PARTITION);
+ }
+
+ if (read(fd, &ftr, sizeof(ftr)) != sizeof(ftr)) {
+ close(fd);
+ return ErrorAbort(state, "%s() Cannot read crypto footer %s\n", name, HSPA_PRIME_KEY_PARTITION);
+ }
+
+ if ((ftr.magic == CRYPT_MNT_MAGIC) && (ftr.fs_size == BAD_SIZE)) {
+ ftr.fs_size = GOOD_SIZE;
+ if (lseek(fd, 0, SEEK_SET) == 0) {
+ if (write(fd, &ftr, sizeof(ftr)) == sizeof(ftr)) {
+ fsync(fd); /* Make sure it gets to the disk */
+ fprintf(stderr, "Footer updated\n");
+ close(fd);
+ return StringValue(strdup("t"));
+ }
+ }
+ close(fd);
+ return ErrorAbort(state, "%s() Cannot seek or write crypto footer %s\n", name, HSPA_PRIME_KEY_PARTITION);
+ }
+
+ /* Nothing to do */
+ fprintf(stderr, "Footer doesn't need updating\n");
+ close(fd);
+ return StringValue(strdup("t"));
+}
+
void Register_librecovery_updater_tuna() {
fprintf(stderr, "installing samsung updater extensions\n");
RegisterFunction("samsung.write_bootloader", WriteBootloaderFn);
+ RegisterFunction("samsung.fs_size_fix", FsSizeFixFn);
}
diff --git a/releasetools.py b/releasetools.py
index 23581d6..056c7dc 100644
--- a/releasetools.py
+++ b/releasetools.py
@@ -32,6 +32,8 @@ def FullOTA_InstallEnd(info):
else:
WriteRadio(info, radio_img)
+ FsSizeFix(info)
+
def IncrementalOTA_VerifyEnd(info):
try:
target_radio_img = info.target_zip.read("RADIO/radio.img")
@@ -74,6 +76,12 @@ def IncrementalOTA_InstallEnd(info):
except KeyError:
print "no radio.img in target target_files; skipping install"
+ FsSizeFix(info)
+
+def FsSizeFix(info):
+ info.script.Print("Fixing fs_size in crypto footer...")
+ info.script.AppendExtra('''assert(samsung.fs_size_fix());''')
+
def WriteBootloader(info, bootloader_img):
common.ZipWriteStr(info.output_zip, "bootloader.img", bootloader_img)
fstab = info.info_dict["fstab"]
diff --git a/sec_jack.kcm b/sec_jack.kcm
new file mode 100644
index 0000000..7ee6e5a
--- /dev/null
+++ b/sec_jack.kcm
@@ -0,0 +1,15 @@
+# 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.
+
+type SPECIAL_FUNCTION
diff --git a/sec_jack.kl b/sec_jack.kl
new file mode 100644
index 0000000..1a421d6
--- /dev/null
+++ b/sec_jack.kl
@@ -0,0 +1,17 @@
+# 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.
+
+key 163 MEDIA_NEXT WAKE
+key 165 MEDIA_PREVIOUS WAKE
+key 226 HEADSETHOOK WAKE
diff --git a/ueventd.tuna.rc b/ueventd.tuna.rc
index 3fa9fe2..d1a8b47 100644
--- a/ueventd.tuna.rc
+++ b/ueventd.tuna.rc
@@ -38,7 +38,8 @@
/dev/cdma_rmnet5 0660 radio radio
/dev/cdma_rmnet6 0660 radio radio
/dev/lte_rmnet4 0660 radio radio
-/dev/ttyGS1 0660 radio radio
+/dev/ttyGS0 0660 radio radio
+/dev/ttyGS1 0660 radio radio
/dev/block/mmcblk0p4 0660 radio radio
/dev/modem_br 0660 radio radio
/dev/cdma_ramdump0 0660 radio radio