[PX5] MTCE Button remapping Tutorial for Malaysk / mtce-utils - MTCD Software Development

Hi there,
after struggling around with the mcte utils settings.ini file to remap buttons, I tought I might share what I learned.
This assumes, you have installed xposed, activated the mtce-utils module and placed the settings.ini file at your internal sc card (/storage/emulated/0).
Here's how to remap buttons:
PHP:
[android.microntek.service#keys]
# In this section, you have to put all GLOABL remap functions into. You can use the following ways or remapping:
# note: xxx always stands for the mtc-keycode. If you do not know them, you can use MTCD Tools -> Creata new bnding -> Obtain key sequence to get the key codes.
app_xxx=com.spotifiy.music
#--> this defines to launch any app, e.g. app_257 would in my case launch spotify when pressig OK button.
keycode_xxx = 4
# ---> with the keycode command, you can assign android keycodes. For example "4" is the back button, "87" is media next.
# a full list of android codes can be found here: https://android.googlesource.com/platform/frameworks/native/+/master/include/android/keycodes.h
activity_xxx = com.zoulou.dab/com.zoulou.dab.MainActivity
# --> this is to launch any activity. Always put a pair of app/activity with a slash in between. My example starts the DAB App.
intent_xxx= [any android intent action]
#--> this is to assign an intent. Couldn't test it yet.
keymtc_xxx= yyy
# --> this is used to reassign another mtc key.
[com.microntek.radio#keys]
# to remap buttons within specific apps, create an extra section which contains the app name [B][app.name#keys][/B]
# same as with global remapping, put the codes here as you which to reassign keys within special apps.
Well hope that makes the settings more clear for you.
BR
Christian

I just made some small corrections to the above post and want to share my settings with you:
What did I actually do?
I changed the two steering wheel keys "Mode" and "List" to Keycodes 219 and 4. 219 launches Google Assitant, 4 is to go back. This way, I can easily launch Google Assistand for calls, navigation and spotify, tunein and can minimize if needed.
I assigned keycodes 87/88 to both forward/backwards keys, so that I in most apps can go forward/backward
I assigned my favorite apps to the buttons 1-6, which are DAB, TuneIn, Spofity, FM Radio app, Google Maps and Bluetooth Phone
So I can switch easily between all those apps. As the radio app has its own buttons assigned, here the keys 1-6 are still used as usual.
What doesn't work is the part where I wanted to fix wrong forward/backward keys in radio app. Assigning backward to forward and vice versa leads to a crashing radio app (behaves like non ending loop then)
PHP:
[android.microntek.service#keys]
activity_331=com.zoulou.dab/com.zoulou.dab.activity.MainActivity
keycode_365=4
keycode_276=87
keycode_278=88
keycode_256=219
activity_283=com.zoulou.dab/com.zoulou.dab.activity.MainActivity
app_284=tunein.player
activity_285=com.spotify.music/com.spotify.music.MainActivity
activity_286=com.microntek.radio/com.microntek.radio.MainActivity
app_287=com.google.android.apps.maps
app_288=com.hb.dialer.free
[com.microntek.radio#keys]
keycode_276=90
keycode_278=89
activity_331=com.zoulou.dab/com.zoulou.dab.MainActivity
Hope this helps!
Christian

I can not make settings.ini work, do you paste the file in / storage / emulated / 0 directly or put it in the mtce-utils folder?

Hy @gforums,
thanks for the little tutorial.
Unfortunately, changing the steering wheel buttons does not work.
I am currently using Android Oreo with the Malaysk Rom.
Enclosed my settings.ini
Code:
[android.microntek.service#keys]
keycode_258=87
keycode_316=88
@elavaro19:
as I understand it you have to put the ini file directly into the directory /storage/emulated/0.
BR
gary822

@gary822 I'll try like this, I can not assign buttons for canbus and I want to remap some buttons between them the aux button to home

Dude, this is awesome stuff! Thank you so much for sharing what you learned!

But where can i find out wich key on my sterlingwhel has wich keycode?

kaderekusen said:
But where can i find out wich key on my sterlingwhel has wich keycode?
Click to expand...
Click to collapse
I've used mtcd tools, option to select a new binding and then pressing the key I want to assign. Mtcd tools should show you the mtce key code then.

kaderekusen said:
But where can i find out wich key on my sterlingwhel has wich keycode?
Click to expand...
Click to collapse
gary822 said:
Hy @gforums,
thanks for the little tutorial.
Unfortunately, changing the steering wheel buttons does not work.
I am currently using Android Oreo with the Malaysk Rom.
Enclosed my settings.ini
Code:
[android.microntek.service#keys]
keycode_258=87
keycode_316=88
@elavaro19:
as I understand it you have to put the ini file directly into the directory /storage/emulated/0.
BR
gary822
Click to expand...
Click to collapse
Did you reboot after changing the settings.ini? This is needed. Have you also activated the xposed-mtce-utils module? And checked whether the mtce key codes used are the right ones?
Are you on Malaysk?

I think I may have found the solution to this. I'll post it here if it works.

mattj949 said:
I think I may have found the solution to this. I'll post it here if it works.
Click to expand...
Click to collapse
hello, Any news ?

Thank you very much for this! I was able to figure out how to remap most of the keys on my CAN bus steering wheel controls. I'm now trying to figure out how to find an apps key codes so I can assign them to other keys on the head unit... How did you find out what the key codes are for your DAB key codes in the very last section of the settings.ini?
I have 2 apps I'm trying to figure out. One I'm trying to do is the FM radio app; [com.microntek.music#keys] and would like to make to when I press and hold the "next or previous" buttons that changes the presets, then just a single press will seek the next FM station. Do you know if there is any command lines that can be added to make it use the press and hold of a button? So that a single button can do 2 actions? I've played around with some of the units key study that has the ability to change the units buttons and can assign a single press, and press and hold, but the list of keys that can be assigned is limited.
The other I need to figure out is one button in a special app that tells it's special USB to send a signal to turn on the factory DSP amplifier. That app has button within the app that can manually send the signal, but I can't figure out how to find it's key code. And there is no Activity for it that I can use that I can find. I use an app called QuickShortcutMaker to identify an apps Activities name that it has.
Thanks.

Hey guys,
can any1 please share respectively upload the latest mtce-utils? Can't find them...
Thanks in advance

look on git hub

whitewolf8111 said:
Thank you very much for this! I was able to figure out how to remap most of the keys on my CAN bus steering wheel controls. I'm now trying to figure out how to find an apps key codes so I can assign them to other keys on the head unit... How did you find out what the key codes are for your DAB key codes in the very last section of the settings.ini?
I have 2 apps I'm trying to figure out. One I'm trying to do is the FM radio app; [com.microntek.music#keys] and would like to make to when I press and hold the "next or previous" buttons that changes the presets, then just a single press will seek the next FM station. Do you know if there is any command lines that can be added to make it use the press and hold of a button? So that a single button can do 2 actions? I've played around with some of the units key study that has the ability to change the units buttons and can assign a single press, and press and hold, but the list of keys that can be assigned is limited.
The other I need to figure out is one button in a special app that tells it's special USB to send a signal to turn on the factory DSP amplifier. That app has button within the app that can manually send the signal, but I can't figure out how to find it's key code. And there is no Activity for it that I can use that I can find. I use an app called QuickShortcutMaker to identify an apps Activities name that it has.
Thanks.
Click to expand...
Click to collapse
--> activity_331=com.zoulou.dab/com.zoulou.dab.MainActivity
The keycode from the key I want to assign can be obtained my "mtcd key tool" or in hal9k rom, where you can activate that keycodes are displayed by key press. In my case, key 331 is the "1"-key from my orginal radio.
the app/activity combination can by obtained by the app "package name viewer" that lists you app names / activities of your insalled apps.
I do not know, how you can change behaviour between short and long press.
Also, how to change the behaviour of the keys within an app, is difficult. You can work with Intents, but I am not used to it.

gforums said:
--> activity_331=com.zoulou.dab/com.zoulou.dab.MainActivity
The keycode from the key I want to assign can be obtained my "mtcd key tool" or in hal9k rom, where you can activate that keycodes are displayed by key press. In my case, key 331 is the "1"-key from my orginal radio.
the app/activity combination can by obtained by the app "package name viewer" that lists you app names / activities of your insalled apps.
I do not know, how you can change behaviour between short and long press.
Also, how to change the behaviour of the keys within an app, is difficult. You can work with Intents, but I am not used to it.
Click to expand...
Click to collapse
Thank you for your help! I think I have most of it all working the way I want now, but I will keep playing around with it some more. :good:

@gforums or anyone with the answer, has anybody been able to remap a wireless keyboard/remote? Mainly I'm trying to get the volume and mute to work. I know that the volume is controlled by the MCU and the remote want's to control the media volume which does nothing on our units. I'm just not quite sure how it should be written for the mtce-utils .ini file.
MCU volume up/down codes for MTCE are: 273/281 respectively. And the remote/native android codes for volume up/down are: 24/25 respectively.

has anyone already tried get this running on android 9 (PX5)?
As xposed is needed and in android 9, xposed only can be installed as magisk module, I can't get it working.
So currently I do not know a way to change canbus keys in Android 9.
Anyone of you does?
Best regards,
Christian

Hi,
I'm running android 9, I installed Xposed, but how do you instal mtce-utils ? Can't find them anywhere.
Thanks

Related

PTT remap/fix

Good Evening
I downloaded a PTT fix from http://www.howardforums.com/archive/topic/1054343-1.html & installed the .cab file. It created a button 5 option in my settings/buttons menu. However, when I set that option for camera instead of PTT...it still initializes the PTT vs the camera. I'm going to assume that the PTT is not button 5 on the fuze, hence why it won't work. Does anyone know which button that it might be, and how i could edit that file? or make my own work around?
Thanks
The PTT might be hard wired to the PTT hardware needed for ATT's push to talk, kinda silly really I don't see why they still push this I've yet to meet anyone on ATT who uses this feature, maybe one day ill run into a cunstruction worker who knows.
TazMan1688 said:
Good Evening
I downloaded a PTT fix from http://www.howardforums.com/archive/topic/1054343-1.html & installed the .cab file. It created a button 5 option in my settings/buttons menu. However, when I set that option for camera instead of PTT...it still initializes the PTT vs the camera. I'm going to assume that the PTT is not button 5 on the fuze, hence why it won't work. Does anyone know which button that it might be, and how i could edit that file? or make my own work around?
Thanks
Click to expand...
Click to collapse
I'd love to see a solution to this too. I tried the Tilt registry hacks that let you re-map the PTT button but all that did was disable the button completely. (Which is still an improvement because at least now I don't have the PTT message come up every time I accidentally hit that button...)
Black93300ZX said:
CONFIRMED, this is how to keep that annoying PTT message from coming up on American Touch Pro's (Fuze maybe? whatever).
Keep in mind, you can't individually map this button with this method, that may come later.
Step 1: Registry editor, remove HKLM/Services/PTT
Step 2: Create a key in HKLM/Software/Microsoft/Shell/Keys called "40C2"
Step 3: Create a string within that key, titled Name with the value being "Button 6" or whatever
Step 4: Soft reset.
From this point on you can remove 40C2, but your PTT button will simply perform with a press what your send button performs with a hold (which can be remapped easily... Settings/Buttons/Button1(Hold)).
Click to expand...
Click to collapse
10 chars..
I were to remove that string after i install the .cab, would that disable PTT,and the settings menu take over?
I realize I can do a registry hack, but I was looking for something that A) would be easy to install/uninstall B) would add an easily accessible option to the settings on the phone.
TazMan1688 said:
I were to remove that string after i install the .cab, would that disable PTT,and the settings menu take over?
I realize I can do a registry hack, but I was looking for something that A) would be easy to install/uninstall B) would add an easily accessible option to the settings on the phone.
Click to expand...
Click to collapse
Um that is the easiest way right now.
And it does as B). Just change what Button 1 (Hold) to whatever you want and that's what your PTT button will act as.
Alright, its Button 1...awesome. Now lets see if I can find that setting ;-)
In settings/personal/buttons
...there is only an option for button 5, and button 5(hold). 1-4 do not show up there. How would I go about editing button 1's action?
Thanks alot
I found a program called AE BUTTON PLUS, it allows you to map any hardware button on the device. The PTT button is not listed by default so you need to "add button" it will then ask you to press the hardware button you would like to map, after that it shows up on the list and you can map it... I have found that adjusting long press setting causes issues, but tap and double tap work fine. I have tap disabled since I always hit the key by accident, double tap is Torch. Working fine so far. I believe you can even map individual keys on the keyboard in the same way.
I tried to use AE Button Plus(registered it), and had no luck creating an action for the PTT button. So I followed the registry ediit intructions, again..with no avail.
My PTT is disabled, which as previously stated, is better than nothing.
I would like to clarify two things. Does 40C6, and 40C7 relate to PTT on all devices, or is this a phone by phone basis? 40C6 could be PTT on a tilt, but the touch may be 33D4. Noobish question, but I'm not sure how this stuff works.
Also you said its "Button 1". Again, does this refer to hardware button # 1. Or is this just a random name we give it so we know which one to edit in the buttons menu?
So if I use 40c6, and 40c7 for "Button 1", and "Button 1(hold)"...it should work?
...I also used Button 6 & Button 6 hold as in the Tilt instructions. Same function.
I appreciate the assistance gang!
any1 have any luck?
If you want to remap the PTT button using a cab file (instead of manually doing reg tweaks) just look here: http://www.fuzemobility.com/ptt-remapping-revisited-application/
pretty simple but read the 'update' at the end

Shortcuts for HTC Sense functions?

I've been trying to find a way to trigger particular Sense functions by mapping them to hardware keys.
In particular, I'd like to map buttons to play/pause music and skip tracks. Ive looked for command line arguments that will do it, and also key commands that the audio manager might pick up on, but I've had no luck. Might anyone be able to point me in the right direction?
Neocronic said:
I've been trying to find a way to trigger particular Sense functions by mapping them to hardware keys.
In particular, I'd like to map buttons to play/pause music and skip tracks. Ive looked for command line arguments that will do it, and also key commands that the audio manager might pick up on, but I've had no luck. Might anyone be able to point me in the right direction?
Click to expand...
Click to collapse
I know that there is a button emulator floating around (don't recall the name) that allows you to emulate pressing a specific x,y, coordinate on the screen.
Maybe this one....
Here's another thread regarding similar request.
I've made it that far. My issue is how to call the actual play/pause using an application such as that. Maybe a command line argument to manila.exe, or an emulated key press that the audio manager would see and toggle the play/pause.
Both of those sound like they'd work, but I can't find any more information on things such as that.

Mapping SIP Key

Ok, I searched around for about an hour, and must not be using the right search term or something. Anyway,
I have an HTC HD2, and i'm trying to run gotomypc with it (and pandora). I can run both, but i have to map the hardware button to my input panel in order for it to come up in either application. Thats all well and fine, except i also like the default long press key option that brings up my voice command. (And for those that don't have an HD2, there is only 1 mappable hardware key). So i have to jump back and forth on button assignments to use applications.
So point is, i installed AE Button Plus, and it appears to be able to do the trick, yet i can't find what file to point the assigned long press button too. Where is "input panel"/aka SIP located at/what directory?
Or does someone have an easier suggestion for mapping a previously unassignable hardware key to the SIP?
Thanks in advance!

Re-mapping keys / Creating or re-assigning keyevent

OK, I've looked around but can't find an answer. Or at least an answer that I can understand. Basically what I'm trying to do is add the ability to quit/exit an app. I've read all about the differing opinions on quitting an app versus pressing back. However, just for my own self-teaching purposes, I want to learn how to do this. I'd like to be able to long-press or double tap a key to either immediately exit an app, or bring up an alternate pop-up menu that allows you to choose an action.
I am thinking specifically in relation to the Browser. The quit option was more necessary pre-CM6 because often times, it would take forever to load the home screen after pressing "home" in order to stop using the browser. A simple exit/quit option that some apps have, usually acts much quicker. Everyone knows that if you've been browsing through a bunch of webpages, hitting the back button repeatedly is a pain in the ass. The other option is to hit menu-->windows-->then close all the open windows-->then hitting the back button once the new window pops up because browser automatically opens a new page once all open windows have been closed.
Another annoyance is not being able to quickly get to your home page. Is there a way to remap/reassign/whatever, keys so that on long-press or double-tap of say, menu, or trackball, a menu pops up which has a "exit/quit" option and a "home page" option?
Another option is to add to the menu (when you hit menu), a "quit/exit" or "homepage" option.
Any help would be appreciated.
So much for a "supporting community". Way to help each other out.
What your trying to do should be located in the /system/usr folder. It has the key information you are trying to edit.
bubonik said:
So much for a "supporting community". Way to help each other out.
What your trying to do should be located in the /system/usr folder. It has the key information you are trying to edit.
Click to expand...
Click to collapse
Yeah, most people are probably trying to figure out a way to tell me I posted in the wrong section or that I need to use the search function. Thanks for your answer but I am familiar with the /system/usr files...I don't see anything in there relating to an action that quits/exits an app. Is there a specific action that is called when someone presses menu while using an app, and the menu brings up options including quit/exit?
Really? Nobody?
The keymap files are stored in /system/usr/keylayout, open them up and have a look at the things you can assign to keys.
Pull-edit-push the correct version for your handset hardware and reboot, changes will take effect. Obviously Magics are sapphire-keypad.kl and G1s are one of the trout files. Most G1s are trout-keypad-v3.kl though you can confirm your specific hardware version with getprop.
Have a search for "keymap" and "keylayout", you'll find there's already a bit of work been done of this, for example this auto key-changer.
I appreciate the help but I guess I'm not explaining myself properly. I have looked at the files in /system/usr/. I know how to remap a key so that, say...volume down = pause music, or change the menu key to have it end a call if I wanted...I know I'm not using the correct terminology all the time but when looking at the various .kl files, there are various "actions" that can be attributed to a particular key. For instance, keys 107 & 62 = Endcall, key 158 = Back, key 10 = the number 9.
In the column next to the numerical keycode in each of the .kl files, there is an "action" that results from pressing the particular key. The action I am looking for is a "quit" and/or "exit" action to apply to a particular key. Let's say I wanted to have key 231 in the sapphire keypad, kill the app I am using. Right now, pressing key 231 = CALL button. Is there a keyevent such as Kill_app or something to that affect that I could put in place of the CALL action so that key 231 = Kill app?

Is it possible to change the way the wheel controls work on MTCD (GS PX5 Oreo)?

Can anyone advise on how I could ho about changing the list of apps that gets started by the Mode function on my Xtrons unit (MTCD GS PX5 oreo)?
I know someone has done something similar with a Joying unit, but as far as I can see, they replaced the "Sofia-1-C9-Server... apk) with an alternative version.
I've pulled all the system apps to my PC via ADB (root) via WiFi, and I can see apps like MTCControlSettings.apk and MTCContolInfo.apk but there are no apks with "server" in their name
So I'm not sure where to start looking for the APK which handles the steering wheel control "Mode" handling.
Does anyone know how this is handled ?
are you able to resolve it? im having the same problem. btw my unit is a MTCE_CSN thanks
slidefriday said:
are you able to resolve it? im having the same problem. btw my unit is a MTCE_CSN thanks
Click to expand...
Click to collapse
I've not had time to investigate this.
For the moment, I've just set my Mode button to be the Home button, as thats better the cycling through a load of useless "modes" like the AV input and their useless audio and video players.
I did try to work out how the radio communicated with the system apps, but I'm having a lot of difficulty de-odex'ing (decompiling) even the radio app. Because the apps are Oreo versions, and most of the decompilers don't fully support Oreo odex (compiled application program) files
I did post a question to the general Dev part of XDA about de-odex'ing Oreo files but didnt get any responses
I would be interested in this if you figure it it out as I'd like to get dab in the list of apps it cycles through.
RogerClark said:
I've not had time to investigate this.
For the moment, I've just set my Mode button to be the Home button, as thats better the cycling through a load of useless "modes" like the AV input and their useless audio and video players.(
Click to expand...
Click to collapse
That would be enough for me, but with onboard apps or settings i haven't found a way to change it. I can use my Wheel control for changing volume and skipping music in any music app I am using, but the mode button always switches throug radio, ac input, mediaplayer and dvd.
The app for steering wheel control which was preinstalled on my head unit, doesn't react to any button and the firmware settings only to the hardware buttons of my head unit.
So, how did you do it?
nadkp said:
That would be enough for me, but with onboard apps or settings i haven't found a way to change it. I can use my Wheel control for changing volume and skipping music in any music app I am using, but the mode button always switches throug radio, ac input, mediaplayer and dvd.
The app for steering wheel control which was preinstalled on my head unit, doesn't react to any button and the firmware settings only to the hardware buttons of my head unit.
So, how did you do it?
Click to expand...
Click to collapse
In the Settings, ( think its in the Car) section, is the setting (app) which allows you to associate specific steering wheel buttons with specific actions.
I thought all generic units had this app, because the steering wheel button for each car operate differently.
My Subaru only has one wire from the steering wheel, and has 6 buttons. Each button has a different electrical resistance, and you have to press each button, and then associate a Short Press and a Long Press, on that button, to a specific action.
The controls like Volume + and - and Track + and - and Mute are pretty standard.
The only other button I have is the Mode button, and I assigned that to the "Mode" action in the settings. However the Mode operation, cycles though a predefined list.
So I simply reassigned the Mode button to the Home action.
I did try a few other things, like seeing if I could press 2 buttons at the same time e.g Mode and Track +, but it either treated this as a press on the Mode button or a press on the Track + button. So that didn't work.
If I get time, I'll have another go at decompiling the system apps, but last time I tried to do that, I could not see anything that looked like the list of apps.
If I had programmed it, I'd probably put the app names into a string resource, but goodness knows what the programmed did who wrote the system apps in these units.
RogerClark said:
In the Settings, ( think its in the Car) section, is the setting (app) which allows you to associate specific steering wheel buttons with specific actions.
Click to expand...
Click to collapse
Thanks for the quick reply. I already tried the factory settings but my steering wheel buttons won't work there. I only can set action to the buttons on my radio. Sadly I have to wait for any other solution. But thanks again for sharing your experience :good:
What brand and model of HU do you have?
Hey,
Opel/Vaux/Chevy cars have canbus hard mapped buttons.
Mine can't be configured through the in-built apps or factory settings either.
One would have to examine the canbus.apk / MTCManager to maybe update the xposed for MTCDTools.
MTCD Tools can see the button codes (3 digits), but can't map any other function or even intercept.
---------- Post added at 16:43 ---------- Previous post was at 16:43 ----------
Hey,
Opel/Vaux/Chevy cars have canbus hard mapped buttons.
Mine can't be configured through the in-built apps or factory settings either.
One would have to examine the canbus.apk / MTCManager to maybe update the xposed for MTCDTools.
MTCD Tools can see the button codes (3 digits), but can't map any other function or even intercept.
RogerClark said:
What brand and model of HU do you have?
Click to expand...
Click to collapse
I have a Xtrons PB78QSFP-B which is designed for a Ford Focus and came with a standard canbus adapter for ford. But I have the old model of the HU which has only 2GB Ram not 4.
My guess is, that Ford has hard mapped buttons too, like Xorit said it about Opel/Vaux etc
update guys! mtcdtools will do the trick! though the old mapping will flicker but still the newly assigned actions will prevail.
i can live with this already. maybe ill just find the solution to delete the factory set MODE actions :laugh:
slidefriday said:
update guys! mtcdtools will do the trick! though the old mapping will flicker but still the newly assigned actions will prevail.
i can live with this already. maybe ill just find the solution to delete the factory set MODE actions :laugh:
Click to expand...
Click to collapse
Did your have to root your unit or install anything like Xposed etc? Or does it just work with the stock firmware?
works with stock fw. im not yet doing any firmware mods
slidefriday said:
works with stock fw. im not yet doing any firmware mods
Click to expand...
Click to collapse
Good to know

Categories

Resources