How to deactivate a specific USB port on Android device - android

I'd like to power on and off a USB device in Android. I know the method on Linux and it is pretty straightforward (see https://loginroot.com/power-off-and-on-usb-device-in-linux-ubuntu/). Unfortunately the command lsusb -t does not work on Android terminal.
Do you know how to deactivate a specific USB port on Android? Alternatively, getting the USB device tree should be enough, but I don't know how to achieve that either.

Related

How do I enable the ethernet over USB drivers on Android Things?

I have a USB dongle that uses ethernet over USB to act as a network adapter. On Ubuntu it makes use of the usbnet driver and as soon as I plug the dongle in, the OS recognizes it and gets a new network interface. However, on Android Things it only get recognized as a USB device.
I installed busybox and tried using modprobe to activate g_ether or usbnet but modprobe complains that /lib/modules doesn't exist. Furthermore, I tried using the lsmod command to find out which drivers are active but lsmod doesn't work either because /proc/modules doesn't exist.
I have located the directories /sys/module/usb_f_rndis and /sys/bus/usb/drivers/cdc_ether which leads me to believe that it should be possible to somehow activate the ethernet over USB functionality.
Does anyone have any experience working with ethernet over USB on Android Things? Can anyone guide me through the process of activating the necessary drivers to make this work? Do I have to rebuild the kernel? Thank you for any advice you can offer.
Seems You can't do it now: only when support of USB<->Ethernet devices will be implemented in Android Things or the source code of Android Things becomes available (then You can add Your USB driver support manually as You wrote).

USB Debugging in VitualBox-hosted Android system

I have set up a virtual machine running an Android 4.4 system on VirtualBox, in a Windows 7 system, for convenience in testing an Android app I am trying to develop. What last remains, is to be able to make the guest Android OS look like it's connected to the host via USB, to be able to use USB Debugging. Is there a way to achieve that?
EDIT: By "convenience" I mean I do not have a good enough physical device at my hands at the moment, and my processor happens not to support VT-x, in which case I could just use an AVD with Android Studio. Therefore, the VirtualBox choice is the next best thing I got, until I get a new device on my hands. What has priority at the moment is to create the app's utility, looks will be taken care of later on.
If your Android system is rooted you can install Wifi ADB (or some similar application) through Android Play store and debug over TCP.
The steps can be simply:
Install Wifi ADB (from https://play.google.com/store/apps/details?id=com.ttxapps.wifiadb&hl=es)
Execute and start service (Bettle will go to green)
Open Command line in Windows 7 machine
Run the connection command, for example:
adb connect 192.168.125.232
Test device connection with
adb devices
Enjoy testing your application!

Viewsonic Viewpad 10s not recognised by PC (over USB)

I'm about to start writing some Android applications, I have downloaded Jave/Android and Eclipse.
I have a test Android tablet (Viewsonic Viewpad 10s) which I will be running the software on.
I was hoping to be able to just plug the Android device straight into my PC to allow me to debug/run applications on the tablet.
I have purchased a male->male USB cable and plugged it into both devices, but nothing happens, it doesn't even come up with an 'unknown device' in the 'devices' window. Is there something else I need to be doing to get Windows to recognise this device? (I'm running Windows 7 (64bit)).
Alternatively, is this the best way to be running/debugging on the tablet? I was thinking that there might be a network debugging application, as both devices are on the network?
I'm totally new to Android, so might be missing something obvious. Although I have set the 'USB Debugging' within the 'Development' menu.
Thanks in advance.
Rich.
It's a Windows problem, Windows isn't capable of recognize your tablet on its own, you need to install the appropriate USB drivers for your device in order to use your tablet when it is connected to your PC.
Under a GNU/linux distribution like Ubuntu everything is much more easier and you can just plug in your device without installing anything, you just have to set the right permissions for the device once.
Unplug the device from your machine
Install the driver for your device : http://www.viewsonic.com/support/downloads/drivers/_download/tablet/viewpad10s/ViewPad_10s_USB_driver.zip
Plug your device in
look at the device for a notificaiton saying debugging enabled.
If you dont, you will need to open Device Manager, find the listing that your computer thinks the device is and right click and uninstall it. Then unplug and replug.

Is there any way to stop ADB from automatically trying to connect to ANY android device plugged in?

So here's the thing. I use MyPhoneExplorer in USB mode which uses ADB to communicate with the phone. Whenever my phone is connected (using MyPhoneExplorer) and try to test an app in eclipse on my EMULATOR, ADB crashes, rendering both MPE and the emulator useless.
My question is: Is there any way to prevent adb from accessing one phone from multiple sources? (In this case its trying to access the phone for both Eclipse and MPE).
Weird/Confusing question I know, but would really appreciate some help.
I haven't tested this, but how about directing ABD at a given device with this:
adb -s <serialNumber> <command>
http://developer.android.com/guide/developing/tools/adb.html#directingcommands
Use adb devices to find out the serial number of your emulator.
But from what you describe it might be that ADB's device detection that's breaking things.

Using My Android as a USB Device

I've been able to find a few posts on StackOverflow about how to control USB devices using an Android phone -- which I understand is impossible (The Android being a USB device and all.)
However, I would be perfectly happy to set up my application to communicate with the other computer (a Linux host) as a USB device. (Like a really expensive mouse...)
Does anybody have information about how to set up an Android app/phone to use the USB connection and exchange data with a host computer. Obviously, it already works at some level -- it's how Eclipse and Android SDK/debugger do what they do, but I'm still looking for some way to do this in an application.
(My current phone, BTW, is a Droid Incredible.)
Thanks,
R.
Basically you'd need to install the USB device driver and the ADB toolsuite from the SDK, either that or reverse engineer their functionality and build it into something else.
Then you enable USB debugging on the phone.
And then you can do something like an adb port forward to allow an application on the pc to connect to a network socket listener on the phone. Note that connections cannot be made in the other direction, but once a connection is made it is bidirectional.
If your version of android supports tethering over USB, you could also leverage that to implicitly create a network between the PC and the phone, at which point you can make connections in either direction. Just make sure nothing starts accidentally pumping lots of data through the phone's mobile network!
(Many android phones actually can experimentally function as USB hosts, but you have to compile new drivers into the kernel, install the new version, and make up a cable to provide USB power to the device as the phone cannot. Also you lose the ADB over USB channel which makes debugging a pain)

Categories

Resources