How to translate device screen position to sendevent position? - General Questions and Answers

I know about the input tap x y shell command, however, I'm trying to understand how to
perform a click using the sendevent command. I have been able to achieve it with the following command:
Code:
sendevent /dev/input/event5 3 53 X &&
sendevent /dev/input/event5 3 54 Y &&
sendevent /dev/input/event5 0 2 0 &&
sendevent /dev/input/event5 0 0 0 &&
sendevent /dev/input/event5 0 2 0 &&
sendevent /dev/input/event5 0 0 0
Where `X` and `Y` is the position that will be clicked, I'm testing it on the android emulator `BlueStacks 5` which the Display Resolution set to `1920x1080`.
The code is working and the click is fired, however, I couldn't understand how to convert the position where I want to be clicked to the sendevent XY position.
If I send using ADB:
Code:
sendevent /dev/input/event5 3 53 2000 &&
sendevent /dev/input/event5 3 54 2000 &&
sendevent /dev/input/event5 0 2 0 &&
sendevent /dev/input/event5 0 0 0 &&
sendevent /dev/input/event5 0 2 0 &&
sendevent /dev/input/event5 0 0 0
It clicks somewhere around x75 y75, how is this calc done? i mean screen xy -> sendevent xy?
--------------------
How to replicate:
--------------------
* First enable BlueStacks 5 adb in the window: Settings -> Advanced -> Android debug bridge
* Open a cmd window and run cd C:\Program Files\BlueStacks_nxt assuming BlueStacks where installed in the default path.
Execute the commands:
* hd-adb.exe connect 127.0.0.1:X where X is the port shown in the window where you enabled the ADB.
* hd-adb.exe -s 127.0.0.1:X shell
Now we are on the shell, execute a new command: getevent -p
and search for:
Code:
... /dev/input/event5
name: "BlueStacks Virtual Touch"
On my emulator the input event for touch is `event5` on yours it can be different, replace it according.
Now you can simulate a click with the code below changing `XY` to the position where you want to be clicked:
Code:
sendevent /dev/input/event5 3 53 X &&
sendevent /dev/input/event5 3 54 Y &&
sendevent /dev/input/event5 0 2 0 &&
sendevent /dev/input/event5 0 0 0 &&
sendevent /dev/input/event5 0 2 0 &&
sendevent /dev/input/event5 0 0 0
I'm trying to figure out how to convert the emulator screen position to the sendevent position.
For example, if you want to perform a click at `x200 y200`, using sendevent what is the value needed?
How to calculate it?
Note: cross-post StackOverflow.

Bump

Related

TUTORIAL: Remote Control Touch Screen

