Hi,
when I open Gallery my Defy hangs.
Looking CPU usage (via ADB) I see that the gallery process takes almost all the CPU.
So I tried with different gallery substitutes (ie Photo Gallery). Same behavior.
So I think it's not gallery fault, but something lower. Maybe some problem with the SD card or the codec for some media file.
I checked the Sd but everything seems fine (anyway I got the problem only when media directory is 'indexed').
I saw some work by szipinf.
Is there a way to trace (maybe via ADB) what is doing the hanging process?
Killing the process doesn't solve the problem (I saw that some system process where closed after sometime).
Same problem but also nowhere on solution.
Send from my gio .
just trying to get a workable flexible phone
I found a workaround!!!!
Connect your device with adb (I use adb over wifi) and verify that your CPU is normal.
Code:
adb connect 192.168.0.3:8000
adb shell
top
The "top" command prints cpu usage every 5 seconds or so.
Scroll up and take a look at the first line.
You should read low values for User and System % (mine is "User 0%, System 5%")
Start gallery on your device, now you should see the cpu usage very high, say over 90% for user.
The first process listed is the one hogging your cpu.
Code:
User 93%, System 5%, IOW 0%, IRQ 0%
User 292 + Nice 0 + Sys 16 + Idle 0 + IOW 0 + IRQ 3 + SIRQ 0 = 311
PID CPU% S #THR VSS RSS PCY UID Name
5243 93% S 12 122920K 31264K fg app_209 com.littlefatfish.photo
The name of the process could vary (say com.cooliris.media).
Write down the PID (in this case 5243).
Hit CTRL+C, adb exit.
Launch adb and take a look at the files held by this process, issuing
Code:
adb shell
ls -l /proc/5243/fd
In the list you should see only one media file, the one that is blocking the gallery!!!
In my case it was
/mnt/sdcard/DoveConviene_icons/[email protected]png
Now you have to remove this file (if is important for you, you should copy elsewhere).
rm /mnt/sdcard/DoveConviene_icons/[email protected]
My gallery now it's back to normality!!!!! (at least till another png will block it)
Intro
I originally wrote this script for LMT, but it has changed a lot since then and (hopefully) deserves its own thread.
You can check the original script's post here, or read more about (part of) what this script is automating (and how it does it) here.
You can also check the Tasker Google Groups thread about the script (clickie).
So what does this do?
It "listens" to your input actions (screen taps, button presses, etc) and turns them into a script you can use to reproduce them.
Think of it as something similar to Excel's Macro Recording feature.
Usage
Run the script, pick the first option and enter the number of events to catch. Depending on the device, one button press ~ 4 events, sometimes more. A screen tap is unpredictable as you're never touching the screen in one spot but in many close spots.
A neat trick would be to enter a high number of events (e.g. 500), do whatever you want to do then wait for ~X seconds (10 for example). Then copy the generated script but exclude everything after the line that says "sleep X".
And if you still have any doubts... try it. That's probably the best way to understand what it does and how to use it.
Custom toolbox
You need a custom toolbox (instead of the default /system/bin/toolbox) in order to use Option 2 correctly. This is because the default "getevent" command isn't line buffered, so it usually sends its output every ~50 lines.
I therefore re-compiled the toolbox (getevent is only a launcher for it) to enable line buffering. This enables the script to work at full speed - it might still be too slow, so do allow a few extra seconds (10 seconds should be safe) of no activity for it to finish.
You'll need to download the modified version, linked below, place it in /tmp/ and give it the correct permissions (chmod 755). Note that it will not persist across reboots, so keep a backup somewhere else.
Code:
https://www.dropbox.com/s/t0xhxa3xuc8m92m/toolbox
Download
You can get the latest version here.
Bugs/Suggestions
Bugs? There are no bugs.
Actually, I'm not an elite script writer, so chances are there are a few quirks. If you find any, please report them.
Also post all your suggestions and I'll try to add them.
To do
This list will be updated based on your feedback.
Thanks
The guys at #bash helped me a lot.
zeppelinrox, learned plenty of stuff from his scripts.
Everyone who tested previous versions (mostly laufersteppenwol ).
Also feel free to ask any question, or answer any potentially interesting question that should be added to this post. I'll make sure to update it with a FAQ.
Thanks
I've contacted a moderator and he said it was okay for me to post in this section instead of the Misc. Software Development section, so it wouldn't get buried within hundreds of ROMs/kernels for devices without forums. This section will be cleaned soon anyway.
worked flawlessly thanks man , example with search button with filtered inputs for xperia play
{
"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"
}
Update:
You're now warned if you don't have busybox installed;
Busybox not automatically creating symlinks shouldn't be an issue any longer;
The timeout option should now work, but you'll need a custom toolbox (instead of /system/bin/toolbox) to run it. Read the OP for more info.
I'm not sure if the custom toolbox will work on all devices. Please test it out, it's completely safe as you'll be placing it in /tmp/ anyway without overwriting the original, unmodified version on your device.
works fine here, too (LG Optimus 4x HD)
the only "issue" is caused by my device itself it records way too much events in a short time (good for using the phone, but bad for the script ) so ~1000 events are enough for about one or two swipe(s)
but try yourself
Can you do a YouTube tutorial or just a written one one how to use it to get an event like opening the app draw of a launcher or something.
You give some explanation but I'm still a bit lost after rereading twice.
Sent from my SPH-L710 using xda app-developers app
fabzbear said:
Can you do a YouTube tutorial or just a written one one how to use it to get an event like opening the app draw of a launcher or something.
You give some explanation but I'm still a bit lost after rereading twice.
Sent from my SPH-L710 using xda app-developers app
Click to expand...
Click to collapse
Choose option 1 or 2, wait for the countdown to finish. do whatever you want to do.
For option 2, it should be simple enough - you just put a timeout. You'll need the modified toolbox from the first post, tho.
For option 1, you have to input a certain number of events. It's just impossible to predict that (especially if you're dealing with screen taps and not just button presses), so I suggest you do this:
Put a higher number (e.g. 500) (if you're only interested in button presses, 1 button press = ~4->~10 events, depending on the device).
Do whatever you want to do.
Wait for ~10s without doing anything.
Check the script's output (by reopening the terminal emulator/script manager).
If the script has finished (500 events have been reached already), it probably didn't record everything. Restart from step 1, with a higher number (e.g. 1000).
If not, spam your touchscreen till it's done.
Copy the outputted script and search for a line that looks like "sleep 10" (where "10" is approximately the amount of seconds you waited in step 3).
Remove everything after that line.
PS: If you get spam events from other input devices you're not interested in (e.g. compass), you can use Option 4 to only monitor the touchscreen device, for example.
wow this is great! what is the minimum number of lines of code needed for one screen touch to register (e.g. pressing a button)? i try to make mine the small by pressing very quickly which works great. However, i am just curious because when i try to shorten the code by myself in any of the areas, the script does not work.
agentdude said:
wow this is great! what is the minimum number of lines of code needed for one screen touch to register (e.g. pressing a button)? i try to make mine the small by pressing very quickly which works great. However, i am just curious because when i try to shorten the code by myself in any of the areas, the script does not work.
Click to expand...
Click to collapse
Possibly two lines -
@GermainZ
Great work - now I can diagnose my power button as well as simulate it. Thanks man!
Thank you for this. I was finally able to get tasker to play Spotify with the help from this script.
GermainZ said:
Update:
You're now warned if you don't have busybox installed;
Busybox not automatically creating symlinks shouldn't be an issue any longer;
The timeout option should now work, but you'll need a custom toolbox (instead of /system/bin/toolbox) to run it. Read the OP for more info.
I'm not sure if the custom toolbox will work on all devices. Please test it out, it's completely safe as you'll be placing it in /tmp/ anyway without overwriting the original, unmodified version on your device.
Click to expand...
Click to collapse
I would like to make a script to copy current text line to clipboard. With Hackers soft keyboard, the keys to press are: HOME, SHIFT+END, CTROL+C. Anyway to do this
simulation with either "input keyevent ..." or "sendevent...".
e154037 said:
I would like to make a script to copy current text line to clipboard. With Hackers soft keyboard, the keys to press are: HOME, SHIFT+END, CTROL+C. Anyway to do this
simulation with either "input keyevent ..." or "sendevent...".
Click to expand...
Click to collapse
I don't think so, not unless you have a hard keyboard.
GermainZ said:
I don't think so, not unless you have a hard keyboard.
Click to expand...
Click to collapse
Found a way to simulate key clicks for coping current text line to clipboard. With Hackers soft keyboard, the keys to press are: HOME, SHIFT+END, CTROL+C. The following script does this simulation nicely:
#simulate key click on fn, home, shift, end, fn, ctrl, c
input touchscreen tap 870 730
input touchscreen tap 1020 450
input touchscreen tap 80 670
input touchscreen tap 1020 520
input touchscreen tap 870 730
input touchscreen tap 70 590
input touchscreen tap 400 660
The key positions are for hacker's keyboard on ASUS TF101 tablet.
Hi, thanks for the wonderful script. I get it working.
Now that I can simulate the "tap", I would like to know how to modify my script to obtain a "double tap" and a "long tap".
Thanks in advance.
PS.: This is my tap at x=248,y=164
sendevent /dev/input/event1 3 57 0
sendevent /dev/input/event1 3 53 248
sendevent /dev/input/event1 3 54 164
sendevent /dev/input/event1 3 48 1
sendevent /dev/input/event1 3 49 0
sendevent /dev/input/event1 3 52 0
sendevent /dev/input/event1 3 50 0
sendevent /dev/input/event1 0 2 0
sendevent /dev/input/event1 3 57 1
sendevent /dev/input/event1 3 53 83
sendevent /dev/input/event1 3 54 202
sendevent /dev/input/event1 3 48 0
sendevent /dev/input/event1 3 49 0
sendevent /dev/input/event1 3 52 0
sendevent /dev/input/event1 3 50 0
sendevent /dev/input/event1 0 2 0
sendevent /dev/input/event1 0 0 0
sendevent /dev/input/event1 3 57 0
sendevent /dev/input/event1 3 53 248
sendevent /dev/input/event1 3 54 164
sendevent /dev/input/event1 3 48 0
sendevent /dev/input/event1 3 49 0
sendevent /dev/input/event1 3 52 0
sendevent /dev/input/event1 3 50 0
sendevent /dev/input/event1 0 2 0
sendevent /dev/input/event1 3 57 1
sendevent /dev/input/event1 3 53 83
sendevent /dev/input/event1 3 54 202
sendevent /dev/input/event1 3 48 0
sendevent /dev/input/event1 3 49 0
sendevent /dev/input/event1 3 52 0
sendevent /dev/input/event1 3 50 0
sendevent /dev/input/event1 0 2 0
sendevent /dev/input/event1 0 0 0
sendevent /dev/input/event1 3 57 0
sendevent /dev/input/event1 3 53 248
sendevent /dev/input/event1 3 54 164
sendevent /dev/input/event1 3 48 0
sendevent /dev/input/event1 3 49 0
sendevent /dev/input/event1 3 52 0
sendevent /dev/input/event1 3 50 0
sendevent /dev/input/event1 0 2 0
sendevent /dev/input/event1 3 57 1
sendevent /dev/input/event1 3 53 83
sendevent /dev/input/event1 3 54 202
sendevent /dev/input/event1 3 48 0
sendevent /dev/input/event1 3 49 0
sendevent /dev/input/event1 3 52 0
sendevent /dev/input/event1 3 50 0
sendevent /dev/input/event1 0 2 0
sendevent /dev/input/event1 0 0 0
gianmaxfactor said:
Hi, thanks for the wonderful script. I get it working.
Now that I can simulate the "tap", I would like to know how to modify my script to obtain a "double tap" and a "long tap".
Thanks in advance.
PS.: This is my tap at x=248,y=164
Click to expand...
Click to collapse
Either copy paste the 4 lines that appear on every touch twice (double tap) or once and put a "sleep 1" between the first two and the last two (long press).
You can also use something like this:
Code:
# double tap
input tap 248 164
input tap 248 164
# long press
input swipe 248 164 248 164 1000
# help on the input command
input
Input tap and input swipe would be marvelous... but unfortunately I'm on android 2.3.6. In fact I imagine that swipe will be almost impossible.
Anyway, why do you talk about "4 lines" ? I see dozens of lines... what are the four I have to duplicate?
gianmaxfactor said:
Input tap and input swipe would be marvelous... but unfortunately I'm on android 2.3.6. In fact I imagine that swipe will be almost impossible.
Anyway, why do you talk about "4 lines" ? I see dozens of lines... what are the four I have to duplicate?
Click to expand...
Click to collapse
It's four on my old device, might be more for you. Basically, X lines are repeated every time you make a click. See which.
BTW, did you try actually long pressing? The script should be able to simulate that, though you'll probably want to exaggerate the long press (e.g. 3 seconds instead of one).
GermainZ said:
It's four on my old device, might be more for you. Basically, X lines are repeated every time you make a click. See which.
BTW, did you try actually long pressing? The script should be able to simulate that, though you'll probably want to exaggerate the long press (e.g. 3 seconds instead of one).
Click to expand...
Click to collapse
I tried... but the output is so long that I am not able to copy it entirely. I think I could add something to your script to divert the output into a file. But I don't know where (and how)...
gianmaxfactor said:
I tried... but the output is so long that I am not able to copy it entirely. I think I could add something to your script to divert the output into a file. But I don't know where (and how)...
Click to expand...
Click to collapse
Run the script. Tap *once*. Wait for ~5s. Cancel the action. In the outputted script, you'll see a line that says something like "sleep 5" - everything before it should be the tap, everything after garbage..
GermainZ said:
BTW, did you try actually long pressing? The script should be able to simulate that, though you'll probably want to exaggerate the long press (e.g. 3 seconds instead of one).
Click to expand...
Click to collapse
Incredibly there is a continuos flow of events while longpressing... dozens and dozens of quickly repeating actions... so there is no "sleep" in the output of the script. Every device is a world apart ! Thanks anyway... I've been a big help from you ! Bye
I used option one
I set to record 4
Nothing happens
O tried 500
Same result
Edit
OK that was vague
It does countdown
Then goes blank
No output no matter what I do
This has been driving me bananas because I can't seem to get it to work.
I want to gradually change the opacity of a layer between 0 and 100 over the course of 1 hour.
I thought setting the value of the opacity property using a counter might work, but it seems to just output a single value.
Any suggestions?
you can write a multi line script like
----------------------------------------------------------
if {dh11}==1 then var_my_opacity= 100
end
if ---- then ----var_my_opacity=50
end
.....
-----------------------------------------------------------
with all var hour ({dh11}) you want and all hour value (1,2,3, >3 and < 5)..... you want
and set you wanted item opacity to "var_my_opacity"
I think part of the problem is I found a bug in the lua interpreter. If I set opacity using a counter to vary between 0 to 100 in 10 seconds and reverse, I get the expected slowly flashing behavior.
{c_0_100_10_st}
But, if I do the same thing as part of a conditional:
({dh24}>=23) and {c_0_100_10_st} or 0
That statement just outputs a fixed value and stops.
Sent from my SM-N910T3 using XDA-Developers Legacy app
and why a "or 0" ?
1 or 0 = 1
0 or 0 = 0
so the "or" function with 0 do nothing.
and a "and" function give "0" only if one of the 2 member is "0", otherwise it is "1"
{dh24) never go up to 23. Hour go to 0 -> 23. So {dh24} can just reach 23 one time otherwise it is "0" from 0 to 22.
dersie said:
and why a "or 0" ?
1 or 0 = 1
0 or 0 = 0
so the "or" function with 0 do nothing.
and a "and" function give "0" only if one of the 2 member is "0", otherwise it is "1"
Click to expand...
Click to collapse
I think you have misunderstood the construct of the if / then command in LUA
pseudo code: If x=1 then y else z
is written thusly: (x==1) and y or z
Think of the brackets as the 'if' command, the 'and' as the 'then' command, and the 'or' as the 'else' command.
Go to your phone dialer and tipe: *#*#3646633#*#*
-->An EngineerMode will appear, swipe left to get to Hardware Testing, tap on Audio and than tap on Normal Mode.
-->Audio_ModeSetting will appear as on picture.
--> select [sph]
-->change values:
lvl 6 = 155 (was 136)
lvl 5 = 140 (was 124)
lvl 4 = 125 (was 112)
lvl 3 = 110 (was 100)
lvl 2 = 100 (was 88)
lvl 1 = 86 (was 76)
lvl 0 = 75 (was 64)
-->Repeat the same for [sph2]
Step 2: Almost There
--> Go back to Speech Enhancement
--> change Common Parametre to Normal Mode
--> while there, select parametre 7, and set it to 96 (was 64).
--> select parametre 6, set to 300 (was 400), supposedly adds a bit more bass to the audio
That's it. For me, volume is significantly boosted and voice sounds more natural.
to see video tutorial go to.... differentguru dot com
tips2222 said:
Go to your phone dialer and tipe: *#*#3646633#*#*
-->An EngineerMode will appear, swipe left to get to Hardware Testing, tap on Audio and than tap on Normal Mode.
-->Audio_ModeSetting will appear as on picture.
--> select [sph]
-->change values:
lvl 6 = 155 (was 136)
lvl 5 = 140 (was 124)
lvl 4 = 125 (was 112)
lvl 3 = 110 (was 100)
lvl 2 = 100 (was 88)
lvl 1 = 86 (was 76)
lvl 0 = 75 (was 64)
-->Repeat the same for [sph2]
Step 2: Almost There
--> Go back to Speech Enhancement
--> change Common Parametre to Normal Mode
--> while there, select parametre 7, and set it to 96 (was 64).
--> select parametre 6, set to 300 (was 400), supposedly adds a bit more bass to the audio
That's it. For me, volume is significantly boosted and voice sounds more natural.
to see video tutorial go to.... differentguru dot com
Click to expand...
Click to collapse
On what device it was tested? I don't want my phone speaker to blow