I need to find a way to (using an Android application) programmatically connect and disconnect an Android device from a host.
I am using a Galaxy Nexus. My goal is to keep everything as close to stock as possible, though I have already enabled verbose debug messages in the kernel and in order to view them have enabled root access on the phone to access /proc/kmsg
(and the shell command dmesg
).
I am certain that there is a way to leverage root access to do what I need to do, but all of my attempts have lead to nix.
/proc/bus/usb
/dev/bus/usb
I am going to try to figure out how to do the last object on the list, as then I would be able to rmmod
and insmod
the resulting *.ko
in my application and that would connect and disconnect the phone. I am unsure of the feasibility of this option though.
Solution came when close to a deadline, so I am almost sure it is not the best way of doing things, but it met my requirements.
Build Modded kernel (to allow hooking of particular function)
Build kernel module (which gives the actual functionality of connecting and disconnecting)
Build Application
If you are interested in repeating these results, read the document posted here and feel free to send me any questions.
https://docs.google.com/uc?export=download&id=0B9WchRkSOWwJbi10MGhLWUljT2s
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With