Do you want to activate the screen wirelessly, or play some music at your phone over SSH because you don't know where you left it?
THIS IS YOUR PLACE!!!
This tutorial will show you how to create a file, that simulates a keypress, swipe, button press.
You can even draw something, save a file of data, and then replay it so android draws the same something.
You can simulate somebody writing text with the default android keyboard, over SSH, etc.
The options are unlimited!
Let's start by the beginning: I will add a zip package with my working directory at my phone, all tools are included there.
The dropbear ssh server is included because it's practical because it can be turned on with your android terminal. You can also access the other tools using another ssh server.
The media player control is a very simple script that takes an argument and then translates it to the android "input keyevent" command.
And the low level screen events is what i'm going to talk about most.
From here on, this will be a tutorial that will focus on screen events
I will cover the following topics:
1) Understanding and getting screen events.
2) Simulating keypressess, creating and sending screen events.
3) Automating the tasks.
​
UNDERSTANDING AND GETTING SCREEN EVENTS
Android provides two commandline tools for managing screen events: getevent and sendevent.
These commands are kinda cryptic:
We'll take a look at the "getevent" command. This command outputs all events of a given device (or all if no device is given)
What i'll do is open a SSH session, and run the commands from my PC, so that it does not interfere with my fingers pressing the keyboard.
I just use getevent (hint, press Control+C to terminate the command and stop getting events):
Code:
[email protected]:/ # getevent
add device 1: /dev/input/event8
name: "compass_sensor"
add device 2: /dev/input/event7
name: "sec_touchkey"
add device 3: /dev/input/event6
name: "gyro_sensor"
add device 4: /dev/input/event5
name: "light_sensor"
add device 5: /dev/input/event4
name: "proximity_sensor"
add device 6: /dev/input/event3
name: "sii9234_rcp"
add device 7: /dev/input/event2
name: "sec_touchscreen"
could not get driver version for /dev/input/mice, Not a typewriter
add device 8: /dev/input/event1
name: "gpio-keys"
add device 9: /dev/input/event0
name: "max8997-muic"
You may notice the "add device X" number is not matching the /dev/input/eventX number. I will use the latter to refer to an event, as we will use this command a lot, believe me.
I will be only talking about devices 1, 2 and 7, i don't care about the rest.
/dev/input/event1 (gpio-keys): This are the hardware keys.
On my Samsung Galaxy SII, these keys are POWER, HOME, VOLUP, and VOLDOWN keys.
/dev/input/event2 (sec_touchscreen): is the touch-screen (they're not very creative at android developing department)
My galaxy has a screen of 480x800 (XY), this is important!.
/dev/input/event7 (sec_touckey): The touch keys.
On my Galaxy, i have the MENU and BACK buttons as touchkeys. This touchkeys are not part of the touchscreen, thats why its another device.
Note though that the touch_screen and the touck_keys devices ARE connected, i'll later have you remember this line.
The numbers of the devices may change from device to device, as not all phones have touchkeys, or a touch screen.
Well, now you know how to list the devices.
The next step is to see how each device works:
Device 1: HWKEYS
I recommend following these steps on your device, and comment any changes at this thread, thank you.
Let's try out short-pressing just the POWER button of our phone (or unlock button)
When i refer to short-pressing, i mean pressing and immediately releasing the button. You'll soon understand why.
Use getevent, press the key, and finish with Control + C.
Code:
[email protected]:/ # getevent /dev/input/event1
0001 0074 00000001
0000 0000 00000000
0001 0074 00000000
0000 0000 00000000
^C
130|[email protected]:/
WTF is this?! Yes, i said that too when i first saw this, (and you havent seen a swipe with 4 fingers yet, haha)
Well, let's go line by line:
0001 0074 00000001
This is a KEYDOWN line (sorry for using my own syntax here)
What can we observe? There are 3 fields, and all numbers.
The first field will always be 1 except in separator lines (see the second line)
The second field is the identifier for the POWER key.
The third field is a boolean value, it will be 1 when the key is pressed and 0 when it is released.
0000 0000 00000000
This is a simple separator, it it means android just processed everything ultil here.
0001 0074 00000000
This is a KEYUP line, as you can see, the identifier field is 1, the keycode field is 74, and the third boolean field is set to 0, what indicates the key is released.
0000 0000 00000000
And another separator so android process it.
^C
This is the Control+C character, it is used to terminate the running program in linux terminal.
Actually quite simple, isn't it? Lets take a look at the touchkeys device (it's simpler as the screen)
Device 7: MENU and BACK
Yes, android has set up a whole device driver only for 2 stupid keys.
Let's see them in action. I will first press the MENU key, and then the BACK key.
Note that now i use "getevent /dev/input/event7", and not event1.
Oh, i will make some comments on the output so you can see it more clear.
Code:
[email protected]:/ # getevent /dev/input/event7
0001 008b 00000001 [FD] KEYDOWN (8b)
0000 0000 00000000 [S] SEPARATOR
0001 008b 00000000 [FU] KEYUP (8b)
0000 0000 00000000 [S] SEPARATOR
0001 009e 00000001 [FD] KEYDOWN (9e)
0000 0000 00000000 [S] SEPARATOR
0001 009e 00000000 [FU] KEYUP (9e)
0000 0000 00000000 [S] SEPARATOR
^C
130|[email protected]:/ #
Wow, hex!!, the POWER button we pressed before, was also hex.
Remember that getevents are all in hex.
Explanation:
[FD] Is (in my syntax), a FINGERDOWN event, that means the finger touches the screen.
[FU] FINGERUP event, the finger leaves the screen.
Separator, processess the event.
The parentheses i put after the FU and FD events are the ID of the key.
Remember i told you that the touch_keys and touch_screen devices were connected?
I dont know why but the first fields of the non-separator events are also 1 (same as the HWKEYS)
You'l see that with touchscreen events this is different (it uses number 3 always)
Well, the syntax of the events in the touchkeys are the same as the hardware keys.
Actually, i consider this touch keys to be hardware, with the consideration that they only work when the screen is on.
Device 2: SCREEN TOUCHES AND SWIPES (The interesting part)
Now it's getting really interesting.
Let's get a simple tap somewhere random at the screen:
Code:
[email protected]:/ # getevent /dev/input/event2
0003 0039 0000024f [FD] FingerDown (24f)
0003 0035 00000163 [X] X coordinate
0003 0036 000001dd [Y] Y coordinate
// NOTE LINE
0000 0000 00000000 [S] Separator
0003 0039 ffffffff [FU] FingerUp (24f)
0000 0000 00000000 [S] Separator
^C
130|[email protected]:/ #
NOTE: At the NOTE LINE you MAY get 2 other events, 0030 and 003a. I have no idea what these two are for.
Besides, to simulate a click we don't need them, so if anyone know what these two events are, you're welcome to comment.
If you enable the Show touches & Pointer location, you see that it has some fields: PRS and SIZE,
Those are for pressure and size, of course, but i don't know if they have something to do with this 0030 and 003a.
Tip for those of you that are debugging: if you increase pressure, your finger's contact area with the device grows, as your sking gets down.
I realised this thinking of somebody pushing his face to a glass surface and somebody watching at the other side.​
NOTE 2: You are recommended to enable Settings -> Developer Options -> Show touches & Pointer location​
Understanding touchscreen events is more complicated. All buttons from HWKEYS and TOUCHKEYS, were quite simple: they only have a key identifier, and a boolean state: Pressed (1) or not pressed (0).
However, when we use the touchscreen, every single tap has the following elements (events):
[ID] Identifier (ill explain this in the double tap section)
[FD] Finger Down (The finger enters the screen)
NOTE: The third field at the figerdown event, is a sort of simple counter, across different taps, swipes, etc. I dont know yet when it is resetted, but for sure at reboot as this counter will probably reside in ram.​[X] Number of pixels counted from left side.
[Y] Number of pixels counted from top.
Separator / process trigger.
[FU] Finger Up (The finger exits the screen completely)
Another separator.
Notice that the 0030 and 003a events are not in my list. I've made a tool to simulate keypressess, and those two events are NEVER included, but my script works always. So something tells me these two events are worthless.
Introduction to swipe
With the pointer location enabled in settins, try swiping somewhere random.
As you may notice, you aren't perfect, so you can't draw a straight line.
Everytime your finger changes direction, a new point is added. this means that if you want to make a square, you would need 4 points, imagining all lines are straight.
If you take a close look at the screen, the POINTER LOCATION shows a colored dot, everytime you set some coordinates (this means, by a single click, or by a direction change with a swipe, or with a double tap it would make two dots).
I will unlock my screen with my finger, and then analyze the output of getevent:
Lets analize this simple swipe, and quicly move on to the last teorichal part: Multiple taps.
Code:
[email protected]:/ # getevent /dev/input/event2
0003 0039 000002ba [FD]
0003 0035 000000e6 [X]
0003 0036 00000290 [Y]
0003 0030 00000032 [?]
0003 003a 00000003 [?]
0000 0000 00000000 [S]
0003 0035 000000fb [X]
0003 0036 00000296 [Y]
0000 0000 00000000 [S]
0003 0035 00000120 [X]
0003 003a 00000004 [?]
0000 0000 00000000 [S]
0003 0035 00000161 [X]
0003 0036 00000292 [Y]
0003 003a 00000003 [?]
0000 0000 00000000 [S]
0003 0035 000001aa [X]
0003 0036 0000029a [Y]
0003 0030 00000018 [?]
0003 003a 00000001 [?]
0000 0000 00000000 [S]
0003 0039 ffffffff [FU]
0000 0000 00000000 [S]
^C
130|[email protected]:/ #
Take a look at the above code. You should already get the point, at every separator the events are processed.
You can use a separator to update coordinates (this includes when a finger enters the screen), and to release a finger (at the last coordinates inputted for that finger).
This that the 2nd to 5th block, only update the coordinates of the finger that is pressing the screen.
Multiple taps
Multiple taps introduces something new: Identificators [ID]
For this i will use the following: a thriple tap.
There is a order in which the fingers enter and leave the screen, while one finger is still pressed, another one can get pressed and released.
Lets see some code:
Code:
130|[email protected]:/ # getevent /dev/input/event2
0003 0039 000002c0 [FD]
0003 0035 00000057 [X]
0003 0036 00000129 [Y]
0000 0000 00000000 [S]
0003 002f 00000001 [ID] 1
0003 0039 000002c1 [FD]
0003 0035 00000169 [X]
0003 0036 000001bb [Y]
0000 0000 00000000 [S]
0003 002f 00000002 [ID] 2
0003 0039 000002c2 [FD]
0003 0035 000000de [X]
0003 0036 00000187 [Y]
0000 0000 00000000 [S]
0003 0039 ffffffff [FU] // NOTE 1
0000 0000 00000000 [S]
0003 002f 00000000 [ID] 0 // NOTE 2
0003 0039 ffffffff [FU]
0000 0000 00000000 [S]
0003 002f 00000001 [ID] 1
0003 0039 ffffffff [FU]
0000 0000 00000000 [S]
^C
130|[email protected]:/ #
Well, its actually quite simple. As there are multiple fingers, android adds ID's to this new fingers.
The default ID = 0, android doesn't know if you're gonna press 1 finger or 200, so it doesnt add a ID to the first.
The first finger's ID is always 0.
When you add a finger, android adds ID=1
If you release a finger, ID=0 is available again.
Important: When an ID is set, all actions that are processed, are affecting the finger of that ID, this means that if you set the coordinates 10 times in a row they will all affect that finger, until you specify another ID event. (You just learned to combine swipe with multiple touches)
Thats why at the line i marked with NOTE 1, there is no ID, because the first finger i released, was finger ID=2 (the last that touched the screen)
Important: When you release a finger, you MUST set an ID, because android only keeps track of the CID (Current ID), but not of the previus.
So if you release a finger, and then set some coordinates, they will affect an ID that is no longer pressed, and it could either do NOTHING, or output some error message
SIMULATING KEYPRESSESS, CREATING AND SENDING EVENTS
NOTE: When we use "getevent", we get some hex codes. When we use "sendevent" we have to use decimal values.
Why? I don't know, maybe bothering is the point. Anyway, it's like that, and we'll have to manage, right?
Sendevent takes the EXACT same input that getevent outputs, except that GETEVENT outputs [HEX]adecimal, and Sendevents wants [DEC]imal characters
To simulate the POWER button key, for one single click, it would take this steps:
STEP 1
STEP 2
STEP 3
Edit: I'm currently making the SENDEVENT TUTORIAL part, in about 2 hours it will be done.
Vote for newsworthy if you think it was!!!
Twin0ne said:
Do you want to activate the screen wirelessly, or play some music at your phone over SSH because you don't know where you left it?
THIS IS YOUR PLACE!!!
Click to expand...
Click to collapse
Welcome to XDA, This is a great way to "roll into to town" :good:
I've been planning to research getevent/sendevent command input for a while, ever since one of my tablet touchscreens decided to die, Mainly to simulate long pressing.
If you don't want to write to the /dev nodes directly you can always step up a level of abstraction and use the /system/bin/input commnd. Prior to jelly bean this used to only support KEYEVENT codes and text input. The JB version however now supports tap and swipe aswell.
Code:
/system/bin/input
usage: input ...
input text <string>
input keyevent <key code number or name>
input tap <x> <y>
input swipe <x1> <y1> <x2> <y2>
Here (androidxref) is a list of Valid KeyCodes for use with the keyevent parameter.
I've gone a bit nuts with a custom adb that I use so i've wrapped a lot of commnds into one word adb commands like "adb power" , "adb back" etc :laugh:
Once again thanks for sharing, low level android tricks are always welcome!
Very useful description thank you. I've found some other relevant info...
Adding -l to the command line of getevent adds the event names, also adding -d preserves the HID descriptor. A single touch event looks like this...
[email protected]:/ # getevent -d -l /dev/input/event2
EV_ABS ABS_MT_TRACKING_ID 00000071
EV_ABS ABS_MT_POSITION_X 0000020d
EV_ABS ABS_MT_POSITION_Y 00000160
EV_SYN SYN_REPORT 00000000
EV_ABS ABS_MT_TRACKING_ID ffffffff
EV_SYN SYN_REPORT 00000000 ​
Also, there is a description of the linux multi-touch protocol here: http://www.kernel.org/doc/Documentation/input/multi-touch-protocol.txt
Thank you very much for this thread.
This helps me better understand how Android works. :good:
And I have chance to use Touch "simulation"...
http://forum.xda-developers.com/showpost.php?p=54953993&postcount=701
Best Regards
Only as info or example...
Code:
adb shell sendevent /dev/input/event3 3 57 0
adb shell sendevent /dev/input/event3 3 53 4
adb shell sendevent /dev/input/event3 3 54 326
adb shell sendevent /dev/input/event3 3 48 28
adb shell sendevent /dev/input/event3 0 2 0
adb shell sendevent /dev/input/event3 0 0 0
adb shell sendevent /dev/input/event3 3 57 0
adb shell sendevent /dev/input/event3 3 53 4
adb shell sendevent /dev/input/event3 3 54 327
adb shell sendevent /dev/input/event3 3 48 32
adb shell sendevent /dev/input/event3 0 2 0
adb shell sendevent /dev/input/event3 0 0 0
adb shell sendevent /dev/input/event3 3 57 0
adb shell sendevent /dev/input/event3 3 53 5
adb shell sendevent /dev/input/event3 3 54 327
adb shell sendevent /dev/input/event3 3 48 48
adb shell sendevent /dev/input/event3 0 2 0
adb shell sendevent /dev/input/event3 0 0 0
adb shell sendevent /dev/input/event3 3 57 0
adb shell sendevent /dev/input/event3 3 53 6
adb shell sendevent /dev/input/event3 3 54 327
adb shell sendevent /dev/input/event3 3 48 49
adb shell sendevent /dev/input/event3 0 2 0
adb shell sendevent /dev/input/event3 0 0 0
adb shell sendevent /dev/input/event3 3 57 0
adb shell sendevent /dev/input/event3 3 53 8
adb shell sendevent /dev/input/event3 3 54 328
adb shell sendevent /dev/input/event3 3 48 51
adb shell sendevent /dev/input/event3 0 2 0
adb shell sendevent /dev/input/event3 0 0 0
adb shell sendevent /dev/input/event3 3 57 0
adb shell sendevent /dev/input/event3 3 53 9
adb shell sendevent /dev/input/event3 3 54 329
adb shell sendevent /dev/input/event3 3 48 52
adb shell sendevent /dev/input/event3 0 2 0
adb shell sendevent /dev/input/event3 0 0 0
adb shell sendevent /dev/input/event3 3 57 0
adb shell sendevent /dev/input/event3 3 53 11
adb shell sendevent /dev/input/event3 3 54 330
adb shell sendevent /dev/input/event3 3 48 53
adb shell sendevent /dev/input/event3 0 2 0
adb shell sendevent /dev/input/event3 0 0 0
adb shell sendevent /dev/input/event3 3 57 0
adb shell sendevent /dev/input/event3 3 53 13
adb shell sendevent /dev/input/event3 3 54 331
adb shell sendevent /dev/input/event3 3 48 54
adb shell sendevent /dev/input/event3 0 2 0
adb shell sendevent /dev/input/event3 0 0 0
adb shell sendevent /dev/input/event3 3 57 0
adb shell sendevent /dev/input/event3 3 53 18
adb shell sendevent /dev/input/event3 3 54 332
adb shell sendevent /dev/input/event3 3 48 54
adb shell sendevent /dev/input/event3 0 2 0
adb shell sendevent /dev/input/event3 0 0 0
adb shell sendevent /dev/input/event3 3 57 0
adb shell sendevent /dev/input/event3 3 53 28
adb shell sendevent /dev/input/event3 3 54 333
adb shell sendevent /dev/input/event3 3 48 54
adb shell sendevent /dev/input/event3 0 2 0
adb shell sendevent /dev/input/event3 0 0 0
adb shell sendevent /dev/input/event3 3 57 0
adb shell sendevent /dev/input/event3 3 53 54
adb shell sendevent /dev/input/event3 3 54 336
adb shell sendevent /dev/input/event3 3 48 55
adb shell sendevent /dev/input/event3 0 2 0
adb shell sendevent /dev/input/event3 0 0 0
adb shell sendevent /dev/input/event3 3 57 0
adb shell sendevent /dev/input/event3 3 53 63
adb shell sendevent /dev/input/event3 3 54 336
adb shell sendevent /dev/input/event3 3 48 56
adb shell sendevent /dev/input/event3 0 2 0
adb shell sendevent /dev/input/event3 0 0 0
adb shell sendevent /dev/input/event3 3 57 0
adb shell sendevent /dev/input/event3 3 53 74
adb shell sendevent /dev/input/event3 3 54 336
adb shell sendevent /dev/input/event3 3 48 56
adb shell sendevent /dev/input/event3 0 2 0
adb shell sendevent /dev/input/event3 0 0 0
adb shell sendevent /dev/input/event3 3 57 0
adb shell sendevent /dev/input/event3 3 53 89
adb shell sendevent /dev/input/event3 3 54 336
adb shell sendevent /dev/input/event3 3 48 57
adb shell sendevent /dev/input/event3 0 2 0
adb shell sendevent /dev/input/event3 0 0 0
adb shell sendevent /dev/input/event3 3 57 0
adb shell sendevent /dev/input/event3 3 53 101
adb shell sendevent /dev/input/event3 3 54 336
adb shell sendevent /dev/input/event3 3 48 59
adb shell sendevent /dev/input/event3 0 2 0
adb shell sendevent /dev/input/event3 0 0 0
adb shell sendevent /dev/input/event3 3 57 0
adb shell sendevent /dev/input/event3 3 53 115
adb shell sendevent /dev/input/event3 3 54 335
adb shell sendevent /dev/input/event3 3 48 59
adb shell sendevent /dev/input/event3 0 2 0
adb shell sendevent /dev/input/event3 0 0 0
adb shell sendevent /dev/input/event3 3 57 0
adb shell sendevent /dev/input/event3 3 53 131
adb shell sendevent /dev/input/event3 3 54 335
adb shell sendevent /dev/input/event3 3 48 60
adb shell sendevent /dev/input/event3 0 2 0
adb shell sendevent /dev/input/event3 0 0 0
adb shell sendevent /dev/input/event3 3 57 0
adb shell sendevent /dev/input/event3 3 53 146
adb shell sendevent /dev/input/event3 3 54 334
adb shell sendevent /dev/input/event3 3 48 61
adb shell sendevent /dev/input/event3 0 2 0
adb shell sendevent /dev/input/event3 0 0 0
adb shell sendevent /dev/input/event3 3 57 0
adb shell sendevent /dev/input/event3 3 53 162
adb shell sendevent /dev/input/event3 3 54 334
adb shell sendevent /dev/input/event3 3 48 61
adb shell sendevent /dev/input/event3 0 2 0
adb shell sendevent /dev/input/event3 0 0 0
adb shell sendevent /dev/input/event3 3 57 0
adb shell sendevent /dev/input/event3 3 53 179
adb shell sendevent /dev/input/event3 3 54 333
adb shell sendevent /dev/input/event3 3 48 62
adb shell sendevent /dev/input/event3 0 2 0
adb shell sendevent /dev/input/event3 0 0 0
adb shell sendevent /dev/input/event3 3 57 0
adb shell sendevent /dev/input/event3 3 53 197
adb shell sendevent /dev/input/event3 3 54 333
adb shell sendevent /dev/input/event3 3 48 62
adb shell sendevent /dev/input/event3 0 2 0
adb shell sendevent /dev/input/event3 0 0 0
adb shell sendevent /dev/input/event3 3 57 0
adb shell sendevent /dev/input/event3 3 53 216
adb shell sendevent /dev/input/event3 3 54 333
adb shell sendevent /dev/input/event3 3 48 63
adb shell sendevent /dev/input/event3 0 2 0
adb shell sendevent /dev/input/event3 0 0 0
adb shell sendevent /dev/input/event3 3 57 0
adb shell sendevent /dev/input/event3 3 53 232
adb shell sendevent /dev/input/event3 3 54 333
adb shell sendevent /dev/input/event3 3 48 64
adb shell sendevent /dev/input/event3 0 2 0
adb shell sendevent /dev/input/event3 0 0 0
adb shell sendevent /dev/input/event3 3 57 0
adb shell sendevent /dev/input/event3 3 53 252
adb shell sendevent /dev/input/event3 3 54 333
adb shell sendevent /dev/input/event3 3 48 64
adb shell sendevent /dev/input/event3 0 2 0
adb shell sendevent /dev/input/event3 0 0 0
adb shell sendevent /dev/input/event3 3 57 0
adb shell sendevent /dev/input/event3 3 53 270
adb shell sendevent /dev/input/event3 3 54 334
adb shell sendevent /dev/input/event3 3 48 64
adb shell sendevent /dev/input/event3 0 2 0
adb shell sendevent /dev/input/event3 0 0 0
adb shell sendevent /dev/input/event3 3 57 0
adb shell sendevent /dev/input/event3 3 53 290
adb shell sendevent /dev/input/event3 3 54 335
adb shell sendevent /dev/input/event3 3 48 64
adb shell sendevent /dev/input/event3 0 2 0
adb shell sendevent /dev/input/event3 0 0 0
adb shell sendevent /dev/input/event3 3 57 0
adb shell sendevent /dev/input/event3 3 53 373
adb shell sendevent /dev/input/event3 3 54 335
adb shell sendevent /dev/input/event3 3 48 64
adb shell sendevent /dev/input/event3 0 2 0
adb shell sendevent /dev/input/event3 0 0 0
adb shell sendevent /dev/input/event3 3 57 0
adb shell sendevent /dev/input/event3 3 53 451
adb shell sendevent /dev/input/event3 3 54 332
adb shell sendevent /dev/input/event3 3 48 54
adb shell sendevent /dev/input/event3 0 2 0
adb shell sendevent /dev/input/event3 0 0 0
adb shell sendevent /dev/input/event3 3 57 0
adb shell sendevent /dev/input/event3 3 53 463
adb shell sendevent /dev/input/event3 3 54 332
adb shell sendevent /dev/input/event3 3 48 42
adb shell sendevent /dev/input/event3 0 2 0
adb shell sendevent /dev/input/event3 0 0 0
adb shell sendevent /dev/input/event3 3 57 0
adb shell sendevent /dev/input/event3 3 53 470
adb shell sendevent /dev/input/event3 3 54 330
adb shell sendevent /dev/input/event3 3 48 32
adb shell sendevent /dev/input/event3 0 2 0
adb shell sendevent /dev/input/event3 0 0 0
adb shell sendevent /dev/input/event3 3 57 0
adb shell sendevent /dev/input/event3 3 53 470
adb shell sendevent /dev/input/event3 3 54 330
adb shell sendevent /dev/input/event3 3 48 0
adb shell sendevent /dev/input/event3 0 2 0
adb shell sendevent /dev/input/event3 0 0 0
I have created simple Batch file... *.bat
I can unlock Screenlock/Screensaver with this...
Tested on my S8600 with I9001 Firmware... because unsupported Hardware and Touch not working yet....
Also on I8150 tested successfully... because taken from I8150...
Here Log, which I have converted into Dec Values by my little brain... line by line...
Code:
getevent /dev/input/event3
0003 0039 00000000
0003 0035 00000004
0003 0036 00000146
0003 0030 0000001c
0000 0002 00000000
0000 0000 00000000
0003 0039 00000000
0003 0035 00000004
0003 0036 00000147
0003 0030 00000020
0000 0002 00000000
0000 0000 00000000
0003 0039 00000000
0003 0035 00000005
0003 0036 00000147
0003 0030 00000030
0000 0002 00000000
0000 0000 00000000
0003 0039 00000000
0003 0035 00000006
0003 0036 00000147
0003 0030 00000031
0000 0002 00000000
0000 0000 00000000
0003 0039 00000000
0003 0035 00000008
0003 0036 00000148
0003 0030 00000033
0000 0002 00000000
0000 0000 00000000
0003 0039 00000000
0003 0035 00000009
0003 0036 00000149
0003 0030 00000034
0000 0002 00000000
0000 0000 00000000
0003 0039 00000000
0003 0035 0000000b
0003 0036 0000014a
0003 0030 00000035
0000 0002 00000000
0000 0000 00000000
0003 0039 00000000
0003 0035 0000000d
0003 0036 0000014b
0003 0030 00000036
0000 0002 00000000
0000 0000 00000000
0003 0039 00000000
0003 0035 00000012
0003 0036 0000014c
0003 0030 00000036
0000 0002 00000000
0000 0000 00000000
0003 0039 00000000
0003 0035 0000001c
0003 0036 0000014d
0003 0030 00000036
0000 0002 00000000
0000 0000 00000000
0003 0039 00000000
0003 0035 00000036
0003 0036 00000150
0003 0030 00000037
0000 0002 00000000
0000 0000 00000000
0003 0039 00000000
0003 0035 0000003f
0003 0036 00000150
0003 0030 00000038
0000 0002 00000000
0000 0000 00000000
0003 0039 00000000
0003 0035 0000004a
0003 0036 00000150
0003 0030 00000038
0000 0002 00000000
0000 0000 00000000
0003 0039 00000000
0003 0035 00000059
0003 0036 00000150
0003 0030 00000039
0000 0002 00000000
0000 0000 00000000
0003 0039 00000000
0003 0035 00000065
0003 0036 00000150
0003 0030 0000003b
0000 0002 00000000
0000 0000 00000000
0003 0039 00000000
0003 0035 00000073
0003 0036 0000014f
0003 0030 0000003b
0000 0002 00000000
0000 0000 00000000
0003 0039 00000000
0003 0035 00000083
0003 0036 0000014f
0003 0030 0000003c
0000 0002 00000000
0000 0000 00000000
0003 0039 00000000
0003 0035 00000092
0003 0036 0000014e
0003 0030 0000003d
0000 0002 00000000
0000 0000 00000000
0003 0039 00000000
0003 0035 000000a2
0003 0036 0000014e
0003 0030 0000003d
0000 0002 00000000
0000 0000 00000000
0003 0039 00000000
0003 0035 000000b3
0003 0036 0000014d
0003 0030 0000003e
0000 0002 00000000
0000 0000 00000000
0003 0039 00000000
0003 0035 000000c5
0003 0036 0000014d
0003 0030 0000003e
0000 0002 00000000
0000 0000 00000000
0003 0039 00000000
0003 0035 000000d8
0003 0036 0000014d
0003 0030 0000003f
0000 0002 00000000
0000 0000 00000000
0003 0039 00000000
0003 0035 000000e8
0003 0036 0000014d
0003 0030 00000040
0000 0002 00000000
0000 0000 00000000
0003 0039 00000000
0003 0035 000000fc
0003 0036 0000014d
0003 0030 00000040
0000 0002 00000000
0000 0000 00000000
0003 0039 00000000
0003 0035 0000010e
0003 0036 0000014e
0003 0030 00000040
0000 0002 00000000
0000 0000 00000000
0003 0039 00000000
0003 0035 00000122
0003 0036 0000014f
0003 0030 00000040
0000 0002 00000000
0000 0000 00000000
0003 0039 00000000
0003 0035 00000175
0003 0036 0000014f
0003 0030 00000040
0000 0002 00000000
0000 0000 00000000
0003 0039 00000000
0003 0035 000001c3
0003 0036 0000014c
0003 0030 00000036
0000 0002 00000000
0000 0000 00000000
0003 0039 00000000
0003 0035 000001cf
0003 0036 0000014c
0003 0030 0000002a
0000 0002 00000000
0000 0000 00000000
0003 0039 00000000
0003 0035 000001d6
0003 0036 0000014a
0003 0030 00000020
0000 0002 00000000
0000 0000 00000000
0003 0039 00000000
0003 0035 000001d6
0003 0036 0000014a
0003 0030 00000000
0000 0002 00000000
0000 0000 00000000
I am using old Android Version, where only input text and input keyevent is supported...
I can't install Android 4.x during incompatibility on my GT-S8600 yet...
Best Regards
Hi,
what i understand so far.
for each device you have different "targets" to simulate e.g. the press/hold of a key. Actually i found it for my device and managed to simulate my hardware/soft keys with tasker-run shell and sendevent...
Question1: how do key-remapper handle that ? Do they question the system e.g. what device the menu-key is ?
But more important to me is Question2: How can i simulate CTRL-C assuming that it is copy (and CTRL-V,CTRL-a) for a floating addition for my soft keyboard. I already managed to have a taker-scene, which floats as an overlay an by pressing my button called "test" the scene(overlay) hides and i can simulate a (sequence of keys or i can sendevent-stuff)...and there i would call Select-All,copy,paste.... Any idea (and no, the standard bar popping up when editing text with these functions does not pop up with swiftkey or in other situations i might want to use that). The keyboard "programmer keyboard" has this as buttons..so the function must be there somewhere...
In short: how to emulate CTRL-C ?
I need to emulate a swipe up and down the side of my screen, in a single touch. I'm trying to go from x=1350 y=1350 to x=1350 y=750 and back down to x=1350 y=1350
I can do this in two distinct touches with:
input swipe 1350 1350 1350 750
input swipe 1350 750 1350 1350
But I need it completed in one single touch, so I'm trying to use sendevent for the first time. I thought this would get me there, but I'm not doing something right:
sendevent /dev/input/event1 3 57 0
sendevent /dev/input/event1 3 53 1350
sendevent /dev/input/event1 3 54 1350
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 1350
sendevent /dev/input/event1 3 54 750
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 1350
sendevent /dev/input/event1 3 54 1350
sendevent /dev/input/event1 0 2 0
sendevent /dev/input/event1 0 0 0
When I do this, I don't get any swipe at all, and my touchscreen gets extremely laggy, then unresponsive to single taps or swipe gestures...but double taps work.
I need to reboot by Vol Down + Power to rescue the device.
Sent from my S6 Edge+ g928c
BobCatRom
trevd said:
I've been planning to research getevent/sendevent command input for a while, ever since one of my tablet touchscreens decided to die, Mainly to simulate long pressing.
Click to expand...
Click to collapse
Were you able to simulate a long press? I'm currently stuck on that with my project. I want to simulate a long press in Chrome so I can open the share dialog for a link and extract the URL. I was hoping to be able to do this through the Accessibility service but it seems long press isn't supported. Thanks!

