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
Related
I try to change the network type from android emulator. From the official android documentation (https://developer.android.com/studio/run/emulator-commandline.html), i want to use network to change LTE/UMTS/GPRS network type. I create a new emulator from the last Android Studio 2.2 and connect with telnet. I run the help command (after authentication) and I get :
Android console command help:
help|h|? print a list of commands
crash crash the emulator instance
kill kill the emulator instance
quit|exit quit control session
redir manage port redirections
power power related commands
event simulate hardware events
avd control virtual device execution
finger manage emulator fingerprint
geo Geo-location commands
sms SMS related commands
cdma CDMA related commands
gsm GSM related commands
rotate rotate the screen by 90 degrees
I don't see network as explain in the documentation and when I try to run a network command, I get an error... Anybody have already met this issue ? Any idea how to solve it ?
Ok, seems to be delete in last versions of the emulator. I hope the android team will implement this feature soon.
https://code.google.com/p/android/issues/detail?can=2&start=0&num=100&q=emulator%20network%20unknown&colspec=ID%20Status%20Priority%20Owner%20Summary%20Stars%20Reporter%20Opened&groupby=&sort=-id%20-stars&id=204888
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.
Update(2013.08.15) : I managed to emulate touch event using 1. adb shell (slow), 2. Monkey tool(fast but not satisfying) and 3. monkeyrunner (best because I can couple it with python)
I'm trying to create an external device (probably using raspberry pi) which acts as input device for android. Specifically, I want the device to create touch event(touch, swipe... etc). The touch event should be created not only when certain app is activated, but also in background.
I have thought several methods of doing it.
Create an app(probably service) which receives data from the input device and emulate the touch event.(Probably monkeyrunner?)
Connect the android device to the external device and use adb to directly create touch event.
Make the device to mimic the behavior of joystick (I heard that this method only applies to several game apps. is it true?)
Which is the most viable method? Or is any of the method possible? (On rooted phone probably)
PS. For solution 1, I saw several apps (Remote desktop-like apps) which creates touch events using S/W. How does it work?(Using Android API, use adb or misc. methods... etc.)
Thank you for reading this question.
I am trying to implement a function like this: when an android device is inserted to USB, get its pid and vid and then use them to do some processing.
Now I use WMI to detect USB insertion and deletion. But everytime the device is inserted, my program receives more than one event. That's because the other devices like usb mass-storage card is also detected.
So from what infomation can I recognize if a newly inserted USB device is an android phone?
I think i find a method to solve this problem.
I listen to the event of win32_PnPEntity creation and the Service property of Win32_pnpEntity can be used to identify the device.
anyone know if its posible to make an application to simulate a touchscreen mouse or trackpad by bluetooth??
How can I make that the PC (or MAC) knows me as a mouse device?
Regards,
Juan
You should have a look at the Bluetooth HID specification. It may be possible, depending on the stack of the device that you are using to emulate a mouse/trackpad. I'm not familiar with the stack on Android (assuming that's the platform you're using from the tag on your question) so I don't know if it's possible from there.
Essentially, you create a HID service on the L2CAP protocol. The service record specifies the HID descriptors which describe the data being sent from emulating device. The HID driver on the host computer should be able to interpret that data.
It might be useful to try to connect to another Bluetooth mouse/trackpad from the desktop (Bluecove on a stack other than Microsoft is a good way to hack around in Bluetooth). Have a look at the service record for the HID service on the mouse/trackpad. Also, look at the data coming from the mouse/trackpad for an idea of what needs to be sent and when.
Alternatively, you could write a server application on your computer that communicates via another Bluetooth protocol (e.g., RFCOMM/SPP) to the input-device emulator app running on your phone. The server application would simulate the input device (e.g., move the mouse pointer around on the screen, etc).
Instead of creating your own project why dont you contribute to the remotedroid project?
I'm assuming you know your bluetooth api's well. Remote droid uses Wifi and OSC messaging to communicate with the PC.
Yes you may use GlovePie with the wiimote connected to BlueSoeil, It will alow you to do anything with you computer with the wiimote. It also has a Language it uses
I think you want this:
Serverless Bluetooth Keyboard & Mouse for PC/Phone
It's even open-source!
Unfortunately it is not open source, it just has a GitHub readme for some reason.
But still the app is quite good!