reading vechicle sensor data in Android app? (CANBUS input) - MTCD Android Head Units Q&A

Dear devs,
I have MTCD PX5 MX (Witson).
I would like to make some small utility apps to enhance HU functionality based on vehicle data.
I would like for example to read the vehicle speed in my app (without using GPS or OBD). I know it's available somewhere in the OS because you can see it in the factory "Vehicle Info" app which seems to be the same for all MTCD units.
Is it some /proc file to be read? Some broadcasts? Some android API additions or some native library calls?
Thanks!

rumburake said:
Dear devs,
I have MTCD PX5 MX (Witson).
I would like to make some small utility apps to enhance HU functionality based on vehicle data.
I would like for example to read the vehicle speed in my app (without using GPS or OBD). I know it's available somewhere in the OS because you can see it in the factory "Vehicle Info" app which seems to be the same for all MTCD units.
Is it some /proc file to be read? Some broadcasts? Some android API additions or some native library calls?
Thanks!
Click to expand...
Click to collapse
The only way is decompilation of an app (you have to find one which deals with CANBUS) and analysis of decompiled source code. There is no API for such things in these devices.

rumburake said:
Dear devs,
I have MTCD PX5 MX (Witson).
I would like to make some small utility apps to enhance HU functionality based on vehicle data.
I would like for example to read the vehicle speed in my app (without using GPS or OBD). I know it's available somewhere in the OS because you can see it in the factory "Vehicle Info" app which seems to be the same for all MTCD units.
Is it some /proc file to be read? Some broadcasts? Some android API additions or some native library calls?
Thanks!
Click to expand...
Click to collapse
You need a canbus decoder. If you buy a canbus decoder for VW golf/Jetta mk5/mk6 I can tell you which messages you need to send to the canbus decoder for the vehicle info apk and for door information, and you can easily send messages with Arduino (with canbus board) or with teensy 3.1 (with can transeiver) or other microcontroller.

I notice by default, (after installing Titanium Backup) that the Vehicle App is "frozen" and when I unfreeze it to run, it doesn't really stay open. I do have a CANBus interface for my 08 Mitsubishi Lancer Evolution X. I noticed in Factory Settings>CANBus, it has options (standard/swap) for front door, back door and air conditioning. Is there any way to have the data displayed somehow? Is the vehicle info app supposed to show it?
Sent from my Nexus 9 using Tapatalk

verkion said:
I notice by default, (after installing Titanium Backup) that the Vehicle App is "frozen" and when I unfreeze it to run, it doesn't really stay open. I do have a CANBus interface for my 08 Mitsubishi Lancer Evolution X. I noticed in Factory Settings>CANBus, it has options (standard/swap) for front door, back door and air conditioning. Is there any way to have the data displayed somehow? Is the vehicle info app supposed to show it?
Sent from my Nexus 9 using Tapatalk
Click to expand...
Click to collapse
In my case (mazda cx5) the vehicle.apk is not the one for showing information
When I open any door it is displayed on the unit.
Even having the same options (air conditioning) like you air conditioning info is not displayed.
Enviado desde mi D6603 mediante Tapatalk

Oh. OK. Hrm...must be controlled somewhere else then. I wonder how I can get it to begin to display that type of info.
Sent from my Nexus 9 using Tapatalk

I'm also in the topic for some weeks, and there is no api or information to access the canbus from the unit.
To reverse engineer the can bus app was the only suggestion provided also.
I think the aim should be to create a android socket can bus api driver for the unit.

