headset problems [possible fix] - Galaxy S II Android Development

If you have a 'iphone' headset that works erratically with i9100 you can try this:
backup! (one bad click when editing anything in /system and you may need it)
edit the system/usr/keylayout/Generic.kl
add this line:
Code:
key 240 HEADSETHOOK
(look for line with "key 226" to see how this should look)
restart
Use this app: https://github.com/chrisboyle/keytest/downloads to see what other crazy scancode (240 in my case) your phone is randomly detecting.
I've just done that so I don't know if the fix/phone will remain stable

Related

Custon buttons

i installed ae button, wanna get rid of it, but when i do i lose the voice command button. i only have 4 buttons in the settings button manager. any idea how to get the buttons back to the way they started? or add buttons to the phones default button manager?
gbenj said:
i installed ae button, wanna get rid of it, but when i do i lose the voice command button. i only have 4 buttons in the settings button manager. any idea how to get the buttons back to the way they started? or add buttons to the phones default button manager?
Click to expand...
Click to collapse
voice command or the voice dialer? for voice command you need to reg edit and add this
hklm/software/microsoft/shell/keys
add key 40C6
1. add binary data "default" value "\windows\appbuttons\record.lnk" -b (with quotes)
2. add dword flags value 0 (0000000)
3. binary data icon value "location of icon"
4. binary data name value button 5 (press and hold)
5. binary data ResetCmd "\windows\appbuttons\record.lnk" -b (with quotes)
then add key 40C7
1. add dword named BtnWnd value 0 (00000000)
2. add binary data "default" value "\program files\voice command\voicecmd.exe" - ptt
3. add dword flags value 0 (0000000)
4. binary data "icon" value "location of icon"
5. binary data "name" value "button 5"
that should do it...
if you have the OEM voice dialer then point #2 at the file for the voice dial program and then point #5 at that icons location
srtpusher said:
voice command or the voice dialer? for voice command you need to reg edit and add this
hklm/software/microsoft/shell/keys
add key 40C6
1. add binary data "default" value "\windows\appbuttons\record.lnk" -b (with quotes)
2. add dword flags value 0 (0000000)
3. binary data icon value "location of icon"
4. binary data name value button 5 (press and hold)
5. binary data ResetCmd "\windows\appbuttons\record.lnk" -b (with quotes)
then add key 40C7
1. add dword named BtnWnd value 0 (00000000)
2. add binary data "default" value "\program files\voice command\voicecmd.exe" - ptt
3. add dword flags value 0 (0000000)
4. binary data "icon" value "location of icon"
5. binary data "name" value "button 5"
that should do it...
if you have the OEM voice dialer then point #2 at the file for the voice dial program and then point #5 at that icons location
Click to expand...
Click to collapse
thanks alot, but could i just have a little more detail about waht i need to do. im using total commander for reg edits, and used the reg edits before to fix my mms with verizon, but im not sure what to do here. i keep getting "Error in line 1, not a valid hex string!" every time i add binary data default value"..." for either of them
to answer your question, i want to set up button 5 to use a program called voice speed dial. eventually ill want a bluetooth headset to access that program, but for now i just want to get that button working again.
similarly, if its possible to adjust the camera button to run a program(flashlight) when clicked, and open the camera when held.
thanks for the help
gbenj said:
thanks alot, but could i just have a little more detail about waht i need to do. im using total commander for reg edits, and used the reg edits before to fix my mms with verizon, but im not sure what to do here. i keep getting "Error in line 1, not a valid hex string!" every time i add binary data default value"..." for either of them
to answer your question, i want to set up button 5 to use a program called voice speed dial. eventually ill want a bluetooth headset to access that program, but for now i just want to get that button working again.
similarly, if its possible to adjust the camera button to run a program(flashlight) when clicked, and open the camera when held.
thanks for the help
Click to expand...
Click to collapse
OK! was able to get it done, was a little unclear based on the descriptions in your instructions, but once i looked at them, and looked at the existing buttons i had in the other folders it made some sense. you kept saying add binary data etc, but instead i just had to add a string with a vale of wtvr, maybe ur right and i just dont know the terminology, but thats what my registry had for the other buttons so i kinda just copied them.
thanks alot
one more question. any idea how i can add the flashlight program to the camera button(without holding it down)?

