[Tutorial][Tasker] Kernel Profile Toggle Widget with Tasker - Nexus 4 General

Through the day, you often have different usage patterns that have different demands on your phone. Sometimes you want the most battery saving, others you just want raw power. Custom kernel allow you to configure things like the used frequencies to adapt to these changing demands. But doing this on the fly, switching between different configurations can be quite a hassle. Having a widget toggle right on your homescreen to do this would make it that much easier right? With Tasker and a bit of elbow grease you can have just that, as you’ll learn in this tutorial.
Since this is my first tutorial and english isn’t my native tongue, I would appreciate any help in improving it. So if you find errors or you think something could be worded differently to make it more understandable, please post your comments! This is done for you guys so you should be able to work with it
This tutorial is split into four steps:
Setup Variables
Setup Settings Tasks
Setup Mode Tasks
Setup Widget
Reference
Note: While this process works for any custom kernel that exposes the correct stubs, this tutorial is based around faux’s because that’s the one I’m currently using. If you want to make it work with your kernel, go to its thread and search/ask (in that order!) for the appropriate path. If you’ve gathered everything, please come back and post your findings so everyone can profit from them .
Note 2: To use the widget you create here, you need to be rooted!
Note 3: This is not meant to replace any of the kernel configuration apps on the play store. Certain features like governor, snake charmer, mpdecision, etc. are not (yet) supported by the widget and should be set with one of those.
Version History:
1.0 - Initial Release [29.05.2013]

1. Setup Variables
First we want to create some variables in Tasker. These will later be used to hold the values we want to set.
To do this, go to the Vars tab in Tasker. Now press the '+' icon and give the variable a name. In theory you can choose anything you want but it helps if you use a naming scheme that incorporates the name of the setting this variable is intended for. This could lead to conflicts with some internal variables of Tasker though, so I just put a single character in front of the name (i.e. ‘C’). Also the complete name has to be in UPPERCASE because Tasker likes its variables that way . As a value, just enter a zero for now.
For this widget, we will need variables for the minimum and maximum CPU frequencies, the GPU freqency and eco mode. We will also need a variable to store the widget state itself. I named mine simply STATE. If you have created all these variables following the guidlines above, you should end up with something likes this:
{
"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"
}
Variables after setup (ignore the other variables for now)​
In the next step we will create the tasks that will enable us to use the variables to change the settings.

2. Setup Setting Tasks
Now that we have our variables ready, we need some tasks to actually use them. I will do this in detail for one tasks and then give you the necessary informations for the other ones. They all follow the same pattern so it should be quite easy to do the rest yourself .
Go into the Tasks tab and click on the ‘+’ icon in the lower right corner. When asked for the name, you can again choose anything you’d like. I again prefer to give them something meaningful, so I use a template like “Set [name of setting]”. Setting the GPU frequency for instance would be named “Set Gpufreq”. After you put in your desired name, hit the checkmark and you should be taking to the task setup screen.
Task setup screen​
Now hit the little ‘+’ again and you’ll be presented with the different categories of actions Tasker can perform. To control the kernel settings we will need to execute shell commands. To do this first select Script and then Run Shell.
Selecting a shell command action​
You should now be presented with the following view:
Shell action setup screen​
Now we need to enter the command that we want to execute. These will follow this template most of the time:
Code:
echo [Tasker variable] > /path/to/kernel/specific/setting/stub
The last part is where the specific setting is controlled in the kernel you are using. The overall process is the same for any kernel though. You just have to find the correct path and the correct input for a setting. The threads of your prefered kernel are often a good start for this.
Since we named our task “Set Gpufreq” let us do exactly that. The path to the GPU frequency control on faux’s kernel can be found here
Code:
/sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/max_gpuclk
Our corresponding variable would be something like %CGPUFREQ. (Tip: if you hit the little labels icon just right of the Command or other input boxes, Tasker will give you a list of system and user defined variables. Tapping on somehting in that lists will insert it into the corresonding box. This is neat if you can’t remeber all your variables or just want to make sure you don’t spell something wrong.) Looking at the command template, this gives us the following line:
Code:
echo %CGPUFREQ > /sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/max_gpuclk
This is what we need to enter in the “Command” part of the shell action setup. Next, make sure the “Use Root” checkbox is set.
Use Root checkbox​
After you entered the command and set the “Use Root” checkbox we are done and you should see something like this:
Shell action for GPU frequency done​
If so, you can go back to the Tasks tab and start adding the next one. You’ll have to repeat this process for any kernel setting you want to controll from tasker. The stubs for all settings I use can be found in the reference section.
After all the wanted tasks have been setup, it’s time to put them to good use.

3. Setup Mode Tasks
This is the part where all the work above comes to fruition. Now we will define the modes that will be switchable via the widget. I use a setup with three modes and this tutorial will reflect that. You can however have as many different modes as you want. Just adapt what you learn here.
All our modes will follow the same pattern: first we set the variables to the values we want and then we use the settings tasks to put these values at the appropriate places.
The first mode is intended for my battery saving settings. Go again to the Tasks tab and tap the ‘+’ icon. As usual the name can be choosen freely but I’ll name mine “Batterymode”. In this mode, I want the minimum CPU frequency to be at 162 MHz, the maximum at 810 MHz, GPU at 200 MHz and Eco mode.
In the Task edit screen tap again on the ‘+’ and choose Variables->Variable Set.
Selecting Variable Set Action​
Fill in the name of the variable (or tap the labels icon and select it there). Now for the value you enter into the To field. This will depend on which setting you are trying to change here. As an example, let’s have a look at the CPU minimum frequency. The CPU frequency stubs expect their value in KHz. This means we have to multiply our values by 1000 to get the correct value. So our minimum frequency of 162 MHz becomes 162000 KHz and that’s what we need to set our variable to (just the number obviously). For the values of other settings, please check the reference. The action now looks like this:
Set Cpufreqlow Action​
After the variable is set, we now need to call our setting task. This is done with the Perform Task action found under the Task action category.
Selecting Perform Task Action​
To select the task to perform with this action, in the action edit screen tap on the magnifier icon on the upper right side. You will be presented with a list of exisiting tasks. Just pick the right one and you are done with this action, as you can leave the rest of the options as they are.
These two steps (1. Add Variable Set action 2. Add Perform Task action) have to be repeated for every setting you want to change. You should end up with something similiar to the following screenshot:
Battery Mode Task​
If you have finished your first mode, the subsequent modes will be much easier to set up. Just long press on the task in the Tasks tab until the action bar comes up, select Clone, give it a new name and hit the checkmark. Now you only have to enter the new task by tapping on it and then you can change the values of the Variable Set actions by also tapping on them. This way you can set up new modes very fast and efficient.
If you have your different modes setup as you like, it’s time to put them to good use. Let’s make a profile switcher widget!