Thanks for your interest guys, I managed to get the data by examining the "Vehicle" app (MTCControlInfo.apk). :victory:
There's a broadcast "com.microntek.sync" which contains a byte[] extra called "syncdata". The array has 20 byte values of which I decoded the speed, revs, voltage, temperature and total mileage. When data[2] == 2, the data is:
Code:
// RPM
int rpm = (0xFF & data[3]) * 256 + (0xFF & data[4]);
// SPEED
double speed = ((0xFF & data[5]) * 256 + (0xFF & data[6])) * 0.01d;
// BATTERY
double battery = ((0xFF & data[7]) * 256 + (0xFF & data[8])) * 0.01d;
// TEMP
double temp = (0xFF & data[9]) * 256 + (0xFF & data[10]);
if (temp >= 32768) {
temp -= 65536;
}
temp /= 10;
// DISTANCE
int distance = (0xFF & data[11]) * 65536 + (0xFF & data[12]) * 256 + (0xFF & data[13]);
The problem is the Broadcast doesn't come unless the "Vehicle" app is started. They seem to either:
flip a switch like this:
Code:
Settings.System.putInt(this.getContentResolver(), "com.microntek.controlinfo.door", 1); // in onCreate() and onStart()
and
Code:
Settings.System.putInt(this.getContentResolver(), "com.microntek.controlinfo.door", 0); // in onStop()
I couldn't get my app to do this, you're not allowed to do this unless you're a system app.
or get the CarManager (which is in another app which I didn't get yet to examine), to do some command, perhaps another Broadcast.
I can get continuous data Broadcasts if I start the "Vehicle" app, then go to home screen, then start my app. Since onStop() would be called I believe it's the second method of switch that really happens.
As soon as you explicitely exit the "Vehicle" app the Broadcasts stop coming.
I'm using Bytecode Viewer, but it has quite a few errors translating to Java. A better disassembler would come in handy.
TBC...

rumburake said:
Thanks for your interest guys, I managed to get the data by examining the "Vehicle" app (MTCControlInfo.apk). :victory:
There's a broadcast "com.microntek.sync" which contains a byte[] extra called "syncdata". The array has 20 byte values of which I decoded the speed, revs, voltage, temperature and total mileage. When data[2] == 2, the data is:
Code:
// RPM
int rpm = (0xFF & data[3]) * 256 + (0xFF & data[4]);
// SPEED
double speed = ((0xFF & data[5]) * 256 + (0xFF & data[6])) * 0.01d;
// BATTERY
double battery = ((0xFF & data[7]) * 256 + (0xFF & data[8])) * 0.01d;
// TEMP
double temp = (0xFF & data[9]) * 256 + (0xFF & data[10]);
if (temp >= 32768) {
temp -= 65536;
}
temp /= 10;
// DISTANCE
int distance = (0xFF & data[11]) * 65536 + (0xFF & data[12]) * 256 + (0xFF & data[13]);
The problem is the Broadcast doesn't come unless the "Vehicle" app is started. They seem to either:
flip a switch like this:
Code:
Settings.System.putInt(this.getContentResolver(), "com.microntek.controlinfo.door", 1); // in onCreate() and onStart()
and
Code:
Settings.System.putInt(this.getContentResolver(), "com.microntek.controlinfo.door", 0); // in onStop()
I couldn't get my app to do this, you're not allowed to do this unless you're a system app.
or get the CarManager (which is in another app which I didn't get yet to examine), to do some command, perhaps another Broadcast.
I can get continuous data Broadcasts if I start the "Vehicle" app, then go to home screen, then start my app. Since onStop() would be called I believe it's the second method of switch that really happens.
As soon as you explicitely exit the "Vehicle" app the Broadcasts stop coming.
I'm using Bytecode Viewer, but it has quite a few errors translating to Java. A better disassembler would come in handy.
TBC...
Click to expand...
Click to collapse
Use this decompiler:
http://www.javadecompilers.com/apk
According to CarManager - it is located inside framework.jar. You can see example usage in my app here:
https://github.com/f1xpl/MtcdTools
To use it in your project, simply copy source code loated at app/src/main/java/android/microntek/ except f1x dir to your project directory.

Cool you've got something.
But it looks like some processed data and not the raw can you will need for full controll so you have to mine deeper.

iwl said:
But it looks like some processed data and not the raw can you will need for full controll so you have to mine deeper.
Click to expand...
Click to collapse
As said in the original post what I want is this data. Don't put your hopes into me digging into the canbus as it's not my purpose.

rumburake said:
As said in the original post what I want is this data. Don't put your hopes into me digging into the canbus as it's not my purpose.
Click to expand...
Click to collapse
I have been looking into this also.
My unit is an MTCD PX5 MX, currently using Malaysk rom 5.0 and MX mcu 2.59. The car is a Peugeot 407.
I get air condition data: temperature readings from both sides of the car, air flow direction only from the driver's side, and the temperatures are off by 4 degrees (ie. showing 17C when the temp is set at 21C).
Steering wheel keys: Volume up/down always work, the other keys, Next, Prev, Source, and the "clicky wheel button" (which should change radio preset, change folder in music player etc.) only work if they are the very first button pressed after a reboot - it seems like something crashes on the first press, and after that only the volume buttons work.
I tried going into setup, factory settings, and using 'logcan' as password, the can logger starts, showing me that it does receive data on all the steering wheel keys, even if they no longer perform any action on the head unit after the first press.
The keys send data like the following:
Source: 2e 02 11 ...
Next: 2e 02 12 ...
Prev: 2e 02 13 ...
Volume up: 2e 02 14 ...
Volume down: 2e 02 15 ...
Volume up+down (should do Mute): 2e 02 16 ...
Clicky wheel button: 2e 02 03 ... or 2e 02 04 ... depending on the direction.
I want to modify the can bus apk, making it add 4 to air con temperature readings before showing, and I would also like to figure out, what happens when I press a steering wheel key for the first time, since everything works initially and then stops after the first press.

My unit is an MTCD PX5 MX, currently using Malaysk rom 5.0 and MX mcu 2.59. The car is a Peugeot 407.
Click to expand...
Click to collapse
Where did you get this MCU? AFAIK 2.55 is the latest MCU available for MX (according to: https://forum.xda-developers.com/an...opment/mtcd-px5-headunits-repository-t3619906)
MCUs from different models (HA etc) present minor incompatibilities such as different key setups / fascias between models. It may well be your problem with the buttons!

OK I got it now to work properly. :victory:
To get messages you need to send a request using CarManager. I have used the CarManager code from MTCDTools (thank you @f1x !)
In the case of a canbus adapter config 1 (VW/Skoda) you can send this message periodically to receive a data response (including the speed, rpm etc):
Code:
canbus_rsp=46,144,2,65,2,42
These numbers are made by functions specific to the canbus adapter type which you can find in the "Vehicle" app. I could obviously test this only on my car.
For this canbus config there are 2 other sequences, that return other data too:
Code:
canbus_rsp=46,144,2,65,3,41
canbus_rsp=46,144,2,65,1,43
To send a message you can call:
Code:
CarManager.setParameters(String par);
I hope this helps other people.... I will post again when I build something useful on this.

Interesting thread, would be nice to see the speed data applied to other apps (like Graser's Dasaita or F1x' sound to speed adjust, or Malaysk's screensaver), without the need to get GPS data.
But I guess not all MTCx units will have the speed data, so using GPS will be more generic. I do think the speed data from canbus will be more reliable when the unit supports it.

rumburake said:
Code:
canbus_rsp=46,144,2,65,2,42
Code:
CarManager.setParameters(String par);
Click to expand...
Click to collapse
Does this altogether mean : ?
Code:
CarManager.setParameters("canbus_rsp=46,144,2,65,2,42");
logcan as factory settings password is such valuable information....
---------- Post added at 01:48 ---------- Previous post was at 01:31 ----------
if code logcan starts the canlog app, may be this app is to find, smaller and more easy to decompile / hack.

logcan Can Bus Logger How To ?
KlausBJ said:
'logcan'
Click to expand...
Click to collapse
I'm just playing around with the factory settings pw logcan Can-Logger, but get nothing shown.
I've tried to send with 125000 Baud and 500000 Baud.
What number do you have choosen in the upper right corner there is No, 01, ..., FF ?
How have you used the bottom Buttons, I pressend Start, changing to stop then, what is TX RX for?

I'm also confused.
What's supposed to be inside the String when
Code:
CarManager.setParameters()
is called?
With this method is it possible to write to the CanBus or just read from it?
I'm asking because I'm trying to find a way to control the fade on my factory amp and this seems like the perfect way to do it if writes are possible.

I am now working on a volume setting app using the car speed and rpm. The volume is relative to the one set by user. I got promising results so far.
But I'm stuck at setting the HU volume, it does not sync with the manual controls: suppose volume is 5, then I set it programmatically to 10, then the user turns the knob up it becomes 6 (because it starts from 5)!
 @f1x you do have experience with this, could you please advise? I have tried all of the following:
This is for setting the real volume in the hardware (a volume value mapped from 0% to 100%):
Code:
carManager.setParameters("av_volume="+mtcLevel);
This is temporary and the Android OS doesn't know the volume was changed.
This setting seems to be used for saving the system known volume (0-30):
Code:
android.provider.Settings.System.putInt(ctx.getContentResolver(),"av_volume=",level);
But doesn't seem to have effect and I get this warning: You shouldn't keep your settings in the secure settings. This will soon become an error.
The same volume used to send a broadcast (also 0-30):
Code:
Intent intent = new Intent("com.microntek.VOLUME_CHANGED");
intent.putExtra("volume",level);
ctx.sendBroadcast(intent);
This probably it's just for notifying other apps (it's also how I get the volume changes in my app).
Anyhow what I mean is to set the volume to 10 and when I turn the knob up to find it at 11. Thanks!

rumburake said:
I am now working on a volume setting app using the car speed and rpm. The volume is relative to the one set by user. I got promising results so far.
But I'm stuck at setting the HU volume, it does not sync with the manual controls: suppose volume is 5, then I set it programmatically to 10, then the user turns the knob up it becomes 6 (because it starts from 5)!
@f1x you do have experience with this, could you please advise? I have tried all of the following:
This is for setting the real volume in the hardware (a volume value mapped from 0% to 100%):
Code:
carManager.setParameters("av_volume="+mtcLevel);
This is temporary and the Android OS doesn't know the volume was changed.
This setting seems to be used for saving the system known volume (0-30):
Code:
android.provider.Settings.System.putInt(ctx.getContentResolver(),"av_volume=",level);
But doesn't seem to have effect and I get this warning: You shouldn't keep your settings in the secure settings. This will soon become an error.
The same volume used to send a broadcast (also 0-30):
Code:
Intent intent = new Intent("com.microntek.VOLUME_CHANGED");
intent.putExtra("volume",level);
ctx.sendBroadcast(intent);
This probably it's just for notifying other apps (it's also how I get the volume changes in my app).
Anyhow what I mean is to set the volume to 10 and when I turn the knob up to find it at 11. Thanks!
Click to expand...
Click to collapse
Take a look at this remark:
Checks if the specified app can modify system settings. As of API level 23, an app cannot modify system settings unless it declares the WRITE_SETTINGS permission in its manifest, and the user specifically grants the app this capability. To prompt the user to grant this approval, the app must send an intent with the action ACTION_MANAGE_WRITE_SETTINGS, which causes the system to display a permission management screen.
Click to expand...
Click to collapse
https://developer.android.com/refer...System.html#canWrite(android.content.Context)

Related

[DEV][TUTORIAL] How to intercept DEX calls with Haret

Guys,
In case you dont know yet how to reverse engineer WinMo and DEX calls, a little tutorial.
- What is DEX call?
It's a mecanism for inter-processor communication used mainly in WinMo devices.
Android devices uses RPC mainly, but WinMo uses DEX also, that's why some features of WinMo are not working on our Liberty kernel.
(remember, our phone uses ARM11 on linux and ARM9 with radio. we dont control the radio software. ARM9 handles many task such as GSM, DSP, video, JPEG, voice etc)
- How can I track them?
Using HarET. See here how to work with it for basic stuff:
http://htc-linux.org/wiki/index.php?title=HaRET_Documentation
When your connection with HarET is working, here is how you intercept:
1st, setup the memory region to listen to
(note: the only address i want to monitor is 0xaccfc100 to fc120, but HarET crash when i do so. the only way for me is to listen to the whole SMEM starting at 0xacc00000)
HaRET(3)# addlist mmutrace 0xaccf0000 0xc130
Click to expand...
Click to collapse
2nd, disable the most common IRQs of photon:
HaRET(4)# ibit irqs 21 45 0 32 16 33 19 23 4 47
Click to expand...
Click to collapse
3nd, start listening for 5 seconds
HaRET(5)# wirq 5
Click to expand...
Click to collapse
during those 5 seconds (can be more if you wish so), the goal is to trigger the action you want to monitor. (for example, headset plug / unplug)
you will get maaaaany output on the screen.
4th, open the log file haret created (on the same folder you launched it) and import this to excell (or text editor) and look for this line:
000000: mmutrace 7a686510: e5832000(str) accfc100 0000011c (00000000)
Click to expand...
Click to collapse
0xaccfc100 is the memory address of DEX commands.
the data associated was 0x11c, which is composed of two things:
0x1c is the DEX id. see here: http://htc-linux.org/wiki/index.php?title=RaphaelDEX
0x100 means there is DATA associated to this DEX call.
if DATA is associated, you need to retrieve it at the good address: 0xaccfc120
the data is there (should be the next line):
000000: mmutrace 7a68651c: e5813000(str) accfc120 00000001 (00000000)
Click to expand...
Click to collapse
To translate this into photon kernel code, you can do this:
Code:
#include "proc_comm_wince.h"
{
struct msm_dex_command dex;
dex.cmd=0x1c;
dex.has_data=1;
dex.data=0x1;
msm_proc_comm_wince(&dex,0);
}
Unfortunately, sometimes the DEX call is not enough to activate the functionality.
sometimes you must also find the RPC call, or another trigger...
thinks,r0bin
Thanks . Want to know more about this!

Link contact adress to Nokia Drive

I use my7rom on my Omnia 7.
Is there anyway to link a contacts adress to Nokia Drive instead of Maps (stock wp7 app). It would be much more practical if Nokia Drive opened a navigation session instead.
Anyone up for the challenge? A reg-tweak perhaps?
// Manneman
Skickat från Windows Phone 7.8
There's two parts here. The first is identifying the correct "filetype" or URI scheme that is used for navigation. That shouldn't be too hard; a little digging in HKCU should reveal it. We already know about ones like callto: and http: and I'm actually (slowly) working on an app to allow people to easily change them. The second part is finding the correct command to load that address or route in the Nokia Maps app. If the app supports pinning routes or destinations to Start, this is probably possible. If not, it may not be possible in the app. Most apps aren't designed to accept command-line parameters, so even if you make them the default handler for a given filetype or URI scheme, they ignore the value you send them and just start as though launched from Start.
GoodDayToDie said:
If the app supports pinning routes or destinations to Start, this is probably possible.
Click to expand...
Click to collapse
Nokia Drive supports pinning to start so it should be possible. Unfortunately I can't tell you exact command line parameters 'cause my Lumia 900 still "in jail"
Let me see if I have a copy of the Nokia Drive XAP handy. I'll need to decompile it to figure out the correct parameters for launching it with the intent of navigating to a specific location. Note also that this might not be possible directly - for example, the app might store a list of locations internally, and the tiles only provide an index into that list rather than providing the location directly - but that just requires another layer of indirection.
In that case, you create an app that gets registered as the navigation handler, and in response to a navigation request, it writes the requested location into the Nokia Drive app and then chain-launches Nokia Drive with the index of the newly written location. That's just an example of one way that this might go wrong, but overall, the odds are actually pretty good. Obviously, all of this will require, at a minimum, write access to the HKCR hive in the registry.
Ah, guys! You are so kind helping me out. I´m really certain alot of members in the WP7 section would love for this to work!
// Manneman
GoodDayToDie said:
I'll need to decompile it to figure out the correct parameters for launching it with the intent of navigating to a specific location
Click to expand...
Click to collapse
GoodDayToDie, you may try much simpler solution. Just create assembly (dll) to show startup parameters in message box, and replace main Nokia Drive dll (but pin some location first).
That's actually harder than it sounds; even if the app is sideloaded (which would mean I already have the DLL) my fake would have to mimic the internal structure of the real app to a degree (namespaces, class names, default actions, etc.). That's not hard, but decompiling .NET is pretty trivial too.
AFAIR, Nokia Drive is obfuscated (but I'm not 100% sure). Also, you don't need to duplicate all names and structures; just a stuff mentioned in WMAppManifest (I hope so). BTW, I forgot: I still have unlocked handset; if I'll found time, will try today later.
Update: tried but without of luck What I did:
- installed Nokia Drive first;
- downloaded map and pinned current location;
- created fake app with same app guid and namespace name ("Drive"), and performed app update (that operation completely override whole solution but NokiaDrive tile still pinned to the start screen);
- tried a few different page names (_default.xaml, QuickStartPage.xaml, DestinationPickerPage.xaml, FavoritesPage.xaml) with code
Code:
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
MessageBox.Show("Hello from fake dll");
if (e.NavigationMode == System.Windows.Navigation.NavigationMode.New)
{
string[] keys = NavigationContext.QueryString.Keys.ToArray();
string[] values = NavigationContext.QueryString.Values.ToArray();
string param = "";
for (int i = 0; i < keys.Length; i++)
{
param += keys[i] + " -> " + values[i] + "\n";
}
MessageBox.Show("parameters: " + param);
}
}
But result always the same: app doesn't start from the pinned tile
Update 2: Finally, I did it
The trick is:
- do the same as I've described above (you should have pinned tile from ND);
- add following code to the start page:
Code:
public MainPage()
{
InitializeComponent();
var appTile = ShellTile.ActiveTiles.Last();
if (appTile != null)
{
//MessageBox.Show(appTile.NavigationUri.OriginalString);
EmailComposeTask emailTask = new EmailComposeTask();
emailTask.Subject = "NokiaDrive pinned parameters";
emailTask.Body = appTile.NavigationUri.OriginalString;
try
{
emailTask.Show();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK);
}
}
}
- run app as usual (not from tile);
We allset - all params are sent to our email (I'm too lazy to manually copy all stuff )
Here we are (start parameters; bold values are changed for privacy reason ):
/_default?destination.name=200 SomeName Street&destination.latitude=49.5255378801376&destination.longitude=-72.4296837244183&destination.address.street=SomeName Street&destination.address.houseno=200&destination.address.district=&destination.address.county=&destination.address.city=SomeCity&destination.address.state=&destination.address.country=USA&destination.address.postcode=05720&destination.hashCode=371767793destination.address.statecode=MA&pinnedFrom=Favorites
P.S. Just found: Navigon also has ability to pin address to the start tile So, if you find the way to modify map protocol (or how it calls), it will be a really nice hack! BTW, could you remind me: do we have ability to launch assembly by GUID (on the full-/policy-unlocked phones)? If "yes", it's possible to write a real nice "proxy" app to handle map requests
I don't know about launching assemblies directly, but it's certainly possible to launch apps by GUID. It doesn't even require anything more than dev-unlock in fact (although of course you can only launch apps that you could launch anyhow). So yes, a proxy app is totally possible. That's actually what I'm working on (started as a project to make a Kindle ebook file loader, that would pur .mobi/.prc file in the Kindle app's folder and then launch the app).
GoodDayToDie, could you please, take a look to the registry, for default map protocol handler and figure out how to change that stuff? I'm pretty busy these days (and probably will be extremely busy couple of next months) but we can cooperate and create this app...
I'll investigate, but you're not the only one busy. If you've noticed a lack of software from me recently, it's due to the nex job I got some months back; I love it, but it leaves me with a lot less time for phone hacking if I want to still have a life outside of that.
With that said, this actually ties into the work I'm already doing with things like filetype handling and default browser switching. I can send you my HKCRlib, at a minimum; it's a library that simplifies interacting with HKCR, including creating backups of important values when they change, and reverting the backups.
GoodDayToDie, truly, I'm not much interested (personally) in that hack 'cause I can't use it for my Lumia 900. So it's only for the community needs but because of lack of time, I believe, we may put it on hold.

Xserver chroot on TF700t

I've been running kexecboot native Linux for a while now and this has been a side project of mine since bumping into Linux Deploy. I really wanted to run my Linux and have my Android too... So, I got tired of trying to get Linux to run on the Android frambuffer and went this route... This runs pretty fast on my tablet. Resources seem way lower than a vnc chroot. And running on an xserver has more advantages. This is only tested so far with an image file and LXDE (I will be trying a microsd directory install soon).
XFCE4 and microsd partition install running fine also.
Use gparted to partition your microsd.
I used a SanDisk Class 10 16gb UH-I (8.5mb/s write and 24.5mb/s read) partitioned to 12gb fat32, 4gb ext4
These are just the settings I used that worked first for me. Play around, you can't hurt anything...
Download/Install:
Linux Deploy, Xserver XSDL and Connectbot
Setup Linux Deploy:
-Goto settings update environment
-On main screen click the install icon (it is the little down arrow)
---Under Deploy:
-Select your distro
-Architecture - arm7hf
-Installation type - File or ext4 partition
-Installation Path - change path and or file name or microsd partition (ex /dev/block/mmcblk1p2 for 2nd partition on microsd)
-Image size - at least 2GB (default is 4GB)
-User name - pick one or leave it
-Select components - check all
-Desktop environment - LXDE
---Under Startup:
-Check ssh server and Custom mount points
---Under Action:
-Go back to the top and select install.
-After it finishes click Start
Setup Xserver XSDL:
-Home button out and start Xserver XSDL
-Click screen immediately and choose 1900x1136(native) and font 0.5
-For those without a dock you may need to click "Change device configuration" at the top
when it first starts
Setup Connectbot:
-Home button out and start Connectbot
-ssh: [email protected]
-password: changes
-export DISPLAY=:0
-startlxde
-Recent apps select Xserver XSDL
**Profit**
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
XSDL works fine with my symlinked Arch.
Running super fast from an ext4 partition on my sdcard...
sound?
workdowg said:
Running super fast from an ext4 partition on my sdcard...
Click to expand...
Click to collapse
Did you manage to make sound work?
I tried to install alsa, audio devices are present but do not work...
pinaz said:
Did you manage to make sound work?
I tried to install alsa, audio devices are present but do not work...
Click to expand...
Click to collapse
No... @_that may have.
workdowg said:
No... @_that may have.
Click to expand...
Click to collapse
No, I only tried apps like Gimp and LibreOffice.
Linux Deploy update
With the latest version of Linux Deploy, Connect Bot is not needed any more.
Just select the option "GUI - Allow startup graphical environment", on "Graphics Subsystem" select "X Window System", and then on "GUI Settings" set "Display" to 0 and "X Server Address" to localhost
Now first start XServer XSDL and then start the Linux Deploy service
BTW, I am trying XFCE desktop on Ubuntu Precise, it is really fast.
A good idea (if you use ubuntu and xfce) may be to install the package xubuntu-desktop (Linux Deploy makes a very basic installation of XFCE, even icons are completely missing!)
PROBLEMS WITH KEYBOARD LAYOUTS OTHER THAN "US" - SOLUTIONS
I have a dock with Italian keyboard and I had some problems, probably due to some XServer XSDL bugs.
I set "it" keyboard layout in XFCE settings, all keys are working correctly apart from two things (only using XServer XSDL, with other android apps I have no problem with the keyboard):
1) Keys " ' ? " and " - _ " are swapped
Solution:
edit /usr/share/X11/xkb/symbols/it and swap AE11 and AB10 codes in the "basic" section, in this way:
Code:
partial default alphanumeric_keys
xkb_symbols "basic" {
include "latin(type4)"
name[Group1]="Italian";
.........
key <[COLOR="Red"]AB10[/COLOR]> { [apostrophe, question, grave, questiondown ] };
.........
key <[COLOR="Red"]AE11[/COLOR]> { [ minus, underscore, dead_macron, division ] };
.........
include "level3(ralt_switch)"
};
I checked with Input event logger app, the problem is probably due to a bug in dock keyboard remapping by Android (I use CROMBI-KK with _that kernel, I do not know what part causes the problem)
The simpler workaround is to manually remap the keys in XServer XSDL: the Italian keyboard's "minus" key shoud be remapped to "SLASH" and Italian "apostrophe" to "MINUS" (in fact US-minus corresponds to IT-apostrophe, and US-slash to IT-minus)
2) the 102nd key is not working at all. ( It is the key at the right of the left-SHIFT key, that in the Italian keyboard layout corresponds to the " < > " key)
It is a problem of XServer XSDL, because if I check key press events in X with the following command:
Code:
xev | grep -A2 --line-buffered '^KeyRelease' | sed -n '/keycode /s/^.*keycode \([0-9]*\).* (.*, \(.*\)).*$/\1 \2/p'
all keys work except for the 102nd key, while if I check key press events from the input device, in this way:
Code:
evtest /dev/input/event1
the 102nd key works.
Solution:
We need a little workaround, because it seems that XServer XSDL does not "see" the 102nd key at all.
First, install some stuff
Code:
sudo apt-get install inputlirc lirc input-tools xautomation
Then create a file .lircrc in your home directory with the following content:
Code:
begin
prog = irexec
remote = /dev/input/event1
button = KEY_102ND
config = xte 'str <'
repeat = 0
end
begin
prog = irexec
remote = /dev/input/event1
button = SHIFT_KEY_102ND
config = xte 'str >'
repeat = 0
end
then execute the following commands
Code:
sudo inputlircd -c -m 0 /dev/input/event1
irexec -d
You may put the above code in a script that starts automatically with the X session (in XFCE, see Applications Menu->Settings->Sessions and Startup)
Note that the "irexec -d" part must be executed from within the X session by the X session user, so you cannot use a Custom Script in Linux Deploy (which executes commands as root outside the X session)
So it is simpler to use an autostart script within XFCE
Hope that this may help also other people, in fact XServer XSDL officially supports only US Keyboards, so I guess that also keyboard layouts other than the Italian one may be affected
Cheers, and happy 2015!
EDIT:
It is definitively an XServer XSDL bug. I tried to connect a wireless Italian keyboard and I got the same problems as with the asus dock keyboards (apostrophe and minus keys swapped, 102nd key not working)
Custom mount points
(I use CROMBI_KK, but I guess the following applies also to other ROMs)
To access internal and external sdcards, usbdisks etc with read-write permission one has to correctly set custom mount points in Linux Deploy. I was using /storage/sdcard0, /storage/sdcard1 but it is not correct, you get only read permissions with normal user (rw only with root).
The right mount points are (in CROMBI_KK)
/data/media/0 (for internal SD)
/mnt/media_rw/sdcard1 (for external MicroSD)
/mnt/media_rw/sdcard2 (for external SD in dock)
/mnt/media_rw/usbdisk0 (for Usb disk in dock)
In other ROMs mount point may change, you can check with a mount command from terminal within android (avoid fuse mounts and search for "real" mounts)
LITTLE TRICK:
When you start Linux Deploy service, it can only mount already mounted sdcards and usbdisks, if you insert a new sdcard after having started Linux Deploy, you cannot see it automatically from Linux.
However, you just have to click again on "Start" in Linux Deploy, it will skip already started services and mount only the missing sdcard(s) or usbdisk
keyboard dock
_that said:
No, I only tried apps like Gimp and LibreOffice.
Click to expand...
Click to collapse
See my previous posts, I have almost managed to configure everything for office use (including printing, excluding sound...), I am quite satisfied because it is reasonably fast and usable, but one important part is missing: esc, del and function keys.
XServer XSDL can remap them but it does not help much: it seems that the following keys are not intercepted normally but seem to be handled specially by CM 11/CROMBI KK:
TOGGLE_(WIFI, BT, TOUCHPAD) , BRIGHTNESS_(UP, DOWN, AUTO), CAMERA, EXPLORER, SETTINGS, POWER
So even with remapping, when I try to press the key corresponding to F1, I get an F1 event on the chrooted linux but also a toggle-wifi event on Android, when I press F2 I get F2 on linux and toggle-bluetooth on android, and so on...
Even using shift/ctrl/alt/fn+ dock special keys, CM11/CROMBI-KK intercepts them as if no shift/ctrl/alt/fn is used.
Other people experienced the same problem, see here:
http://forum.cyanogenmod.org/topic/83065-how-to-re-map-keyboard-dock-layout-for-custom-keymap/
I guess I have to stop some service in CM11/CROMBI KK that handles special keys, any idea about which one I have to kill? @_that?
pinaz said:
but one important part is missing: esc, del and function keys.
Click to expand...
Click to collapse
Try playing with the kernel level function key remapping that I added in my kernel:
http://forum.xda-developers.com/showpost.php?p=40168242&postcount=3
If you're not using my kernel, you need to extract the patch that implements this feature from my kernel on github and compile your own.
_that said:
Try playing with the kernel level function key remapping that I added in my kernel:
http://forum.xda-developers.com/showpost.php?p=40168242&postcount=3
If you're not using my kernel, you need to extract the patch that implements this feature from my kernel on github and compile your own.
Click to expand...
Click to collapse
Great! It works!
I can write parameters even from inside the chrooted environment.
Now I only have to change remapping of function keys done by XServer XSDL in order to avoid "double" remapping of the same key, and I am done
Thank you!
_that's Kernel key remapping function works perfectly, I can use the following commands (in Android terminal or within the chrooted environment, as root in both cases) to enable Esc, Del, Ins keys, and to use special keys as Function keys without needing to press Alt/Alt Gr:
Code:
echo 3 > /sys/module/asusdec/parameters/key_flags
The problem is XServer XSDL.
Problem 1:
Xserver XSDL sees Esc, Del and Ins keys (corresponding to Back, Lock, Volume Mute dock keys) as if they were the same key, that in the default XServer XSDL config is mapped to 'Unknown'.
So even if you try to remap them, you can choose only one option for ALL of them.
Solution:
Do not touch XServer XSDL default key mapping settings .
Follow my previous post, point 2, and add to the $HOME/.lircrc config file the following lines:
Code:
begin
prog = irexec
remote = /dev/input/event1
button = KEY_ESC
config = xte 'key Escape'
repeat = 0
end
begin
prog = irexec
remote = /dev/input/event1
button = KEY_DELETE
config = xte 'key Delete'
repeat = 0
end
begin
prog = irexec
remote = /dev/input/event1
button = KEY_INSERT
config = xte 'key Insert'
repeat = 0
end
It is a problem of android kbd mapping, see next posts
Problem 2:
With _that's kernel key remapping functions, function keys (with no alt/Alt gr) and dock's special keys (with Alt/Alt Gr) are different key events, however XServer XSDL sees them as the same event, so you cannot remap them differently.
If you use function keys in your chrooted linux GUI, everithing is fine.
If you try to use dock's special keys (with Alt/Alt Gr to toggle wifi, bluetooth, adjust brightness etc.) you get the special key event AND the function key event at the same time.
So if you press Alt/AltGr+ToggleWifi you toggle wifi AND press F1 at the same time, so you may see the help window of the program you are using. And so on...
Quite annoying....
Solution
none found at the moment, I guess it would be necessary to modify XServer XSDL code.
Simply do not try use dock special keys (with Alt/AltGr) when you are inside your chrooted linux GUI
Anyway, thanks @_that!
@_that:
I chatted with @pelya , see my comments on github:
https://github.com/pelya/commandergenius/issues/40#issuecomment-69906349
it seems to be a problem of your kernel-level keyboard remapping function: it sends correct Scancodes but wrong keycodes (always 0) for "fake" ESC, DEL and INS keys (checked in android with input event logger app) see my next post
https://github.com/pelya/commandergenius/issues/40#issuecomment-69908886
keycode and scancode swap for keys SLASH (Italian kbd: minus) and MINUS (IT kbd: apostrophe) may be a problem of the kernel remapping function or of CM11-CROMBI-KK, needs to be investigated
pinaz said:
@_that:
I chatted with @pelya , see my comments on github:
https://github.com/pelya/commandergenius/issues/40#issuecomment-69906349
it seems to be a problem of your kernel-level keyboard remapping function: it sends correct Scancodes but wrong keycodes (always 0) for "fake" ESC, DEL and INS keys (checked in android with input event logger app)
Click to expand...
Click to collapse
Thanks for your research so far! The kernel sends only one set of codes, those defined in linux/input.h, through the event interface. The keycodes you're seeing come from Android and it looks like you need to copy some lines from /system/usr/keylayout/Generic.kl to asusdec.kl.
_that said:
Thanks for your research so far! The kernel sends only one set of codes, those defined in linux/input.h, through the event interface. The keycodes you're seeing come from Android and it looks like you need to copy some lines from /system/usr/keylayout/Generic.kl to asusdec.kl.
Click to expand...
Click to collapse
You're right, thanks!
I solved the esc-ins-del problem in the following way
In Android terminal:
Code:
su
mount -o remount,rw /system
nano /system/usr/keylayout/asusdec.kl
then I added at the end
Code:
key 1 ESCAPE WAKE_DROPPED
key 110 INSERT WAKE_DROPPED
key 111 FORWARD_DEL WAKE_DROPPED
then
Code:
mount -o remount,ro /system
reboot
---------- Post added at 10:26 AM ---------- Previous post was at 10:17 AM ----------
pinaz said:
https://github.com/pelya/commandergenius/issues/40#issuecomment-69908886
keycode and scancode swap for keys SLASH (Italian kbd: minus) and MINUS (IT kbd: apostrophe) may be a problem of the kernel remapping function or of CM11-CROMBI-KK, needs to be investigated
Click to expand...
Click to collapse
@_that : the swap between the MINUS and SLASH keys (respectively, apostrophe and minus in Italian keyboards) seems to be a problem at the kernel level.
I looked here:
http://www.win.tue.nl/~aeb/linux/kbd/scancodes-1.html#ss1.4
The correct scancode for US MINUS key is #0c (12) while for US SLASH key is #35 (53)
If I use @pelya 's input logger app, I get swapped scancodes (12 when I press US-SLASH/IT-minus, and 53 when I press US-MINUS/It-apostrophe, while it should be the other way round).
I did not notice it before because I was confused (in Italian kbd minus=US-SLASH, and apostrophe=US-MINUS, I saw KEY MINUS in the logger app when I was pressing It-minus and I thought it was OK, but it was not, I should see KEY SLASH instead!).
So I guess that it is something at the kernel level. @_that?
P.S. The same problem (swap of scancodes 12 and 53) happens also with an external wireless keyboard, so it is not a problem related to the asus dock kbd
pinaz said:
The correct scancode for US MINUS key is #0c (12) while for US SLASH key is #35 (53)
Click to expand...
Click to collapse
These are exactly the codes that I get when I run evtest, which operates directly on the kernel's event interface.
The key near the right Shift key ("/" on US keyboards, "-" on my German one) sends keycode 53 (KEY_SLASH).
The key next to 0 in the top row ("-" on US keyboards, "ß" on my German one) sends keycode 12 (KEY_MINUS).
The same happens on my PC.
_that said:
These are exactly the codes that I get when I run evtest, which operates directly on the kernel's event interface.
The key near the right Shift key ("/" on US keyboards, "-" on my German one) sends keycode 53 (KEY_SLASH).
The key next to 0 in the top row ("-" on US keyboards, "ß" on my German one) sends keycode 12 (KEY_MINUS).
The same happens on my PC.
Click to expand...
Click to collapse
mmm
I am not an expert in such kind of things
Do you think it is a problem of Asus hardware? Why am I getting wrong codes both on dock kbd and on external kbd?
(A simple workaround in my case is to use key remapping function in XServer XSDL, but I would like to solve the problem)
pinaz said:
Do you think it is a problem of Asus hardware? Why am I getting wrong codes both on dock kbd and on external kbd?
(A simple workaround in my case is to use key remapping function in XServer XSDL, but I would like to solve the problem)
Click to expand...
Click to collapse
No, the hardware works fine, and the kernel works correctly too - according to your own log output you're getting the correct scancodes:
Italian Kbd Apostrophe key: Keycode 76 KEYCODE_SLASH Scancode 12
Italan Kbd minus key: keycode 69 KEYCODE_MINUS Scancode 53
Click to expand...
Click to collapse
_that said:
No, the hardware works fine, and the kernel works correctly too - according to your own log output you're getting the correct scancodes:
Click to expand...
Click to collapse
You're right!
The fact that IT-MINUS corresponds to US-SLASH and not to US-MINUS was confusing me, sorry.
I repeated the tests having in mind the corresponding US keys, if I press US-MINUS I get 12, and if I press US-SLASH I get 53.
So it may be a problem of XServer XSDL.
I will check with @pelya
Thanks!
Alberto

