diff options
26 files changed, 855 insertions, 72 deletions
diff --git a/CleanSpec.mk b/CleanSpec.mk index cf089c4..cff019a 100644 --- a/CleanSpec.mk +++ b/CleanSpec.mk @@ -48,4 +48,5 @@ # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST # ************************************************ $(call add-clean-step, rm -rf $(PRODUCT_OUT)/root/default.prop) -$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/APPS/Phone_intermediates) +$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/APPS/phone_intermediates) +$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/etc/updatecmds/migrate_nfc.txt) diff --git a/audio/audio_hw.c b/audio/audio_hw.c index 2a58f4f..0ba9a41 100755 --- a/audio/audio_hw.c +++ b/audio/audio_hw.c @@ -697,6 +697,7 @@ static void set_incall_device(struct tuna_audio_device *adev) break; case AUDIO_DEVICE_OUT_SPEAKER: case AUDIO_DEVICE_OUT_AUX_DIGITAL: + case AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET: device_type = SOUND_AUDIO_PATH_SPEAKER; break; case AUDIO_DEVICE_OUT_WIRED_HEADSET: @@ -951,9 +952,11 @@ static void select_output_device(struct tuna_audio_device *adev) break; case TTY_MODE_OFF: default: - /* force speaker on when in call and HDMI is selected as voice DL audio - * cannot be routed to HDMI by ABE */ - if (adev->devices & AUDIO_DEVICE_OUT_AUX_DIGITAL) + /* force speaker on when in call and HDMI or S/PDIF is selected + * as voice DL audio cannot be routed there by ABE */ + if (adev->devices & + (AUDIO_DEVICE_OUT_AUX_DIGITAL | + AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET)) speaker_on = 1; break; } @@ -2454,6 +2457,10 @@ static void adev_close_input_stream(struct audio_hw_device *dev, free(in->buffer); release_resampler(in->resampler); } + if (in->proc_buf) + free(in->proc_buf); + if (in->ref_buf) + free(in->ref_buf); free(stream); return; diff --git a/board-info.txt b/board-info.txt index 9663179..73dad7f 100644 --- a/board-info.txt +++ b/board-info.txt @@ -1,3 +1,3 @@ require board=tuna -require version-bootloader=PRIMEKK15 +require version-bootloader=PRIMEKL01 @@ -44,6 +44,9 @@ PRODUCT_PACKAGES += \ libinvensense_mpl PRODUCT_PACKAGES += \ + nfc.tuna + +PRODUCT_PACKAGES += \ audio.primary.tuna \ audio.a2dp.default \ libaudioutils @@ -93,6 +96,11 @@ PRODUCT_PACKAGES += \ VisualizationWallpapers \ librs_jni +# 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 + # Input device calibration files PRODUCT_COPY_FILES += \ device/samsung/tuna/Melfas_MMSxxx_Touchscreen.idc:system/usr/idc/Melfas_MMSxxx_Touchscreen.idc @@ -125,6 +133,33 @@ PRODUCT_COPY_FILES += \ device/samsung/tuna/mms144_ts_rev31.fw:system/vendor/firmware/mms144_ts_rev31.fw \ device/samsung/tuna/mms144_ts_rev32.fw:system/vendor/firmware/mms144_ts_rev32.fw +# Portrait dock image +PRODUCT_COPY_FILES += \ + device/samsung/tuna/dock.png:system/vendor/res/images/dock/dock.png + +# Commands to migrate prefs from com.android.nfc3 to com.android.nfc +PRODUCT_COPY_FILES += \ + packages/apps/Nfc/migrate_nfc.txt:system/etc/updatecmds/migrate_nfc.txt + +# file that declares the MIFARE NFC constant +PRODUCT_COPY_FILES += \ + device/sample/nxp/com.nxp.mifare.xml:system/etc/permissions/com.nxp.mifare.xml + +# NFC EXTRAS add-on API +PRODUCT_PACKAGES += \ + com.android.nfc_extras +PRODUCT_COPY_FILES += \ + frameworks/base/nfc-extras/com.android.nfc_extras.xml:system/etc/permissions/com.android.nfc_extras.xml + +# NFCEE access control +ifeq ($(TARGET_BUILD_VARIANT),user) + NFCEE_ACCESS_PATH := device/samsung/tuna/nfcee_access.xml +else + NFCEE_ACCESS_PATH := device/samsung/tuna/nfcee_access_debug.xml +endif +PRODUCT_COPY_FILES += \ + $(NFCEE_ACCESS_PATH):system/etc/nfcee_access.xml + PRODUCT_PROPERTY_OVERRIDES += \ ro.opengles.version=131072 @@ -145,12 +180,10 @@ PRODUCT_PACKAGES += \ setup_fs # for bugmailer -ifneq ($(TARGET_BUILD_VARIANT),user) - PRODUCT_PACKAGES += send_bug - PRODUCT_COPY_FILES += \ - system/extras/bugmailer/bugmailer.sh:system/bin/bugmailer.sh \ - system/extras/bugmailer/send_bug:system/bin/send_bug -endif +PRODUCT_PACKAGES += send_bug +PRODUCT_COPY_FILES += \ + system/extras/bugmailer/bugmailer.sh:system/bin/bugmailer.sh \ + system/extras/bugmailer/send_bug:system/bin/send_bug $(call inherit-product, frameworks/base/build/phone-xhdpi-1024-dalvik-heap.mk) diff --git a/dock.png b/dock.png Binary files differnew file mode 100644 index 0000000..0bc715e --- /dev/null +++ b/dock.png diff --git a/init.tuna.rc b/init.tuna.rc index 8ac2758..70f1cbe 100755 --- a/init.tuna.rc +++ b/init.tuna.rc @@ -155,7 +155,7 @@ service setup_fs /system/bin/setup_fs \ service tf_daemon /system/bin/tf_daemon \ -d -c /vendor/etc/smc_normal_world_android_cfg.ini - class core + class main user drmrpc group drmrpc diff --git a/libsensors/LightSensor.cpp b/libsensors/LightSensor.cpp index 15ae4e2..29b222b 100644 --- a/libsensors/LightSensor.cpp +++ b/libsensors/LightSensor.cpp @@ -31,46 +31,17 @@ LightSensor::LightSensor() { mPendingEvent.sensor = ID_L; mPendingEvent.type = SENSOR_TYPE_LIGHT; - mPreviousLight = -1; -} - -int LightSensor::handleEnable(int en) { - mPreviousLight = -1; - return 0; } bool LightSensor::handleEvent(input_event const *event) { if (event->value == -1) { return false; } - mPendingEvent.light = indexToValue(event->value); - if (mPendingEvent.light != mPreviousLight) { - mPreviousLight = mPendingEvent.light; - return true; - } - return false; -} - -float LightSensor::indexToValue(size_t index) const { - /* Driver gives a rolling average adc value. We convert it lux levels. */ - static const struct adcToLux { - size_t adc_value; - float lux_value; - } adcToLux[] = { - { 50, 10.0 }, /* from 0 - 50 adc, we map to 10.0 lux */ - { 280, 160.0 }, /* from 51 - 280 adc, we map to 160.0 lux */ - { 320, 225.0 }, /* from 281 - 320 adc, we map to 225.0 lux */ - { 350, 320.0 }, /* from 321 - 350 adc, we map to 320.0 lux */ - { 400, 640.0 }, /* from 351 - 400 adc, we map to 640.0 lux */ - { 520, 1280.0 }, /* from 401 - 520 adc, we map to 1280.0 lux */ - { 590, 2600.0 }, /* from 521 - 590 adc, we map to 2600.0 lux */ - { 1024, 10240.0 }, /* from 591 - 1024 adc, we map to 10240.0 lux */ - }; - size_t i; - for (i = 0; i < ARRAY_SIZE(adcToLux); i++) { - if (index <= adcToLux[i].adc_value) { - return adcToLux[i].lux_value; - } - } - return adcToLux[ARRAY_SIZE(adcToLux)-1].lux_value; + // Convert adc value to lux assuming: + // I = 10 * log(Ev) uA + // R = 24kOhm + // Max adc value 1023 = 1.25V + // 1/4 of light reaches sensor + mPendingEvent.light = powf(10, event->value * (125.0f / 1023.0f / 24.0f)) * 4; + return true; } diff --git a/libsensors/LightSensor.h b/libsensors/LightSensor.h index ed3b435..f5f8af0 100644 --- a/libsensors/LightSensor.h +++ b/libsensors/LightSensor.h @@ -32,10 +32,7 @@ struct input_event; class LightSensor:public SamsungSensorBase { - float mPreviousLight; - virtual int handleEnable(int en); virtual bool handleEvent(input_event const * event); - float indexToValue(size_t index) const; public: LightSensor(); }; diff --git a/libsensors/sensors.cpp b/libsensors/sensors.cpp index 57b1aa8..156f08d 100644 --- a/libsensors/sensors.cpp +++ b/libsensors/sensors.cpp @@ -80,7 +80,7 @@ static struct sensor_t sSensorList[LOCAL_SENSORS + MPLSensor::numSensors] = { { "GP2A Light sensor", "Sharp", 1, SENSORS_LIGHT_HANDLE, - SENSOR_TYPE_LIGHT, 3000.0f, 1.0f, 0.75f, 0, { } }, + SENSOR_TYPE_LIGHT, powf(10, 125.0f/ 24.0f) * 4, 1.0f, 0.75f, 0, { } }, { "GP2A Proximity sensor", "Sharp", 1, SENSORS_PROXIMITY_HANDLE, diff --git a/media_profiles.xml b/media_profiles.xml index 4a6eb46..02058a5 100755 --- a/media_profiles.xml +++ b/media_profiles.xml @@ -75,6 +75,7 @@ <!ATTLIST VideoEditorCap maxInputFrameHeight CDATA #REQUIRED> <!ATTLIST VideoEditorCap maxOutputFrameWidth CDATA #REQUIRED> <!ATTLIST VideoEditorCap maxOutputFrameHeight CDATA #REQUIRED> +<!ATTLIST VideoEditorCap maxPrefetchYUVFrames CDATA #REQUIRED> <!ELEMENT ExportVideoProfile EMPTY> <!ATTLIST ExportVideoProfile name (h264|h263|m4v) #REQUIRED> <!ATTLIST ExportVideoProfile profile CDATA #REQUIRED> @@ -379,9 +380,21 @@ --> <VideoDecoderCap name="wmv" enabled="false"/> <AudioDecoderCap name="wma" enabled="false"/> + + <!-- + The VideoEditor Capability configuration: + - maxInputFrameWidth: maximum video width of imported video clip. + - maxInputFrameHeight: maximum video height of imported video clip. + - maxOutputFrameWidth: maximum video width of exported video clip. + - maxOutputFrameHeight: maximum video height of exported video clip. + - maxPrefetchYUVFrames: maximum prefetch YUV frames for encoder, + used to limit the amount of memory for prefetched YUV frames. + For this platform, it allows maximum 30MB(3MB per 1080p frame x 10 + frames) memory. + --> <VideoEditorCap maxInputFrameWidth="1920" maxInputFrameHeight="1080" maxOutputFrameWidth="1920" - maxOutputFrameHeight="1080"/> + maxOutputFrameHeight="1080" maxPrefetchYUVFrames="10"/> <!-- The VideoEditor Export codec profile and level values correspond to the values in OMX_Video.h. @@ -399,7 +412,7 @@ --> <ExportVideoProfile name="h263" profile= "1" level="1"/> <!-- - Codec = mpeg4, Simple profile, level 3 + Codec = mpeg4, Simple profile, level 5 --> - <ExportVideoProfile name="m4v" profile= "1" level="16"/> + <ExportVideoProfile name="m4v" profile= "1" level="128"/> </MediaSettings> diff --git a/nfc/Android.mk b/nfc/Android.mk new file mode 100644 index 0000000..c89e404 --- /dev/null +++ b/nfc/Android.mk @@ -0,0 +1,26 @@ +# Copyright (C) 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. + +LOCAL_PATH := $(call my-dir) + +include $(CLEAR_VARS) + +LOCAL_MODULE := nfc.tuna +LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw +LOCAL_SRC_FILES := nfc_hw.c +LOCAL_SHARED_LIBRARIES := liblog libcutils +LOCAL_MODULE_TAGS := optional +LOCAL_CFLAGS += -D$(TARGET_DEVICE) + +include $(BUILD_SHARED_LIBRARY) diff --git a/nfc/nfc_hw.c b/nfc/nfc_hw.c new file mode 100644 index 0000000..99adc29 --- /dev/null +++ b/nfc/nfc_hw.c @@ -0,0 +1,153 @@ +/* + * Copyright (C) 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. + */ +#include <errno.h> +#include <string.h> + +#include <hardware/hardware.h> +#include <hardware/nfc.h> + +static uint8_t pn544_eedata_settings[][4] = { + // DIFFERENTIAL_ANTENNA + + // RF Settings + {0x00,0x9B,0xD1,0x0D} // Tx consumption higher than 0x0D (average 50mA) + ,{0x00,0x9B,0xD2,0x24} // GSP setting for this threshold + ,{0x00,0x9B,0xD3,0x0A} // Tx consumption higher than 0x0A (average 40mA) + ,{0x00,0x9B,0xD4,0x22} // GSP setting for this threshold + ,{0x00,0x9B,0xD5,0x08} // Tx consumption higher than 0x08 (average 30mA) + ,{0x00,0x9B,0xD6,0x1E} // GSP setting for this threshold + ,{0x00,0x9B,0xDD,0x1C} // GSP setting for this threshold + ,{0x00,0x9B,0x84,0x13} // ANACM2 setting + ,{0x00,0x99,0x81,0x7F} // ANAVMID setting PCD + ,{0x00,0x99,0x31,0x70} // ANAVMID setting PICC +#ifdef maguro + // Maguro load modulation settings + ,{0x00,0x99,0x29,0xF4} // Type A load modulation amplitude fine tuning + ,{0x00,0x99,0x2A,0xF4} // Type B load modulation amplitude fine tuning + ,{0x00,0x99,0x2B,0xF4} // Type B' load modulation amplitude fine tuning + ,{0x00,0x99,0x85,0xF1} // Type Felica load modulation amplitude fine tuning +#endif +#ifdef toro + // Toro load modulation settings + ,{0x00,0x99,0x29,0xF3} // Type A load modulation amplitude fine tuning + ,{0x00,0x99,0x2A,0xF3} // Type B load modulation amplitude fine tuning + ,{0x00,0x99,0x2B,0xF3} // Type B' load modulation amplitude fine tuning + ,{0x00,0x99,0x85,0xF1} // Type Felica load modulation amplitude fine tuning +#endif + // For tuna we don't override load modulation settings. + + // Enable PBTF + ,{0x00,0x98,0x00,0x3F} // SECURE_ELEMENT_CONFIGURATION - No Secure Element + ,{0x00,0x9F,0x09,0x00} // SWP_PBTF_RFU + ,{0x00,0x9F,0x0A,0x05} // SWP_PBTF_RFLD --> RFLEVEL Detector for PBTF + ,{0x00,0x9E,0xD1,0xA1} // + + // Change RF Level Detector ANARFLDWU + ,{0x00,0x99,0x23,0x00} // Default Value is 0x01 + + // Low-power polling + ,{0x00,0x9E,0x74,0xB0} // Default Value is 0x00, bits 0->2: sensitivity (0==max, 6==min), + // bit 3: RFU, + // bits 4,5 hybrid low-power: # of low-power polls per regular poll + // bit 6: RFU + // bit 7: (0 -> disabled, 1 -> enabled) + ,{0x00,0x9E,0x7D,0xB0} // bits 0->3: RFU, + // bits 4,5: # retries after low power detection + // 0=1 retry, 1=2 retry, 2=3 retry, 3=4 retry + // bit 6: RFU, + // bit 7: Enable or disable retry mechanism (0: disable, 1: enable) + ,{0x00,0x9F,0x28,0x01} // bits 0->7: # of measurements per low-power poll + + // Polling Loop - Card Emulation Timeout + ,{0x00,0x9F,0x35,0x14} // Time for which PN544 stays in Card Emulation mode after leaving RF field + ,{0x00,0x9F,0x36,0x60} // Default value 0x0411 = 50 ms ---> New Value : 0x1460 = 250 ms + + //LLC Timer + ,{0x00,0x9C,0x31,0x00} // Guard host time-out in ms (MSB) + ,{0x00,0x9C,0x32,0xC8} // Guard host time-out in ms (LSB) + ,{0x00,0x9C,0x19,0x40} // Max RX retry (PN544=>host?) + ,{0x00,0x9C,0x1A,0x40} // Max TX retry (PN544=>host?) + + ,{0x00,0x9C,0x0C,0x00} // + ,{0x00,0x9C,0x0D,0x00} // + ,{0x00,0x9C,0x12,0x00} // + ,{0x00,0x9C,0x13,0x00} // + + //WTX for LLCP communication + ,{0x00,0x98,0xA2,0x0E} // Max value: 14 (default value: 09) + + //SE GPIO + ,{0x00, 0x98, 0x93, 0x40} + + // Set NFCT ATQA + ,{0x00, 0x98, 0x7D, 0x02} + ,{0x00, 0x98, 0x7E, 0x00} + + // Enable CEA detection mechanism + ,{0x00, 0x9F, 0xC8, 0x01} + // Set NFC-F poll RC=0x00 + ,{0x00, 0x9F, 0x9A, 0x00} + // Setting for EMD support for ISO 14443-4 Reader + ,{0x00,0x9F,0x09,0x00} // 0x00 - Disable EMD support, 0x01 - Enable EMD support +}; + +static int pn544_close(hw_device_t *dev) { + free(dev); + + return 0; +} + +/* + * Generic device handling + */ + +static int nfc_open(const hw_module_t* module, const char* name, + hw_device_t** device) { + if (strcmp(name, NFC_PN544_CONTROLLER) == 0) { + nfc_pn544_device_t *dev = calloc(1, sizeof(nfc_pn544_device_t)); + + dev->common.tag = HARDWARE_DEVICE_TAG; + dev->common.version = 0; + dev->common.module = (struct hw_module_t*) module; + dev->common.close = pn544_close; + + dev->num_eeprom_settings = sizeof(pn544_eedata_settings) / 4; + dev->eeprom_settings = (uint8_t*)pn544_eedata_settings; + dev->linktype = PN544_LINK_TYPE_UART; + dev->device_node = "/dev/ttyO3"; + dev->enable_i2c_workaround = 0; + *device = (hw_device_t*) dev; + return 0; + } else { + return -EINVAL; + } +} + +static struct hw_module_methods_t nfc_module_methods = { + .open = nfc_open, +}; + +struct nfc_module_t HAL_MODULE_INFO_SYM = { + .common = { + .tag = HARDWARE_MODULE_TAG, + .version_major = 1, + .version_minor = 0, + .id = NFC_HARDWARE_MODULE_ID, + .name = "Tuna NFC HW HAL", + .author = "The Android Open Source Project", + .methods = &nfc_module_methods, + }, +}; diff --git a/nfcee_access.xml b/nfcee_access.xml new file mode 100644 index 0000000..02e12fd --- /dev/null +++ b/nfcee_access.xml @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <!-- Applications granted NFCEE access on user builds + + See packages/apps/Nfc/etc/sample_nfcee_access.xml for full documentation. + --> + + <!-- Google wallet release signature --> + <signer android:signature="3082044c30820334a003020102020900a8cd17c93da5d990300d06092a864886f70d01010505003077310b3009060355040613025553311330110603550408130a43616c69666f726e6961311630140603550407130d4d6f756e7461696e205669657731143012060355040a130b476f6f676c6520496e632e3110300e060355040b1307416e64726f6964311330110603550403130a476f6f676c65204e4643301e170d3131303332343031303635335a170d3338303830393031303635335a3077310b3009060355040613025553311330110603550408130a43616c69666f726e6961311630140603550407130d4d6f756e7461696e205669657731143012060355040a130b476f6f676c6520496e632e3110300e060355040b1307416e64726f6964311330110603550403130a476f6f676c65204e464330820120300d06092a864886f70d01010105000382010d00308201080282010100c30f88add9b492096a2c586a5a9a80356bfa026958f8ff0c5dfaf59f49268ad870dee821a53e1f5b170fc96245a3c982a7cb4527053be35e34f396d24b2291ec0c528d6e26927465e06875ea621f7ff98c40e3345b204907cc9354743acdaace65565f48ba74cd4121cdc876df3522badb095c20d934c56a3e5c393ee5f0e02f8fe0621f918d1f35a82489252c6fa6b63392a7686b3e48612d06a9cf6f49bff11d5d96289c9dfe14ac5762439697dd29eafdb9810de3263513a905ac8e8eaf20907e46750a5ab7bf9a77262f47b03f5a3c6e6d7b51343f69c7f725f70bcc1b4ad592250b705a86e6e83ee2ae37fe5701bcbdb26feefdfff60f6a5bdfb5b64793020103a381dc3081d9301d0603551d0e041604141ccece0eea4dc1121fc7515f0d0a0c72e08cc96d3081a90603551d230481a130819e80141ccece0eea4dc1121fc7515f0d0a0c72e08cc96da17ba4793077310b3009060355040613025553311330110603550408130a43616c69666f726e6961311630140603550407130d4d6f756e7461696e205669657731143012060355040a130b476f6f676c6520496e632e3110300e060355040b1307416e64726f6964311330110603550403130a476f6f676c65204e4643820900a8cd17c93da5d990300c0603551d13040530030101ff300d06092a864886f70d01010505000382010100a470c728e1d31b06d9af6ae768b565046c57806b9843724931d75d4ca10c321520d33ccfed2aa65462234c9ef9b6f910cc676b99cb7f9895d6c06763574fbb78331275dc5cf38fbaa918d7938c051ffba2ade8f303cde8d9e68a048d1fdb9e7c9f2a49b222c68fff422bf15569b85eeeedb04aa30873dbe64b9c9e74f8f2c2f6c40124aaa8d1780d18512b540add28b3e9581971a4170dd868cf5f31e44712b2c23bb51037d7ef9f87a6e5bdb35e2ceb6bb022636c17a56a96bc7a50258c0bd2ed7b31555a18452e17321a0d52838c82f63f742d74ff79586a5cbb7faf7198a84bcf744310e9e927597f00a23dd00660800c2238d90b2fb372dfdbba75bd852e" /> + +</resources> diff --git a/nfcee_access_debug.xml b/nfcee_access_debug.xml new file mode 100644 index 0000000..a96a2d1 --- /dev/null +++ b/nfcee_access_debug.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <!-- Applications granted NFCEE access on userdebug/eng builds + + See packages/apps/Nfc/etc/sample_nfcee_access.xml for full documentation. + --> + + <!-- Google Wallet dev signature --> + <signer android:signature="3082044c30820334a003020102020900de7695041d7650c0300d06092a864886f70d01010505003077310b3009060355040613025553311330110603550408130a43616c69666f726e6961311630140603550407130d4d6f756e7461696e205669657731143012060355040a130b476f6f676c6520496e632e3110300e060355040b1307416e64726f6964311330110603550403130a476f6f676c65204e4643301e170d3131303332343031303332345a170d3338303830393031303332345a3077310b3009060355040613025553311330110603550408130a43616c69666f726e6961311630140603550407130d4d6f756e7461696e205669657731143012060355040a130b476f6f676c6520496e632e3110300e060355040b1307416e64726f6964311330110603550403130a476f6f676c65204e464330820120300d06092a864886f70d01010105000382010d00308201080282010100e6ff3defe92aa10d71eb0fa6408bc036b7e243eeed68a6a4763dc7a52a31757cdac61fe510bb73c716e4000104265b347fcecef4c42bf1e1379dd0a876f028227fbbc1f9bdd5d713b2f6a935a379d2cba9c96f92d2d0787c11f1eb19548008a6a072b34b91836cfa0ae1276780e9007530166986a11c9cef46cef7c704806dde9431fb60284d120ab0e7de1d633f07687d468c51139afffdc6bc9a207ca904b8be1da0aa7b4e97756f43606488be5cae3c68e8bb7942cdf51607c930a2fcda655b75d0759cba89ad06e739bd0ba29b1f404296c2c0a85a847f5ab0d067c6c3ec9c49212042ac63a7e53b546c65b46080b4e3e680e23e1f77cfe7f6de744b1a65020103a381dc3081d9301d0603551d0e04160414a2e89064b05d08865c34db930a9d840050117aec3081a90603551d230481a130819e8014a2e89064b05d08865c34db930a9d840050117aeca17ba4793077310b3009060355040613025553311330110603550408130a43616c69666f726e6961311630140603550407130d4d6f756e7461696e205669657731143012060355040a130b476f6f676c6520496e632e3110300e060355040b1307416e64726f6964311330110603550403130a476f6f676c65204e4643820900de7695041d7650c0300c0603551d13040530030101ff300d06092a864886f70d010105050003820101003771870ce87c3c52ea84899230c6e962d94b4d5f1293c25d88261541fd90b5555d1285cef3b8312c3f5df691a8aae04cb981b305e427fd1d2d9e1987e1d29078f13c8452990f1821980263d8d4bd36519348d8d8ba26d8b99fbf09f5fd3ebb0ea3c2f0c9376f1e1fca76f3a6a405429d081b752a7a90b756e9ab44da41abc8e1e8f88ac2758da743fb73e650719a57840ccb6b7add21b99fc681e456e1872c223d5c074adf55f6abda268c2d8b64ea0a8845eecd968f92b493127e75c753c3ff30cbc678b51c9f52961472f17da20a0dc6274aa2463434c1a9b614df697d8ff5ca8101e7a25c7db3fb055d65569c04b01d389cabba57b3a1703ec2e74a88d334" /> + + <!-- Google wallet release signature --> + <signer android:signature="3082044c30820334a003020102020900a8cd17c93da5d990300d06092a864886f70d01010505003077310b3009060355040613025553311330110603550408130a43616c69666f726e6961311630140603550407130d4d6f756e7461696e205669657731143012060355040a130b476f6f676c6520496e632e3110300e060355040b1307416e64726f6964311330110603550403130a476f6f676c65204e4643301e170d3131303332343031303635335a170d3338303830393031303635335a3077310b3009060355040613025553311330110603550408130a43616c69666f726e6961311630140603550407130d4d6f756e7461696e205669657731143012060355040a130b476f6f676c6520496e632e3110300e060355040b1307416e64726f6964311330110603550403130a476f6f676c65204e464330820120300d06092a864886f70d01010105000382010d00308201080282010100c30f88add9b492096a2c586a5a9a80356bfa026958f8ff0c5dfaf59f49268ad870dee821a53e1f5b170fc96245a3c982a7cb4527053be35e34f396d24b2291ec0c528d6e26927465e06875ea621f7ff98c40e3345b204907cc9354743acdaace65565f48ba74cd4121cdc876df3522badb095c20d934c56a3e5c393ee5f0e02f8fe0621f918d1f35a82489252c6fa6b63392a7686b3e48612d06a9cf6f49bff11d5d96289c9dfe14ac5762439697dd29eafdb9810de3263513a905ac8e8eaf20907e46750a5ab7bf9a77262f47b03f5a3c6e6d7b51343f69c7f725f70bcc1b4ad592250b705a86e6e83ee2ae37fe5701bcbdb26feefdfff60f6a5bdfb5b64793020103a381dc3081d9301d0603551d0e041604141ccece0eea4dc1121fc7515f0d0a0c72e08cc96d3081a90603551d230481a130819e80141ccece0eea4dc1121fc7515f0d0a0c72e08cc96da17ba4793077310b3009060355040613025553311330110603550408130a43616c69666f726e6961311630140603550407130d4d6f756e7461696e205669657731143012060355040a130b476f6f676c6520496e632e3110300e060355040b1307416e64726f6964311330110603550403130a476f6f676c65204e4643820900a8cd17c93da5d990300c0603551d13040530030101ff300d06092a864886f70d01010505000382010100a470c728e1d31b06d9af6ae768b565046c57806b9843724931d75d4ca10c321520d33ccfed2aa65462234c9ef9b6f910cc676b99cb7f9895d6c06763574fbb78331275dc5cf38fbaa918d7938c051ffba2ade8f303cde8d9e68a048d1fdb9e7c9f2a49b222c68fff422bf15569b85eeeedb04aa30873dbe64b9c9e74f8f2c2f6c40124aaa8d1780d18512b540add28b3e9581971a4170dd868cf5f31e44712b2c23bb51037d7ef9f87a6e5bdb35e2ceb6bb022636c17a56a96bc7a50258c0bd2ed7b31555a18452e17321a0d52838c82f63f742d74ff79586a5cbb7faf7198a84bcf744310e9e927597f00a23dd00660800c2238d90b2fb372dfdbba75bd852e" /> + + <!-- Platform dev-keys signature --> + <signer android:signature="308204a830820390a003020102020900bcdfe81405d5c69e300d06092a864886f70d0101050500308194310b3009060355040613025553311330110603550408130a43616c69666f726e6961311630140603550407130d4d6f756e7461696e20566965773110300e060355040a1307416e64726f69643110300e060355040b1307416e64726f69643110300e06035504031307416e64726f69643122302006092a864886f70d0109011613616e64726f696440616e64726f69642e636f6d301e170d3131303931393230303634325a170d3339303230343230303634325a308194310b3009060355040613025553311330110603550408130a43616c69666f726e6961311630140603550407130d4d6f756e7461696e20566965773110300e060355040a1307416e64726f69643110300e060355040b1307416e64726f69643110300e06035504031307416e64726f69643122302006092a864886f70d0109011613616e64726f696440616e64726f69642e636f6d30820120300d06092a864886f70d01010105000382010d00308201080282010100ef7a8a34d8151d0479a239903261fe5026c520d5d88cd65920c98e096d2770f49636da9ffc4e80c472b05bd62a435f8266912aa2a34a18f6f4856f9ef52c10b88c267627136726823e8f3389b051ba92920e10bbaae0e38879efbe681b05863b655d81a6f3b75a85eb230b38b23ea4ef56f2161ff01652ae2049881adbe60d3bf8b5386a81f7404c0cf0c111c0a35ab0a9760426e4af12add73327ec433e047e3517f47a2d3674c2b819354d56eb7fd6c9aa67dd05b4bb1ca8a7e1946c2494e9364ea677a25481ac81f434bff3dd56e93e59fccef0e24a753461cd1cf15f22b62251d07416057ac5ca3e03a24f7f4eca876bacc5a1828acbde04c5cfdb608c47020103a381fc3081f9301d0603551d0e0416041402f997668541fa74693bea699a5766893a362a5d3081c90603551d230481c13081be801402f997668541fa74693bea699a5766893a362a5da1819aa48197308194310b3009060355040613025553311330110603550408130a43616c69666f726e6961311630140603550407130d4d6f756e7461696e20566965773110300e060355040a1307416e64726f69643110300e060355040b1307416e64726f69643110300e06035504031307416e64726f69643122302006092a864886f70d0109011613616e64726f696440616e64726f69642e636f6d820900bcdfe81405d5c69e300c0603551d13040530030101ff300d06092a864886f70d0101050500038201010047d6fb32cadeae4444c379b3441ff9ba10990c23d10472c54fb7ebd9c33b2a173836337e1c175c980847a8894f6a99782e9c2e2133629254295fe52749f93ec1e39d213dd06d0ba99de3b6b5d4d856fafe74e08113b7b23a1b56f4918ed41218a03b9564456480b665200267d3770a9463db413c6a47bd81d725cb7d39c9d0941693c59cbe727d40415f0815c3c8363fb8fa2e028ceeb3bbfbc6b119db5b72f0edb0bb417bfcbf74d9fa069de22afe56a50bcde7ea1078749bb9ec0adc0e6de045641ee3a82c576645160b4ab9710d3cb3201f23957da8de9084c0bec93ad1c8c2054195f13c926db07c8bdf15673acf6d791ec1d3a0d7e1b3470447acd95873" /> + +</resources> diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml index 55c3d45..1af8aad 100644 --- a/overlay/frameworks/base/core/res/res/values/config.xml +++ b/overlay/frameworks/base/core/res/res/values/config.xml @@ -35,6 +35,7 @@ <integer name="config_deskDockKeepsScreenOn">0</integer> <integer name="config_carDockKeepsScreenOn">1</integer> + <bool name="config_deskDockEnablesAccelerometer">true</bool> <!-- If this is true, the screen will come on when you unplug usb/power/whatever. --> <bool name="config_unplugTurnsOnScreen">true</bool> @@ -64,11 +65,25 @@ Must be overridden in platform specific overlays --> <integer-array name="config_autoBrightnessLevels"> - <item>100</item> - <item>200</item> - <item>400</item> - <item>1000</item> - <item>3000</item> + <item>6</item> + <item>9</item> + <item>14</item> + <item>20</item> + <item>30</item> + <item>46</item> + <item>68</item> + <item>103</item> + <item>154</item> + <item>231</item> + <item>346</item> + <item>519</item> + <item>778</item> + <item>1168</item> + <item>1752</item> + <item>2627</item> + <item>3941</item> + <item>5912</item> + <item>8867</item> </integer-array> <!-- Array of output values for LCD backlight corresponding to the LUX values @@ -76,11 +91,25 @@ than the size of the config_autoBrightnessLevels array. --> <integer-array name="config_autoBrightnessLcdBacklightValues"> - <item>16</item> - <item>40</item> - <item>60</item> - <item>70</item> - <item>70</item> + <item>19</item> + <item>23</item> + <item>26</item> + <item>30</item> + <item>34</item> + <item>39</item> + <item>45</item> + <item>51</item> + <item>59</item> + <item>67</item> + <item>77</item> + <item>88</item> + <item>101</item> + <item>116</item> + <item>133</item> + <item>152</item> + <item>174</item> + <item>199</item> + <item>228</item> <item>250</item> </integer-array> @@ -95,6 +124,20 @@ <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 @@ -109,6 +152,20 @@ <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> <!-- Minimum screen brightness allowed by the power manager. --> diff --git a/overlay/packages/apps/Settings/res/values-be/arrays.xml b/overlay/packages/apps/Settings/res/values-be/arrays.xml new file mode 100644 index 0000000..e1dfcf3 --- /dev/null +++ b/overlay/packages/apps/Settings/res/values-be/arrays.xml @@ -0,0 +1,31 @@ +<?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. +*/ + --> + +<resources xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string-array name="screen_timeout_entries"> + <item msgid="5314770629356662739">"15 секунд"</item> + <item msgid="8672738773876256432">"30 секунд"</item> + <item msgid="465923292941002466">"1 хвіліна"</item> + <item msgid="7955177189296850016">"2 хвіліны"</item> + <item msgid="1244255986255344525">"5 хвілін"</item> + <item msgid="294890536998091748">"10 хвілін"</item> + </string-array> +</resources> diff --git a/overlay/packages/apps/Settings/res/values-et/arrays.xml b/overlay/packages/apps/Settings/res/values-et/arrays.xml new file mode 100644 index 0000000..bb3352e --- /dev/null +++ b/overlay/packages/apps/Settings/res/values-et/arrays.xml @@ -0,0 +1,31 @@ +<?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. +*/ + --> + +<resources xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string-array name="screen_timeout_entries"> + <item msgid="5314770629356662739">"15 sekundit"</item> + <item msgid="8672738773876256432">"30 sekundit"</item> + <item msgid="465923292941002466">"1 minut"</item> + <item msgid="7955177189296850016">"2 minutit"</item> + <item msgid="1244255986255344525">"5 minutit"</item> + <item msgid="294890536998091748">"10 minutit"</item> + </string-array> +</resources> diff --git a/overlay/packages/apps/Settings/res/values-ru/arrays.xml b/overlay/packages/apps/Settings/res/values-ru/arrays.xml index b4d5e6e..0e013b0 100644 --- a/overlay/packages/apps/Settings/res/values-ru/arrays.xml +++ b/overlay/packages/apps/Settings/res/values-ru/arrays.xml @@ -21,11 +21,11 @@ <resources xmlns:android="http://schemas.android.com/apk/res/android" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> <string-array name="screen_timeout_entries"> - <item msgid="5314770629356662739">"15 секунд"</item> - <item msgid="8672738773876256432">"30 секунд"</item> - <item msgid="465923292941002466">"1 минута"</item> - <item msgid="7955177189296850016">"2 минуты"</item> - <item msgid="1244255986255344525">"5 минут"</item> - <item msgid="294890536998091748">"10 минут"</item> + <item msgid="5314770629356662739">"15 сек."</item> + <item msgid="8672738773876256432">"30 сек."</item> + <item msgid="465923292941002466">"1 мин."</item> + <item msgid="7955177189296850016">"2 мин."</item> + <item msgid="1244255986255344525">"5 мин."</item> + <item msgid="294890536998091748">"10 мин."</item> </string-array> </resources> diff --git a/overlay/packages/apps/Settings/res/values-vi/arrays.xml b/overlay/packages/apps/Settings/res/values-vi/arrays.xml index c6de6bd..9b4bfad 100644 --- a/overlay/packages/apps/Settings/res/values-vi/arrays.xml +++ b/overlay/packages/apps/Settings/res/values-vi/arrays.xml @@ -26,6 +26,6 @@ <item msgid="465923292941002466">"1 phút"</item> <item msgid="7955177189296850016">"2 phút"</item> <item msgid="1244255986255344525">"5 phút"</item> - <item msgid="294890536998091748">"10 phút"</item> + <item msgid="294890536998091748">"10 phút"</item> </string-array> </resources> diff --git a/overlay/packages/apps/Settings/res/values/bools.xml b/overlay/packages/apps/Settings/res/values/bools.xml new file mode 100644 index 0000000..b5e8b7b --- /dev/null +++ b/overlay/packages/apps/Settings/res/values/bools.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 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. +--> + +<resources> + <!-- Show dock settings when docked --> + <bool name="has_dock_settings">true</bool> +</resources> diff --git a/reflash-bootloader/Android.mk b/reflash-bootloader/Android.mk new file mode 100644 index 0000000..c7a9e54 --- /dev/null +++ b/reflash-bootloader/Android.mk @@ -0,0 +1,10 @@ +LOCAL_PATH:= $(call my-dir) + +include $(CLEAR_VARS) + +LOCAL_SRC_FILES := reflash-bootloader.c +LOCAL_MODULE = tuna-reflash-bootloader +LOCAL_MODULE_TAGS := optional +LOCAL_FORCE_STATIC_EXECUTABLE := true +LOCAL_STATIC_LIBRARIES := libc +include $(BUILD_EXECUTABLE) diff --git a/reflash-bootloader/build-image.sh b/reflash-bootloader/build-image.sh new file mode 100755 index 0000000..7b0edf5 --- /dev/null +++ b/reflash-bootloader/build-image.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +DIR=/tmp/reflash_bootloader.$$ +RAMDISK=/tmp/ramdisk.$$.img + +mkdir ${DIR} +cp ${OUT}/system/bin/tuna-reflash-bootloader ${DIR}/init +cp ${ANDROID_BUILD_TOP}/vendor/samsung/tuna/bootloader.img ${DIR}/bootloader.img +mkbootfs ${DIR} | minigzip > ${RAMDISK} +mkbootimg --kernel ${OUT}/kernel --ramdisk ${RAMDISK} -o tuna-reflash-bootloader.img +rm ${DIR}/init +rm ${DIR}/bootloader.img +rmdir ${DIR} +rm ${RAMDISK} diff --git a/reflash-bootloader/reflash-bootloader.c b/reflash-bootloader/reflash-bootloader.c new file mode 100644 index 0000000..001d315 --- /dev/null +++ b/reflash-bootloader/reflash-bootloader.c @@ -0,0 +1,359 @@ +/* + * Copyright (C) 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. + */ + +#include <errno.h> +#include <fcntl.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> + +#include <sys/mount.h> +#include <sys/types.h> +#include <sys/reboot.h> +#include <sys/stat.h> + +#define error(s, a...) \ + { \ + printf("error: " s "\n", ##a); \ + exit(-1); \ + } + +#define error_errno(s, a...) error(s ": %s", ##a, strerror(errno)) + +#define ARRAY_SIZE(a) (sizeof(a)/sizeof(a[0])) + +enum omap_type_enum { + OMAP4460_EMU = 0, + OMAP4460_HS, + OMAP4460_HS_PROD, + OMAP4430_HS, +}; + +struct omap_type { + const char *family; + const char *type; + unsigned long msv_val; + const char *msv_type; + off_t offset; +} omap_type_list[] = { + [OMAP4460_EMU] = {"OMAP4460", "EMU", 0x00000000, "eng", 0x1000}, + [OMAP4460_HS] = {"OMAP4460", "HS", 0x00000000, "eng", 0x21000}, + [OMAP4460_HS_PROD] = {"OMAP4460", "HS", 0xf0000f00, "prod", 0x41000}, + [OMAP4430_HS] = {"OMAP4430", "HS", 0x00000000, "eng", 0x61000}, +}; + +#define IMG_PIT_OFFSET 0UL +#define IMG_SBL_OFFSET 0x81000UL + +#define MMC_PIT_OFFSET 0x4400UL +#define MMC_XLOADER_OFFSET 0x20000UL +#define MMC_SBL_OFFSET 0x80000UL + +#define PIT_SIZE 0x1000UL +#define XLOADER_SIZE 0x20000UL + +static void drop_caches(void) +{ + int fd; + int ret; + char buf[] = "3\n"; + + fd = open("/proc/sys/vm/drop_caches", O_WRONLY); + if (fd < 0) + error_errno("failed to open /proc/sys/vm/drop_caches"); + + ret = write(fd, buf, sizeof(buf)); + if (ret < 0) + error_errno("failed to write to /proc/sys/vm/drop_caches"); +} + +static void read_file(const char *filename, char *buf, size_t size) +{ + int fd; + ssize_t ret; + + fd = open(filename, O_RDONLY); + if (fd < 0) + error_errno("failed to open %s", filename); + + ret = read(fd, buf, size - 1); + if (ret < 0) + error_errno("failed to read %s", filename); + buf[ret] = 0; + while (buf[ret - 1] == '\n') + buf[--ret] = 0; + + close(fd); +} + +static const struct omap_type *get_omap_type(void) +{ + int fd; + char family[10]; + char type[5]; + char msv[9]; + unsigned long msv_val; + ssize_t ret; + unsigned int i; + + read_file("/sys/board_properties/soc/type", type, sizeof(type)); + read_file("/sys/board_properties/soc/family", family, sizeof(family)); + read_file("/sys/board_properties/soc/msv", msv, sizeof(msv)); + + msv_val = strtoul(msv, NULL, 16); + + for (i = 0; i < ARRAY_SIZE(omap_type_list); i++) + if ((strcmp(omap_type_list[i].family, family) == 0) && + (strcmp(omap_type_list[i].type, type) == 0) && + msv_val == omap_type_list[i].msv_val) + return &omap_type_list[i]; + + error("unknown omap type %s %s %s (0x%08lx)", family, type, msv, msv_val); +} + +static void zero_data(int to_fd, off_t to_offset, ssize_t size) +{ + char buf[4096]; + int ret; + unsigned int to_write; + + memset(buf, 0, sizeof(buf)); + + ret = lseek(to_fd, to_offset, SEEK_SET); + if (ret < 0) + error_errno("failed to seek output file to %lx", to_offset); + + while (size != 0) { + to_write = size; + if (to_write > sizeof(buf)) + to_write = sizeof(buf); + + ret = write(to_fd, buf, to_write); + if (ret < 0) + error_errno("failed to write to output file"); + size -= ret; + } +} + +static void verify_data(int to_fd, off_t to_offset, + int from_fd, off_t from_offset, + ssize_t size) +{ + char buf_to[4096]; + char buf_from[4096]; + int ret; + int to_read; + int c; + char *ptr; + + ret = lseek(to_fd, to_offset, SEEK_SET); + if (ret < 0) + error_errno("failed to seek output file to %lx", to_offset); + + ret = lseek(from_fd, from_offset, SEEK_SET); + if (ret < 0) + error_errno("failed to seek input file to %lx", from_offset); + + while (size != 0) { + to_read = sizeof(buf_to); + if (size > 0 && to_read > size) + to_read = size; + + ptr = buf_to; + c = to_read; + while (c > 0) { + ret = read(to_fd, ptr, c); + if (ret < 0) + error_errno("failed to read from output file"); + if (ret == 0 && size < 0) + return; + if (ret == 0) + error_errno("eof while reading output file"); + ptr += ret; + c -= ret; + } + + ptr = buf_from; + c = to_read; + while (c > 0) { + ret = read(from_fd, ptr, c); + if (ret < 0) + error_errno("failed to read from input file"); + if (ret == 0 && size < 0) + return; + if (ret == 0) + error_errno("eof while reading input file"); + ptr += ret; + c -= ret; + } + + if (memcmp(buf_from, buf_to, to_read) != 0) + error("mismatch while verifying written data"); + + size -= to_read; + } +} + +static void copy_data(int to_fd, off_t to_offset, + int from_fd, off_t from_offset, + ssize_t size) +{ + char buf[4096]; + int ret; + int to_write; + const char *ptr; + + ret = lseek(to_fd, to_offset, SEEK_SET); + if (ret < 0) + error_errno("failed to seek output file to %lx", to_offset); + + ret = lseek(from_fd, from_offset, SEEK_SET); + if (ret < 0) + error_errno("failed to seek input file to %lx", from_offset); + + while (size != 0) { + ret = read(from_fd, buf, sizeof(buf)); + if (ret < 0) + error_errno("failed to read from input file"); + if (ret == 0 && size > 0) + error_errno("eof while reading input file"); + if (ret == 0) + return; + + to_write = ret; + ptr = buf; + + if (size > 0) + size -= to_write; + + while (to_write > 0) { + ret = write(to_fd, ptr, to_write); + if (ret < 0) + error_errno("failed to write to output file"); + to_write -= ret; + ptr += ret; + } + } +} + +static void init(void) +{ + int ret; + + umask(0); + + ret = mkdir("/dev", 0755); + if (ret && errno != EEXIST) + error_errno("failed to create /dev"); + + ret = mkdir("/proc", 0755); + if (ret && errno != EEXIST) + error_errno("failed to create /proc"); + + ret = mkdir("/sys", 0755); + if (ret && errno != EEXIST) + error_errno("failed to create /sys"); + + ret = mount("proc", "/proc", "proc", 0, NULL); + if (ret) + error_errno("failed to mount proc"); + + ret = mount("sysfs", "/sys", "sysfs", 0, NULL); + if (ret) + error_errno("failed to mount sys"); + + ret = mkdir("/dev/block", 0755); + if (ret && errno != EEXIST) + error_errno("failed to create /dev/block"); + + ret = mknod("/dev/block/mmcblk0", S_IFBLK | 0755, makedev(179, 0)); + if (ret) + error_errno("failed to create mmcblk0"); +} + +int main(int argc, char **argv) +{ + int in_fd; + int out_fd; + const struct omap_type *type; + + if (getpid() == 1) + init(); + + in_fd = open("bootloader.img", O_RDONLY); + if (in_fd < 0) + error_errno("failed to open bootloader.img"); + + out_fd = open("/dev/block/mmcblk0", O_RDWR); + if (out_fd < 0) + error_errno("failed to open mmcblk0"); + + type = get_omap_type(); + + printf("Found %s %s %s\n", type->family, type->type, type->msv_type); + + printf("Zeroing to end of sbl\n"); + zero_data(out_fd, 0, MMC_SBL_OFFSET); + + /* Don't write the partition table, let the bootloader do it on next boot */ +#if 0 + printf("Writing partition-table from %lx to %lx\n", + IMG_PIT_OFFSET, MMC_PIT_OFFSET); + copy_data(out_fd, MMC_PIT_OFFSET, in_fd, IMG_PIT_OFFSET, PIT_SIZE); +#endif + + printf("Writing xloader from %lx to %lx\n", + type->offset, MMC_XLOADER_OFFSET); + copy_data(out_fd, MMC_XLOADER_OFFSET, in_fd, type->offset, XLOADER_SIZE); + + printf("Writing sbl from %lx to %lx\n", + IMG_SBL_OFFSET, MMC_SBL_OFFSET); + copy_data(out_fd, MMC_SBL_OFFSET, in_fd, IMG_SBL_OFFSET, -1); + +#if 0 + printf("Verifying partition table\n"); + verify_data(out_fd, MMC_PIT_OFFSET, in_fd, IMG_PIT_OFFSET, PIT_SIZE); +#endif + + printf("Verifying xloader\n"); + verify_data(out_fd, MMC_XLOADER_OFFSET, in_fd, type->offset, XLOADER_SIZE); + + printf("Verifying sbl\n"); + verify_data(out_fd, MMC_SBL_OFFSET, in_fd, IMG_SBL_OFFSET, -1); + + printf("Syncing\n"); + sync(); + + printf("Dropping caches\n"); + drop_caches(); + + printf("Verifying xloader.img\n"); + verify_data(out_fd, MMC_XLOADER_OFFSET, in_fd, type->offset, XLOADER_SIZE); + + printf("Verifying sbl.img\n"); + verify_data(out_fd, MMC_SBL_OFFSET, in_fd, IMG_SBL_OFFSET, -1); + + printf("Done\n"); + + if (getpid() == 1) { + __reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, + LINUX_REBOOT_CMD_RESTART2, "bootloader"); + + while (1) { sleep(1); } + } + + return 0; +} diff --git a/tuna-gpio-keypad.kcm b/tuna-gpio-keypad.kcm new file mode 100644 index 0000000..1a3cb57 --- /dev/null +++ b/tuna-gpio-keypad.kcm @@ -0,0 +1,15 @@ +# Copyright (C) 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. + +type SPECIAL_FUNCTION diff --git a/tuna-gpio-keypad.kl b/tuna-gpio-keypad.kl new file mode 100644 index 0000000..383fe6b --- /dev/null +++ b/tuna-gpio-keypad.kl @@ -0,0 +1,17 @@ +# Copyright (C) 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. + +key 114 VOLUME_DOWN WAKE +key 115 VOLUME_UP WAKE +key 116 POWER WAKE |