[Q] IconBIT Toucan Nano hard keys remapping - Android Q&A, Help & Troubleshooting

Hello.
I am new to this forum, so please bear with me, thanks. I did watch the noob video.
I am building a carPC system based on Android 2.3 device IconBIT Toucan Nano. It's an ARM9 standalone box w/ HDMI and 2 USB ports, no GPS, no WiFi, no screen. Device comes rooted.
I've built a HID USB keyboard emulator based on a PIC18F2550 to use car radio keys to control the Android box, they basically map to F1-F10 keys, but I can change the setting to any HID USB scan code of course.
What I am trying to achieve is to be able to start Music player, Navigation and some other apps of my choice by pressing a single hardkey. When you drive, you don't really want to browse menus and look thru Applications, you just want a seperate keys for Music player, Navigation, Camera, etc etc. I have found a keylayout file (/system/usr/keylayout/*) which maps hardkeys to keys and apps, however it only runs pre-chosen default apps (like Music.apk or VideoPlayer.apk), and no user-specified apps.
I would like e.g. to run PowerAMP instead of Music.apk when 'MUSIC' key is pressed, also I would like to run Navigation (e.g. Google Maps) when some other key (say 'CAMERA') is pressed.
How do I specify my own apps for hard keys? Some posters suggest I should use some Application->Launch menu, but my device does not have this menu. Also, another suggested way is again go to Applications, All and change defaults, but no defaults are set for music player.
Also, for some reason, when I installed the latest firmware provided by IconBIT, HOME button stopped working. I have a mapping in keylayout file like key 62 HOME # F4, but just nothing happens when F4 is pressed.
I think there's gotta be some config file responsible for the apps launched on hardkey press, but where is it?
Thanks.

Anyone please? Can't believe no-one out of 4 million users can help me?
At least, can you please point out which system file (or app) is responsible for launching applications when a hard-key is pressed? I understand, *.kl files are only map files, which map Linux keycodes to Android keycodes (e.g. 'HOME' is a key code)...
Is it compiled into the core? Can't be so! Is the launcher app responsible for this?

I have found a working solution and would like to share it with the forum readers.
Using a .sh script, it is possible to read keyboard events using getevent and then launch required app using am start command. Here is my sample script:
#!/system/bin/sh
while true # infinite loop
do
s=$(getevent -v0 -c1) # get a single event from input stream
# -v0 switch utilized to sort out unneeded garbage data
s=$(echo $s | awk '{print $4}') # sort out key scan code
case $s in # based on scan code, launch required application
0007003f) am start -n com.maxmpz.audioplayer/.PlayListActivity # launch PowerAMP
;;
00070040) am start -n ru.yandex.yandexmaps/.MapActivity # launch nav app
;;
0007003d) echo "HOME" # reserved for HOME button
;;
00070045) am start -a android.intent.action.MAIN -n com.speedsoftware.rootexplorer/.RootExplorer # launch Root Explorer
;;
0007003b) echo "CALL" # etc etc
;;
esac
sleep 1 # delay to prevent double events
done
Put the script into a skeys.sh file and chmod 0755 skeys.sh - that's it.

Related

[Ref][Kernel][Gestures]Triggering actions with touch gestures