[Q] How to write a shell script for android?

Is there any guide for writing a shell script over here?
I have been reading up for hours and unfortunately and still plague by the 1 problem,
I am unable to start the shell script in android.
However to run the script via Putty and SSHdroid, the script runs smoothly but
my TF101 transformer gets very very hot.
I am wondering if anyone can help me with my script.
Thanks!
Here is the body/context for the script.
sendevent /dev/input/event1 0003 57 0
sendevent /dev/input/event1 0003 48 96
sendevent /dev/input/event1 0003 58 96
sendevent /dev/input/event1 0003 53 380
sendevent /dev/input/event1 0003 54 550
sendevent /dev/input/event1 0000 2 0
sendevent /dev/input/event1 0000 0 0
sendevent /dev/input/event1 0000 2 0
sendevent /dev/input/event1 0000 0 0
sendevent /dev/input/event1 0003 57 0
sendevent /dev/input/event1 0003 48 96
sendevent /dev/input/event1 0003 58 96
sendevent /dev/input/event1 0003 53 67
sendevent /dev/input/event1 0003 54 536
sendevent /dev/input/event1 0000 2 0
sendevent /dev/input/event1 0000 0 0
sendevent /dev/input/event1 0000 2 0
sendevent /dev/input/event1 0000 0 0
sendevent /dev/input/event1 0003 57 0
sendevent /dev/input/event1 0003 48 96
sendevent /dev/input/event1 0003 58 96
sendevent /dev/input/event1 0003 53 224
sendevent /dev/input/event1 0003 54 552
sendevent /dev/input/event1 0000 2 0
sendevent /dev/input/event1 0000 0 0
sendevent /dev/input/event1 0000 2 0
sendevent /dev/input/event1 0000 0 0
What this script does is emulate a tap on 3 different spots on the screen to move the character in a game.
I need help completing the script by getting it to execute in android and looping it!
Thanks again