ANT+ disabled by default?

I was just wondering if anybody had tried to enable ANT on this device (the Mi 5s Plus)?
I am running the latest stable global version of the ROM (8.2.2.0), am unrooted but have the bootloader unlocked (as I plan on rooting it soon so I can enable mass storage on it) and decided to poke around at what I can do unrooted.
And I found an interesting tool. /system/xbin/antradio_app. Starting it up it shows:
[email protected]:/system/xbin $ antradio_app
===ANT Test===
Using libantradio version:
libantradio.so: Qualcomm UART. Version 1.8.0
Press V to get Version
Press R to Reset
Press K to hard reset
Press H to setup an ANT+ HRM rx channel
Press A to Assign channel
Press F to set radio Frequency
Press I to set channel Id
Press P to set channel Peroid
Press O to Open channel
Press E to Enable ANT
Press D to Disable ANT
Press S to get State
Press X to eXit
S
State is: 4
X
Exiting
State change to: DISABLING
State change to: DISABLED
Disable returned: 0
As you can see the state is 4 and it seems to be Disabled (?) by default? The only things I have tried are V (which does nothing), S (which tells you "4") and X. Has anybody played with this and set up ANT+?
There are a bunch of neat things that I have found, but this was one of the ones I was unsure about. I can't think why it would be disabled, unless the SOC doesn't support ANT+ .
What is ANT+ and how is it useful? I googled it and it says it's a censor to monitor heart rate and car tire pressure?
It is an IoT technology that (from my understanding) works on the bluetooth protocol. It would be useful for devices that support ANT+ (which as you said fitness trackers and some cars use) to be able to get the data from those on our phones.
Ants are eusocial insects of the family Formicidae and, along with the related wasps and bees, belong to the order Hymenoptera. Ants evolved from wasp-like ancestors in the Cretaceous period, about 99 million years ago, and diversified after the rise of flowering plants. More than 12,500 of an estimated total of 22,000 species have been classified.[4][5] They are easily identified by their elbowed antennae and the distinctive node-like structure that forms their slender waists.
Ants form colonies that range in size from a few dozen predatory individuals living in small natural cavities to highly organised colonies that may occupy large territories and consist of millions of individuals. Larger colonies consist mostly of sterile, wingless females forming castes of "workers", "soldiers", or other specialised groups. Nearly all ant colonies also have some fertile males called "drones" and one or more fertile females called "queens". The colonies are described as superorganisms because the ants appear to operate as a unified entity, collectively working together to support the colony.
so, ANT+ is SUPER ANT....
If you truly want to use ANT+, most commonly seen in bike sensors, running sensors, smart scales, etc. Then you will want to get LineageOS as it supports the ANT+ hardware.
Yes its possible
you need to install official ANT+ radio services from the Playstore and the attached ZIP file in recovery mode it works perfectly
http://en.miui.com/thread-1091266-1-1.html
The app cannot be deleted, however it may be turned off. Why would you delete anything useful, after all? In any case, adhere to following instructions to deactivate it:
Go to your phone’s settings.
Look for the applications tab.
Pick the ANT app.
Click ‘Force Stop.’
Click ‘Disable.’