4. Setup Widget
To setup a toggable widget, first create a new task and name it “Toggle”. Remember the variable we defined in the first step I named STATE? Now is the time we are going to use it. In the following Task Edit screen add an If action found under the Task category. This will enable us to check a variable for a certain state and execute actions based on that check. In the Action Edit screen of the If we just added, tap the labels icon and select the STATE variable (or whatever you named yours). Next click on the ‘~’ in the middle and select “ Math: Equals” and then enter a zero on the right side. Now add a Perform Task action and select the profile you want to have at the first position. For me, that is my battery oriented one. Then add a Variable Set action and use it to set STATE to 1.
Now that we set our profile, we also want the widget to reflect what state we currently are in. You can do this by changing the text of the widget, the icon or both. To change the text when execute a profile, add a Set Widget Label action found under the Tasker action category. As a name, enter “Toggle” and as a label anything you want the widget to show in the state you are currently in. I choose “Battery”. For the icon, add a Set Widget Icon action also under the Tasker group. Enter the name again and then select an icon you want to represent your state.
Now the first state of the widget is setup. For the next one, first add an Else action. Select the If option and once again select the STATE variabel and the “Math: Equals” option. This time however check for STATE = 1 instead of a zero as we did for the previous state. Now repeat the same process with the Perform Task and Variable Set actions (again increasing the number by one, so STATE is set to 2). And if you decided to change the label or icon of the widget, repeat the steps here again with the new text and/or icon.
Repeat the Else action step until you have all the profiles you want to toggle. For the very last step you need to set STATE to zero again instead of increasing it, so the widget loops around and starts again at the first profile.
After the last Else action, add an End If to finalize the task. Now it is ready to use as an widget.
Finished Toggle Task​
To do that, add a Tasker widget to your home screen. The actions to do that differ between launchers, so you'll have to find out how to do it in the one you are using. When adding the widget, you'll have the choice between Task and Task Timer. Select the first one and then pick the "Toggle" task from the list. Now just press the Back button to return to your home screen.
Congratulations, you now have your very own profile toggle! :good:
If you have any questions left or are stuck in a step, don't hesitate to post you comments/questions!

5. Reference
Property stubs for faux’s Nexus 4 kernel:
GPU frequency
Path: /sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/max_gpuclk
Value: Frequency in Herz
Example: Setting GPU frequency to 200 MHz
Code:
echo 200000000 > /sys/devices/platform/kgsl-3d0.0/kgsl/kgsl-3d0/max_gpuclk
CPU maximum frequency
Path: /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
Value: Frequency in Kiloherz
Example: Setting maximum CPU frequency to 1512 MHz
Code:
echo 1512000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
CPU minimum frequency
Path: /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
Value: Frequency in Kiloherz
Example: Setting minimum CPU frequency to 162 MHz
Code:
echo 162000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
Set Eco Mode
(only available if mpdecision is off)
Path: /sys/module/intelli_plug/parameters/eco_mode_active
Value: 1 for on, 0 for off
Example: Setting eco mode to on
Code:
echo 1 > /sys/module/intelli_plug/parameters/eco_mode_active
Set CPU frequency limit
(only available if snakecharmer is on)
Path: /sys/kernel/msm_cpufreq_limit/cpufreq_limit
Value: Frequency in Kiloherz
Example: Setting CPU frequency limit to 810 MHz
Code:
echo 810000 > /sys/kernel/msm_cpufreq_limit/cpufreq_limit

Related

[KERNEL][5 Dec] T700/T705 Exynos TW Oloendithas Kernel v1.5