[Q] How to write a shell script for android for use on tf101?

Is there any guide for writing a shell script over here?
I have been reading up for hours and unfortunately and still plague by the 1 problem,
I am unable to start the shell script in android.
However to run the script via Putty and SSHdroid, the script runs smoothly but
my TF101 transformer gets very very hot.
I am wondering if anyone can help me with my script.
Thanks!
Here is the body/context for the script.
sendevent /dev/input/event1 0003 57 0
sendevent /dev/input/event1 0003 48 96
sendevent /dev/input/event1 0003 58 96
sendevent /dev/input/event1 0003 53 380
sendevent /dev/input/event1 0003 54 550
sendevent /dev/input/event1 0000 2 0
sendevent /dev/input/event1 0000 0 0
sendevent /dev/input/event1 0000 2 0
sendevent /dev/input/event1 0000 0 0
sendevent /dev/input/event1 0003 57 0
sendevent /dev/input/event1 0003 48 96
sendevent /dev/input/event1 0003 58 96
sendevent /dev/input/event1 0003 53 67
sendevent /dev/input/event1 0003 54 536
sendevent /dev/input/event1 0000 2 0
sendevent /dev/input/event1 0000 0 0
sendevent /dev/input/event1 0000 2 0
sendevent /dev/input/event1 0000 0 0
sendevent /dev/input/event1 0003 57 0
sendevent /dev/input/event1 0003 48 96
sendevent /dev/input/event1 0003 58 96
sendevent /dev/input/event1 0003 53 224
sendevent /dev/input/event1 0003 54 552
sendevent /dev/input/event1 0000 2 0
sendevent /dev/input/event1 0000 0 0
sendevent /dev/input/event1 0000 2 0
sendevent /dev/input/event1 0000 0 0
What this script does is emulate a tap on 3 different spots on the screen to move the character in a game.
I need help completing the script by getting it to execute in android and looping it!
I am running on EOS 4.
Thanks again
How do you try to run it/call it?
For example...
Code:
#!/system/bin/sh
sendevent /dev/input/event1 0003 57 0
sendevent /dev/input/event1 0003 48 96
sendevent /dev/input/event1 0003 58 96
...
saved in a chmod'ed +x file should run when you run ./file as long as you call a compatible shell as the first line. I strongly suggest looking into busybox as it provides much improvements to the base shell/system.
For the loop you need a condition. You can't just "loop" really otherwise the script will just run endlessly until you kill it. What you want is that if a condition is met, then loop and eventually exit. You can see it explained very well here. Given that, if you provide more details as to what you want to accomplish and how, I may be able to provide some more assistance with the loop itself.
See this for an example.
Lethe6 said:
How do you try to run it/call it?
For example...
Code:
#!/system/bin/sh
sendevent /dev/input/event1 0003 57 0
sendevent /dev/input/event1 0003 48 96
sendevent /dev/input/event1 0003 58 96
...
saved in a chmod'ed +x file should run when you run ./file as long as you call a compatible shell as the first line. I strongly suggest looking into busybox as it provides much improvements to the base shell/system.
For the loop you need a condition. You can't just "loop" really otherwise the script will just run endlessly until you kill it. What you want is that if a condition is met, then loop and eventually exit. You can see it explained very well here. Given that, if you provide more details as to what you want to accomplish and how, I may be able to provide some more assistance with the loop itself.
See this for an example.
Click to expand...
Click to collapse
Thanks for offering your help!
I have no knowledge in programming and scripting and this is my first attempt to create a looping script that emulates 3 touchscreen taps on my transformer.
What i want my script to do, is basically tap left, right and click on the ingame Dpad.
The location of the touchscreen is provided in the context. However I am not sure of how to call or execute the script.
I used ES file manager to paste the script inside /system/bin as click.sh. Following that, i use ES to change permission to read write execute for all 3 groups.
Then I used smanager to locate the click.sh and attempted to execute it. But I get permission denied and unable to call error messege.
As for the loop, I just want it to loop infinitely until killed because it is supposed to grind the levels for me overnight.
Thanks
Easy enough, try this:
Code:
#!/system/bin/sh
while :
do
sendevent /dev/input/event1 0003 57 0
sendevent /dev/input/event1 0003 48 96
sendevent /dev/input/event1 0003 58 96
sendevent /dev/input/event1 0003 53 380
sendevent /dev/input/event1 0003 54 550
sendevent /dev/input/event1 0000 2 0
sendevent /dev/input/event1 0000 0 0
sendevent /dev/input/event1 0000 2 0
sendevent /dev/input/event1 0000 0 0
done
Make sure it's chmod'ed +x or 755 or something with execute permission for your user. If you edit it as root then you need to be root if you just chmod +x it, 755 would allow everyone to execute/read it.
Let me know how it works out!
What is chmoded? How do I go about setting it? Btw Where did you learn to write scripts? I would like to learn more.
Thanks
I tried with your script and I got 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"
}
Here's a step by step guide.
First you need to determine where it's allowed to run. Basically, for protection, linux has an option when mouting filesystems to prevent execution of files. Most of what you have write access to has that option enabled, to help prevent malware and such. You'll need a terminal emulator or ADB installed to run the following (I much prefer ADB):
At a root shell prompt, figure out which partition is mounted read-write without the noexec option:
mount |grep -vE 'noexec|tmpfs|debugfs|proc|pts|none|fuse|cache'| grep rw
This would return something like:
Code:
sysfs /sys sysfs rw,relatime 0 0
/dev/block/mmcblk0p7 /data ext4 rw,nosuid,nodev,noatime,user_xattr,acl,barrier=1,data=ordered,discard 0 0
It might differ depending on with rom you're running. We don't want to go in /sys though I guess we could. I'd prefer going to /data, it just seems more suited. So now we know /data is read-write and you can exec on it. As I said I prefer ADB so I'll first explain how to do it through ADB.
Open up a text editor on your computer, and put the following in it (everything in the code tag):
Code:
#!/system/bin/sh
while :
do
sendevent /dev/input/event1 0003 57 0
sendevent /dev/input/event1 0003 48 96
sendevent /dev/input/event1 0003 58 96
sendevent /dev/input/event1 0003 53 380
sendevent /dev/input/event1 0003 54 550
sendevent /dev/input/event1 0000 2 0
sendevent /dev/input/event1 0000 0 0
sendevent /dev/input/event1 0000 2 0
sendevent /dev/input/event1 0000 0 0
sendevent /dev/input/event1 0003 57 0
sendevent /dev/input/event1 0003 48 96
sendevent /dev/input/event1 0003 58 96
sendevent /dev/input/event1 0003 53 67
sendevent /dev/input/event1 0003 54 536
sendevent /dev/input/event1 0000 2 0
sendevent /dev/input/event1 0000 0 0
sendevent /dev/input/event1 0000 2 0
sendevent /dev/input/event1 0000 0 0
sendevent /dev/input/event1 0003 57 0
sendevent /dev/input/event1 0003 48 96
sendevent /dev/input/event1 0003 58 96
sendevent /dev/input/event1 0003 53 224
sendevent /dev/input/event1 0003 54 552
sendevent /dev/input/event1 0000 2 0
sendevent /dev/input/event1 0000 0 0
sendevent /dev/input/event1 0000 2 0
sendevent /dev/input/event1 0000 0 0
done
Save that file as script.txt in your ADB directory, or on your desktop if you put ADB in your $PATH during install. Now in a windows/linux/osx console, type:
adb push script.txt /data
adb chmod 755 /data/script.txt
Alternatively, if you don't want to use ADB, save it on your desktop, copy it to your sdcard through the USB cable, then using a terminal emulator (as root):
cp /sdcard/script.txt /data
chmod 755 /data/script.txt
Or a final option, use a text editor on the device itself and do the same commands assuming you save it on your sdcard:
cp /sdcard/script.txt /data
chmod 755 /data/script.txt
Now obviously you want to run it! In the terminal, again as root (make sure to type "su" without the quotes), simply type:
/data/script.txt
I made a script that just prints "TEST" on the screen in the console to show I can execute the script:
Code:
[email protected]:/data # /data/script.txt
TEST
[email protected]:/data #
If you want to learn more, Google is your friend. Android is just a layer on top of a stripped down Linux. Most of what applies to Linux applies in some form under Android, usually in some modified form with less options. For example, the shell used in the script, sh, is very basic and "old", there are newer / more powerful versions like ash, bash, dash, and many other variations found in Linux but not Android.
I started making scripts to automate stuff, make my life easier, pretty much like what you're doing now
Edit: the "while" in the script is the loop. While "condition", do ... done. The colon ":" used to be a placeholder for "true", before true and false were added to sh/bash. Alternatively, you could use "while true" instead of "while :". True is the condition and is always true, obvisouly. So it will just loop forever.
How do i run the terminal as root? where do i place the script.txt in my tf101 or sdcard?
Thanks
bladez87 said:
How do i run the terminal as root?
Click to expand...
Click to collapse
In the terminal window, type: su
bladez87 said:
where do i place the script.txt in my tf101 or sdcard?
Thanks
Click to expand...
Click to collapse
First put it on your sdcard, then copy it to /data as specified above. Make sure to make it 755.
Lethe6 said:
In the terminal window, type: su
First put it on your sdcard, then copy it to /data as specified above. Make sure to make it 755.
Click to expand...
Click to collapse
Here is what I did.
ADB shell
mount |grep -vE 'noexec|tmpfs|debugfs|proc|pts|none|fuse|cache'| grep rw
adb push script.txt /data
It failed at this step.
By $PATH, I take it you mean environment variable?
Attempted your second method. This is the result.
Attempted to execute using command prompt
What does it return when you run mount |grep -vE 'noexec|tmpfs|debugfs|proc|pts|none|fuse|cache'| grep rw
?
It does it just /sys ? Nothing at all?
Please show me the result of the "mount" command.
Lethe6 said:
What does it return when you run mount |grep -vE 'noexec|tmpfs|debugfs|proc|pts|none|fuse|cache'| grep rw
?
It does it just /sys ? Nothing at all?
Please show me the result of the "mount" command.
Click to expand...
Click to collapse
It is in the 1st of the 3 pictures I posted.
That is what was returned when I typed that super long command.
Ah sorry. Yeah device not found is a pretty obvious error
We you already IN your device when you did that? You shouldn't be if you're using adb. Exit from adb shell before you run adb push and it'll work!
Bladez,
Not That I do too many scripts, but if you are going to play more with them.. download NotePad++
http://notepad-plus-plus.org/
Lethe6 said:
Ah sorry. Yeah device not found is a pretty obvious error
We you already IN your device when you did that? You shouldn't be if you're using adb. Exit from adb shell before you run adb push and it'll work!
Click to expand...
Click to collapse
Sorry but can you explain that again?
I tried to use the mount command "mount |grep -vE 'noexec|tmpfs|debugfs|proc|pts|none|fuse|cache'| grep rw" without adb shell, but it failed.
Lethe6 said:
In the terminal window, type: su
First put it on your sdcard, then copy it to /data as specified above. Make sure to make it 755.
Click to expand...
Click to collapse
I just noticed you mentioned type su.
I have been using the adb shell command for windows 8 cmd. Is that the same?
Yeah it's the same. But if you use adb you don't need su, it's just for the terminal.
You only need to run that long command once, it was just to confirm that /data was mounted read-write without noexec, so that the script can run.
After that, without being in adb shell, just do the adb push and it should work! don't forget to chmod 755 too
Edit: So you understand that command:
mount |grep -vE 'noexec|tmpfs|debugfs|proc|pts|none|fuse|cache'| grep rw
mount = displays the mounted filesystems with options
grep = allows to display only some part of the text, or in this case, ignore some part. The -E is to allow extended regular expressions and the -v to invert match (ignore instead of display).
So the command would display all mount points on the device, then ignore those matching noexec,tmpfs,debugfs,proc,pts,none,fuse and cache, and display what's left that matches "rw".
And pipe | is to send the results of the first command over to the second command.
Mount is not recognized as a internal or external command...operable program or batch file.
Actually the problem I am facing now is executing the script.txt
When i type /data/script.txt in adb shell, it says no such file or directory. As per my third picture.
When I try executing with smanager app, the error on my second picture appears.
But checking on my tf101 with es explorer, i do see the script.txt in data folder with the content copied and pasted from you.
So why cant I execute the txt?
Mount will only work on the device itself, either in the terminal or in adb.
It's just weird now. What happens if you type:
adb shell
cat /data/script.txt
?
Lethe6 said:
Mount will only work on the device itself, either in the terminal or in adb.
It's just weird now. What happens if you type:
adb shell
cat /data/script.txt
?
Click to expand...
Click to collapse
Ok I got the script to run without the while loop.
That would mean that the while loop was incomplete, do you have any idea what is missing?
Thanks.
First error came with the "unexpected done" message. Removing the done from the script resulted in "while unmatched", removing the while loop allowed the script to run once.
YES! Thanks! Got it running! The problem lies with the done command. There was supposed to be a space between the last command and done. Thanks