Software Development [FYT units] FytHWOneKey: non-rooted app to assign other apps to the unit hardware buttons

{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Hi,
I created an app (first release March 2019) that works on standard FYT ROMs (Joying, T'eyes, KingBeats, NaviFly, Funrover, some Witsons, some Sinosmarts, iDoing, etc) and allows to modify the standard actions (started apps) of a number of the hardware buttons on the units.
See on my github repository.
It does not (always) work in combination with the Steering Wheel keys if they are controlled by the CANbus..
It is simple but has the great benefit that you do not need a rooted unit (YOU DON'T NEED ROOT, but it functions just as well on a rooted unit).
The app is < 50 Kb and starts therefore extremely fast.
Again: See on my github repository.
New release 1.6.0 18 December 2022:
Changelog:
giladg (Gilad S.) added functionality for Llamalab Automate. A tool to automate various tasks and app flows on your Android device.
Download this 1.6.0 version.
For a "Changelog" about this and previous versions, you can visit the general Releases page.
Currently there are 4 options to "start something" with the "Call method"
by package name
by intent (package name / intent)
by system call (terminal command(s) or script)
by LlamaLab Automate Flow URI (Automate various tasks; Added by giladgd (Gilad S.)
by package name: This is NOT the name of the apk but the internal package name. How do you get this "package name"?
Use the "List all Installed apps" option in the main screen of the settings. It shows the app icon, the app name and the package name. This package name is what you need. You can select it and copy & paste it into the field.
Search in play.google.com for the app you want to start. Say you want to start the navigation app "Magic Earth" and you have selected that one in the play store (in a browser, not the android app). In the address bar you will then see "https://play.google.com/store/apps/details?id=com.generalmagic.magicearth". The bold part behind the "id=" is your package name.
by intent: Every app has a "launch" intent to start the app. Some apps can also be started with other intents to immediately start a specific function. Google Search can be started with the launch intent, but you can also start it with the Google Voice search option intent. The Google (Search) package name is "com.google.android.googlequicksearchbox", the specific intent for google voice search is "com.google.android.googlequicksearchbox.VoiceSearchActivity". The combined "String to be used" is therefore "com.google.android.googlequicksearchbox/com.google.android.googlequicksearchbox.VoiceSearchActivity".
Another example is the Joying Bluetooth apk having intents for the dialer (default launch), the call receiver, the bluetooth streaming, the pairing and a few more.
by system call: A system call can be a direct (linux) command or a shell script or a binary (to do something).
= Commands can be a single command as in:
"ls -l > /sdcard/some_file.txt" to capture a directory listing to a file
"input keyevent 3" => Go to the Home screen (of the default launcher)
"am start -a android.intent.action.MAIN -c android.intent.category.HOME" => Go to the Home screen (of the default launcher)
"input keyevent 127" => pause active media player (any media player)
"input key event 126" => (re)start last used media player.
"am start com.syu.radio/com.syu.radio.Launch" => Start the radio app with the default launch intent (or better use "by package name": com.syu.radio; Or use "by intent": com.syu.radio/com.syu.radio.Launch)
As you can see from the 2nd and 3rd example, there are multiple ways to do something.
From the 6th example you can see that you can start an app (the radio) from the command line with "am start <full intent>", or by package name, or by intent directly.
by Automate Flow URI: Every Flow in LlamaLab Automate has a URI you can find in its Flow Beginning block.
For example: content://com.llamalab.automate.provider/flows/7/statements/1.
If you want to start one Flow on a short button press and a different Flow on a long button press, you can set the value to be the short press Flow URI, followed by a new line with the maximum time to wait for a second button press in milliseconds, followed by a new line with the long press Flow URI.
For examples on how to use a created flow from FytHWOneKey, see the Readme on the github repository site. On how to use LlamaLab Automate itself you have to visit the LlamaLab website.
** Reserved **
(You never know)
Hi Surfer.
I will check this app tonight.
My unit has 5 HW buttons: FF, REW, DVD, MUTE, MODE.
I want to change function for DVD (as the HU has no DVD drive), mute (as it repeats function of volume knob press) and Mode(to change it to app of my choice).
Will mute button work separately of volume knob press?
Is it possible to call specific activity on some app (if that app has several ones)?
Can you share the methods you have used in this app for rerouting button presses (short, in technical terms)?
Thanks in advance.
IG_Vasilich said:
Hi Surfer.
I will check this app tonight.
My unit has 5 HW buttons: FF, REW, DVD, MUTE, MODE.
I want to change function for DVD (as the HU has no DVD drive), mute (as it repeats function of volume knob press) and Mode(to change it to app of my choice).
Will mute button work separately of volume knob press?
Is it possible to call specific activity on some app (if that app has several ones)?
Can you share the methods you have used in this app for rerouting button presses (short, in technical terms)?
Thanks in advance.
Click to expand...
Click to collapse
The "application" buttons simply call the app connected to it. I could easily capture that.
Mode will not work as it is an internally arranged "carroussel" function in the server apk. I can't capture that.
I don't know whether the mute button acts differently from the volume knob press. Also in that case I can't capture it as it is a direct android keyevent call. You would really need Xposed to capture the entire function.
Currently my app only allows for calling an app by package name, which will always start the default launching activity. I have already the layout ready for a "call by intent" which allows you to call any activity which is defined in the AndroidManifest of that app: This is what you are asking for. I will also add a system call.
The point is that I wanted to wait how many people would use my app before putting more time in it. It has only been downloaded 4 times: 2x by me, 1x by you (I assume), and someone else (I guess Paul Borges).
Of course the "audience" is rather limited as it only deals with those units having hardware buttons.
This apk is really a non-rooted "poor mans" Xposed spin off. The options are really limited in comparison with Xposed, but then of course you need root and Xposed.
The working:
- I checked in the AndroidManifest.xml of the radio, music, dvd and eq apk what their launch intents/activities were.
- Then I created aliases for them in the AndroidManifest.xml of my OneKey app "targeting" those original intents/activities to activities in my app, which then call the configured apps.
- In that case Android finds two intents doing the same and therefore asking which app to start. It is actually exactly the same as clicking an html file where the Android Browser and Google Chrome (and/or firefox/opera/etc) have an intent defined which takes care of an html file. Or in case of a gpx file in case of several navigation apps.
Please have a look on my github at my AndroidManifest.xml. I think i put it quite understandably in there
Edit: If you investigate the launch intents for for example TomTom or PowerAmp or whatever app, you could also capture them via aliases in "your" app if you would want that. That is also what the Google package installer does when you compare it to the default AOSP android package installer.
Thank you for explanation, got the trick with package names, and all the restrictions related to it. Nice idea!
Will report whether it will work for my DVD hw key.
Will also test it with media key - maybe it will help to replace some apps, hardcoded in the caroussel, with calls to my apps (though in that case your app has to be extended to the package names used in the caroussel).
Tested it. As it appeared, my HU has EJECT button, not DVD, so this button stays dead.
But i tested MODE button, and it calls following packages:
com.syu.radio
com.syu.bt - BT phone
com.syu.bt - BT AV
com.syu.video
com.syu.av
com.syu.music
????? - smth like ipod (i don't have ipod)
SO for that case i have already changed music player to the app i use for music. Maybe you can implement other package names as well, to be able to change some apps in caroussel mode to other ones (e.g. i don't use video on this unit, so i would like to change call to video player to call to DAB software).
And another question: in the list of installed apps with package names is it possible to copy package name, to later paste it in configuration dialog for replacing?
Thanks in advance
IG_Vasilich said:
Tested it. As it appeared, my HU has EJECT button, not DVD, so this button stays dead.
But i tested MODE button, and it calls following packages:
com.syu.radio
com.syu.bt - BT phone
com.syu.bt - BT AV
com.syu.video
com.syu.av
com.syu.music
????? - smth like ipod (i don't have ipod)
SO for that case i have already changed music player to the app i use for music. Maybe you can implement other package names as well, to be able to change some apps in caroussel mode to other ones (e.g. i don't use video on this unit, so i would like to change call to video player to call to DAB software).
And another question: in the list of installed apps with package names is it possible to copy package name, to later paste it in configuration dialog for replacing?
Thanks in advance
Click to expand...
Click to collapse
W.r.t. to the MODE carrousel: Yes, I can capture the activities/intents for the BT phone/AV options (one app, 2 launch intents) and the video and av apk. Music is already captured.
Eject does not call an app, but performs a "physical" action in the device (if a DVDplayer is installed). I captured that in Xposed where I capture the entire function. I'm afraid that won't be possible in this app.
Copying of package names: I already experienced that myself but it was not high on my priority list. I do not know why that doesn't work. It is a standard text field, which should allow copy&paste. I will google for it.
surfer63 said:
Copying of package names: I already experienced that myself but it was not high on my priority list. I do not know why that doesn't work. It is a standard text field, which should allow copy&paste. I will google for it.
Click to expand...
Click to collapse
Stupid. It requires 2 enties in the layout per textview. I did some copy&paste from one of my other apps and I did not copy that.
Code:
android:longClickable="true"
android:textIsSelectable="true"
So copy&paste now works in my local version. Not uploaded yet.
Not on release page, only in attached version:
- Added copy&paste
- Added BT phone and BT AV options for the MODE "carrousel" button.
@IG_Vasilich: As I do not have a MODE button on either of my 2 units, I can't test myself. Can you please test if the BT phone and BT AV options work? If so, I will also add video and av.
EDIT: Sorry. I made an error. File temporarily removed.
EDIT2: New version attached. With BT AV, BT Phone, Video and AV
Attachment removed. Version not correct.
Sorry for late reply.
My HW button seems to be broken - nothing happens when i press it. And it worked the day before yesterday. Even with uninstalled HWOneKey app. So i tested it with Mode button from steering wheel (or actually any SW key mapped to Mode function - this way you can also test it ).
And there are the differences to previous version:
1. package name copy works!
2. Rado app starts instantly - no request for OneKey or Radio. in previous version i got a selection menu what to use. Have you changed anything related to radio?
And now the rest of report:
* Media button override works - i got selection dialog once, and then it just started the player i have selected in OneKey. Good.
* No other selection dialogs - neither for BT Phone, nor for BT AV. Just as before.
So with your last version only media(music) override works.
IG_Vasilich said:
Sorry for late reply.
My HW button seems to be broken - nothing happens when i press it. And it worked the day before yesterday. Even with uninstalled HWOneKey app. So i tested it with Mode button from steering wheel (or actually any SW key mapped to Mode function - this way you can also test it ).
And there are the differences to previous version:
1. package name copy works!
2. Rado app starts instantly - no request for OneKey or Radio. in previous version i got a selection menu what to use. Have you changed anything related to radio?
And now the rest of report:
* Media button override works - i got selection dialog once, and then it just started the player i have selected in OneKey. Good.
* No other selection dialogs - neither for BT Phone, nor for BT AV. Just as before.
So with your last version only media(music) override works.
Click to expand...
Click to collapse
2. This can happen if you selected "Always" for the action to start the radio. Then you will have to undo the "default" activity/app/action. I assume somewhere from the settings, but I can't find it right now. I will do some googling. Normally you should be able to do this from Settings -> Apps -> "specific app" -> Clear Defaults.
I will check again on my unit, but as far as I can remember it did work for me.
The BT AV and BT phone and others: I will check this weekend. I can't test it myself, so it is a theoretical approach (and of course I could have made some other ordinary mistake).
I will check radio defaults tonight (completely forgotten about this setting, just assumed that if other app is uninstalled then installed again, that setting should be reset)
IG_Vasilich said:
Tested it. As it appeared, my HU has EJECT button, not DVD, so this button stays dead.
But i tested MODE button, and it calls following packages:
com.syu.radio
com.syu.bt - BT phone
com.syu.bt - BT AV
com.syu.video
com.syu.av
com.syu.music
????? - smth like ipod (i don't have ipod)
Click to expand...
Click to collapse
I had a quick look in the "000000000_com.syu.ms.apk" (PX5), which is called " Sofia-1-C9-Server-V1.0.apk" on the Sofia 3GR and called "190000000_com.syu.ms.apk" on the i9853
the actual code is:
Code:
public static int AppByAppId(int value) {
if (DataBt.sPhoneWork != 0 && value != 2) {
return 2;
}
switch (value) {
case 1:
radio();
return 2;
case 2:
btPageDialByKey();
return 2;
case 3:
btPageBtAvForce();
return 2;
case 4:
return dvd();
case 5:
return aux();
case 6:
return tv();
case 7:
return ipod();
case 8:
return audioPlayer();
case 9:
return videoPlayer();
case 11:
return carRadio();
case 12:
carUsb();
return 2;
case 13:
carUsbCd();
return 2;
default:
return 0;
}
}
I assume that based on the installed components it can rotate through a whole lot of options.
IG_Vasilich said:
I will check radio defaults tonight (completely forgotten about this setting, just assumed that if other app is uninstalled then installed again, that setting should be reset)
Click to expand...
Click to collapse
Hmm. I would expect that as well. It should.
If you have two apps where one is the default, and you install a 3rd app being able to do the same, Android should ask again.
i have checked MODE/carousel on my SoFIA unit - it has 6 items:
radio
BT Phone
BT AV
Aux
Music
Video.
acc to code
Java:
public static synchronized void mcuKeyMode() {
synchronized (HandlerMain.class) {
if (LOCK_KEY_MODE.unlock(800)) {
int index = (DataMain.sAppIdSequnceIndex + 1) % FinalMain.APP_ID_CNT_MAX;
int endIndex = ((DataMain.sAppIdSequnceIndex - 1) + FinalMain.APP_ID_CNT_MAX) % FinalMain.APP_ID_CNT_MAX;
while (index != endIndex && (JumpPage.AppByAppId(DataMain.APP_ID_SEQUENCE[index]) != JumpPage.RESULT_OK || DataMain.APP_ID_SEQUENCE[index] == -1)) {
index = (index + 1) % FinalMain.APP_ID_CNT_MAX;
}
DataMain.sAppIdSequnceIndex = index;
}
}
}
and to
Java:
public static final int APP_ID_NULL = 0;
public static final int APP_ID_RADIO = 1;
public static final int APP_ID_BTPHONE = 2;
public static final int APP_ID_BTAV = 3;
public static final int APP_ID_DVD = 4;
public static final int APP_ID_AUX = 5;
public static final int APP_ID_TV = 6;
public static final int APP_ID_IPOD = 7;
public static final int APP_ID_AUDIO_PLAYER= 8;
public static final int APP_ID_VIDEO_PLAYER= 9;
public static final int APP_ID_THIRD_PLAYER= 10;
public static final int APP_ID_CAR_RADIO = 11;
public static final int APP_ID_CAR_BTPHONE = 12;
public static final int APP_ID_CAR_USB = 13;
public static final int APP_ID_DVR = 14;
public static final int APP_ID_3GPHONE = 15;
public static final int APP_ID_SPECIAL = 16;
public static final int APP_ID_CNT_MAX = 20;
...
for (int i = 0; i < 20; i++) {
APP_ID_SEQUENCE[i] = i;
}
APP_ID_SEQUENCE[10] = -1;
APP_ID_SEQUENCE[11] = -1;
APP_ID_SEQUENCE[12] = -1;
APP_ID_SEQUENCE[13] = -1;
and to code AppByAppId you have posted, this works exactly as expected.
Java:
public static int AppByAppId(int value) {
if (DataBt.sPhoneWork != 0 && value != FinalMain.APP_ID_BTPHONE) {
return RESULT_OK;
}
switch (value) {
case FinalMain.APP_ID_RADIO:
radio();
return RESULT_OK;
case FinalMain.APP_ID_BTPHONE:
btPageDialByKey();
return RESULT_OK;
case FinalMain.APP_ID_BTAV:
btPageBtAvForce();
return RESULT_OK;
case FinalMain.APP_ID_DVD:
return dvd();
case FinalMain.APP_ID_AUX:
return aux();
case FinalMain.APP_ID_TV:
return tv();
case FinalMain.APP_ID_IPOD:
return ipod();
case FinalMain.APP_ID_AUDIO_PLAYER:
return audioPlayer();
case FinalMain.APP_ID_VIDEO_PLAYER:
return videoPlayer();
case FinalMain.APP_ID_CAR_RADIO:
return carRadio();
case FinalMain.APP_ID_CAR_BTPHONE:
carUsb();
return RESULT_OK;
case FinalMain.APP_ID_CAR_USB:
carUsbCd();
return RESULT_OK;
default:
return RESULT_NO_INTENT;
}
}
after resetting of default settings for OneKey and Radio my MediaKey from steering wheel asked about radio and media. SO far OK, but it hadn't ask about BT.
IG_Vasilich said:
after resetting of default settings for OneKey and Radio my MediaKey from steering wheel asked about radio and media. SO far OK, but it hadn't ask about BT.
Click to expand...
Click to collapse
I made this actually for the hardware buttons on the unit, but it is good to hear that it also (partly) works on the steering wheel buttons.
The BTPhone and BT AV both have double intent filters. I combined those doubles into one for each. Now I split them up again.
Please try attached.
EDIT: I attached a new one at 11:58 CET
tested the last attached APK - radio, Aux, video and music can be overriden, BT - not. I tried to stop BT app, clead all defaults, and test again - no luck Do you have some ideas more to try?
For those, that working - can it be possible to send "play" intent/MediaKey event to the app after start? I assume that after FM Radio starts, all other sources stop. That is why i need to press "play" button for music app (AIMP in my case) and reselect radio station in app instead of video player (in my case DAB-Z).
Thanks.
IG_Vasilich said:
tested the last attached APK - radio, Aux, video and music can be overriden, BT - not. I tried to stop BT app, clead all defaults, and test again - no luck Do you have some ideas more to try?
For those, that working - can it be possible to send "play" intent/MediaKey event to the app after start? I assume that after FM Radio starts, all other sources stop. That is why i need to press "play" button for music app (AIMP in my case) and reselect radio station in app instead of video player (in my case DAB-Z).
Thanks.
Click to expand...
Click to collapse
I will first look in my XFytTweaker to see what function is captured an see what that function does. Stupid that I did not think about that earlier
Otherwise, I will write a small test app that "should" do what the BT function does. And then see what activity/intent is selected/started.
In my code I already made options for starting an app by intent and for a system call, just like in the XSofiaTweaker and XFytTweaker.
That will take a few hours to work out and I will do that somewhere this week.
just FYI - i have tapped EQ button in MCU settings and got selection dialog - OneKey or Built-in Equalizer.
So the only things that do not work are BT (and i cannot test DVD).
Your prebeta description on GitHub states that aux doesn't work, but it works here (i have written it in one of previous posts)

Categories

Resources