[MOD][SK17i][Ver:1][ALPHA] Playstation GamePad 14/8/12

First: I am not responsible if this mod destroys your device!
WARNING: It is only for the Xperia Mini Pro (sk17i)
PlayStation GamePad​
This mod just remaps the hardware keyboard's buttons to look like the playstation one's.
Remaped Buttons:
W --> up
A --> left
Z --> down
D --> right
I --> triangle
M --> cross
J --> square (Actually "BACK" button)
L --> circle
Q --> R1
BackSpace --> L1
< --> start
> --> select
Requirements:
ES file explorer (Market Link: https://play.google.com/store/apps/...sMSwxLDEsImNvbS5lc3Ryb25ncy5hbmRyb2lkLnBvcCJd )
Root
Terminal Emulator (Market Link: https://play.google.com/store/apps/...251bGwsMSwxLDEsImphY2twYWwuYW5kcm9pZHRlcm0iXQ.. )
ClockWorkMod Recovery.
The attached file below.
This mod will place two files in the system folder
Gamepad (at /system) . It is a script that backups the qurrent keyboard mapping and replace it with the gamepad mapping!
gamepad.kl (at /system/usr/keylayout) Actually the new buttons
How to install:
Backup ROM.
Flash the attached file at ClockWorkMod Recovery.
Install Terminal Emulator and ES File Manager.
Open ES File Manager, go to Settings, Check "Root Explorer", "Mount File System", "Backup System App".
Pess "Allow".
Go to the terminal Emulator and type "su".
Press "Allow".
Then type "sh system/gamepad".
The device will reboot. Once it boots open a game and...
Enjoy!
How to uninstall:
Uninstall works only since you haven't changed ES File Manger Settings from the "How to install" proccess.
Open ES File Manager.
Press "HOME" button.
Open Terminal Emulator and type: "su".
Press Allow if needed.
Type "sh system/gamepad".
The device reboots...
Done!
I'm telling you to open the ES File Managen in order to mount the /system Read-Write! I will fix it in a later version!
Credits to:
BPaul (for the idea!)
Download: PS_Gamepad_v1.zip
Tested only on stock ics 4.0.4...
ChangeLog:
Version 1: Initial Release
this is your mod ? thanks anyway
Why everyone is so suspicious here? The original idea came from: http://forum.xda-developers.com/showthread.php?t=1503977 . I modded BPaul's files so they meet our device, taken his permissions and voila!
can you change deleting gamepad.kl? then we can change normal and gamepad mode without always paste gamepad.kl sorry for my bad english i'm from poland...
hye friend
this is work for ics custom rom,,i use ics serenity v2.1,,thanks for anwers:fingers-crossed:
It's Not Working on Some Key since there's a change, i've edit "gamepad.kl" to this
Code:
# Copyright (c) 2009, Code Aurora Forum.
#
# 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 102 HOME WAKE
key 115 VOLUME_UP WAKE
key 114 VOLUME_DOWN WAKE
key 528 FOCUS
key 212 CAMERA WAKE
key 17 DPAD_UP WAKE_DROPPED
key 44 DPAD_DOWN WAKE_DROPPED
key 30 DPAD_LEFT WAKE_DROPPED
key 32 DPAD_RIGHT WAKE_DROPPED
key 23 BUTTON_Y WAKE_DROPPED
key 38 BUTTON_B WAKE_DROPPED
key 36 BUTTON_X WAKE_DROPPED
key 50 BUTTON_A WAKE_DROPPED
key 14 BUTTON_L1 WAKE_DROPPED
key 16 BUTTON_R1 WAKE_DROPPED
key 56 MENU WAKE_DROPPED
key 108 BUTTON_START
key 103 BUTTON_SELECT
which game can be play by this mod ?
fifa12 ?pes12?nfs most wanted ?
is it can be use to play ppsspp emulator ?
you can play fifa 12 xperia play version & asphalt seris & virtual tennis
sorry for my bad English
Works on CM 10.1
but buttons are not correst, W is left and Z is right and so on
fchaster said:
which game can be play by this mod ?
fifa12 ?pes12?nfs most wanted ?
is it can be use to play ppsspp emulator ?
Click to expand...
Click to collapse
see here
http://forum.xda-developers.com/showthread.php?t=1217060

[Q] Hardware Keys Lights

How to adjust brightness of capacitive hardware keys ( back menu home )? make it light brighter
Xperia Active/satsuma/st17i
CM 10 FXP 217
Mesa Hybrid Kernel V4.4
Edit the hw_config.sh file in system/etc
You'll find a line echo 100 (something about button backlight)
And change the 100 to 200.... etc etc
Regards
-N
mnishamk said:
Edit the hw_config.sh file in system/etc
You'll find a line echo 100 (something about button backlight)
And change the 100 to 200.... etc etc
Regards
-N
Click to expand...
Click to collapse
Thanks! Got it :good:

[Q] Huawei U8350 Icy Tiramisu Keyboard

I am trying to fix the Physical keyboard to have full functionality (smiley and symbol keys). From what I can tell the issue lies in QWERTY.kl which is missing a few lines from the stock ROM
Code:
#key 11 0
key 11 SMILE
#/* < BU5D09842 weixinghai 20100513 begin */
key 163 MEDIA_NEXT WAKE
key 165 MEDIA_PREVIOUS WAKE
#/* BU5D09842 weixinghai 20100513 end> */
key 194 SYM
Now I've tried editing the qwerty.kl that comes with Icy Tiramisu with various text editors and when I reboot it's as though the keyboard is not being recognised at all. I've even just added 1 line (key 194 SYM) with the same result.
I've had a look at the fixed HuaweiIME.apk that zenaufa made for this ROM and it seems to contain all the correct elements for the smiley and symbol button to work and from what I can tell the changes to qwerty.kl should work. Can anyone give me any insight into what could be going wrong?

Solution: Get Rid of Google Voice Search Popping In At Random While Using Headphones

With the latest software update of my Sony Z5P I faced a really annoying issue, which essentially prevents me from listening to the music with the device. Symptoms are as following: during headphones connect or disconnect, or even slight movement of the jack in the audio port, volume randomly goes all way up or down and, the most annoyingly, music pauses and Voice Search is activated. Very frustrating.
I searched for the possible fixes in the Internet and found that there are dozens of posts on various web resources, regarding exactly the same issue. The issue exists on a very broad range of phones, tablets and Android versions. There are a lot of solutions too, generally "Try to install app X" or even "disable Google Search", but nothing worked for me (and probably for majority of users). And I didn't wanted to disable Voice Search, because it's a useful feature.
Looking into the problem further, I discovered that the issue is caused by the wrong detection of a headphones by Android. The system decides that it's not headphones, but a headset, that is the headphones with a mic and hardware buttons to control audio. The system even places an icon to the upper bar and there is a "Headset is plugged in" notification in the drawer.
Due to a hardware difference between connectors of headphones and a headset, every time it is slightly moved in port generates random electric signals which Android mistakenly recognizes as commands from a hardware remote control. If you are listening to the music while walking or especially running, the chances are pretty high, that connector is moving slightly. And the music become constantly interrupted by Voice Assistant or its volume is being decreased or increased. That's really, really disturbing.
One particular useful post which I found was this one. From it I learned there is a /system/usr/keylayout directory in Android filesystem, with files handling hardware buttons. Other useful insight is a link to the small Chris Boyle's app for keypresses debug (he even made a blog post about it). With this knowledge and this small useful tool I started to dig into my phone's system.
Using Key Test app mentioned above I figured out that any slight jack movement generates keypresses with scan codes 226 and 582 (HEADSETHOOK and VOICE_ASSIST) and occasionally 114 and 115 (VOLUME_DOWN and VOLUME_UP). That's what I should find in the system.
At first I should state that to make my solution work, you will need a rooted phone. All dirty hacks need root privileges. For Sony Z5 Premium rooting I assembled a dedicated guide, although it should work with most recent Sony devices. If you have a phone from some other OEM, please search this forum, there are plenty of rooting guides.
Okay, you have a topic problem, your phone is rooted and your adb works. That's how I fixed my phone.
At first you should check contents of your phone's /system/usr/keylayout directory and inspect individual files. It's easier to do on a computer, so copy this folder (maybe with some file manager like ES File Explorer) to your internal or external storage (for example to /sdcard) and then transfer by MTP to the computer (in Windows use File Explorer, the directory is in the This PC\Xperia Z5 Premium Dual folder or something like this).
Once you have keylayout directory on your computer, use some text editor tool which can search multiple text files for a particular text (I use Notepad++, but if you are on a Unix-like OS, you may use grep as well). You should search you files for this text strings:
Code:
HEADSETHOOK
and
Code:
VOICE_ASSIST
On the latest Z5 Premium firmware (Android 6.0.1, build .224) these particular strings were found in the Generic.kl and msm8994-tomtom-snd-card_Button_Jack.kl files. While the former is a generic keymapping file of all Android devices, the latter is specific to Z5P, because of it's name, which suggests that it is somehow related to MSM 8994, which is a partnumber of Qualcomm Snapdragon 810 SoC. In fact, this file is obviously handles headset keypresses, and its contents are:
Code:
key 226 HEADSETHOOK
key 115 VOLUME_UP
key 114 VOLUME_DOWN
key 582 VOICE_ASSIST
key 260 VENDOR_1
Your phone may have file with some other name but contents should be similar. What worked in my case is a changing the codes in this file to some different values which are not used elsewhere. I changed mine to this:
Code:
key 995 HEADSETHOOK
key 996 VOLUME_UP
key 997 VOLUME_DOWN
key 998 VOICE_ASSIST
key 999 VENDOR_1
And that's how I placed modified msm8994-tomtom-snd-card_Button_Jack.kl back into its original place in the phone. This is particularly tricky and you absolutely need rooted phone to do this.
First, place the file into the phone's memory with a guaranteed write access. /sdcard usually is a such place:
Code:
adb.exe push msm8994-tomtom-snd-card_Button_Jack.kl /sdcard/
Then login to the phone's shell and become superuser (root):
Code:
adb.exe shell
[email protected]:/ $ su
[email protected]:/ #
After that make /system mounted as a read/write filesystem:
Code:
[email protected]:/ # mount -o remount,rw /system
And copy the modified file back in place. After that reboot:
Code:
root[email protected]:/ # cp /sdcard/msm8994-tomtom-snd-card_Button_Jack.kl /system/usr/keylayout/
[email protected]:/ # reboot
Once the file was updated and the phone rebooted, I checked keypresses with Key Test again. These keypresses were generated as before, with the same scan codes, but this time key codes were registered as KEYCODE_UNKNOWN and did not any harm. The system cannot recognize them and doesn't react to them in any sensible way.
That's it. Be informed, that if you plan to use a real headset, with this hack its keys will not work at all.
tl;dr
- Enable ADB and root access for ADB
- In ADB shell:
Code:
$ su
# mount -o remount,rw /system
# sed -i "s/\(key.*HEADSETHOOK\)/#\1/g" /system/usr/keylayout/Generic.kl
# sed -i "s/\(key.*VOICE_ASSIST\)/#\1/g" /system/usr/keylayout/Generic.kl
# reboot

Categories

Resources