[Help] Toushscreen broken trying to unlock pattern with touchevents

Hey I'm trying to unlock my a110 over adb. All known ways didn't work because I can't get permission for critical commands like "rm *key" (no SU rights for ADB) and I can't acess recovery because I use TeamWin which uses touch input. Also Busybox doesn't seem to be installed.
I was trying to get acess by emulating the touch input with "adb shell input swipe x1 y1 x2 y2" but it doesn't work with complex patterns, just seperate lines.
So I'm trying to use sendevents like:
Code:
adb shell sendevent /dev/input/event2 3 0 200
adb shell sendevent /dev/input/event2 3 1 600
adb shell sendevent /dev/input/event2 1 330 1
adb shell sendevent /dev/input/event2 0 0 0
adb shell sendevent /dev/input/event2 3 0 100
adb shell sendevent /dev/input/event2 0 0 0
adb shell sendevent /dev/input/event2 3 0 108
adb shell sendevent /dev/input/event2 0 0 0
adb shell sendevent /dev/input/event2 1 330 0
adb shell sendevent /dev/input/event2 0 0 0
But it doesn't seem to work. Can someone record a swipe pattern over "adb shell getevent" so I can confirm I'm using the correct device?
Or is there a way to use TeamWin Recovery without screen?
USB mouse
bro u can unlock using a USB mouse connected with USB OTG cable.
or try this method. but u need cwm recovery as your touch is broken. install cwm recovery with sp flash tool.
http://forum.xda-developers.com/micromax-a110/help/pattern-lock-t2820060
Thanks that helped!