Hi folks!
This thread explains a feature I first introduced in the Siyah kernel (available in 4.1beta5) that allows defining finger movement detection and triggering actions when certain gestures are made.
There are also apps available on the market to do it but this approach happens on the kernel level.
I welcome your feedback on any advantages and drawbacks you find.
Index
This post - feature explanation and samples
Post #2 - Configuring gestures
Post #3 - Actions​
Change log
01.12.2012
Added instructions on how to use camera from the lockscreen (see post #3).
Added link to Flint2's Kernel Gesture Builder (see post #2).
Added index.
27.10.2012
Added 3 additional actions (see items 9, 10 and 11 at the end of this post): v1.2 sample script.
Fixed mDNIe negative toggle for newer JB kernels.
23.08.2012
Added action commands and explanations to the 3rd post, with all that has been identified so far.
18.08.2012
Added sample CWM file for the S3 (different coordinates) - thanks to Gokhanmoral
16.08.2012
CWM-flashable zip with ready to use examples
8 gestures
Actions: invert mDNIe; launch camera (3 different apps detected, including JB); direct dial (must edit script); toggle bluetooth; toggle WiFi; play/pause; simulate power button (save the physical button); simulate home key
fixed JB / CM10 hanging on boot when script is present
13.08.2012
Initial post​
There are 2 steps required to use this feature:
1. Defining the gestures - in other words, the path that the fingers are expected to make for the gesture to be detected
2. Reacting to detected gestures
Defining gestures
The sysfs entry /sys/devices/virtual/misc/touch_gestures/gesture_patterns provides access to the gesture definitions - the hot spots for the path that each finger must travel for a gesture to be triggered.
"cat /sys/devices/virtual/misc/touch_gestures/gesture_patterns" will show you the current definitions, and some comments on the expected structure:
Code:
# Touch gestures
#
# Syntax
# <gesture_no>:<finger_no>:(x_min|x_max,y_min|y_max)
# ...
# gesture_no: 1 to 10
# finger_no : 1 to 10
# max steps per gesture and finger: 10
# Gesture 1:
...
Choosing the coordinates
Your S2 screen has the following X,Y coordinates:
Code:
+---------------+
|0,0 479,0|
| |
| |
| |
| |
| |
| |
|0,799 479,799|
+---------------+
Each hotspot is a rectangle from X1 to X2 and Y1 to Y2. For example, a hotspot for just the top half of the screen would be X between 0 and 479 and Y between 0 and 399 (~ half of 800).
A maximum of 10 gestures can be defined, each of them using 1 or more fingers (up to a maximum of 10 but in practice more than 4 might not be very feasible) and for each of them a maximum of 10 consecutive hotspots, which make a path.
All gestures must be defined in one go by writing multiple lines to /sys/devices/virtual/misc/touch_gestures/gesture_patterns, in the following form:
Code:
gesture_no:finger_no:(min_x|max_x,min_y|max_y)
gesture_no:finger_no:(min_x|max_x,min_y|max_y)
... additional hotspots for the same finger, or additional fingers, or additional gestures ...
Writing to "gesture_patterns" will erase all previous definitions and replace with what you're writing.
Some examples that can be used in practice (or define your own gestures)
1. swipe one finger near the top and another near the bottom from left to right
Code:
+----+-----------+----+
| | | |
| +-|-----------|-> |
| | | |
+----+ +----+
| |
| |
| |
| |
| |
+----+ +----+
| | | |
| +-|-----------|-> |
| | | |
+----+-----------+----+
Definition (bound to gesture 1; uses fingers 1 and 2):
Code:
1:1:(0|150,0|150)
1:1:(330|480,0|150)
1:2:(0|150,650|800)
1:2:(330|480,650|800)
2. swipe 3 fingers from near the top to near the bottom
Code:
+---------------------+
| |
| + + + |
| | | | |
+---------------------+
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
+---------------------+
| | | | |
| v v v |
| |
+---------------------+
Definition (bound to gesture 2; uses fingers 1, 2 and 3):
Code:
2:1:(0|480,0|200)2:1:(0|480,600|800)
2:2:(0|480,0|200)2:2:(0|480,600|800)
2:3:(0|480,0|200)2:3:(0|480,600|800)
3. draw a Z with one finger while another is pressed on the middle left of the screen
Code:
+----+-----------+----+
| | | |
| +--|-----------|-> |
+----+ +----+
| +--+ |
+----+ | |
| | +--+ |
| + | | |
| | +--+ |
+----+ | |
| +--+ |
+----+-+ +----+
| <-| | |
| +-|-----------|-> |
+----+-----------+----+
Definition (bound to gesture 3; uses fingers 1 and 2):
Code:
3:1:(0|150,0|150)
3:1:(330|480,0|150)
3:1:(0|150,650|800)
3:1:(330|480,650|800)
3:2:(0|150,300|500)
(notice that I mixed the way the lines are written, in order to show how you can organize the entries)
To wrap it all up, you can use the following in an init.d script - as the definitions aren't persisted across reboots - in order to define all these gestures whenever the device starts:
Code:
echo "
[COLOR="SeaGreen"]# Gesture 1 - swipe 1 finger near the top and one near the bottom from left to right
1:1:(0|150,0|150)
1:1:(330|480,0|150)
1:2:(0|150,650|800)
1:2:(330|480,650|800)
# Gesture 2 - swipe 3 fingers from near the top to near the bottom
2:1:(0|480,0|200)2:1:(0|480,600|800)
2:2:(0|480,0|200)2:2:(0|480,600|800)
2:3:(0|480,0|200)2:3:(0|480,600|800)
# Gesture 3 - draw a Z with one finger while another is pressed on the middle left
3:1:(0|150,0|150)
3:1:(330|480,0|150)
3:1:(0|150,650|800)
3:1:(330|480,650|800)
3:2:(0|150,300|500)
[/COLOR]
" > [COLOR="Blue"]/sys/devices/virtual/misc/touch_gestures/gesture_patterns[/COLOR]
There are 2 important things to keep in mind when defining gestures:
* The touches are still delivered to whatever applications are active. If a certain gesture proves to cause nuisance with the actual apps, change it to something different or use it only in certain situations;
* Whenever you're pressing or moving 2 fingers close together, at some point the screen will start detecting only one of them. For some of the gesture definitions this might cause the detection to fail or only work very rarely. Make sure to use the "Show pointer location" option in Settings / Developer in order to be able to track what the device detects, while you're setting things up the way you want.
Triggering actions
Defining gestures won't do anything by itself. Now you need to check the /sys/devices/virtual/misc/touch_gestures/wait_for_gesture entry to see which gesture is detected and do whatever you want.
Here's an example, also to be run from an init.d script:
Code:
( while [ 1 ]
do
GESTURE=`cat /sys/devices/virtual/misc/touch_gestures/wait_for_gesture`
if [ "$GESTURE" -eq "1" ]; then
mdnie_status=`cat /sys/class/mdnie/mdnie/negative | head -n 1`
if [ "$mdnie_status" -eq "0" ]; then
echo 1 > /sys/class/mdnie/mdnie/negative
else
echo 0 > /sys/class/mdnie/mdnie/negative
fi
elif [ "$GESTURE" -eq "2" ]; then
# Start the camera app
am start --activity-exclude-from-recents com.sec.android.app.camera
elif [ "$GESTURE" -eq "3" ]; then
# Edit and uncomment the next line to automatically start a call to the target number
### EDIT ### service call phone 2 s16 "133"
fi
done ) > /dev/null 2>&1 &
What this will do is:
- for the 1st gesture, toggle mDNIe inverted / normal
- for the 2nd gesture, launch the Camera app no matter what app is active (quick, that chick is almost out of view! )
- for the 3rd gesture - after you edit and uncomment the appropriate line - a call will be established to that number (the wife is impatient, I don't even have time to enter my PIN!!! )
It loops eternally looking for the next detected gesture and triggering the appropriate action.
NOTE - this has been edited to no longer cause hangs on CM10 startup. The problem was with comments inside the script that contained chars like ' ( ) etc.; be careful when changing the script not to introduce these problems.
Reading from "wait_for_gesture" blocks until one of them is detected, and therefore no CPU is consumed nor deep sleep prevented because of the infinite loop.
In some rare occasions (e.g. multiple scripts waiting for gestures, which can be awaken at the same time but only one of them will get each gesture) the script can wake up with a value of 0, which should just be ignored.
If no script is reading "wait_for_gesture", multiple gestures can be detected and buffered (at most one instance of each one) and be send immediately as soon as something starts reading the entry.
Doing an "echo reset > ..../wait_for_gesture" will flush that buffer so no pending gestures are reported, only future ones.
Sample script
The attached file is a CWM installable package that contains a sample script with all this and more.
It has both the definition of 8 gestures and actions to be performed for each of those.
Remember to edit and uncomment the line with the intended phone, otherwise it won't do anything when you draw the Z on the screen.
Just flash it on your primary or your secondary ROM and you're good to go, with the behavior described below.
Gestures:
1. one finger on the top left, another on the bottom left; swipe both horizontally to the right edge
triggered action - invert mDNIe
2. swipe 3 fingers from the top of the screen to the bottom
triggered action - launch the camera app
(currently recognizes the apps from stock Sammy 4.0.*, AOKP 4.0.4 and JellyBean / CM10)
3. press one finger on the middle left of the screen; with another finger draw a Z starting on the top left edge
triggered action - immediately dial a predefined number on the script (must edit the script to put the number you want or it won't do nothing as it is)
WARNING: This has a nice bonus but you need to be aware of it - it will work even on a locked screen. Anyone that knows the gesture will be able to dial that destination even without knowing your PIN or Unlock Pattern. They won't however be able to press any of the other phone buttons like Contacts, etc.
4. hold one finger on the bottom right while another goes from top-left to the middle of the screen and back
triggered action - toggle Bluetooth on/off (will also vibrate for 100ms to provide feedback)
5. hold one finger on the bottom left while another goes from top-right to the middle of the screen and back
triggered action - toggle WiFi on/off (will also vibrate for 100ms to provide feedback)
6. hold one finger on the top left and another on the bottom left, move both to the middle right
triggered action - Media play / pause
7. draw an X on the screen - top-left, bottom-right, top-right, bottom-left - while holding another finger on the middle left
triggered action - Power button (to spare the physical button)
8. swipe one finger from the bottom left to the bottom right, then again bottom left (5 times)
triggered action - Home button (to spare the physical button)
9. hold one finger on the bottom left and with another swipe from the top right to top left and back to top right
triggered action - Toggle between the last 2 activities, excluding the TW Launcher (edit the script if you use another launcher)
10. hold one finger on the middle left and with another swipe top-right, bottom-right, top-right (3 times)
triggered action - force closes the current activity
11. press 3 fingers in the positions: top-left, top-right, bottom-left
triggered action - temporarily disables finger detection by the apps (or re-enables) so you can then swipe other gestures without causing effects in the apps
All other gestures automatically re-enable detection after it has been disabled by this gesture.
These gestures and actions are already an evolution over the original sample I shared, as a result of people posting their suggestions and ideas on the thread.
It's your turn now - think of what is useful to you and make sure to share it with others
Configuring gestures
Refer to [GUIDE] Defining/Creating Triggering Actions Gestures easier by janreiviardo for a great visual explanation on how to setup gesture coordinates.
Also, be sure to follow Flint2's Kernel Gesture Builder app for those who are not so fond of editing script files.
Actions
Here's a collection of the several types of actions that have been identified so far. They're mostly ready to use as-is, but do read the script code and edit where necessary to suit your needs.
Please refer to the previous posts for instructions on how to include this in the gesture detection loop.
For test purposes you can simply execute these from the ADB shell, but for it to be part of your daily usage they must be included on your personal script.
Key presses
With these your gestures can simulate that certain keys were pressed, usually hard-keys that you may wish to avoid wearing out, or special keys that the device may even not have but the ROM can react to, depending on the ROM.
Examples: HOME, Power, Volume up/down, Media play/pause, Media stop, Media next/previous, Volume mute/unmute, Recent Apps, etc.
Script code:
Code:
input keyevent 26
This has the same effect as pressing the Power key.
For other key codes, check here for ICS or here for JB. Some examples:
3 - HOME
24/25 - Volume up/down
26 - Power
84 - Search
85 - Media play/pause
86 - Media stop
87/88 - Media next/previous
164 - Toggle volume mute
187 or 214 - Recent apps
220 - Voice search
212/213 - Brightness up/down
215 - App drawer
As an alternative to executing "input keyevent <code>", it is also possible to inject key press events and even choose the delay between the press and the release to simulate long presses.
Example for a HOME key long press:
Code:
sendevent /dev/input/[COLOR="Red"]event1[/COLOR] 1 [COLOR="Red"]102[/COLOR] 1
sendevent /dev/input/event1 0 0 0
usleep [COLOR="red"]500000[/COLOR]
sendevent /dev/input/event1 1 [COLOR="red"]102[/COLOR] 0
sendevent /dev/input/event1 0 0 0
102 is the scan code for the HOME key and it will have a delay of 500ms between pressing and releasing.
Possible scan codes (for the physical buttons):
102 - Home
116 - Power
115 / 114 - Volume up / down
For the touchkeys "menu" and "back", instead of using event1 (gpio-keys as stated by "getevent"), send the scan codes to event7 (sec_touchkey):
139 - Menu
158 - Back
Invoking services
There are quite a few services running on the device, which expose interfaces that can be invoked using the "service call <name> <transaction> <params>..." syntax.
How to explore existing services
To list running services:
Code:
# service list
Found 95 services:
0 sip: [android.net.sip.ISipService]
1 phoneext: [com.android.internal.telephony.ITelephonyExt]
2 [COLOR="Red"]phone[/COLOR]: [com.android.internal.telephony.[COLOR="Red"]ITelephony[/COLOR]]
3 iphonesubinfo: [com.android.internal.telephony.IPhoneSubInfo]
4 simphonebook: [com.android.internal.telephony.IIccPhoneBook]
5 isms: [com.android.internal.telephony.ISms]
6 voip: [android.os.IVoIPInterface]
7 FMPlayer: [com.samsung.media.fmradio.internal.IFMPlayer]
8 mini_mode_app_manager: [com.sec.android.app.minimode.manager.IMiniModeAppManager]
9 tvoutservice: [android.os.ITvoutService]
10 motion_recognition: [android.hardware.motion.IMotionRecognitionService]
11 samplingprofiler: []
...
Search sources (using for instance grepcode.com) for the interfaces, such as ITelephony in this example.
Here you can find the existing transactions for the "phone" service on 4.0.3 (in some cases it may be slightly different in JB).
If we want to invoke the TRANSACTION_call operation on this service, we'll need to indicate transaction code 2 (1+1) and check what parameters it expects. The code for that is in this line which shows that this particular call it needs a string (with the number to call).
So, in conclusion, to make the device call a certain number one only has to issue this commant:
Code:
service call phone 2 s16 "123456789"
replacing the destination number for the one you want.
Note that "service call" accepts arguments of type "i32 <number>" and "s16 <string>", which can be joined together as many times as needed. For transactions expecting "long", you'll need to pass in 2 i32's to make a long value.
In some of them - such as when asking for the current state of something like bluetooth - you'll need to analyze the output (using grep, for instance) to find if the result is "00000000 00000000" vs "00000000 00000001", or some other value.
Collected service calls so far
Calling a phone
Code:
service call phone 2 s16 "123456789"
(replace 123456789 by the destination number you want to call)
Toggling bluetooth enabled/disabled
This involves 3 transactions on the bluetooth service: isEnabled, enable, disable (this one changes from ICS to JB); the output of isEnabled must also be analyzed in order to know what to do next.
Code:
service call bluetooth 1 | grep "0 00000000"
if [ "$?" -eq "0" ]; then
service call bluetooth 3
else
[ "$is_jb" -eq "1" ] && service call bluetooth 5
[ "$is_jb" -ne "1" ] && service call bluetooth 4
fi
The "is_jb" variable should have been set to 1 prior to this in the case of a JB rom (the script on the OT includes it)
Toggling data connection
Similar to bluetooth, but on the connectivity service.
Code:
service call connectivity 18 | grep "0 00000000"
if [ "$?" -eq "0" ]; then
service call connectivity 19 i32 1
else
service call connectivity 19 i32 0
fi
Toggling WiFi on/off
Similar to bluetooth, but on the wifi service.
Code:
service call wifi 14 | grep "0 00000001"
if [ "$?" -eq "0" ]; then
service call wifi 13 i32 1
else
service call wifi 13 i32 0
fi
Vibration
Transaction "vibrate" can be called in the vibrator service (it requires a long parameter, which maps to 2 i32 entries)
It is asynchronous, meaning that the instruction ends but the device will continue vibrating for the requested duration. This is important in case you wish to insert pauses between multiple vibrations; in that case you'll need to call "usleep" (to have times smaller than 1s) but pause for the duration of the first vibration + the non-vibration time you want, before invoking it again.
Code:
service call vibrator 2 i32 300 i32 0
usleep 600000
service call vibrator 2 i32 300 i32 0
This starts the vibration with a timeout of 300ms, pauses for 600ms (enough for it to stop and stay off for another 300ms) and vibrates a second time.
Expand / collapse the status bar
Not particularly useful, but the transactions "expand" and "collapse" can be called on the statusbar service.
Code:
service call statusbar 1
Code:
service call statusbar 2
Enable / disable the touch screen
This can be very useful in order to prevent the finger movement for gestures to trigger side-effects on the active app that also receives those events (moving icons on the launcher, etc.)
For best experience, map these to a simple gesture such as pressing 2 or 3 fingers in the screen corners, preferably without movement in order not to cause active apps to do anything.
For ICS:
Code:
# Disable
service call window 18 i32 0
# Enable
service call window 18 i32 1
For JB use transaction code 15 instead of 18.
Force-stopping an activity
One of the ways to do this is invoking the FORCE_STOP_PACKAGE_TRANSACTION on the activity service.
Code:
service call activity 79 s16 com.swype.android.inputmethod
This will stop the swype package if it's running.
For a more dynamic script that will stop whatever is foreground app, the output of "dumpsys activity" can be combined:
Code:
service call activity 79 s16 `dumpsys activity top | grep '^TASK.*' | cut -d ' ' -f2`
Toggling between the last 2 applications / windows
For this, invoke MOVE_TASK_TO_FRONT_TRANSACTION on the activity service with the task id to activate and with the MOVE_TASK_NO_USER_ACTION flag.
Again, "dumpsys activity" can be used to identify the next-to-last activity which will be brought to front:
Code:
service call activity 24 i32 `dumpsys activity a | grep "Recent #1:" | grep -o -E "#[0-9]+ " | cut -c2-` i32 2
Since the launcher is just an app like any other, if the previous app was the launcher that's where you'll switch to. If you'd like to exclude it from this logic, a slightly more elaborate script is required:
Code:
dumpsys activity a | grep "Recent #1:.* com.sec.android.app.twlauncher"
if [ "$?" -eq "0" ]; then
service call activity 24 i32 `dumpsys activity a | grep "Recent #2:" | grep -o -E "#[0-9]+ " | cut -c2-` i32 2
else
service call activity 24 i32 `dumpsys activity a | grep "Recent #1:" | grep -o -E "#[0-9]+ " | cut -c2-` i32 2
fi
Basically, if the last app was ...twlauncher, switch to the one before that (#2) instead of the last (#1). You'll obviously need to edit the package name to match your launcher.
Launching applications (and other intents)
The "am" command can be used to launch applications, much like what happens when their icons are pressed in the launcher. In fact, this command is so powerful that it can be a challenge to know what to do with it.
The most usual scenario is to merely execute "am start <packagename>/<activity>".
To find out which values to pass as package and activity, you can launch whatever apps you're interested in and then execute "dumpsys activity a" to see what's running and what is their associated activities:
Code:
# dumpsys activity a
ACTIVITY MANAGER ACTIVITIES (dumpsys activity activities)
Main stack:
* TaskRecord{41d938c8 #48 A com.android.email}
numActivities=1 rootWasReset=false
...
Running activities (most recent first):
TaskRecord{41d938c8 #48 A com.android.email}
Run #3: ActivityRecord{41bbeda0 com.android.email/.activity.MessageListXL}
TaskRecord{41dfff40 #46 A com.seasmind.android.gmappmgr}
Run #2: ActivityRecord{41950668 com.seasmind.android.gmappmgr/.GmUserAppMgr}
TaskRecord{41d9a498 #2 A com.sec.android.app.twlauncher}
Run #1: ActivityRecord{41dd14c0 com.sec.android.app.twlauncher/.Launcher}
TaskRecord{41f12788 #40 A com.cooliris.media}
Run #0: ActivityRecord{4157e130 [COLOR="Green"]com.cooliris.media/.Gallery[/COLOR]}
...
Recent tasks:
* Recent #0: TaskRecord{41d938c8 #48 A com.android.email}
...
intent={act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10400000 cmp=com.android.email/.activity.Welcome}
realActivity=[COLOR="green"]com.android.email/.activity.Welcome[/COLOR]
...
* Recent #1: TaskRecord{41dfff40 #46 A com.seasmind.android.gmappmgr}
...
intent={act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.seasmind.android.gmappmgr/.GmUserAppMgr}
realActivity=[COLOR="green"]com.seasmind.android.gmappmgr/.GmUserAppMgr[/COLOR]
...
From here you can see that good candidates for the "am start" command would be "com.cooliris.media/.Gallery", "com.android.email/.activity.Welcome", etc.
Invoking the Gallery app, for instance, will output this:
Code:
# am start com.cooliris.media/.Gallery
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.cooliris.media/.Gallery }
Warning: Activity not started, its current task has been brought to the front
In this case, the application was already running so it was merely brought to the foreground. Otherwise, it would have been launched.
On the script in the OP you can find the following for the gesture that launches the Camera app:
Code:
result=`am start com.sec.android.app.camera/.Camera 2>&1 | grep Error`
[ "$result" != "" ] && result=`am start com.android.camera/.Camera 2>&1 | grep Error`
[ "$result" != "" ] && result=`am start com.android.gallery3d/com.android.camera.CameraLauncher 2>&1 | grep Error`
Since different ROMs have different camera apps, in this code 3 different activities are tried, moving on to the next whenever the previous one failed. This still doesn't cover all possibilities, but at least is not only for stock 4.0.3 roms but also works e.g. on some JB roms.
An interesting use can obtained if you're using the Android 4.2 Camera. It supports taking pictures even from a locked phone, in a secure manner i.e. not requiring to unlock the phone but not allowing to browse the gallery contents (while still allowing to see the ones you took at that time). Here's the am command:
Code:
am start -a android.media.action.STILL_IMAGE_CAMERA_SECURE
Check this post for more details.
Finally, there are some topics that you can explore on the "am" command:
1. additional intent details for "am start": instead of merely passing <package>/<activity>, there are many more options to use if you know the action to launch, the category, any data it uses, extra parameters, etc.
2. optional arguments such as "--activity-exclude-from-recents" (which prevents the task to be added to the recents list, in the task manager). Just explore the available options by running "am" only.
3. actions other than "start": force-stop, kill, broadcast, etc.
Again, the "am" command allows lots of things to be done related with Intents, but a lot of investigation is required on what intents exist, what parameters they take, etc.
In pretty much all cases the standard "am start <package>/<activity>" will be the syntax to use.
Sweet jesus. Nice going man
Incredible amount of work, well done
### EDIT ### service call phone 2 s16 "133"
To call "111-111-1111", Should "133" alone be replaced and un-commented like given below
service call phone 2 s16 "111-111-1111"
rav4kar said:
### EDIT ### service call phone 2 s16 "133"
To call "111-111-1111", Should "133" alone be replaced and un-commented like given below
service call phone 2 s16 "111-111-1111"
Click to expand...
Click to collapse
Something like that, yes. I'm not sure whether you need to remove the dashes but I guess not. Just open a shell and run that command directly to see what happens.
Tungstwenty said:
Something like that, yes. I'm not sure whether you need to remove the dashes but I guess not. Just open a shell and run that command directly to see what happens.
Click to expand...
Click to collapse
Thanks so much, it worked as was ( diff. number though) with dashes from shell, greatly appreciate your efforts.
service call phone 2 s16 "111-111-1111"
This is awesome. For a sample can. I ask for a pinch screen with five finger gesture. On and to really p off Apple let me pull fingers away from the screen and use my fingers now holding a virtual joystick to move the gallery in three dimensions. Lol
Seriously though, interested in how you'd go about the five finger pinch.
Thank you
Edit : something like this...?
1:1219|259,0|40)
1:1219|259,359|399)
1:20|40,379|420)
1:2199|239,379|420)
1:3440|480,379|420)
1:3240|280,379|420)
1:4219|259,860|800)
1:4219|259,400|440)
Is there a margin allowed?
Awesome feature and tutorial! Much faster than any app as it's handled at kernel level, anyway an UI for this would be perfect though. Keep up the good work!
on my wife's phone drawing a heart on screen calls my number
Code:
4:1:(200|280,699|799)
4:1:(0|150,300|500)
4:1:(200|280,300|500)
4:1:(330|480,300|500)
4:1:(200|280,699|799)
it is actually a triangle at the lower part of the screen but works with almost any kind of heart figure as long as the action starts from the lowest middle part of the screen.
supercool feature to demonstrate to friends
loved your idea and creativity, you should patent this, some enterprise will want it for sure
Can installed (non system) user apps in /data/data be linked to the application to call in the gesture?
I'm trying to link the Phandroid app but it doesnt seem to want to run it.
I obtained the package name (com.blau.android.phandroidnews) and am trying to run this but nothing happens.
System apps (camera and browser) are opening ok.
One thing I've noticed, if you define for example 3 fingers down from top to bottom, and also an identical gesture but for 2 fingers down from top to bottom, and you perform 3 fingers down on screen, then the 2 gestures get detected and executed (as both 2 fingers down and 3 fingers down gets detected)
Thanks mate
rav4kar said:
Thanks so much, it worked as was ( diff. number though) with dashes from shell, greatly appreciate your efforts.
service call phone 2 s16 "111-111-1111"
Click to expand...
Click to collapse
You don't need the dashes this will also work
service call phone 2 s16 "1111111111"
You can also use international dialing code like this
service call phone 2 s16 "+271111111111"
Sent from my Galaxy S2
great work ,,, it,s amazing
Heroeagle said:
@gokhanmoral
how can i trigger this gesture ?? how can i add the phone number in the init.d file?
Click to expand...
Click to collapse
Here it's a script that you need to put it in your init.d folder ( remember this is an example )
Code:
#!/system/bin/sh
echo "
# Gesture 1 - Heart gesture. Dial favorite number
1:1:(200|280,699|799)
1:1:(0|150,300|500)
1:1:(200|280,300|500)
1:1:(330|480,300|500)
1:1:(200|280,699|799)
" > /sys/devices/virtual/misc/touch_gestures/gesture_patterns
(while [ 1 ];
do
GESTURE=`cat /sys/devices/virtual/misc/touch_gestures/wait_for_gesture`
if [ "$GESTURE" -eq "1" ]; then
#Replace 133 with your favorite number you want to call
service call phone 2 s16 "133"
elif [ "$GESTURE" -eq "0" ]; then
sleep 2
fi
done &);
what a brilliant idea master tungstwenty.. bowing m(-_-)m
PS: if someone has a good template please share
install 4.1Beta 6 on galaxys2/9100
flashed this sample script to try
it wont past siyah logo if this script is loaded.., have to wipe init.d folder from recovery to make my phone boot...
any help?
i just want this script badly (want to be able to pull notification bar even from locked screen).
btw very great work man this script looks very promising.
Tungstwenty
Wow...what a great idea. Impressive work! :thumbup:
I am still learning and have been reading (intensively) the Siyah thread to learn as much as i can about kernels, which is how i came to this thread. I have two quick questions, to help me understand a bit better how kernels work--i apologize if the questions sound dumb.
-since this is done at the kernel level, i assume these gestures take precedence over gestures defined in a launcher or app? For instance, if i define the same gesture to trigger an action in, say, apex launcher, and the same gesture to trigger a different action via your kernel feature, what would happen? Would the kernel action occur and block the launcher action, or would the kernel action happen, and then the launcher action happen?
-can these actions be triggered from the lockscreen without having to unlock the phone the "normal" way?
thanks!
crypticc said:
This is awesome. For a sample can. I ask for a pinch screen with five finger gesture. On and to really p off Apple let me pull fingers away from the screen and use my fingers now holding a virtual joystick to move the gallery in three dimensions. Lol
Seriously though, interested in how you'd go about the five finger pinch.
Thank you
Edit : something like this...?
Code:
1:1:(219|259,0|40)
1:1:(219|259,359|399)
1:2:(0|40,379|420)
1:2:(199|239,379|420)
1:3:(440|480,379|420)
1:3:(240|280,379|420)
1:4:(219|259,860|800)
1:4:(219|259,400|440)
Is there a margin allowed?
Click to expand...
Click to collapse
You're on the right track but still not quite there.
All these lines are for the definition of gesture number 1 (first token) - good
You're defining the expected movement / hotspots of 4 fingers, not 5 as you mentioned (second token) - good if 4-finger pinch is ok instead of 5-finger.
For each of them, the first line defines a BOX where it must start (or pass through for the tracking to start) and another one where it must reach. Once all of the 4 fingers have passed from the initial to the final box - even if they then proceed moving - the gesture will fire up.
Example: the 1st finger (any of them, really) must pass through the box with X between 214 and 259 (about the middle width), and Y between 0 and 40 (top of the screen). Perhaps a box of 40px per 40px might be too small or restrictive, you'll need to test it out. Just think that this means about 1/12 of the total width of the screen (480), and 1/20 of the height (800).
The finger that started there must then proceed to a box near the middle of the screen - same horizontal limits / tolerance, but Y not a bit above half (400).
2nd finger follows the same logic - from the west side to the middle.
3rd as well, from east to the middle.
The 4th is not to good - you have a typo in the minimum Y for the starting position. You meant 760|800 instead of 860|800
Other than that it should work, although depending on your tests you might want to widen a bit more the detection boxes.
I think your final question is also answered - there is a margin allowed, which is the one you defined (in this case 40px wide and tall in every box).

