Is there any command to perform sensor event in device using monkey or adb like using monkey we can perform so many commands for touch long press etc.but i am not getting any sensor commands
Does anyone have idea about this please share.
Thanks in advance
You can inject events using adb shell sendevent command. Name of the device to send the events to is going to be device specific (actually it could change with software upgrade on the same hardware). You can get a list of the devices with getevent -il
Another option would be to use some low-level development tool to send I2C messages (most sensors sit on I2C bus).
The problem is that while you can inject the extra events - it would not stop the actual sensor from sending its own. So your fake sensor reading would only last till the next real update.
Related
I wish to control an androidtv box via pi using adb. I am able to send KEYCODES and have the android box execute them, however I would like to accomplish this via sendevent for quicker execution and reaction.
1.) how can I get a list of the available commands - I assume that they are in the eventxx files in the android box, however the device is not rooted so I can not access them directly. Is the only way to execute commands while recording the output using getevent?
2.) Once I have a list of the available commands, what is the proper format/spacing to send them to the android box from the pi? I have read that I need to insert a pause for timing reason but I am not clear how/where to do that.
I would appreciate some examples or reference where I may be able to get some additional info.
I'm testing an application which records user travels for later review. One part of testing involves testing application behavior when under user specified battery level.
It must stop recording to save battery. I have built a system with a raspberry pi that when you flip a switch, adb commands are sent to all connected devices to mock battery status.
My issue is when I tried to have adb as startup or as a service it, adb list all device offline thus the device doesn't work. My script will work as long you start manually the adb server.
More info:
It is the cold season here so we use a car to record travels. We can't have a screen on the device to comply with local regulations that is why, I require the adb to start at boot or during account automatic login.
Can anyone help me on this issue?
I'm trying to get my computer (Mac/Linux) to send touch commands to my Nexus 7 tablet via ADB. I've found that I can successfully send touch events via "adb shell input tap x y", but the noticable delay is inhibiting what I can do. I would need to be able to send several per second, but this method sends at about 1 per second. I'm hoping to in the end control the inputs via a python script on the host pc if that's possible.
Thanks!
Have you taken a look at monkeyrunner?
Or if you are looking for an automation test framework, you could try robotium.
I am developing android app for OBD.
I have written bluetooth connection with OBD device code in thread.
This thread is working for some devices but the device whose processer is very good then it has problem.
Let me know how I can manage for those devices?
Thank you in advance.
So if I get you right, your code gets executed too fast? If you send 1 command and then nothing, it works right?
Only problem I could imagine, is that you are sending your commands too quickly. You will have to make a smart way of sending commands to the OBD-device, or just let the thread sleep after sending a command. The base problem is that your device can send multiple commands, while the obd-ii device didn't handle it first command and then it reads in multiple commands at a time, which makes it confusing for him.
Update:
When you send a command, the OBD protocols sends the command and a ECU reponds on the command, and the answer gets responded to you. During that time, the OBD-II device does not follow any other instructions. After the respsonse, it looks into the buffer and processes that command. Look at it as a single thread that can only hanlde 1 command at a time.
Standard, the time the OBD-ii device waits, is 200 ms. Then it sends a response back to you. You can alter this by setting the timeout lower. (Look into AT-commands for ELM-327), or by adding a 1 after your command, so the OBD-II device knows it should respond back when he found 1 possible answer.
I know, I can listen input devices from /dev/input/eventx on Android/Linux. If you are superuser, you can also send events to the device through that.
I would like to send mouse events to my Android device as superuser. However, in order to do this, a mouse must be connected to the device via USB or bluetooth connection. Without it, I get error as Could not open /dev/input/event8, No such device when execute this command on adb sendevent /dev/input/event8 xxxx xxxx xxxxxxxx. In this case, the node was attempted to be created using the mknod /dev/input/event8 c 13 71 command.
The problem is solved when I connect a bluetooth or USB mouse to the device. The device is created automatically under /sys/devices/platform/tegra_uart.2/tty/ttyHS2/hci0 named hci0:11 also create input event /dev/input/event7 (major 13 minor 71). After that I can send events to that node and control Android mouse cursor. But I want to do this without connecting a mouse to the device.
Could anyone suggest how can I create a mouse input device (like when a mouse is connected) on my android device virtually?
From what i see you should create your own virtual device with your own driver , Fortunately there is an easy way to do so using uinput
There is an easy guide for getting started here , and this question can be a good guide to write your own virtual driver.
I thought this can only be done if you have access to kernel , and create your own ( i dont think modifying user rom is a good solution ) , but after reading this , it is clear that Uinput can run in user mode.
Note :
I agree with recommendition to use touch events ; as this solution is more common and makes sense , check second suggestion is this answer