Turning Gear S3 Bezel via ADB

Hi
Is there any way to turn the bezel of samsung gear s3 frontier smartwatch without actually turning it physically? I mean via adb command? Turning/rotating bezel isn't doing anything on my watch as its liquid damaged from inside. The bezel rotates when I turn it but it doesn't do/register anything in the smartwatch.
I know we can swipe screen, unlock phone and even enter password/pin in the smartphone via adb commands. I have done it myself once when my wife's phone screen/touch panel broke and she wanted to save pictures in her phone's internal memory. Her phone had a pin lock so after connecting it to my laptop, it was not showing phone's internal memory as mass storage device in my laptop. So i unlocked her phone by entering pin via adb commands and then copied all data from it while the screen was completely blacked out.
Now my samsung gear s3 frontier smartwatch's bezel has stopped working. I reset it and sent it to samsung under warranty. After couple of weeks they returned it without fixing it saying that its parts are unavailable. Samsung has not officially launched gear s3 and gear sports officially in Pakistan after poor sales of its gear and gear s2 smartwatch models. Because I had reset the watch before sending it to samsung, it now boots and then stucks in the startup wizard where it asks me to turn the bezel clockwise to continue further. My bezel isn't working so it has become extremely difficult to operate this watch. I have to open apps via my phone. I cannot use home button to get to the menu. All the functions are working as I can open apps via my phone. I can even go to settings set alarm etc via s voice. But when i return from any app, it does not go back to watch face as it is stuck on startup wizard and does not go beyond that "Let's Go. Go clockwise. Widgets will appear. " screen.
I was wondering if there is any way to turn this bezel via an adb command (because with non functional bezel I cannot turn it physically ) so that I can start operating my watch normally.
Najam
This question was asked on a different thread. So far no ideas or responses.
---------- Post added at 12:45 ---------- Previous post was at 12:45 ----------
Other thread.
https://forum.xda-developers.com/gear-s3/help/fixing-gear-s3-bezel-rotation-sensor-t3825446
Step 1 IMHO...
Log Commands...
With SDB/ADB...
Best Regards
adfree said:
Step 1 IMHO...
Log Commands...
With SDB/ADB...
Best Regards
Click to expand...
Click to collapse
But what is the sdb command to rotate bezel clockwise and anti-clockwise?
But what is the sdb command to rotate bezel clockwise and anti-clockwise?
Click to expand...
Click to collapse
I have no final solution nor I have Crystal Ball.
IMHO find solution means search... investigate/research.
First hint for you... it must be possible is... Samsungs RTL service...
https://developer.samsung.com/remotetestlab/gear/rtlDeviceList.action
No idea if solution is easy harder or f&ing tough to use...
Maybe you need short commnad:
move left or move right...
Or you need to send:
5348547368957687048249067549675940784675476ß37654675ß673979749056745654637354rfdhbcgvbjgbqagjhsdVHSDKHDKFG
Click to expand...
Click to collapse
So again...
First step should be logging... to idenify correct part of Software...
I have no time yet...
I can only give some hints how to log with sdb...
Best Regards
You could also perhaps look at options (if at all possible) to disable the setup wizard through SDB!
Pat123 said:
You could also perhaps look at options (if at all possible) to disable the setup wizard through SDB!
Click to expand...
Click to collapse
I have also been searching for this kind of option but couldn't find any sdb command which could disable it.
I have also been searching for...
Click to expand...
Click to collapse
I have no Crystal Ball... IMHO others also have NO Crystal Ball...
SDB related...
IMHO you can NOT connect... because WiFi not enabled... Debug not enabled...
Maybe give more details what you have tried... what you have found...
Btw...
Do you know this?
https://www.youtube.com/watch?v=2bVpAItyzWE
Best Regards
Edit 1.
No idea if you try to find alternate solution... Maybe Hardware repair attempt...
Look into this Video... after 5 minutes...
https://www.youtube.com/watch?v=TMYSm3NoefY
Your idea about Software solution is nice... but remember you have to manage many things BEFORE you can connect via SDB Tool... btw you can alos connect to ADB...
Anyway...
Only as hint...
Because it is 4 years ago for me...
Android Control XP
https://forum.xda-developers.com/showthread.php?t=2786395
This is what I have found and used during my GT-S8600 Android Porting Adventure...
As example what was sent:
https://forum.xda-developers.com/showpost.php?p=54953993&postcount=701
This seems I have used for swipe...
Code:
adb shell sendevent /dev/input/event3 3 57 0
adb shell sendevent /dev/input/event3 3 53 4
adb shell sendevent /dev/input/event3 3 54 326
adb shell sendevent /dev/input/event3 3 48 28
adb shell sendevent /dev/input/event3 0 2 0
adb shell sendevent /dev/input/event3 0 0 0
adb shell sendevent /dev/input/event3 3 57 0
adb shell sendevent /dev/input/event3 3 53 4
adb shell sendevent /dev/input/event3 3 54 327
adb shell sendevent /dev/input/event3 3 48 32
adb shell sendevent /dev/input/event3 0 2 0
adb shell sendevent /dev/input/event3 0 0 0
adb shell sendevent /dev/input/event3 3 57 0
adb shell sendevent /dev/input/event3 3 53 5
adb shell sendevent /dev/input/event3 3 54 327
adb shell sendevent /dev/input/event3 3 48 48
adb shell sendevent /dev/input/event3 0 2 0
adb shell sendevent /dev/input/event3 0 0 0
adb shell sendevent /dev/input/event3 3 57 0
adb shell sendevent /dev/input/event3 3 53 6
adb shell sendevent /dev/input/event3 3 54 327
adb shell sendevent /dev/input/event3 3 48 49
adb shell sendevent /dev/input/event3 0 2 0
adb shell sendevent /dev/input/event3 0 0 0
adb shell sendevent /dev/input/event3 3 57 0
adb shell sendevent /dev/input/event3 3 53 8
adb shell sendevent /dev/input/event3 3 54 328
adb shell sendevent /dev/input/event3 3 48 51
adb shell sendevent /dev/input/event3 0 2 0
adb shell sendevent /dev/input/event3 0 0 0
adb shell sendevent /dev/input/event3 3 57 0
adb shell sendevent /dev/input/event3 3 53 9
adb shell sendevent /dev/input/event3 3 54 329
adb shell sendevent /dev/input/event3 3 48 52
adb shell sendevent /dev/input/event3 0 2 0
adb shell sendevent /dev/input/event3 0 0 0
adb shell sendevent /dev/input/event3 3 57 0
adb shell sendevent /dev/input/event3 3 53 11
adb shell sendevent /dev/input/event3 3 54 330
adb shell sendevent /dev/input/event3 3 48 53
adb shell sendevent /dev/input/event3 0 2 0
adb shell sendevent /dev/input/event3 0 0 0
adb shell sendevent /dev/input/event3 3 57 0
adb shell sendevent /dev/input/event3 3 53 13
adb shell sendevent /dev/input/event3 3 54 331
adb shell sendevent /dev/input/event3 3 48 54
adb shell sendevent /dev/input/event3 0 2 0
adb shell sendevent /dev/input/event3 0 0 0
Only as example...
No idea how Commands looks in Tizen...
If I have time I will check if getevent... sendevent...
Best Regards
Research... Google Power...
https://developer.tizen.org/develop...nderstanding-tizen-programming/event-handling
Will try to collect infos...
To be continued...
Best Regards
Edit 1.
Code:
sh-3.2$ tizen-rotary --help
Common usage: tizen-rotary [options]
-h, --help Print this usage information.
-v, --verbose Increase verbosity of logging by one level.
Levels: error (default) -> info ('-v') -> debug ('-vv').
-s, --syslog Enable logging to syslog (default: disabled, log only to stdout).
-p, --port <port> Listening port (default: 42400).
-e, --event <event> Input device event number (default: /dev/input/event15).
Code:
sh-3.2$ cd /dev/input/event15
sh: cd: /dev/input/event15: No such file or directory
sh-3.2$ cd /dev/input/
sh-3.2$ ls -a1l
total 0
drwxr-xr-x 3 root root 420 Dec 8 09:23 .
drwxr-xr-x 14 root root 4440 Dec 8 09:23 ..
drwxr-xr-x 2 root root 160 Dec 8 09:23 by-path
crw-rw---- 1 root input 13, 64 Dec 8 09:23 event0
crw-rw---- 1 root input 13, 65 Dec 8 09:23 event1
crw-rw---- 1 root input 13, 74 Dec 8 09:23 event10
crw-rw---- 1 root input 13, 75 Dec 8 09:23 event11
crw-rw---- 1 root input 13, 76 Dec 8 09:23 event12
crw-rw---- 1 root input 13, 77 Dec 8 09:23 event13
crw-rw---- 1 root input 13, 78 Dec 8 09:23 event14
crw-rw---- 1 root input 13, 66 Dec 8 09:23 event2
crw-rw---- 1 root input 13, 67 Dec 8 09:23 event3
crw-rw---- 1 root input 13, 68 Dec 8 09:23 event4
crw-rw---- 1 root input 13, 69 Dec 8 09:23 event5
crw-rw---- 1 root input 13, 70 Dec 8 09:23 event6
crw-rw---- 1 root input 13, 71 Dec 8 09:23 event7
crw-rw---- 1 root input 13, 72 Dec 8 09:23 event8
crw-rw---- 1 root input 13, 73 Dec 8 09:23 event9
crw-rw---- 1 root input 13, 63 Dec 8 09:23 mice
crw-rw---- 1 root input 13, 32 Dec 8 09:23 mouse0
crw-rw---- 1 root input 13, 33 Dec 8 09:23 mouse1
Code:
sh-3.2$ tizen-event-service --help
Connecting to PanelAgent server. Connected :0
^C
Tried everything. Still my screen is stuck on "Let's go. Go clockwise. Widgets will appear" screen. I have researched a lot and it seems there is no way to send a command via SDB to rotate the bezel clockwise and anti-clockwise.
Hope Samsung will make Gear S3 parts available in my country so that I could get my smartwatch's bezel replaced or at least provide an option in the software to skip this start-up wizard screen in the next software update. Until then I am stuck on this startup screen.
Thanks for your help.
I have the same problem but with the "back button". Stuck on the Quick Start startup screen.
lek32 said:
I have the same problem but with the "back button". Stuck on the Quick Start startup screen.
Click to expand...
Click to collapse
I got the latest Tizen 4.0 update in my Gear S3 Smartwatch 2 days ago. After installing the update, it automatically re-booted the watch and came back on same startup wizard screen where it was stuck before. This time it said "Turn Clockwise" instead of "Rotate Clockwise". I then tapped on the screen 6 to 8 times and it skipped that startup wizard screen on which my watch was stuck since 4 months. It is now showing the watchface normally. I had used this same trick several times in tizen 3.0 but it never worked on previous version. The latest Tizen 4.0 update allows us to bypass that start-up wizard screen by tapping on screen several times.
Off course the latest software update didn't solve the bezel problem as that is a hardware issue and my bezel is still broken thus non-functional. But there is very little in Gear S3 which cannot be done without the use of bezel. So far I have found that only Alarms cannot be set without bezel (I can do that using "S Voice") and there is only one setting in "Samsung Health" app called "Distance" under "Guide Frequency" which cannot be changed without bezel not even using S Voice .
I was having this issue when I did a hard reset on my Gear S2 which has a broken bezel. By fiddling around, I found that I was able to fool the watch by putting it on the charging cradle and twisting it left and right. The magnetic contacts somehow were able to mimic the bezel rotating and got me past that startup wall thankfully. Not sure if similar can be done with an S3.

Categories

Resources