redirect Q home screen to a launcher

By default, the Q has no launcher, and instead uses 'broker' as the default launcher, which has no interface, only loads up the visualizer. You cannot change this with a home switcher or any other app capable of changing the launcher. I haven't been able to find how exactly the Q is doing this, but I did find a workaround.
This assumes you are already rooted, you have a controller connected via OTG cable and have Nova launcher installed. This will work with other launchers but you will have to write your own app to launch something else.
For me, the solution consists of:
- Connect a controller of your choosing (logitech K400), and install Nova launcher
- Identify the Scan Code of the button you would like to use as a 'Home' key (KeyTool.apk attached to help find it easily if not a standard home button)
- Remap the 'CALL' action to the button you want to use. (I chose CALL since is of no use to the Q.)
- Install a small app to intercept the 'CALL' intent and fire up your launcher
1) To connect a controller, you will need a OTG cable. I wont go into this since others have already covered this in detail. Here's a good example: http://davidnhutch.com/sandbox/blog/connect-a-mouse-and-keyboard-via-usb/
2) If your controller already has a home button, and it is already kicking you to the visualizer, the scan code you're looking to intercept is probably 172. If not, you can install KeyTest.apk (attached credits solarbanjo at mobileread.com forums) on the Q and it will tell you the scancode when you press each button.
3) Now, you need to edit the Q's keylayout file (found in /system/usr/keylayout/Generic.kl) and point that key declaration to 'CALL' instead of 'HOME'. Find the number that cooresponds to your scan code, and change the action to CALL.
BTW There are probably multiple key layout files in this folder. I've attached my Generic.kl for reference, but if you're not using the same keyboard this might not be useful. Compare to yours and change accordingly.
Note: If you edit Generic.kl it will change the default action for any new device that is connected. The *proper* way to do this is to create a device specific key layout, but I didn't bother because I'm lazy.
You can find more detail about this part here: http://chris.boyle.name/2010/08/android-keymaps and here: http://www.mobileread.com/forums/showthread.php?t=159538
4) Install HijackDialer.apk (attached). This app is simple, all it does is received the dial intent and launches Nova. No need to run as service since its the only app registered to the dialer intent. Ideally, this would allow you to choose your launcher but this works for now.
I also mapped My F1 - F11 Keys to other actions like BACK, FORWARD, POWER etc. Now my keyboard can control the Q completely and I can get to my launcher without having to send adb commands. All I'm missing now is a 'close' button to kill locked up apps that don't behave on the Q.
I'm sure I may have glossed over some details but hope this helps someone.
Great work. I'll try this out this week.
Sent from my Nexus 7
I know this was posted some time ago but everytime I tried to change the Value an press sabe it say error can save. same thing happen trying to put the tablet xml also trying to change the dpi value is there something I have to do to edit system stuff
Forget it found my mistake need to be root to edit files just download Rom toolbox