Hello.
Here is something I've made for myself, but I think it might be useful for someone else.
Here are some major features list:
Based on T700ANG2
CPU - 1900-250MHz, voltage control
Simple hotplug governor integrated into Interactive governor
GPU - 677-100MHz (default to 480-100), governor control, voltage control
BFQ I/O governor
FIOPS I/O governor (default)
Async fsync, dynamic fsync, dynamic read-ahead, dynamic vfs_cache_preassure
- /proc/sys/vm/[dynamic_dirty_writeback | dirty_expire_centisecs | dirty_writeback_centisecs | dirty_writeback_suspend_centisecs | dirty_writeback_suspend_centisecs]
- /sys/kernel/dyn_fsync/Dyn_fsync_active
New Google's POWERSUSPEND driver
SELinux disabled (still present in ROM)
mDNIe tunning profiles moved to /data partition to make them stick across screen off/on cycles
mDNIe brightness dependency correction mechanism (it's complicated, will be explained later in this post)
Wolfson Audio Control (thanks to AndreiLux and UpInTheAir)
- stereo DRC
- stereo EQ for both headphones and stereo speakers
- controlling EQ frequency bands explained next in this post
Init.d
Frandom random number generator
Haveged - even faster then Frandom
printk and logcat on/off interfaces (/sys/kernel/...)
Alot of debug noise removed
hundreds of performance and battery saving patches
Changelog in 2-nd post
Attention! Kernel has SELinux disabled, so you might have trouble with installed user apps if returning to kernel with SELinux enabled from this one. Thus, as always it's a good idea to make a backup.
Downloads in attachment
Source here
Now the tricky parts
Color correction
If you are not interested in waisting your life fighting for color correction, just skip this part
There are two features regarding mDNIe color correction gonna need explanation:
First one is about profiles themselves. It was explained here, but the difference now is that profiles folder was moved from /sdcard/mdnie to /data/mdnie to make loaded tunning profile stick across screen off/on cycles, so it needs to be loaded only once on boot.
To work, profile need to be copied to /data/mdnie folder and loaded as follows:
echo 1 > /sys/devices/platform/s5p-mipi-dsim.1/lcd/panel/mdnie/tuning
echo "CUSTOM1" > /sys/devices/platform/s5p-mipi-dsim.1/lcd/panel/mdnie/tuning
It's explained in details in aformentioned thread.
The second one is really tricky. It is related to non-linear color distortion. I've seen it on my previous Tab 7.7, now I see it here, so I guess true for all AMOLED screens (or maybe only Samsung's, or even maybe only SuperAMOLED). Anyway, on low brightness levels screen goes really green. It can be seen clearly on grayscale images.
So the "solution" implemented here is another one profile, which gets loaded ontop of the primary one. Assuming that the primary profile is made for maximum brightness condition, when colors are most correct, this "secondary" profile contains not actual, but shift values, the corrections, need to be applied to primary profile in lowest brightness conditions.
Example:
Suppose you have a value 0x05(5) in line 151 (red in black) of your primary profile, and you figured out that for lowest brightness you need to set that value to 0x14(20) to keep the tint visually same or close to the one in highest brightness condition. So now you just need to substract base value from corrected value and you'll get the shift:
0x14(20) - 0x05(5) = 0x0F(15)
So the value 0x0F is the one you need to have at line 150 in your secondary profile. And when you'll have the implemented algorithm can calculate corrected color values for all brightness levels in between.
Now make deep breath and please be patient a couple of minutes more. Since that mDNIe thing only supports a positive values in profiles, when it comes to addition correction value to the base value you can't just set something like -0x0F or 1x0F. So I've had to use another dirty trick.
Thus, shift values from 1 to 127 are added to base value, like in example above -- base 0x05 + shift 0x0F = corrected value 0x14.
While shift values from 128 to 255 are lowered by 127 and then substracted from the base value like this -- base 0xFD - (shift 0x8A - 0x7F(127)) = 0xF2 corrected value for lowest brightness condition.
I'll attach my personal profiles to help you understand all this better. TUNNING is for primary profile, CORRECTION is for secondary.
Script to load them on boot:
Code:
sleep 40;
echo 1 > /sys/devices/platform/s5p-mipi-dsim.1/lcd/panel/mdnie/tuning
echo "TUNING" > /sys/devices/platform/s5p-mipi-dsim.1/lcd/panel/mdnie/tuning
sleep 5;
echo "CORRECTION" > /sys/devices/platform/s5p-mipi-dsim.1/lcd/panel/mdnie/tuning_correction
PS: you can use Windows(c) calculator for hexadecimal calculations, just switch it to "Programmer" mode - Alt+3.
Parametric equalizer settings
For people not aware of what parametric equalizer is, here is a plain explanation:
It's like any regular graphic equalizer you can see in any consumer audio player or application with a difference that in regular graphic equalizer you have predefined bands like 100Hz - 400Hz - 1kHz - 6kHz - 14kHz, while for parametric equalizer you can set those bands manually.
Default values here are might be alright for external speakers, but not quite useful for a headphones.
Now, to the point.
We have a folder /sys/devices/virtual/misc/wolfson_control/ with the following EQ-related attributes:
Code:
/sys/devices/virtual/misc/wolfson_control/switch_eq_headphone
/sys/devices/virtual/misc/wolfson_control/eq_hp_freqs
/sys/devices/virtual/misc/wolfson_control/eq_hp_gain_1
/sys/devices/virtual/misc/wolfson_control/eq_hp_gain_2
/sys/devices/virtual/misc/wolfson_control/eq_hp_gain_3
/sys/devices/virtual/misc/wolfson_control/eq_hp_gain_4
/sys/devices/virtual/misc/wolfson_control/eq_hp_gain_5
Code:
/sys/devices/virtual/misc/wolfson_control/switch_eq_speaker
/sys/devices/virtual/misc/wolfson_control/eq_sp_freqs
/sys/devices/virtual/misc/wolfson_control/eq_sp_gain_1
/sys/devices/virtual/misc/wolfson_control/eq_sp_gain_2
/sys/devices/virtual/misc/wolfson_control/eq_sp_gain_3
/sys/devices/virtual/misc/wolfson_control/eq_sp_gain_4
/sys/devices/virtual/misc/wolfson_control/eq_sp_gain_5
And while it's all pretty simple with switch_eq_headphone and switch_eq_speaker, you just set 1 to on, 0 to off, so as for eq_[hp/sp]_gain_[1-5] you can set values from -12 to 12 dB.
But eq_[hp/sp]_freqs attribs are showing us some weird hex values.
So the bad news is we don't have the algorithm to generate custom values for this. The official documentation states "use WISCE software to get..." those magic values. So be brave, it's not that terrifying as you might imagine.
First you have to download that WISCE software, thankfully it's free:
http://www.wolfsonmicro.com/products/software-licence-agreement/?dl=WISCESetup.zip
http://www.wolfsonmicro.com/products/software-licence-agreement/?did=5273
Install them both.
Than start it from WM5102 shortcut.
There you'll see an "Add new system" dialog (do as on screenshots):
{
"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"
}
In the opened window from the tree on left select Tuning->EQ1 (or any of four EQs)
There you'll see an equalizer window
You can setup bands as you prefer
Now select "Registers" from tree on left and scroll right pane till Address RE12h.
There you'll see the values we are looking for:
You need to wright them down and you are ready load them to tablet:
Code:
echo "0x0fc6 0x03ff 0x00e8 0x1ed9 0xf11a 0x040a 0x045d 0x1e60 0xf150 0x040a 0x64cc 0x0b46 0xfed3 0x040a 0x3ab5 0xfc8f 0x0400 0x323c" > /sys/devices/virtual/misc/wolfson_control/eq_hp_freqs
.
That's pretty much it.
I'll attach a script for speaker to make them sound more bassy and sample for headphones with settings from tutorial above.
For speakers
Code:
#!/system/bin/sh
echo 1 > /sys/devices/virtual/misc/wolfson_control/switch_eq_speaker
echo 6 > /sys/devices/virtual/misc/wolfson_control/eq_sp_gain_1
echo 10 > /sys/devices/virtual/misc/wolfson_control/eq_sp_gain_2
echo -2 > /sys/devices/virtual/misc/wolfson_control/eq_sp_gain_3
echo -1 > /sys/devices/virtual/misc/wolfson_control/eq_sp_gain_4
echo -2 > /sys/devices/virtual/misc/wolfson_control/eq_sp_gain_5
For headphones
Code:
#!/system/bin/sh
echo 1 > /sys/devices/virtual/misc/wolfson_control/switch_eq_headphone
echo "0x0fc6 0x03ff 0x00e8 0x1ed9 0xf11a 0x040a 0x045d 0x1e60 0xf150 0x040a 0x64cc 0x0b46 0xfed3 0x040a 0x3ab5 0xfc8f 0x0400 0x323c" > /sys/devices/virtual/misc/wolfson_control/eq_hp_freqs
echo 5 > /sys/devices/virtual/misc/wolfson_control/eq_hp_gain_1
echo 3 > /sys/devices/virtual/misc/wolfson_control/eq_hp_gain_2
echo 0 > /sys/devices/virtual/misc/wolfson_control/eq_hp_gain_3
echo 1 > /sys/devices/virtual/misc/wolfson_control/eq_hp_gain_4
echo 3 > /sys/devices/virtual/misc/wolfson_control/eq_hp_gain_5
That's pretty much it for now.
Special thanks to
Faux123
Yank555
Halaszk
Changelog
1.5
- Updated to Samsung's ANJ5 source drop
- Stability fix
1.4
- Stability and performance improvements
1.3
- Stability and performance improvements
1.2
- Hotplug integrated into Interactive governor
- Interactive governor performance optimizations
- Stability fixes
1.1
- Disabled Intelli-Plug (luggy and unstable)
- Latest Interactive governor source from Google
- Interactive governor short circuits to optimize for IKCS cluster
- Simple hotplug governor
1.0
- Initial release
Click to expand...
Click to collapse
Tried this kernel last night, am running twrp which could be the reason, but installed fine but the OS wouldn't hold long enough to get a catlog as to why crashing.
As I say could well be twrp issue as the download says cwm... Nice to see some fresh deving in the thread though. Need to get my nose into the xda university pages
Edit: Am running Super Samsung V2, Not that TW is that super!
chrispgibbs81 said:
Tried this kernel last night, am running twrp which could be the reason, but installed fine but the OS wouldn't hold long enough to get a catlog as to why crashing.
As I say could well be twrp issue as the download says cwm... Nice to see some fresh deving in the thread though. Need to get my nose into the xda university pages
Edit: Am running Super Samsung V2, Not that TW is that super!
Click to expand...
Click to collapse
Can you please describe, how did that crash looked like?
And also have you tried to clear the dalvik-cache?
heyjoe66 said:
Can you please describe, how did that crash looked like?
And also have you tried to clear the dalvik-cache?
Click to expand...
Click to collapse
I installed it but had a screen lock issue (would not unlock-simple swipe unlock) (phone had been charging for some time with screen off). After some pressing home and power buttons, it rebooted (have taken it off for now..was using the Synapse kernel earlier..no mods or anything in kernel was being used either on Synapse or your kernel) thanks will use in future (using the Devious SuperSamsung v2 ROM on T705 LTE, rooted and flashed through twrp 2.8.0.1...did I need to do any dalvik and/or cache wipe after installation before rebooting?)
(resolved)
heyjoe66 said:
Can you please describe, how did that crash looked like?
And also have you tried to clear the dalvik-cache?
Click to expand...
Click to collapse
Hi, yes I always wipe dalvik/cache as a matter of habit...
I was experiencing crash almost as soon as android booted up, I barely had time to open the app drawer, then device just died and reboot... When I think it could be a trickster MOD conflict? I have that apply settings on boot! Will do a full backup tonight and remove to check... If that doesn't help I shall try those packages to see if they make any differences.
Cheers
Thanks! will try them
Sent from my SM-T705 using XDA Free mobile app
Have reinstaled the original file with Trickster uninstalled and all appears to be running smoothly, will try to reinstall Trickster and see how I go with that. Hopefully it was just a setting conflict...
Good work
Edit: Seemingly there was a setting conflict in trickster from stock kernel to yours which caused the system to choke! All running smooth as a touch wiz system can be expected to run... roll on AOSP rollout for this device, as I said earlier in a post, need to get the xda university pages out to try to get my own head around such a feat!
Again, nice work heyJoe66!
So for the mentally codely challenged, can we just flash each zip you have one by oneand should be awesome? Lol. And will this work for the Cyanogenmod port?
TehJorge said:
So for the mentally codely challenged, can we just flash each zip you have one by oneand should be awesome? Lol. And will this work for the Cyanogenmod port?
Click to expand...
Click to collapse
It's not necessary, if build from the first post works for you. If it's not, feel free to try, but please make a backup.
I'm pretty sure that TW kernels don't work with CM.
Thanks..it was the dalvik+cache wipe....runs well. One question..do not know if this requires kernel work but was wondering if the task manager hard key could be remapped to a menu key instead. Asked this on general forum as have seen this done for like camera and power button. Thanks (anyone)
mac231us said:
Thanks..it was the dalvik+cache wipe....runs well. One question..do not know if this requires kernel work but was wondering if the task manager hard key could be remapped to a menu key instead. Asked this on general forum as have seen this done for like camera and power button. Thanks (anyone)
Click to expand...
Click to collapse
Indeed, remaping it through /system/usr/keylayout/gpio-keys.kl file is magically useless, but if you're using Xposed Framework, there is a nice little extension called Xposed Additions, with which you can easily accomplish what you're looking for.
remapped app switcher to menu
heyjoe66 said:
Indeed, remaping it through /system/usr/keylayout/gpio-keys.kl file is magically useless, but if you're using Xposed Framework, there is a nice little extension called Xposed Additions, with which you can easily accomplish what you're looking for.
Click to expand...
Click to collapse
Well I did it...remapped
Key 254 is the app switcher...reassigned to menu and wake
commented out the original
dusted off some from n7000 days (forgotten it)
won't let me attach the .kl files but anyway
in generic.kl
# samsung
#key 254 APP_SWITCH
key 254 MENU WAKE
in gpio-keys.kl
just added
key 254 MENU WAKE
not sure if both needed that statement
now I am happier (gg)
Note..the xposed mod needed the codes anyway so I went into the system keylayout files and thought well I can just do it here
mac231us said:
Well I did it...remapped
Key 254 is the app switcher...reassigned to menu and wake
commented out the original
dusted off some from n7000 days (forgotten it)
won't let me attach the .kl files but anyway
in generic.kl
# samsung
#key 254 APP_SWITCH
key 254 MENU WAKE
in gpio-keys.kl
just added
key 254 MENU WAKE
not sure if both needed that statement
now I am happier (gg)
Note..the xposed mod needed the codes anyway so I went into the system keylayout files and thought well I can just do it here
Click to expand...
Click to collapse
Ha! So generic.kl still does something. When I was playing with HOME button remaping, I was doing it in gpio-keys.kl, so as people over web think that gpio-keys.kl does the actual mappings.
Anyway, good to know that you have what was looking for.
Hello!
I wonder if you can include the kexec-hardboot patch into your kernel?
That would be great if you could do it.
svardman said:
Hello!
I wonder if you can include the kexec-hardboot patch into your kernel?
That would be great if you could do it.
Click to expand...
Click to collapse
No problem, but gonna have to test recent changes for stability. After that will try to add this one.
I know this says its for t705 but will it work on a t700? Are the kernels compatible?
svardman said:
Hello!
I wonder if you can include the kexec-hardboot patch into your kernel?
That would be great if you could do it.
Click to expand...
Click to collapse
I've investigated this topic deeper and it couldn't find a patch for Exsynos.
So, alas, I guess I can't add it for now. Sorry.
NerdFurgison said:
I know this says its for t705 but will it work on a t700? Are the kernels compatible?
Click to expand...
Click to collapse
I can try to build it for T700, but I have no any chance to test it, so if you can try this and say if it's working, I would much appreciate that.

