Related
Here are a few commands for Android in terminal. If you have any commands that you think should be here, just reply. Enjoy!
chmod - give/take rights away from files. The numbers you see in the how-to's is a little complicated. It has to do with the rights you are assigning the file or folder. http://wiki.linuxquestions.org/wiki/Chmod for further reading.
cat - look at, modify, or combine a file. You can also copy files with this command by "reading" it to another file instead of to the screen.
cd - change from one directory to another
cp - Copy a file from one location to another
dd - copies exact locations to other locations. Can be an entire drive, a folder, etc.
dd if= of=. uses an input file and an output file.
exit - exits the shell you are in. When you type su you start up a shell.
ls - lists all files with in a directory try ls - l too.
mv - Move a file from one location to another. At the same time you can rename a file.
su - Substitute User. We type this to switch to the root user. You need to type this command first to do a lot of the other commands.
tar - creates taped archives. Compresses files like winzip, 7zip, winrar and others tar /? for details.
rm - followed by a file name with delete the file sync - synchronizes any data on disk with data in memory. We type this before rebooting to ensure we've got all data written
Other commands of interest:
df - how much free disk space. In linux you can add a switch "df -h" but the "-h" does nothing for me on Android. top - like task manager, it displays running processes. in Linux the q key quits. On Android I don't know how to make it quit other than closing the app. uptime - displays how long it has been since you last rebooted the system.
busybox - a tool that combines many linux commands into a single compact file. Typing this displays all the commands at your disposal.
busybox df - a much easier to read display of free diskspace. This display shows how full (use%) each file system is.
Thanks
thank you so much, well for a noob like me very informative was looking for this kind from very long :laugh:
Substitute user XD you know it is superuser right?
free - see all free Memory from the Device
mid-kid said:
Substitute user XD you know it is superuser right?
Click to expand...
Click to collapse
Actually substitute user is also correct.
"The su command, also referred to as substitute user, super user, or switch user, allows a computer operator to change the current user account associated with the running virtual console."
Source: http://en.wikipedia.org/wiki/Su_(Unix)
Sent from my Galaxy Nexus using xda premium
So practically the basic linux comands are the same with android terminal!!!
I just noticed that the ping command is working just fine
Type ping 4.2.2.4 for example
rezo609 said:
If you have any commands that you think should be here, just reply. Enjoy!
Click to expand...
Click to collapse
svc data enable - turn on mobile data
svc data disable - turn off mobile data
svc wifi enable - turn on wifi
svc wifi disable - turn off wifi
svc help - show information about subcommands
For the top command mentioned in the OP, just type "top -n 1" and it will exit, leaving you with the readout at the time you executed the command. -n is for number of updates before stopping.
Also will add that the powertop command will show the top reasons for wakeups from idle.
Tnx
Metalcorpe said:
So practically the basic linux comands are the same with android terminal!!!
Click to expand...
Click to collapse
Yep
rezo609 said:
If you have any commands that you think should be here, just reply.
Click to expand...
Click to collapse
grep - Useful to apply filters to other commands. For example, to list only the apk files inside a folder:
Code:
ls /folder/to/list | grep apk
or to search a string inside a file:
Code:
cat /file | grep stringToSearch
logcat - Debugging tool, all the system messages are shown here. To show only the debug messages (useful when an app is giving FC without apparent reason), type:
Code:
su
logcat -d
mount - The most common use for this command is remount the system partition, to modify its content (be careful, you can easily brick your device!). Common usage (needs root):
Code:
Mount /system in Read/Write mode:
mount -o rw,remount /system
Mount /system in Read Only mode:
mount -o ro,remount /system
Saving command output to file. Type
Code:
command >> /folder/to/save/file
If the file doesn't exist will be created, otherwise, the info will be added to the end of the file.
You can also use:
Code:
command > /folder/to/save/file
If the file doesn't exist also will be created, but if the file exists its content will be deleted before add the info.
mount - Mounting a partition
umount - Unmounting a mounted partition
reboot - Reboot phone
stop - Shutdowns the GUI
start - Restarts GUI
above two commands can be used to get a fast reboot.
Also you my use the reboot command to do a faster restart to the device but your are going to lose any unsaved work
You must be rooted
First type : su
Then : reboot
Sent from my GT-I9505 using XDA Premium 4 mobile app
run program with command
I want to run "Applock"s lock all command. I have widgetsoid which can create shortcut for any command. How to do it? I am rooted.
SAVED ME!
toasterwater said:
svc data enable - turn on mobile data
svc data disable - turn off mobile data
svc wifi enable - turn on wifi
svc wifi disable - turn off wifi
svc help - show information about subcommands
Click to expand...
Click to collapse
Dude, thank you so much for posting this information. I had switched my MNVO service to a newer a phone, and this one was just sitting around. There were still things on it that I needed like some notes that I had saved. Because I had not used it in a while, and there was no data/cell service on it, I was out of luck (or so I thought) when I forgot my unlock pin. It wouldn't accept my google login information because there was no data connection. I COULD NOT GET INTO MY PHONE! I was dreading the possibility of having to factory reset, which would erase my notes and other things saved on there. On a whim and after MUCH Google searching, I was trying to find a way to reset the number of attempted pin locks to no avail. I was about to give up, but luckily, I remembered I had rooted it. And after downloading the latest SDK bundle, I came across your post. It allowed me to turn the wifi on my cell phone even though I was "locked out." Wouldn't you know that it very quickly picked up my home wifi signal. Because a data connection was enabled, I was then able to use my gmail login information to get into the phone. Your post saved me and prevented me from having to factory reset my phone and losing my information. Thank you so much!
netstat - show connections status in local device
...
rezo609 said:
Here are a few commands for Android in terminal. If you have any commands that you think should be here, just reply. Enjoy!
chmod - give/take rights away from files. The numbers you see in the how-to's is a little complicated. It has to do with the rights you are assigning the file or folder. http://wiki.linuxquestions.org/wiki/Chmod for further reading.
cat - look at, modify, or combine a file. You can also copy files with this command by "reading" it to another file instead of to the screen.
cd - change from one directory to another
cp - Copy a file from one location to another
dd - copies exact locations to other locations. Can be an entire drive, a folder, etc.
dd if= of=. uses an input file and an output file.
exit - exits the shell you are in. When you type su you start up a shell.
ls - lists all files with in a directory try ls - l too.
mv - Move a file from one location to another. At the same time you can rename a file.
su - Substitute User. We type this to switch to the root user. You need to type this command first to do a lot of the other commands.
tar - creates taped archives. Compresses files like winzip, 7zip, winrar and others tar /? for details.
rm - followed by a file name with delete the file sync - synchronizes any data on disk with data in memory. We type this before rebooting to ensure we've got all data written
Other commands of interest:
df - how much free disk space. In linux you can add a switch "df -h" but the "-h" does nothing for me on Android. top - like task manager, it displays running processes. in Linux the q key quits. On Android I don't know how to make it quit other than closing the app. uptime - displays how long it has been since you last rebooted the system.
busybox - a tool that combines many linux commands into a single compact file. Typing this displays all the commands at your disposal.
busybox df - a much easier to read display of free diskspace. This display shows how full (use%) each file system is.
Click to expand...
Click to collapse
if i wanted to delete a directory with data ? what would be the syntax
Set/View Network Host Name
Run the following as root
setprop net.hostname <new_hostname> // To Change Device Hostname
getprop net.hostname // To View Device Hostname
list of all android terminal commands
Open terminal or file explorer with root access
From root folder go to /system/bin
Type command :ls
The list contains all the terminal codes available
Enjoy!!
Disclaimer1: I'm not responsible if anything goes wrong while you try out the codes.
Disclaimer:man & help pages are not available on android terminal
I am not responsible for anything that may come of or from this information. Use at your own risk!
Step #1)
Create security lock through Settings (pattern, pin, password).
Step #2)
Add VPN connections
Step #3)
Plug the phone in and run these commands (requires adb to be setup properly and drivers). I am sure there is a way to do this directly on the phone but this is easier for me.
Commands to remove security:
Code:
adb shell
sqlite3 /data/system/locksettings.db
update locksettings set value=0 where name='lockscreen.password_type';
.exit
exit
Finished!
For me no reboot was required and you do not have to restore pattern in order to create more VPN connections.
Optional Step:
If you decide that you want to restore the security run the one that fits you.
Commands to restore pattern:
Code:
adb shell
sqlite3 /data/system/locksettings.db
update locksettings set value=65536 where name='lockscreen.password_type';
.exit
exit
Commands to restore pin:
Code:
adb shell
sqlite3 /data/system/locksettings.db
update locksettings set value=131072 where name='lockscreen.password_type';
.exit
exit
Commands to restore password:
Code:
adb shell
sqlite3 /data/system/locksettings.db
update locksettings set value=262144 where name='lockscreen.password_type';
.exit
exit
Great! Thank you!
really helpful, i've been fed up with stupid design.
Brilliant, does it also work for ICS?
I don't have an ICS device. If I can find someone that is willing to let me take a look at their ICS device I can see.
When I restart my phone, it needs a password to access VPN menu. what should I do? I don't want to run these commands every time I restart my phone. any solutions?
does it work with exchange password policy as well?
Sent from my GT-I9300 using xda app-developers app
P30SiNa said:
When I restart my phone, it needs a password to access VPN menu. what should I do? I don't want to run these commands every time I restart my phone. any solutions?
Click to expand...
Click to collapse
Hmm did notice that before I will see whats up with that,
portnoy.vitaly said:
does it work with exchange password policy as well?
Sent from my GT-I9300 using xda app-developers app
Click to expand...
Click to collapse
I am not sure but I would imagine so. I would try with pattern lock and not PIN or Password.
Says that "sqlite3: not found" ....
I justd used Forget password option and entered pin , then i didnt choose any options , and the pattern removed
Just tried this. Added vpn, removed lock pattern. It went back to slide, worked fine.
Rebooted, not visiting VPN settings it's asking me to enter credential storage...any ideas how I can a) get past this without wiping my wifi/vpns, or b) remove this but keep my vpns and slide lock?
sorset said:
Says that "sqlite3: not found" ....
I justd used Forget password option and entered pin , then i didnt choose any options , and the pattern removed
Click to expand...
Click to collapse
Same here.
Works great, thanks for sharing :good:
spumanti said:
Same here.
Works great, thanks for sharing :good:
Click to expand...
Click to collapse
Works for me, too, until I reboot :/
Doesn't work. Apparently it's problem with sqlite.
soinfo_relocate(linker.cpp:1013): cannot locate symbol "sqlite3_enable_load_extension" referenced by "sqlite3"...CANNOT LINK EXECUTABLE
Any help please?
Use Script Manager to make this done on every boot.
1. Make this a batch file:
Code:
#!/system/bin/sh
echo "update locksettings set value=0 where name='lockscreen.password_type';" | sqlite3 /data/system/locksettings.db
and save it to your sdcard
2. Use Script Manager to run it on boot and enable su (root).
3. Test it by running it from script manager and see if it runs correctly. You can try enabling PIN and it should be disabled after running this.
4. Final test: reboot your phone and see if PIN/password is disabled.
Keep in mind this gets executed after everything else, so if you try to wake your phone right away, you might still see the PIN prompt.
Another way without script manager:
1. Make this a batch file:
Code:
#!/system/bin/sh
echo "update locksettings set value=0 where name='lockscreen.password_type';" | sqlite3 /data/system/locksettings.db
and save it to your sdcard as 99pinremove
2. Run the following using adb:
Code:
adb shell
su
mount -o remount rw /system
cp /sdcard/99pinremove /etc/init.d/99pinremove
chmod 755 /etc/init.d/99pinremove
chown root:shell /etc/init.d/99pinremove
exit
exit
In 4.4 there is no such file
Code:
/data/system/locksettings.db
.. any ideas?
ALL CREDITS GOES TO "CAMEL"
For those who experienced this annoyng warning like "The SIM-card you are trying to use is now roaming. No local SIM is available now" I found a working solution. The basic ideea is to update a system property called [gsm.operator.isroaming] to false fast enough that the system belives that is not in roaming. You need root on your device for this workaround to work.
Step 0. Get root access!!!! Adb working!!!
Step 1. Create a file in /system/etc called "install-recovery.sh". If this file exists, append a new line
android# echo "\n/system/etc/camel-roaming &\n" >> /system/etc/install-recovery.sh
This line will execute in background a script named camel-roaming which is placed in system/etc. Change its permission to 755 with
android# chmod 755 /system/etc/install-recovery.sh
Step 2. Create a file in /system/etc called "camel-roaming". This will change roaming parameters once every second. Content of this file will be:
while [ 1 - eq 1 ]
do
setprop gsm.roaming.indicator.needed false
setprop gsm.operator.isroaming false
sleep 1
done
Change its permission to 755 using the same chmod command. Do not use windows notepad for edit because the way that it threats new lines. Use root explorer, midnight commander or simply echo to this file using echo "some text \n" where "\n" stands for a new line.
Reboot your phone and voila! The warning will no more be displayed. It is a chance, probably one in a million to get this warning again if the property is changed by system in less than one second, while our script is sleeping.
:crying:
Don't work for me! :crying:
I use a dual-sim phone (Allview V1 Viper, the same with Gionne Elife E3 / Blue Life Play / General Mobile Discovery, etc).
This solution is valid also for dual-sim phones or only for single-sim?
Thanks!
******************************
A late note:
below contents were written in May2015, after some days I paid my attention to other things (now Oct2015).
If you are new to read, and really interested to achieve this, you may also read the following comments, which may contain some new thoughts/ better methods.
Currently my new watch system is not rooted and am not so hungry on battery. But I promise I will be back to tidy through when I got spare time.
Thanks again for reading.
******************************
I got a way to automate the "Theater mode" of my watch.
I would like my wear to auto switch to "Theater mode" at night and exit every morning to save battery. (Just too lazy to remember to switch it when sleeping ). The real problems are ①google doesn't provide an API for developers ②currently no good method to execute native standalone command on watch.
My basic idea is to simulate a double tap on power button using shell. This would not be that difficult like ②..
Seems current apps don't provide such function: like autowear, weartasker,tasker for wear.... none of them provide a function of executing command on watch.
Then I used thread of gusano38 to apply a debugging of wear from phone (pretend as a PC).
Besides, there is another thread of joschi70 on wearshell, I don't know much about bean shell, so no idea whether it can modify wear setting rather than just retrieving info.
Here are the detailed steps:
Your phones should be rooted.
A. One time record
1. debug your watch (turn on in watch developer opition)
2. use "getevent" to find "bcmpmu_on" related event, in my case, event2
3. run command "cat /dev/input/event2 > /sdcard/doubletap", double tap your power button, then use control-C to stop the command
4. There should be a "doubletap” located in you watch /sdcard
use "cat /sdcard/doubletap > /dev/input/event2" to run and test if it is working
B. After you finish step A, you can always use the following code to trigger current Theater mode
allow bluetooth debugging
Code:
[COLOR="gray"]su
adb kill-server
export HOME=/sdcard
setprop service.adb.tcp.port 5555
stop adbd
start adbd
adb forward tcp:4444 localabstract:/adb-hub
adb connect localhost:4444
sleep 2
adb -s localhost:4444 shell "input keyevent 26; cat /sdcard/doubletap > /dev/input/event2"
setprop service.adb.tcp.port -1
stop adbd
start adbd
adb kill-server
exit[/COLOR]
Also recorded a short demo video
Note: NOT recommended for daily use, maybe you prefer a simple hardware tap, but here debugging mode may make your wear unsafe (therefore this is permanent notification)
=========================================================
It has been some time since my above post, I tried beanshell and finally solved my own problem.
The disadvantage of debug is unsafe, permanent notification, and delay(e.g. my above codes need wait 2s for adb service to be ready). No one if use wearshell.
main code
Code:
import java.lang.Runtime;
import java.io.DataOutputStream;
Process su = Runtime.getRuntime().exec("su");
DataOutputStream outputStream = new DataOutputStream(su.getOutputStream());
outputStream.writeBytes("input keyevent 26;cat /sdcard/doubletap>/dev/input/event2;");
outputStream.flush();
outputStream.writeBytes("exit\n");
outputStream.flush();
su.waitFor();
How:
Step B:
1. install wearshell
2. Prepare above main code, you can either
save to a file (e.g. doubletap.bsh) in /sdcard of watch, and call the through source("/sdcard/doubletap.bsh")
or
directly run (sometimes need to combine into one line like intent)
3. use intent to call: de.fun2code.android.wear.shell.EXEC with extra "bsh".
Now you are free to use it daily!
{
"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"
}
============================================================
This is a third update: I grayed the ADB part of first post for not confusing. This time I show how I used it.
Basically I make my watch into Theater mode and turn off Bluetooth of my phone at night. In the morning do the opposite things:
Just skip the run shell step which kills "bluetooh share" app (my phone has some problem with BT).
This is just one part pf my day/night switch tasks e.g. I also have auto airplane mode and interruption mode. By the way, I don't use airplane mode to turn off bluetooth. Simply because I want my watch to connect a little longer. To do that, you can set "airplane radios" so that you decide whether or not to turn off wifi/bluetooth/etc when you go to airplane mode.
This should save battery a little if not too much. Your decision if it helps you.
my one day sample:
I was searching a solution for this.. However this is still not a daily solution! However this puts a few steps closer at least. Thanks
Sent from my SM-G920F using Tapatalk
I have updated. wearshell worth to try.
qingtest said:
I have updated. wearshell worth to try.
Click to expand...
Click to collapse
This project looks great since it would let me automate activating theater mode with Tasker and I haven't found any other ways to do it. If I understand your post correctly, I need to save the code to a file and save on my watch's storage. How do I copy the file there?
I installed the wearshell , then placed the file with the code named doubletap.bsh in watch sdcard folder and created intent in tasker exactly like in the screenshot and nothing.. The intent goes as it should (green dot on tasker) but the watch still the same..
Sent from my SM-G920F using Tapatalk
if you have sony smart watch 3 like me, can simply plug in your usb cable, otherwise I think can use Debugging over Bluetooth.
then use "adb push" to transfer the file.
In tasker the target is Activity/Service, not BroadcastReceiver.
if this does not solve, can you just paste the codes to web shell page (can also insert 'echo xxx;'), see if there is any output or error?
If error maybe it is the root permission, as you can see my sample code needs su.
well I think the key simulation function may not necessarily need root, but I had my watch rooted (my default). You can either root watch or make a little change to the java codes (so that not requiring root permission).
qingtest said:
In tasker the target is Activity/Service, not BroadcastReceiver.
if this does not solve, can you just paste the codes to web shell page (can also insert 'echo xxx;'), see if there is any output or error?
If error maybe it is the root permission, as you can see my sample code needs su.
well I think the key simulation function may not necessarily need root, but I had my watch rooted (my default). You can either root watch or make a little change to the java codes (so that not requiring root permission).
Click to expand...
Click to collapse
I was using target as activity.
The watch wakes up the screen like if o touched it in normal mode, but nothing else.
My watch it is supposed to be rooted.. I get the # when using shell, but when I saw on code that had SU it was my first though that it might not be rooted.
What changes you suggest for the code? I'm a bit dumb on code since I'm a basic self learner...
Sent from my SM-G920F using Tapatalk
It should work. For problem shooting purpose I guest you check shell and beanshell separately.
1. Make sure adb works in the command window.
The first command "input" is to simulate power press, it should 100% work.
The second command "cat" is to simulate double press, if not working you need to redo the recording.
2. Run beanshell with any command like "echo aaa" in the webpage it should 100% work [edit: print("aaa");]
3. Run my code in webpage, should work
4. Put in tasker
Let me know which step you cannot go through.
qingtest said:
It should work. For problem shooting purpose I guest you check shell and beanshell separately.
1. Make sure adb works in the command window.
The first command "input" is to simulate power press, it should 100% work.
The second command "cat" is to simulate double press, if not working you need to redo the recording.
2. Run beanshell with any command like "echo aaa" in the webpage it should 100% work
3. Run my code in webpage, should work
4. Put in tasker
Let me know which step you cannot go through.
Click to expand...
Click to collapse
I'm having problem right on the second command... using "adb shell cat /sdcard/doubletap>/dev/input/event2" returns in command prompt "The system cannot find the path specified"... however I have triple checked and I have the file doubletap.bsh in the SDCARD folder....
I pushed the doubletap.bsh file to /sdcard and it's not working for me. Running a task with the intent doesn't do anything despite showing the green dot. My watch isn't rooted so I'm sure that's a factor. When I run the code on the web interface this is the error I get
BeanShell: error code bsh.TargetError: Sourced file: inline evaluation of: ``import java.lang.Runtime; import java.io.DataOutputStream; Process su = Runtime. . . . '' : Typed variable declaration : Method Invocation exec : at Line: 3 : in file: inline evaluation of: ``import java.lang.Runtime; import java.io.DataOutputStream; Process su = Runtime. . . . '' : .exec ( "su" )
Target exception: java.io.IOException: Error running exec(). Command: [su] Working Directory: null Environment: null
Click to expand...
Click to collapse
I tried removing what I thought was calling on su permissions but couldn't get it to work, but it may just be poor syntax. Do you know what the code would be if it's not using su?
Edit:
I can't even get the echo beanshell command to run. When I enter 'echo aaa' in the webpage I get the following:
BeanShell: error code bsh.EvalError: Sourced file: inline evaluation of: ``echo aaa ;'' : Typed variable declaration : Class: echo not found in namespace : at Line: 1 : in file: inline evaluation of: ``echo aaa ;'' : echo
Click to expand...
Click to collapse
there are two files 1. doubletap 2. doubletap.bsh.
The first one includes is generated following my step A, did you check it?
sorry "echo" is only for bash.. if you are running beanshell it should be print("aaa"); which work 100%
qingtest said:
there are two files 1. doubletap 2. doubletap.bsh.
The first one includes is generated following my step A, did you check it?
Click to expand...
Click to collapse
Thanks but I'm still overlooking something.
A. One time record
1. debug your watch (turn on in watch developer opition)
2. use "getevent" to find "bcmpmu_on" related event, in my case, event2
3. run command "cat /dev/input/event2 > /sdcard/doubletap", double tap your power button, then use control-C to stop the command
4. There should be a "doubletap” located in you watch /sdcard
use "cat /sdcard/doubletap > /dev/input/event2" to run and test if it is working
Click to expand...
Click to collapse
I need to do the above first even if I'm not using the run shell command, correct? I have my watch set to ADB debugging on, but where am I entering the commands? I'm sure I'm just not understanding what to do.
qingtest said:
A. One time record
1. debug your watch (turn on in watch developer opition)
2. use "getevent" to find "bcmpmu_on" related event, in my case, event2
3. run command "cat /dev/input/event2 > /sdcard/doubletap", double tap your power button, then use control-C to stop the command
4. There should be a "doubletap” located in you watch /sdcard
use "cat /sdcard/doubletap > /dev/input/event2" to run and test if it is working
Click to expand...
Click to collapse
I assumed we could do B without A, so I guess this was the mistake.
Still I'm lacking some knowleage to where we do this and how..
Where we go for one time record and where we run all this steps? ADB to use the "getevent" and the command?
If you could ptovide some more baby steps would be helpfull! thanks
EDITk, I guess I figured it out partially
WIth command prompt and watch screen ON run "adb shell getevent" and while running double press the button (to induce theater mode).
In my phone it showed up like this in the command prompt when I double pressed the button:
I don't get the "bcmpmu_on" on any event but rater "gpnp_pon"
could not open /dev/input/event0, Out of memory
add device 1: /dev/input/event10
name: "ssp_context"
add device 2: /dev/input/event9
name: "tilt_wake_sensor"
add device 3: /dev/input/event8
name: "hrm_lib_sensor"
add device 4: /dev/input/event7
name: "meta_event"
add device 5: /dev/input/event6
name: "step_cnt_sensor"
add device 6: /dev/input/event5
name: "uncal_gyro_sensor"
add device 7: /dev/input/event4
name: "sig_motion_sensor"
add device 8: /dev/input/event3
name: "uncal_geomagnetic_sensor"
add device 9: /dev/input/event2
name: "geomagnetic_sensor"
add device 10: /dev/input/event1
name: "qpnp_pon"
/dev/input/event1: 0001 0074 00000001
/dev/input/event1: 0000 0000 00000000
/dev/input/event1: 0001 0074 00000000
/dev/input/event1: 0000 0000 00000000
/dev/input/event1: 0001 0074 00000001
/dev/input/event1: 0000 0000 00000000
/dev/input/event1: 0001 0074 00000000
/dev/input/event1: 0000 0000 00000000
NOw it's here I'm kind of stuck.. now Im trying to use in the command prompt :
adb shell sendevent cat /dev/input/event1 > /sdcard/doubletap
I event tried
adb shell su sendevent cat /dev/input/event1 > /sdcard/doubletap
and it's returning
"The system cannot find the specified path"
what I'm I missing?
insaned said:
I assumed we could do B without A, so I guess this was the mistake.
Still I'm lacking some knowleage to where we do this and how..
Where we go for one time record and where we run all this steps? ADB to use the "getevent" and the command?
If you could ptovide some more baby steps would be helpfull! thanks
EDITk, I guess I figured it out partially
WIth command prompt and watch screen ON run "adb shell getevent" and while running double press the button (to induce theater mode).
In my phone it showed up like this in the command prompt when I double pressed the button:
I don't get the "bcmpmu_on" on any event but rater "gpnp_pon"
could not open /dev/input/event0, Out of memory
add device 1: /dev/input/event10
name: "ssp_context"
add device 2: /dev/input/event9
name: "tilt_wake_sensor"
add device 3: /dev/input/event8
name: "hrm_lib_sensor"
add device 4: /dev/input/event7
name: "meta_event"
add device 5: /dev/input/event6
name: "step_cnt_sensor"
add device 6: /dev/input/event5
name: "uncal_gyro_sensor"
add device 7: /dev/input/event4
name: "sig_motion_sensor"
add device 8: /dev/input/event3
name: "uncal_geomagnetic_sensor"
add device 9: /dev/input/event2
name: "geomagnetic_sensor"
add device 10: /dev/input/event1
name: "qpnp_pon"
/dev/input/event1: 0001 0074 00000001
/dev/input/event1: 0000 0000 00000000
/dev/input/event1: 0001 0074 00000000
/dev/input/event1: 0000 0000 00000000
/dev/input/event1: 0001 0074 00000001
/dev/input/event1: 0000 0000 00000000
/dev/input/event1: 0001 0074 00000000
/dev/input/event1: 0000 0000 00000000
NOw it's here I'm kind of stuck.. now Im trying to use in the command prompt :
adb shell sendevent cat /dev/input/event1 > /sdcard/doubletap
I event tried
adb shell su sendevent cat /dev/input/event1 > /sdcard/doubletap
and it's returning
"The system cannot find the specified path"
what I'm I missing?
Click to expand...
Click to collapse
I'm stuck at the same place you are. When I run "adb shell getevent" from the command prompt I get results that show "gpnp_pon" for event1 and there's no "bcmpmu_on". So I've tried "adb shell sendevent cat /dev/input/event1 > /sdcard/doubletap" and "adb cat /dev/input/event1 > /sdcard/doubletap" and both give me the same error, "The system cannot find the path specified."
Hi I hoped to make it clear but was too lazy to wrote every detail where I assume readers were familiar with adb.
This is the answer for you two:
①You should know the basic idea is to simulate keypress.
The "input keyevent" does not have the ability to simulate a double tap, that's why we need to use adb to record.
The recorded data is put in the file "doubletap"
②From your question, I guess you are not so familiar with cmd right?
If you run "adb cat /dev/input/event1 > /sdcard/doubletap" in dos cmd, it will actually only run the command "cat /dev/input/event1 " and retrieve the result then write to a file "/sdcard/double" in windows. However, windows does not have such a path, that's why error is reported.
③ sorry I only have played with my own watch, I think the one ‘**on’ should be equivalent to my 'bcmpmu_on'.
④ To do it right, you need to quote the command like this: adb shell "cat /dev/input/event1 > /sdcard/doubletap"
Or first go into adb shell ,then run the command (like below picture)
↑After double press, press Ctrl+C to stop. Then adb will exit with "^C"
The file should already in /sdcard/, can check like below: (in your case doubletap)
Now you can simply run below command to test. should toggle theater mode 100%: (in your case doubletap)
qingtest said:
Hi I hoped to make it clear but was too lazy to wrote every detail where I assume readers were familiar with adb.
This is the answer for you two:
①You should know the basic idea is to simulate keypress.
The "input keyevent" does not have the ability to simulate a double tap, that's why we need to use adb to record.
The recorded data is put in the file "doubletap"
②From your question, I guess you are not so familiar with cmd right?
If you run "adb cat /dev/input/event1 > /sdcard/doubletap" in dos cmd, it will actually only run the command "cat /dev/input/event1 " and retrieve the result then write to a file "/sdcard/double" in windows. However, windows does not have such a path, that's why error is reported.
③ sorry I only have played with my own watch, I think the one ‘**on’ should be equivalent to my 'bcmpmu_on'.
④ To do it right, you need to quote the command like this: adb shell "cat /dev/input/event1 > /sdcard/doubletap"
Or first go into adb shell ,then run the command (like below picture)
↑After double press, press Ctrl+C to stop. Then adb will exit with "^C"
The file should already in /sdcard/, can check like below: (in your case doubletap)
Now you can simply run below command to test. should toggle theater mode 100%: (in your case doubletap)
Click to expand...
Click to collapse
I'm familiar with command prompt and know the basics with adb. I guess it was confusing that some of the steps were very detailed so I could do exactly what you wrote, but some steps were missing things and I didn't realize it. Thank you for your patience.
After doing what was in your last post I'm able to toggle theater mode from adb on my laptop while my laptop is connected, so that's great. However doing it from the Wearshell intent still doesn't work. I copied the code you posted and changed event2 to event1, but I'm pretty sure the problem is that your code uses su and my watch is not rooted. Do you know what the code would look like without using root?
This is the error I got from Wearshell
BeanShell: error code bsh.TargetError: Sourced file: inline evaluation of: ``import java.lang.Runtime; import java.io.DataOutputStream; Process su = Runtime. . . . '' : Typed variable declaration : Method Invocation exec : at Line: 3 : in file: inline evaluation of: ``import java.lang.Runtime; import java.io.DataOutputStream; Process su = Runtime. . . . '' : .exec ( "su" )
Target exception: java.io.IOException: Error running exec(). Command: [su] Working Directory: null Environment: null
Click to expand...
Click to collapse
I just updated my watch to 5.1.1, so lost root. The code is no longer working for me either. I confirm the input and cat do not necessarily need su permission.
However, I don't have an existing code for you ( i am relative new in beanshell too). Will try and share with my spare time (you are welcome to do so too )
Thanks a million for the patience to the detailed adb explanation which helped a lot!
Already working both in Adb, Wearshell and tasker intent. I have the Watch rooted..
However I DID a slight change to the code, I had to remove the " input keyevent 26" from the line, because it was causing only the screen to turn on and without it works great. The double tap on the button for theater mode doesn't need screen on anyway, so I gave it a shot to remove and it worked.
import java.lang.Runtime;
import java.io.DataOutputStream;
Process su = Runtime.getRuntime().exec("su");
DataOutputStream outputStream = new DataOutputStream(su.getOutputStream());
outputStream.writeBytes("cat /sdcard/doubletap>/dev/input/event1;");
outputStream.flush();
outputStream.writeBytes("exit\n");
outputStream.flush();
su.waitFor();
Click to expand...
Click to collapse
I bought a Lenovo Yoga tablet with android 6.0.1 and I want to use it only for PC hardware sensors. I want to power it up when my pc starts. I found some methods to do this but I can`t find these files on "/system/bin/" playlpm, ipod, lpm etc.; fastboot oem off-mode-charge 0 is not working. Anyone has a working solution please?
edit: found a rom that had kpoc_charger and ipod file inside /system/bin/ . They had in common charging word and some others. I copied all my files from /system/bin/ to PC and opened all of them with notepad++. I search those words on my files and I haven`t found any. So there is no file in bin folder that have any relation with charger or battery animation file on Lenovo YT3-850F android 6.0.1. WTF GOOGLE ?
edit: after some research and I don`t remember how many google pages and searches I found that you can achieve this function using:
1. Enter Fastboot Mode (adb reboot bootloader)
2. Enter Command: fastboot oem off-mode charge 0
3. Enter Command: fastboot reboot
if that is not working for you maybe this one will work:
1. search in /system/bin/ for playlpm, ipod, lpm, kpoc_charger or any other file that have inside some reference to battery animation.
2. edit that file, delete all content inside and add
#!/system/bin/sh
/system/bin/reboot
if that is not working you can try this:
1. Unpack boot.img and edit init.rc.
2. Add following to the end of file:
#Check if chargermode and start autoreboot service.
on property:ro.bootmode=charger
start autoreboot
#autoreboott service which command reboot
service autoreboot /su/bin/su /system/bin/reboot -c reboot now
user root
oneshot
3. re-pack boot.img
None of that worked for me but I had an idea. Why not just create that damn file inside /bin ???
1. unpack boot.img
2. edit > ramdisk > init.target.rc (your file may have a different name then mine but search every file for "on charger" word using notepad++ and when you see that below that line are some "start" services you found it)
3. add start kpoc_charger below "on charger" line *** "kpoc_charger" can have any name be free to name it ***
4. add after:
service kpoc_charger /system/bin/kpoc_charger
class charge
5. create kpoc_charger file on root/system/bin/ with 755 permissions using any root file managers
6. edit file and add:
#!/system/bin/sh
/system/bin/reboot
Have fun and enjoy this.
Did you have to remove dm-verity to get this to work?