HOWTO: Tasker Padfone S/X-easily detect phone/tablet switch-swap GMD Gesture Control

I've had my Padfone S for a few months now but never really found the time to figure this out till I woke up early this morning.
Background, the Padfone series of phones have a tablet 'dock' which acts as an external larger screen when its plugged in. Does not appear as a dock in the android sense of the word, so the dock state for Tasker isn't useful. The HDMI state activates for a short while when plugged into the tablet but deactivates a short while later, so no use as well.
Earlier posts in Tasker's google group suggested using `dumpsys display` with grep, but that's quite ROM-specific, and besides its hard to debug without a terminal due to the sheer volume of output.
**Check Tablet mode part**
I used to just grep wm size or wm density for Override, but that had a bug.
So it turns out 'Override' simply means 'not the same as the mode I booted in'. My task failed when I rebooted as a tablet, it would give the opposite answer. The solution, after I've played around a bit, is two calls to wm size/density.
The first call is `wm size | grep "Physical size: 1920x1200" | wc -l` - I save this in %tabletboot, it has the value of 1 when booted as tablet, 0 if booted as phone.
The second call is `wm size | wc -l` - I save this as %samemode, it has the value of 1 if we're in the mode we booted in (tablet/phone) and of 2 if we're not (because there's an additional Override line).
The test is simply "If %tabletboot + %samemode is even" or is equal to 2, if you prefer. This would be true if we booted as tablet AND we're still in that mode or if we booted as phone AND we're in the opposite mode.
**GMD Gesture Control part**
The reason I wanted to do this was mainly because GMD Gesture Control could only work either in phone or tablet mode for me. Auto-detection of the touchscreen input didn't work because of course there are 2 touch screens, so for tablet mode I needed to select 'asus_dds_sis_touch' and 'HC_DEFAULT' in GMD's advanced settings while for phone mode I needed to select 'Himax-touchscreen' and 'HC_FT5X'. Of course, you may also want to have different gestures for the different screens.
First, from a Padfone perspective, you need to go to ASUS Customized Settings -> Padfone Settings -> Dynamic Display List and add GMD Gesture Control to the list not to be killed when switching modes. Tasker and any Tasker plugins which need to constantly run (such as Whatstasker) should also be here.
GMD Gesture Control puts its settings in two files (both in /data/data/com.goodmooddroid.gesturecontrol/shared_prefs) named 'GestureControl.xml' and 'gestures.xml'. You'll need to create two additional copies of these files and delete the originals. So I ended up with 'tabGestureControl.xml', 'phoneGestureControl.xml', 'tabgestures.xml', and 'phonegestures.xml'.
Now, back to Tasker. Set up a state profile based on the value of the %TABLET variable. You'll need an entry task and exit task, which are almost identical. Basically, both tasks need to do these steps in order:-
1. Delete both GestureControl.xml and gestures.xml (use Root, continue after error)
2. Symbolically link the right copy of GestureControl.xml/gestures.xml
3. Kill GMD Gesture Control using root to restart it.
4. Pause GMD Gestures (use AutoShortcut), wait 1 second, and then unpause GMD Gestures
Of course, step 2 differs in the entry/exit task, one is for tablet configuration, one is for phone. The rest are identical.
Step 1 can be done using Run Shell and calling `rm /data/data/com.goodmooddroid.gesturecontrol/shared_prefs/GestureControl.xml` or using Tasker's Delete File. Remember to delete both files.
Step 2 needs Run Shell to call `ln -s /data/data/com.goodmooddroid.gesturecontrol/shared_prefs/tabGestureControl.xml /data/data/com.goodmooddroid.gesturecontrol/shared_prefs/GestureControl.xml`. Again, remember to do this for both files.
Step 4 needs autoshortcut, so download that and use it, under Plugins.
That's about it. The same technique can be used for anything you want to change in this awesome Padfone device. Perhaps you'd want to activate an overlay or change an app's font settings. With Tasker, no limits =).

[XPM] MTC-Keys Button remapping tool - by MVG-V70

Malaysk said:
++++ Added a module for Xposed from MVG-V70 with Russian Forum (I thank him very much for the good job) mtc-keys, which allows action to remap the buttons radio.
Click to expand...
Click to collapse
Very nice addition. One less thing on my plate now
I hope MVG-V70 doesn't mind, but for those here that don't have 4pda.ru accounts, I've downloaded the file and attached it here.
It requires a text file named mtc-keys.ini located at /sdcard/mtc-keys/ that contain remapping definitions. From the original post (translated by google):
The configuration file must be a redefinition of the buttons on the inside of the map (/ mnt / sdcard or / mnt / internal_sd depending on the version of Android) in the catalog mtc-keys and called mtc-keys.ini
file to download happens when you start the radio.
Example mtc-keys / mtc-keys.ini
app_51 = ru.yandex.yandexmaps
Click to expand...
Click to collapse
Just in case people aren't clear, this is not my work. I'm just resharing it for those not on malaysk's roms and want to try it out.
jacekruf said:
Im still trying to fight with this mtc-key setup.
Dmesg showing only that key was press and that is screen below is from xposed log.
I just want to change one key from DVD to MXplayer pro.
Module is working fine, xposed as well file is looking good but every time i press DVD button all i got is standard dvd player.
Help.
Click to expand...
Click to collapse
I had a difficult time myself getting this to work. I looked high and low, and found a little bit of information here and there. So I complied everything I found and put together this tutorial. Hopefully this helps.
mtc-keys 2.5 from developer MVG-V70 on 4pda.ru (a russian site)
Must have access to root
Need to install:
Exposed framework
CarService
AppInfoViewer
mtc-keys 2.5
A root browser
Download and install mtc-keys 2.5
Create the folder (mtc-keys) (no uppercase letters)
The folder must be located in one of the following spots depending on the version of andriod. **It will not work if the mtc-keys directory is in the wrong place**
/mnt/sdcard/
/mnt/internal_sd/
/mnt/external_sd/
To discover the buttons keycode open CarService - clear the log and press a button, its keycode will appear
To discover package name download AppInfoViewer
Create the text file mtc-keys.ini within the folder mtc-keys folder
i.e.
/mnt/external_sd/mtc-keys/mtc-keys.ini
a four line mtc-keys.ini example: (all lowercase)
app_84=com.clearchannel/iheartradio.controller
app_42=com.opera.mini.native
app_3=com.microntek.bluetooth
action_45=apps
MTC Instructions taken from 4pda.ru site:
app_xx = package name
xx-button code, the package name, the name of the package installed program. eg: app_42 = ru.yandex.yandexmaps on the DVD is assigned to the program Yandex If you press when you run the program is already running, it is inactive.
activity_xx = name of the package / class name
xx-button code, the package name, the name of the package installed program, the class name, the full name of the class Activiti.
We aktiviti triggered should be set sign exported = "true", or the present list Navi button is assigned to the call of the main window ES-Explorer.
action_xx = action
xx-button code, the effect is one option from the list: home, menu, back, apps, screenshot.
eg: action_51 = apps button Navi is assigned access the list of applications.
intent_xx = intent
sending broadcast Intents.
event_xx = button code
MY CAR BUTTON MAP
Leftside;
DVD = 42
TV = 73
RADIO = 43
MEDIA = 84
LEFT KNOB/ PUSH = 4
LEFT KNOB CLOCKWISE = 19
LEFT KNOB CCW = 27
Rightside;
PLAY/PAUSE = 3
TRACK DOWN = 45
TRACK UP = 46
NAVI = 51
RIGHT KNOB PUSH = UNDEFINED
RIGHT KNOB CLOCKWISE = 59
RIGHT KNOB = 58
a four line mtc-keys.ini example:
app_84=com.clearchannel/iheartradio.controller
app_42=com.opera.mini.native
app_3=com.microntek.bluetooth
action_45=apps
This changes the behavior as such:
DVD = 42 = OPERA
TV = No change
RADIO = 43 = No change
MEDIA = 84 = IHEART RADIO
PLAY/PAUSE = 3 = BLUETOOTH
TRACK DOWN = 45 = RECENT APPS
TRACK UP = Nochange
NAVI = No change
Hopes this sheds some light.
---------- Post added at 03:23 PM ---------- Previous post was at 03:08 PM ----------
dranny69 said:
Hi I would like some advice if possible , i have just got my steering wheel controls working and i have mapped the volume buttons and track up and down buttons . the volume control is working fine and the skip track buttons are working fine on the stock music player but on any other music player skip track buttons do not work ? is there a music player that is better than the poor stock one that will work with the track up/down buttons ? thanks
Click to expand...
Click to collapse
Try:
http://forum.xda-developers.com/and...app-modding-radio-music-movie-kld-jy-t3217197
It is better, don't know if it will work for you.
forum.xda-developers.com/showthread.php?p=63615305&highlight=mtc-keys+2+5#post63615305
Mtc-keys 2.5 from developer MVG-V70 on 4pda.ru (a russian site)
Must have access to root
Need to install:
Exposed framework
CarService
AppInfoViewer
mtc-keys 2.5
A root browser
Download and install mtc-keys 2.5
Create the folder (mtc-keys) (no uppercase letters)
The folder must be located in one of the following spots depending on the version of andriod. **It will not work if the mtc-keys directory is in the wrong place**
/mnt/sdcard/
/mnt/internal_sd/
/mnt/external_sd/
To discover the buttons keycode open CarService - clear the log and press a button, its keycode will appear
To discover package name download AppInfoViewer
Create the text file mtc-keys.ini within the folder mtc-keys folder
i.e.
/mnt/external_sd/mtc-keys/mtc-keys.ini
a four line mtc-keys.ini example: (all lowercase)
app_84=com.clearchannel/iheartradio.controller
app_42=com.opera.mini.native
app_3=com.microntek.bluetooth
action_45=apps
MTC Instructions taken from 4pda.ru site:
app_xx = package name
xx-button code, the package name, the name of the package installed program. eg: app_42 = ru.yandex.yandexmaps on the DVD is assigned to the program Yandex If you press when you run the program is already running, it is inactive.
activity_xx = name of the package / class name
xx-button code, the package name, the name of the package installed program, the class name, the full name of the class Activiti.
We aktiviti triggered should be set sign exported = "true", or the present list Navi button is assigned to the call of the main window ES-Explorer.
action_xx = action
xx-button code, the effect is one option from the list: home, menu, back, apps, screenshot.
eg: action_51 = apps button Navi is assigned access the list of applications.
intent_xx = intent
sending broadcast Intents.
event_xx = button code
This might be related a little to this thread, we went from needing a forum to maybe having too many forums haha. There's a way to flip the direction of your up / down in the factory settings, correct? Which setting is that exactly, I can't tell by the labels.
Thanks to everyone above who has posted about the mtc-keys module.
I am gradually getting things to work how I want and have been able to successfully remap my "MEDIA" button to launch my preferred music playing app.
Now a few more issues have come up. I can't work out how to get the play/pause, skip forward and skip back buttons to work in the music app I am using. I have worked out the key codes using CarService but I dont know how to write the entries in the .ini file to use these functions in the app. Any one have any ideas how to do this. I assume it will use the activity_xx or action_xx parameter but how can I find out what these are from my music app (currently trying out Mixzing).
Also, with the stock apps if you were in music player and pushed the radio button (called BAND on my head unit) it would close the music app and open the radio and you wouldnt get both playing over each other. Similarly opening the music app would close the radio. This no longer works, so is there a way I can get it to terminate or close the music app if I push radio button or terminate radio if I launch the music app?
I have searched this a fair bit and havent come up with much and the original post being in Russian isnt helping.
Any help or advice anyone is willing to provide would be most welcome.
Kind regards,
Steve
WestlakeSt said:
Any one have any ideas how to do this. I assume it will use the activity_xx or action_xx parameter but how can I find out what these are from my music app (currently trying out Mixzing).
Click to expand...
Click to collapse
It depends on how that media player expects commands to come to it. Some use the generic Android media intents, others use app-specific intents. The easiest way to find out is to send generic android intents from a shell (or Terminal). If it responds, then you're good. You can also try sending keyevents for specific keys, and see if it responds to those.
agentdr8 said:
It depends on how that media player expects commands to come to it. Some use the generic Android media intents, others use app-specific intents. The easiest way to find out is to send generic android intents from a shell (or Terminal). If it responds, then you're good. You can also try sending keyevents for specific keys, and see if it responds to those.
Click to expand...
Click to collapse
Hi agentdr8. Thanks for your help (here and in the other thread ). I have now started using Poweramp and the play/pause, next track, prev track hard buttons work fine without any need to use mtc-keys.
Can the MTC-keys make that:
I would like to use radio and Poweramp app by pressing hard button rotatory.
- When I listening poweramp and press the Radio button, will be the result: radio start and Poweramp app killed. I made this with rules of LLama app.
- When I listening Radio and press the Media (Poweramp) button, will be the result: Poweramp start and Radio app killed. I didn't kill radio app with Llama app.
A quick question: since malaysk's latest ROM update, I have to press TWICE a key to work AFTER REBOOT. After that, it works if I press only once, but right at the first keypress, I have to press it two times to work.
Any key.
Any idea what could that be?
robertut said:
A quick question: since malaysk's latest ROM update, I have to press TWICE a key to work AFTER REBOOT. After that, it works if I press only once, but right at the first keypress, I have to press it two times to work.
Any key.
Any idea what could that be?
Click to expand...
Click to collapse
I was experiencing that with the stock firmware and still experiencing it now that I'm on Malaysk ROM. However I have noticed that sometimes if I wait a while I don't need to press it twice. So it might be a overworked or working processor problem.
I guess it's good to see someone else with the same issue.
tmiller101 said:
I was experiencing that with the stock firmware and still experiencing it now that I'm on Malaysk ROM. However I have noticed that sometimes if I wait a while I don't need to press it twice. So it might be a overworked or working processor problem.
I guess it's good to see someone else with the same issue.
Click to expand...
Click to collapse
I also experience this issue and I am using stock rom which is now rooted. I have also found like tmiller101 that if you leave the unit for a bit after first booting it doesn't need to two presses to the start to function normally. Could it be something needing to load in the background after boot for the hardware buttons to function???
Its a bit odd but doesn't bother me to much luckily.
How to disable activity?
I'm trying to replace my play/pause button function with bluetooth app like this:
app_3=com.microntek.bluetooth
It starts the bluetooth app, but it also starts playing the music through it, and also starts Music player app in the background ocasionnaly. I don't want any of that.
All I need is to start the Bluetooth phone app, in order to make calls. Just like I was able to remap DVD button to something else.
Any idea?
Tried the Carservice app on my KLD rom. Crashed when I hit clear log, and never shows any key codes.
Need to get this working as my radio has NO hardware home or back button, and trying to swipe from the top is almost impossible thanks to the raised bezel.
lotherius said:
Need to get this working as my radio has NO hardware home or back button, and trying to swipe from the top is almost impossible thanks to the raised bezel.
Click to expand...
Click to collapse
Try using Terminal and run:
Code:
# logcat | grep mtc-keys
And then try pressing the hard buttons you do have. It should print out their keycodes.
Got it working, thanks. Simpler than the instructions made it seem.
Hi all,
Thanks for all info on this great app. I would like to change two of my hard key settings:
I would like to change my EQ setting to instead of cycling through the default EQ profiles , to take me to the fader screen inside of amp settings.
I would also like to change my SETUP button to cycle between the (a) Setup screen and (b) as if pressing the Home button.
I have logged my buttons as 49 for EQ and 74 for SETUP. And I think I want action commands. But I am not sure what is the action to get to the fader screen within the Amp settings; i.e. action_49 = [??]
And I am not sure if I can cycle by pressing a button more than once, or what is the setup screen command to insert? i.e. action_74 = home [but then ??]
Help much appreciated!
But at this point I am a bit stuck as I do not know how to tell what command would take me to the the fader screen or is the
Mr Bigglesworth said:
And I am not sure if I can cycle by pressing a button more than once, or what is the setup screen command to insert? i.e. action_74 = home [but then ??]
Click to expand...
Click to collapse
I don't think mtc-keys can cycle between different actions/apps/activities from a single remapping.
As for the Poweramp EQ, you'll need to figure out what the activity is named within the package. Give Package Explorer a try and see if it lists the activity. Then use that in mtc-keys.ini as activity_##=package_name/activity_name
ktibor69 said:
Can the MTC-keys make that:
I would like to use radio and Poweramp app by pressing hard button rotatory.
- When I listening poweramp and press the Radio button, will be the result: radio start and Poweramp app killed. I made this with rules of LLama app.
- When I listening Radio and press the Media (Poweramp) button, will be the result: Poweramp start and Radio app killed. I didn't kill radio app with Llama app.
Click to expand...
Click to collapse
Yes you can. From my recent experience shouldnt need LLama app.
First you need to find out the key codes of the hard buttons you want to use with the CarService app.
Install XposedMTC and in this app's settings change the preferred music app to Poweramp
Add the following lines to your mtc-keys.ini file (replacing xx with the code for the hard button you want to use)
activity_xx=com.dr8.xposedmtc/com.dr8.xposedmtc.activities.Music
activity_xx=com.dr8.xposedmtc/com.dr8.xposedmtc.activities.Radio
Good luck
WestlakeSt said:
Yes you can. From my recent experience shouldnt need LLama app.
First you need to find out the key codes of the hard buttons you want to use with the CarService app.
Install XposedMTC and in this app's settings change the preferred music app to Poweramp
Add the following lines to your mtc-keys.ini file (replacing xx with the code for the hard button you want to use)
activity_xx=com.dr8.xposedmtc/com.dr8.xposedmtc.activities.Music
activity_xx=com.dr8.xposedmtc/com.dr8.xposedmtc.activities.Radio
Good luck
Click to expand...
Click to collapse
I tried your solution.
I edited my used mtc-keys.ini, but now does't work the MTCkey function. I'm using version 1.2. Until I used perfectly mtckey function: DVD button was remapping to iGo.
I did only: I made new mtc-keys.ini file and replaced the old mtc-keys.ini file and reboot the HU.
What did I do wrong?
Edit: In the morning the MTC-keys function is work well.
But the offer solution doesn't work (rotary radio/poweramp).
Did you try your solution? Which version of the MTC-keys did you use?
Edit2:
I installed the latest v2.6 MTC-keys. And now your solution works perfectly.
Many thanks!
agentdr8 said:
I don't think mtc-keys can cycle between different actions/apps/activities from a single remapping.
As for the Poweramp EQ, you'll need to figure out what the activity is named within the package. Give Package Explorer a try and see if it lists the activity. Then use that in mtc-keys.ini as activity_##=package_name/activity_name
Click to expand...
Click to collapse
So I was playing around with mtc-keys, found a couple of interesting things.
You can cycle in a limited fashion, e.g. I had:
"action_74 = home
action_74 = apps"
And this worked as cycling between home and apps depending on what was last pressed.
I then tried:
"action_74 = home
app_74 = com.android.settings"
And this didn't work - it would only go to the settings menu. So it seems that when you select two 'actions' it can cycle, but when you mix an 'action' and an 'app' it wouldn't work. It also doesn't cycle if you have several apps to the same key - it just seems to use the last set app.
Also - does anyone know how a quick way to restart mtc-keys without switching off and on the unit (as it is taking me ages to try different permutations otherwise!).

Question Simple LED Blinker for the rooted Motorola Edge 20 Lite(Fusion)

I have made "Moto_LED_Blinker.prj.xml" file. See attached file.
This is a simple LED Blinker for the rooted Motorola Edge 20 Lite(Fusion)
"Moto_LED_Blinker.prj.xml" is a project file of "Tasker" for the blinking LED notification.
It is require "Tasker" for the running it.
The LED starts to blink by:
a phone calling.
a message of some messenger applications(Eg, WhatsApp, Signal, Telegram and so on).
a charging battery.
And the LED stops to blink when open an anpplicable application.
Moto_LED_Blinker.prj.xml is not a perfect.
However, it is so nice.
Please customize it for your device.
Regards!
this sounds great!
i've never used tasker before, can it be exported as a stand alone app so people without tasker can use it?
trevtdogg said:
this sounds great!
i've never used tasker before, can it be exported as a stand alone app so people without tasker can use it?
Click to expand...
Click to collapse
Techinical Iinformation:
Moto_LED_Blinker.prj.xml makes LED on and off by writting data to /sys/class/leds/charging/brightness.
This writing operation require the ROOT permission.
It is possible to export as a standalone application and people can execute the application without Tasker.
In this case, the standalone application have to be ran with the ROOT permission.
We need ROOTED device for the running the standalone application.
I have no plan to export the standalone application.
Because:
(1) There is no easy way to verify that the standalone application is secure by another person. This is a great chance to mix malicious code into the standalone application.
(2) The standalone application can not change a triggering application for the LED blinking.
(3) After all, the standalone application needs ROOT permission.
Regards,
TakaSZK said:
Techinical Iinformation:
Moto_LED_Blinker.prj.xml makes LED on and off by writting data to /sys/class/leds/charging/brightness.
This writing operation require the ROOT permission.
It is possible to export as a standalone application and people can execute the application without Tasker.
In this case, the standalone application have to be ran with the ROOT permission.
We need ROOTED device for the running the standalone application.
I have no plan to export the standalone application.
Because:
(1) There is no easy way to verify that the standalone application is secure by another person. This is a great chance to mix malicious code into the standalone application.
(2) The standalone application can not change a triggering application for the LED blinking.
(3) After all, the standalone application needs ROOT permission.
Regards,
Click to expand...
Click to collapse
Nice work
This reminds me.. I need to fix the flashlight toggle on pbrp.
Do you know which dir is for flash / torch?
I assume it'll be one of these 3.. Not had a chance to test
Code:
/sys/class/flashlight/mt-flash-led1
/sys/class/flashlight/mt-flash-led2
/sys/class/flashlight_core/flashlight
CFKod said:
Nice work
This reminds me.. I need to fix the flashlight toggle on pbrp.
Do you know which dir is for flash / torch?
I assume it'll be one of these 3.. Not had a chance to test
Code:
/sys/class/flashlight/mt-flash-led1
/sys/class/flashlight/mt-flash-led2
/sys/class/flashlight_core/flashlight
Click to expand...
Click to collapse
@CFKod
Hi,
I had confirmed in my Edge 20 Fusion.
I think that the torch is depend in /sys/class/flashlight/mt-flash-led1/ directory.
Because:
When the torch is OFF then follwing results.
:/ #
:/ # cat /sys/class/flashlight/mt-flash-led1/torch_brightness
12
:/ # cat /sys/class/flashlight/mt-flash-led1/mode
Off
:/ # cat /sys/class/flashlight/mt-flash-led2/torch_brightness
0
:/ # cat /sys/class/flashlight/mt-flash-led2/mode
Off
:/ #
When the torch is ON then follwing results.
the mode file of mt-flash-led1 says "Torch".
:/ #
:/ # cat /sys/class/flashlight/mt-flash-led1/torch_brightness
12
:/ # cat /sys/class/flashlight/mt-flash-led1/mode
Torch
:/ # cat /sys/class/flashlight/mt-flash-led2/torch_brightness
0
:/ # cat /sys/class/flashlight/mt-flash-led2/mode
Off
:/ #
I had tried to write "Off" and "Torch" into mode file.
It was failed. It so regrettable.
:/ #
:/ # echo Off > /sys/class/flashlight/mt-flash-led1/mode
: can't create /sys/class/flashlight/mt-flash-led1/mode: Permission denied
1|:/ #
1|:/ # echo Torch > /sys/class/flashlight/mt-flash-led1/mode
: can't create /sys/class/flashlight/mt-flash-led1/mode: Permission denied
1|:/ #
1|:/ #
Regards,
Does this mod use the white led over the top of the screen that lights up on the boot sequence?
xvivo said:
Does this mod use the white led over the top of the screen that lights up on the boot sequence?
Click to expand...
Click to collapse
Let's try below if you have rooted Edge 20 fusion. You can find which LED going ON ;-)
# echo 1 > /sys/class/leds/charging/brightness
# echo 0 > /sys/class/leds/charging/brightness
For anyone still wondering, it indeed uses the Led near the top grill.
It works well. Thanks.
I found my way around and customized it for my applications using the original application slots.
How to add more such slots?
Second question is that some apps pop up a temporary notification when they are checking for new messages (for example gmail, whatsapp). This notification triggers the script, but since it goes away, I check the phone and there is nothing there. I thought it was a bug until I found out what is happening from the "monitoring" option in tasker. Any way to stop these false alarms?
To answer my second question, I just added that it will trigger the led only if the display is off.
I also changed most off triggers to happen when the notification is cleared instead of needing to open the app.
In my case, I find a false alarm(false notifaction) in the history of notification and disable the false alarm.
> How to add more such slots?
I am very sorry. I have no answer because I don't know slot.
Good morning. Where can I find the procedure to import the file on tasker in my Edge 30 fusion? Thank you

Categories

Resources