[GUIDE][Difficulty: Advanced] Prompt to Edit Screenshot and Upload to Imgur

If you're the kind who likes to post screenshots of your device (...like, say, you're making a picture guide to help people with Tasker tasks ), then you'll probably find it a bit tedious having to manually open your screenshot in an image editor app, edit it, and then manually uploading the edited file to an image hosting service such as Imgur. If you would like to automate some of these steps, then look no further!
Please note that my guide is set up with some particular free apps that I'm using, but it can be generalized to edit in other image editor apps or upload to other hosting services so long as you find out the proper intent. Thankfully, you can use apps such as Intent Intercept to capture the proper intent you'll need. On the other hand, I'm also using a few paid apps to make things a bit easier, but if you're getting into Tasker I highly recommend you purchase them as it will make things significantly easier.
Prerequisites
OPTIONAL: Snackbar Tasker Plugin to implement the prompt. Can be replicated using a Tasker scene, but Snackbar is free so I recommend grabbing it anyways.
AutoNotification or Notification Listener. You will need either in order to intercept notifications and toast messages.
OPTIONAL: AutoShare. You can use regular intent broadcasts from within Tasker to do this, but if you don't know what intent to use then AutoShare can help.
Uploader for Imgur (or any other hosting app with a sharing receiver)
Instructions
Enable the notification listener for AutoNotification or Notification Listener in Settings. Enable the Accessibility service for either app so it can intercept toast notifications.
Open a new profile and name it 'Screenshot Edit.'
Create an Event context and go to Plugin --> AutoNotification/Notification Listener and set it up to listen to the screenshot posted notification. Here's the information you'll need to do so. I recommend you set it to react to Only Created Notifications so it doesn't trigger when the notification is dismissed.
Code:
Notification Title: Screenshot captured.
Notification Text: Touch to view your screenshot.
Package Name: com.android.systemui
Exit the configuration for AutoNotification and create a new task named whatever it is you want. For me, I left the name blank because I won't be using the task anywhere else.
{
"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"
}
Now for the task...
Plugin --> Snackbar Tasker Plugin. For the title, put "Edit Screenshot?" or whatever else you want. For the items, put 'Yes,No.' For the commands, put 'yes,no.' Edit the colors to theme the snackbar however you would like.
Task --> If. Set it to %bs_command ~ yes. This is so you'll only edit/upload the screenshot if you want, otherwise it'll do nothing.
Code --> Run Shell. You'll want to run the following command:
Code:
ls /sdcard/Pictures/Screenshots
Write %File under "Store Output In". This will get the filenames of all the screenshots you have in your screenshot folder and put it into a variable.
Variables --> Variable Split. Under name put %File, but leave Splitter blank. This splits the filename variable into an array from File1...FileN with each variable holding an individual filename.
Variables --> Variable Set. Under name put %new and set it to %File(#). This gets the pointer to the latest filename in the filename array.
Variables --> Array Pop. Under Variable put %File, for the Position put %new, and for the To Var put down %file. In %file now you've got the filename of the screenshot you just took!
System --> Send Intent. This is the intent information you'll need to fill in:
Code:
Data: file:///storage/emulated/0/Pictures/Screenshots/%file
Package: com.iudesk.android.photo.editor
Class: app.activity.PhotoViewActivity
Target: Activity
If you have AutoShare installed like I recommended, then you can easily use its find intent option to find and automatically fill in most of this information. You will still need to manually specify the file using the %file variable, though.
Task --> End If.
Okay, so what we've done so far is set-up Tasker to automatically send the screenshot you took to your image editor app. Now you'll want it to automatically upload it to Imgur. Take note of which folder you're saving your edited screenshots in, because you'll need to reference it below when sending the path to the edited file.
Create a new Profile and name it Screenshot Upload.
Create an Event context, go to Plugin and choose AutoNotification Toast Intercept.
Choose Photo Editor for the app you want to intercept, and for the Notification Text you want to intercept write down "saved successfully."
Back out, and create a task with any name you want.
Code --> Run Shell. For the command, put this down:
Code:
ls /sdcard/Pictures/Edited
For Store Output In, put it in %File (just like the previous task).
Variables --> Variable Split. Split %File.
Variables --> Variable Set. Set name as %new and set it to %File(#)
Variables --> Array Pop. For variable put %File, under position put %new, and in the to var put %file.
System --> Send Intent. Here's the information you need:
Code:
Package: net.moosen.imgur
Class: net.moosen.imgur.DoUpload
Data: file:///storage/emulated/0/Pictures/Edited/%file
That's it! Enjoy the new automation of screenshot editing. You can go a little further to automate things by perhaps immediately sharing the Imgur link to your app of choice or push it with Pushbullet, but that's up to you. For me, this profile has been an immense help in putting together these guides. Let me know if there are any changes you would make.
Very cool implementation! I use literally the same setup to help with screenshots, but with some different Actions in certain places. My setup is like:
AN Intercept, AN click action for the notification, then use AutoInput to go through some steps to get to a very specific screen in a specific editor. Then a Profile for 'Gesture' (when I tilt the device to the left) uses AutoShare to share the file over to the (new plugin) AutoWeb API for direct upload to Imgur, then when the link comes back it puts it in the Clipboard and shows a Snackbar to confirm upload complete.
Definitely take a bit of time to setup, but it works like magic and sooo fast and automated it's well worth it!
Ratchet_Guy said:
Very cool implementation! I use literally the same setup to help with screenshots, but with some different Actions in certain places. My setup is like:
AN Intercept, AN click action for the notification, then use AutoInput to go through some steps to get to a very specific screen in a specific editor. Then a Profile for 'Gesture' (when I tilt the device to the left) uses AutoShare to share the file over to the (new plugin) AutoWeb API for direct upload to Imgur, then when the link comes back it puts it in the Clipboard and shows a Snackbar to confirm upload complete.
Definitely take a bit of time to setup, but it works like magic and sooo fast and automated it's well worth it!
Click to expand...
Click to collapse
Glad to see you here! I was actually inspired by your thread on /r/tasker, however, I didn't like the implementation that relied a bit too much on AutoInput in my view, so I thought to generalize it a bit using intents and shell commands.
MishaalRahman said:
Glad to see you here! I was actually inspired by your thread on /r/tasker, however, I didn't like the implementation that relied a bit too much on AutoInput in my view, so I thought to generalize it a bit using intents and shell commands.
Click to expand...
Click to collapse
Thanks! Glad to be here! Tasker Week has been great. Awesome to see the effort and detail that went into the Guides and Tutorials, screenshots and all.
Speaking of screenshots (lol) yes I was having lots of fun with AutoInput clicking around everywhere Eventually I did condense certain portions of it, but one thing I noticed is that depending on the imaging app, using an AutoShare Intent didn't quite get it to the exact screen I was looking for. Of course the beauty of Tasker is that just about anything can be customized for your exact/specific needs
MishaalRahman said:
Now for the task...
Plugin --> Snackbar Tasker Plugin. For the title, put "Edit Screenshot?" or whatever else you want. For the items, put 'Yes,No.' For the commands, put 'yes,no.' Edit the colors to theme the snackbar however you would like.
Task --> If. Set it to %bs_command ~ yes. This is so you'll only edit/upload the screenshot if you want, otherwise it'll do nothing.
Code --> Run Shell. You'll want to run the following command:
Code:
ls /sdcard/Pictures/Screenshots
Write %File under "Store Output In". This will get the filenames of all the screenshots you have in your screenshot folder and put it into a variable.
Variables --> Variable Split. Under name put %File, but leave Splitter blank. This splits the filename variable into an array from File1...FileN with each variable holding an individual filename.
Variables --> Variable Set. Under name put %new and set it to %File(#). This gets the pointer to the latest filename in the filename array.
Variables --> Array Pop. Under Variable put %File, for the Position put %new, and for the To Var put down %file. In %file now you've got the filename of the screenshot you just took!
System --> Send Intent. This is the intent information you'll need to fill in:
Code:
Data: file:///storage/emulated/0/Pictures/Screenshots/%file
Package: com.iudesk.android.photo.editor
Class: app.activity.PhotoViewActivity
Target: Activity
If you have AutoShare installed like I recommended, then you can easily use its find intent option to find and automatically fill in most of this information. You will still need to manually specify the file using the %file variable, though.
Task --> End If.
Okay, so what we've done so far is set-up Tasker to automatically send the screenshot you took to your image editor app. Now you'll want it to automatically upload it to Imgur. Take note of which folder you're saving your edited screenshots in, because you'll need to reference it below when sending the path to the edited file.
Create a new Profile and name it Screenshot Upload.
Create an Event context, go to Plugin and choose AutoNotification Toast Intercept.
Choose Photo Editor for the app you want to intercept, and for the Notification Text you want to intercept write down "saved successfully."
Back out, and create a task with any name you want.
Code --> Run Shell. For the command, put this down:
Code:
ls /sdcard/Pictures/Edited
For Store Output In, put it in %File (just like the previous task).
Variables --> Variable Split. Split %File.
Variables --> Variable Set. Set name as %new and set it to %File(#)
Variables --> Array Pop. For variable put %File, under position put %new, and in the to var put %file.
System --> Send Intent. Here's the information you need:
Code:
Package: net.moosen.imgur
Class: net.moosen.imgur.DoUpload
Data: file:///storage/emulated/0/Pictures/Edited/%file
That's it! Enjoy the new automation of screenshot editing. You can go a little further to automate things by perhaps immediately sharing the Imgur link to your app of choice or push it with Pushbullet, but that's up to you. For me, this profile has been an immense help in putting together these guides. Let me know if there are any changes you would make.
Click to expand...
Click to collapse
Hello and thank you for your guide. I was having some problems with getting the snack bar button to do anything but just ask. None of the responses did anything, my video which includes my question in greater detail is here. I wasn't able to put a link in the message because I am a new user so I can't put links in new posts but the YouTube video ID is U2OpwlK2BWc
If one goes to youtube dot com slash U2OpwlK2BWc they can watch the video.
Thanks again,
yonikasz
yonikasz said:
Hello and thank you for your guide. I was having some problems with getting the snack bar button to do anything but just ask. None of the responses did anything, my video which includes my question in greater detail is here. I wasn't able to put a link in the message because I am a new user so I can't put links in new posts but the YouTube video ID is U2OpwlK2BWc
If one goes to youtube dot com slash U2OpwlK2BWc they can watch the video.
Thanks again,
yonikasz
Click to expand...
Click to collapse
Video not loading for me
Video
MishaalRahman said:
Video not loading for me
Click to expand...
Click to collapse
Oh here I figured out how to put YouTube into the forum. Before I was on my mobile so I couldn't do that. Hope that helps.
Yoni

[GUIDE][Difficulty: Advanced] Read Google Calendar Events for the Day

You're a busy person, and you've decided to organize your busy life by placing all your events on Google Calendar. If this describes you, then you might like to know that you can query Calendar for its events and set it up to notify you however you want. This means you don't have to open the app or even display a widget if you want to see what your events for the day are. Here's how.
This guide is based heavily off of the work of redditor CallMeLucky but written to be more friendly and with more documentation. Credits for the implementation go to him.
Prerequisites
Google Calendar
Instructions
Create a new task, and name it "Get Events."
Variables --> Variable Convert. Convert %DATE, set the Function to "Date Time to Seconds" and Store Result In %date.
Variables --> Variable Set. Name %schedstart and set To
Code:
%date + (60*60*6)
This sets the start time to 6AM in the morning. If you want to make it earlier, change the 6 to a different number. CHECK DO MATHS!
Variables --> Variable Set. Name %schedend and set To
Code:
%date + (60*60*24)
This sets the end time to midnight. CHECK DO MATHS!
App --> Test App. Type "Calendar Title", Data %schedstart, Store Result In %event. Set the Label to "TEST NEXT EVENT." This is querying Google Calendar using the time to see if there's an event at that time.
App --> Test App. Type "Calendar Calendar", Data %schedstart, Store Result In %calendar. This is querying the calendar to see, if there's an event, which calendar it belongs to.
Task --> If. If %event(#) neq 0 AND %event1 !~ %doubleevent AND %calendar1 ~ *MYCALENDAR*. This will basically check to see if %event is empty or if it matches the previous event, which in either case means there is no new event at this time. Replace MYCALENDAR with the name of the calendar you want to pull from.
Variables --> Variable Convert. Name %schedstart, set Function to "Seconds to Long Date Time." Store Result In %time. Once you've found an event, convert the time it starts at to a human readable time.
Variables --> Variable Split. Name %time, splitter is 2016. We know what today's date is, so let's split the variable to only give us the time today and not the date.
Variables --> Array Push. Name %calevents, Position 999, Value should be
Code:
%event1, at %time 2
Here, we're pushing the event title and its time into an array that we'll read from later.
Variables --> Variable Set. Name %doubleevent, To %event1. Save the event title so when we do our next check we compare to see if it matches, if so, don't save it again!
Task --> End If.
Variables --> Variable Add. Name %schedstart, Value 900. Increment the time to check next by 15 minutes (ie. move up through the day).
Task --> Goto. Type "Action Label" and label should be "TEST NEXT EVENT". Check If and set it to If %schedstart < %schedend. Basically, loop back if we're still in the same day testing the calendar.
Alert --> Say. Text: "You have no events today." Check If and set it to if %calevents(#) eq 0
Alert --> Say. Text: "You have one event today." Check If and set it to if %calevents(#) eq 1.
Alert --> Say. Text: "You have %calevents(#) events today." Check If and set it to if %calevents(#) > 1.
Task --> For. Variable %eventtosay, Items %calevents). In this for loop, we're simply reading the calendar events we've found in order.
Alert --> Say. Text: "%eventtosay"
Task --> End For.
Here are screenshots of the task:
{
"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"
}
Now you might ask, what do I do with this task? That's up to you! You can have this task run whenever your alarm is dismissed if you're using an app like AlarmPad, or you can make it run when you dismiss an NFC tag using an app like Trigger.
Below, I am attaching the XML file for the task that you can import. IF YOU IMPORT THIS, YOU MUST EDIT ACTION #6 (THE IF ACTION) AND CHANGE *MYCALENDAR*. REPLACE "MYCALENDAR" WITH THE NAME OF THE CALENDAR YOU WANT TO PULL FROM. You can import a task by putting it in /sdcard/Tasker/tasks. Then when inside Tasker, long-press on the Tasks tab up top and press import.
I love this task. I've been using it for a hot minute. I have it run immediately after another task that uses an HTTP get to pull and read the weather for the day as well. Great combo to use with an "Alarm Dismissed" trigger like you suggested.
how about if you have multiple calendars?
jskala said:
how about if you have multiple calendars?
Click to expand...
Click to collapse
Then simply remove the if condition that requires you to set a specific calendar
jskala said:
how about if you have multiple calendars?
Click to expand...
Click to collapse
I second the motion.
I have one exclusively for my work schedule, and one for my personal schedule. It would be ideal to be able to add several calendars at once.
For example, today I had work and a service repair call for my place. Yesterday, I had work, my child had an appointment and a Parent Teacher Meeting all in different calendars. To know that there are three events or all on one schedule that lists the agenda would be cool.
in topic "5", when you say "app" what exactly I have to do? I didn't get it. Sorry I'm a newbie
---------- Post added at 02:56 AM ---------- Previous post was at 02:52 AM ----------
Erlonbie123 said:
in topic "5", when you say "app" what exactly I have to do? I didn't get it. Sorry I'm a newbie
Click to expand...
Click to collapse
omg, nevermind, sorry! lol
You can use just a couple of actions of CalendarTask plugin in order to that.
i love your idea, it's amazing thanks!!
i'm trying to work in a mod: i don't like the voiceover option, i prefer to receive a notification with the list of events. then if i click on the notification it should open the calendar to check the details.
my mod:
- removed 15. alert, 15. alert, 17. alert
- replaced 19. alert with "Notify sound": Title "Daily Agenda"; Text: "%eventtosay"; Action: "open google calendar"; if "%calevents(#) >0
doing like that i receive a notification with sound (i've added the calendar icon too) instead the voice over.
I have 2 problems, i hope you can help me:
1. all the events are showed once at the time in the same notification (e.g. if i have 3 events, i receive a notification with event 1, than change to event 2 and event 3 in few seconds); it would be nice to have a a list with all the events
2. when i click on the action to open the calendar, it opens the calendar in background without closing the notification panel (see the screenshot)
any suggestions??
thanks a lot!!
Great work
Hi, I like the calendar program. I have a question. Where do you get the Calendar Task plugin for reading different events? For example
Personal Calendar: Sister Birthday
Appointments: Dr. Appointment.
Etc.
Another feature that would be good is to read the events out for the week or have a drop down box with selecting By Week or By Day.
I'm trying to make tasker read my events of tomorrow. I changed %date + (60*60*25) and %date + (60*60*48)
Now I want it to say the day and date of tomorrow (for instance "14.03.2016. Tomorrow is Monday.").
I can't use the default variables like %DATE and %DAYW, because they are for the current day.
I already tried converting the schedstart value from seconds back to date.
flash629 said:
Hi, I like the calendar program. I have a question. Where do you get the Calendar Task plugin for reading different events? For example
Personal Calendar: Sister Birthday
Appointments: Dr. Appointment.
Etc.
Another feature that would be good is to read the events out for the week or have a drop down box with selecting By Week or By Day.
Click to expand...
Click to collapse
You find it on the play store obviously
flash629 said:
Hi, I like the calendar program. I have a question. Where do you get the Calendar Task plugin for reading different events?
Click to expand...
Click to collapse
https://play.google.com/store/apps/details?id=com.balda.calendartask
Thanks
j03x2 said:
https://play.google.com/store/apps/details?id=com.balda.calendartask
Click to expand...
Click to collapse
Thanks J03. Now I just have to try and learn it, unless you can give me some hints.
flash629 said:
Thanks J03. Now I just have to try and learn it, unless you can give me some hints.
Click to expand...
Click to collapse
Here you go! You can download an example profile from here:
https://plus.google.com/102582215848134314158/posts/BZfUp88jwc8
hmm
Weather
I like the program, but please forgive me. I'm using this routine but changing MyCalendar to *. For example: --> If %event(#) neq 0 AND %event1 !~ %doubleevent AND %calendar1 ~ *.
That will read ALL my calendars. The problem comes up after reading the "Event" it will keep on telling me the weather. That's what I'd like to stop. I may have 3 events in different calendars and it reads those events plus the weather for each.
I guess what's happening is because the "Events" are in different calendars I get the weather from each.
Is there away I can just get the weather once?
Thanks for your help.
Nice script! I tried using it for my university calendar but unfortunately it doesn't get the events right.
Today I have three events, one from 9:30 till 11:30, one from 11:30 till 13:30 and another one from 13:30 till 14:30. The script says I have 20 events today. It says all the events in 15 minute increments. Thats 5 (hours) x 4 (events per hour) = 20.
How would I solve this issue? Unfortunately this makes the script not very useful.
Please answer
In a previous post it was suggested that taking out the if statement would give you all your events for the day for all your calendars. I took mine out and it said that I had 72 events.
I changes the If statement in line 6 %calendar1 ~ *Appointments* to %calendar1 ~ ** and what I get is double events. For example Work event at 5:30am then again Work event at 7:15. I don't understand this.
I hope this post is monitored.
flash629 said:
In a previous post it was suggested that taking out the if statement would give you all your events for the day for all your calendars. I took mine out and it said that I had 72 events.
I changes the If statement in line 6 %calendar1 ~ *Appointments* to %calendar1 ~ ** and what I get is double events. For example Work event at 5:30am then again Work event at 7:15. I don't understand this.
I hope this post is monitored.
Click to expand...
Click to collapse
You still need the Variables --> Variable Set. Name %doubleevent, To %event1 and the If statement: %event1 !~ %doubleevent otherwise you will get double events like you mentioned.
Thank you MishaalRahman,
I have read numerous solutions to pulling events from Google Calendar, but none so elegant. I have recently discovered phones and more recently discovered Tasker. My skills are quite rusty but with the help others (you included) I am finding my way. This is a wonderful resource.
As some have already pointed out, this is a great task to include in a wake-up profile. However, not all of us work or sleep on a regular schedule. I remember the 'good ole days' when I could get by on just two jobs.
A moving time segment from 'now' to 'set_length' would be ideal. I think I can work that out. But Event location (address) to pass to Google Maps or Waze as a destination is a topic for which I haven't found much information. Do you (or anyone else) have any suggestions?

[GUIDE][Difficulty: Advanced] Create a Hotspot Monitor to Watch Who's Connected

If you use a WiFi hotspot, you might be interested in monitoring how many devices and which devices are still connected to it. This is useful for when you're sharing your hotspot with friends or family. There is no real way to do this easily in Android, but with some clever shell commands, variable manipulation, and database searching, we can do so using Tasker!
Disclaimer: this is a profile created by redditor StillAzure over on the /r/tasker forum. I have taken the liberty to add comments explaining each step of the process as well as make a few changes to make it work on devices that his implementation does not work on.
Prerequisites
Root Access
Snackbar Tasker Plugin. This is what handles the pop-ups telling you what devices are connected. Not necessary but if you want to just import and forget just install it anyways.
AutoNotification. This handles the notification telling you how many devices are connected by creating a persistent notification.
The IEEE OUI database. Download it at http://standards-oui.ieee.org/oui.txt. I've found that this download server is slow and prone to time-out, so try it a few times until it fully downloads. Move it to /sdcard/Tasker. The redditor's task downloads it automatically but again it could fail and you wouldn't know without a progress bar telling you so.
Instructions
First profile will be the hotspot monitor profile (this is my own creation separate from the redditor's because his method did not trigger the profile):
{
"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"
}
Create a new profile and name it Hotspot Monitor.
Create an Event context and go to System --> Intent Received. Set Action to:
Code:
android.net.wifi.WIFI_AP_STATE_CHANGED
Leave everything else blank.
Enter the task creation, but leave the name blank.
Task --> If. If %wifi_state eq 13. This means the hotspot is active.
Variables --> Variable Set. Set %Hotspot to 1.
Task --> Else.
Plugin --> AutoNotification Cancel. Id: 55555. This will cancel the persistent notification from the hotspot monitor if the hotspot disconnects.
Variables --> Variable Set. Set %Hotspot to 0. This means the hotspot has disconnected.
Task --> End If.
Here's a screenshot of the task:
Next, we'll set up the task that actually looks up the manufacturer of the device connected to your hotspot by using its MAC ID.
Create a task and name it "MAC Lookup"
File --> Test File. Type: Modified. Data: Tasker/oui.txt. Store Result In: %MODIFIED. Check "continue task after error."
Task --> If. If %err Set. Basically, if error is set, it means you don't have the database in the folder, so we'll need to download it.
Plugin --> AutoNotification. Title: OUI Database not found! Text: Downloading the database... Id: Database. Persistent: true.
Task --> Goto. Type: Action Label. Label: DOWNLOAD.
Task --> End If.
Variables --> Variable Set. Name %TODAY to %DATE.
Variables --> Variable Convert. Name %TODAY, Function "Date Time to Seconds."
Variables --> Variable Set. Name %SINCE to (%MODIFIED - %TODAY)/24/60/60. Check "Do Math." This is basically figuring out how many days it has been since the oui.txt has been last modified.
Task --> If. Set it to if %SINCE > 14. If it's been more than 2 weeks since the database has been modified, we'll update it.
Plugin --> AutoNotification. Title: OUI Database outdated! Text: Updating the database... Id: Database. Persistent: true.
Net --> HTTP Get. Severort set to http://standards-oui.ieee.org/oui.txt Make the file output to Tasker/oui.txt
Plugin --> AutoNotification Cancel. Id: Database
Plugin --> AutoNotification. Title: Database has been downloaded. Text: You can now swipe away this notification. Id: Database.
Task --> End If.
Variables --> Variable Clear. Name %MANU. This clears the current array of manufacturer IDs if it's already set (so we'll only get the most currently connected devices to our hotspot).
Variables --> Array Clear. Name %MANU. Same idea.
Code --> Run Shell. Run this command:
Code:
ip neigh show dev wlan0 | grep -i -e reachable -e delay | grep -o' ..\:..\:..'
Check "Use Root", Store Output In %CLIENTS, and Store Errors in %error. Check "Continue Task after Error". This action basically gets the currently connected devices' MAC addresses and puts it into an array.
Task --> If. If %error is Set. Meaning no devices are connected.
Alert --> Flash. Text: Zero clients were found.
Task --> Stop. Exit the task.
Task --> End If.
Variables --> Variable Split. Name: %CLIENTS. Leave Splitter blank.
Task --> For. Variable is %for and Items are 2:%CLIENTS(#). Here, we're looping through each connected MAC ID and using our OUI database to look up and determine what manufacturer it belongs to.
Variables --> Variable Convert. Name %CLIENTS(%for). Function: To Upper Case.
Variables --> Variable Search Replace. Variable: %CLIENTS(%for), Search set to : (a colon), check Replace Matches, and for Replace With make it a blank space.
Code --> Run Shell. Here's the command:
Code:
sed -n '/%CLIENTS(%for)/ p' /sdcard/Tasker/oui.txt
Check Use Root, Store Output In %MANU(%for) and check Continue Task after Error.
Variables --> Variable Section. Name %MANU(%for) From 23, Length 100. Cut out all the extraneous data.
Task --> End For.
Here's screenshots of the task:
Next, we'll set up the profile that triggers when the hotspot is confirmed to be on.
Create a new profile and name it "Hotspot Connected."
Create a new State context and go to Variables --> Variable Value. Set it to when %Hotspot eq 1.
Create a new task, but you don't need to name it anything.
Task --> Perform Task. Name: MAC Lookup.
Variables --> Variable Set. Name %PPLCOUNT to %CLIENTS(#)-1. This gets us how many clients are connected.
Task --> If. If %CLIENTS(2) !Set. Meaning nobody is connected.
Variables --> Variable Set. Name: %msg to <font color=yellow>No one's there!
Task --> Else
Variables --> Variable Set. Name: %msg to <font color=red>%PPLCOUNT <font color=white>people are still connected!
Task --> End If.
Variables --> Variable Join. Name %MANU, Joiner is , (a comma). This turns the manufacturer array into a comma-separated list.
Plugin --> AutoNotification. Title: Warning! Text: Your hotspot is still on! %msg Action on Touch: CLIENTS. Id: 55555. Persistent: true. Title Expanded: List of Registered clients:
That's it for this task. Exit out, and add a time context to this profile. Set it to every 5 minutes so your hotspot notification will update.
Here are screenshots of the task:
Finally, we will make the profile that triggers when you click on the notification.
Create a new profile and name it Hotspot Information.
Create an Event context and go to Plugin --> AutoNotification Event. Filter: CLIENTS.
Create a task with no name. Go to the task editor.
Plugin --> Snackbar Tasker Plugin --> Snackbar Without Button. Message: No one is connected to the hotspot! At the bottom, check If and set it to if %MANU !Set.
Plugin --> Snackbar Tasker Plugin --> Snackbar Without Button. Message: Connected devices: %MANU. Check If at the bottom and set it to if %MANU is Set.
Here's a screenshot of the task:
I've attached the XMLs below. Please import them, but read through the labels and instructions above if you want to understand how these profiles work and how to edit them in the future.
Hi,
I am getting this error. Please see the attachment. Where am i going wrong?
did not get it with the auto notification. how do i change the name?
/u/StillAzure here, didn't notice this thread lol.
jayzero76 said:
did not get it with the auto notification. how do i change the name?
Click to expand...
Click to collapse
What name again?
iamronin said:
Hi,
I am getting this error. Please see the attachment. Where am i going wrong?
Click to expand...
Click to collapse
It means there's no client connected. Are you sure there are any?
If you are rooted, try arcais netcut (cant link because i am new) which helps you to check who is connected to your network and also lets you kill the connection (Even if you are on someone elses connection) [WORKS IN ANDROID, IOS, MAC WINDOWS , LINUX . 100% TESTED]
Hope this helps!
Getting following error in Mac lookup task
EDIT
that's my bad
Where's the MAC Lookup task? You've got everything else to import except it.

[APP][NST/G] NSTWeather

New NST Weather Widget is done! https://forum.xda-developers.com/nook-touch/themes-apps/app-nst-weather-widget-t3946270
Updated to v1.1
--fixed issue that often caused app crash if initial contact with OWM was unsuccessful
--added sunrise/sunset update for condition icon
--added "current value" display in Settings for Lat., Long. and API
--some cosmetic changes to forecast panel
Everybody talks about the weather...
I miss WeatherAce, but when WeatherUnderground deep-sixed their free API service, there was nothing left in the app that worked. I made a few half-hearted attempts at updating the APIs for some of the other services included in the app but it became clear that my approach was too simple-minded and I gave up.
NSTWeather is my "learning app" for figuring out how to deal with xml weather data. It's a simple weather display and forecast app just for the NST (and sort of the NSTG...read on). Because Tasker (which I used to make this app) cannot create widgets, I started looking for some screen real estate that would (almost) always be visible. There is a small "blank" section of the status bar to the right of the soft Menu button. On the NST, this area is large enough for a temperature (no F or C) and a small condition icon. On the rare occasion that sync arrows appear, they overlap the condition icon. Alas, if you have an NSTG, the Glowlight indicator overlaps the condition icon when WiFi is on and, I suppose, sync arrows displayed with the WiFi on might overlap the temperature. So this might not be the best thing for NSTG users.
{
"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"
}
"What about apps that run full-screen?", you ask. I have only one or two, including the stock reader. I have made the weather information the same color as the reading page background. That's one reason the icons look a little rough. Only 2 colors. If you have other full-screen apps and the weather display is annoying you, it can be toggled by a long press once the app is activated.
This app is not quite experimental, but it is not a destination for me. This is a way for me to work out various issues leading up to an eventual Widget.
With that out of the way...
What it does
This app uses your latitude, longitude and free OpenWeatherMap API to fetch a 3-hr, 5-day forecast for your locale. The app makes up to two attempts to contact the OWM servers each morning, at 4:30 am. The xml file from OWM is then processed to extract sunrise/sunset times, and temperatures and precipitation amounts for each 3-hr period over the 5-day forecast. All this data is massaged to get the time zone corrected, adjust the day/night condition icons for sunrise/sunset (OWM has them wrong...) and convert the precipitation into the units you desire. There is lots of other information in the xml file, but I decided to keep this "simple" (it is anything but) and just go for this essential information.
At each 3-hr interval, starting at 2:00 am, the temperature/condition display is updated from the forecast data. In addition, a tap on the temperature display will open a panel with the forecast for all 5 days, at 3-hr intervals (see screenshot below).
If the app fails to contact OWM (their servers are sulking or you have arrived in a hotel the previous evening and your NST can't make a WiFi connection...), it will re-sort the panel data to keep the day display correct and continue to display whatever information it has in the last forecast received until it runs out of data. I don't know what happens then! Of course, one could hope that in the course of 5 days it will eventually reach OWM.
What it doesn't do
The app--as configured--does not display "tiny" amounts of precipitation. I have it set to indicate "trace" (tr.) when the value falls below a tenth of whatever unit is selected. Also, I make no distinction among the types of precipitation other than by the condition icon.
Unfortunately, in the old version of Tasker that runs on the NST there is no way to directly address the changes at sunrise or sunset since they are variable, and variable time contexts were added only to later versions of Tasker. In the current version of NSTWeather I have added a routine for updating the condition icon within 15 minutes of sunrise or sunset, always on the early side rather than later. I based my range of potential times on Anchorage and Oslo. If you live at even more extreme northerly or correspondingly southerly latitudes, this will not work for you all the time. Also, since the weather data is updated at 4:30 am, I did not include the entire potential sunrise range (as early as 3 am), but rather settled for 4:45 am as my starting value. Hopefully you are asleep at that point...
Requirements
1. This is a Tasker-generated app. If you already have one of my other Tasker-generated apps or have previously installed GApps, you don't need the two Google maps library files included in the zip and can delete them. If you do need them, copy the two files into the locations shown below:
/system/etc/permissions/com.google.android.maps.xml
/system/framework/com.google.android.maps.jar
Set permissions for both files to rw-r--r-- and reboot. Without these files resident, the app will not install.
2. Copy the folder "NSTWeather" and its contents from the zip below to the root of your sdcard. This contains all the condition icons and is where the weather.xml file from OWM will be stored.
3. Go to https://openweathermap.org/ and find the current weather for your locale. When this is displayed you will also see the "geocoordinates" (i.e., the latitude and longitude). Copy these two values.
4. Go to https://openweathermap.org/api and sign up for a free API (right there in the opening paragraph, click on the words "sign up"). You will eventually receive an email with the API.
Installation and Use
Install the app from the zip below either by side-loading or ADB. The only user interface of the app is a Settings page. Open NST Weather and enter your latitude and longitude, as well as your API. Be especially careful with the API and make sure to include any negative signs with the geocoordinates.
Next, make your selection of the units you want displayed. Finally, to make the app fully functional you need to check both of the boxes in the lower section (you can disable the app temporarily by unchecking these). When you've made all the selections, tap on the bottom box to start a manual data retrieval. The Settings page will close and you should see WiFi come on for a bit. It will then turn off. If a successful connection was made with OWM and if you entered your information correctly, you will eventually see a weather display in the status bar. How long will it take? About 3 minutes. There's an awful lot of stuff to be done. That's one reason for having the data update done at 4:30 am when you are hopefully snoozing.
If nothing seems to happen and you see WiFi come back on again in 15 minutes, then it failed to contact OWM the first time and is trying again. If the second time fails, you will get a notification telling you that download failed, assuming there is nothing wrong with the values you entered. Go back to the Settings page and carefully check your API. That's where the most likely error will occur. Of course you should check your geocoordinates, too, just to be sure.
If you have made a successful connection with OWM before and one day there is a notification saying download failed, you can just ignore it and hope for better luck the next day unless you absolutely must have an updated forecast. In that case, you can use the manual retrieval option. There is no need to re-enter the latitude, longitude and API each time you open the Settings page once they have been entered correctly. They are stored in the /data/data/app folder for the app. Also, if you decide to change the locale, you only need to enter the new latitude and longitude, not the API.
The 5-day forecast panel is updated daily even if a download fails (data is just shifted to the left and the names of the days are changed). You access the panel by tapping on the temperature display.
If you want to hide the weather display, a long press on the temperature will make it invisible, but the area on the status bar adjacent to the soft Menu button remains active. Another long press will re-display the weather information.
Widgets?
As I said early on, Tasker cannot make widgets on its own, although it can share data with some other apps which can. Of these, only one will still work on the NST/G: Minimalistic Text. The current version of NSTWeather shares the current temperature value display with Minimalistic Text as a "Locale" variable called CURRTEMP. If you have a working install of Minimalistic Text and some familiarity with the app, you can play with this just to get a feel for the possibilities (that's what I'm doing!). To do so, create a widget (1x1 or perhaps 2x1), and select "Custom" for the format/layout. Get rid of all the stuff that is there by default and tap on the "Misc" tab. One of the options there is "Locale". If you drag that up to the working area you can enter the name of the variable CURRTEMP. If you want to add a degree symbol and F or C, or perhaps your location, you can use the "Static Text" option. I've done this and it works wonderfully well, updating right along with the normal status bar temperature display of NSTWeather. There's still a tremendous amount of work to be done to get to the actual Widget with the condition icons, etc., but it's a start

Categories

Resources