Access LAN on Android without wifi - android

I'm working on a web-app at work, and would like to access my development computer from my HTC Hero device. Preferably linux, but I have access to windows and mac computers. The emulator can debug locally, and helps a lot, but it's not good enough to debug real touch-events.
Ad-hoc wifi will breach our strict network policy. No matter how strict key or MAC-address restrictions it has.
Have anyone found a way to access the LAN through USB or Bluetooth? Bluetooth might be on the edge of our rules, but I will accept it as a solution if it's possible.
I'm not looking for Tethering, but rather the opposite.

I think you can use adb ppp in combination with nc to set up what you need. This guy uses his laptop's internet connection over usb on his phone.

Related

How to debug application on real device by using WIFI while not being able to use cable at all

My MacBook computer battery is broken and somehow it has not enough power to power device by usb-c adapter so I cannot connect anything and only have to use android emulator. But I need to debug on real device while testing some ocr sdk that obviously don't want to recognize anything in android emulator virtual scene. I asked other question about that but still I am puzzled by this inability to use WIFI for usb debugging because sdk runs fine on my phone but to debug using fabric and APK deployment is really horrible dev experience and productivity.
Is there some way I can setup WIFI debugging without cable at all... Maybe I need to root my device but again how to do it without cable, it seems impossible either way. I feel in like in dead and but still asking question here. I have computer and phone but cannot connect them for debugging by wifi.
Afraid I don't have an easy wireless solution. The closest thing I could find is that android wearables may have a debug over bluetooth feature, but it's built to route through another (wired) android device.
There is likely a feasible wired solution though- you can hook the device to a powered hub and the hub to the computer.
You could also use an adapter of sorts. They were built for printers and such before everything came with wifi and could get a proper wireless setup going without either side realizing they aren't directly connected over USB (OS still knows that some funky usb drivers are loaded and a separate application may need to run to connect), but again more hardware. A decent Wireless "USB Device Server" seems to run ~$100 while wired ones are cheaper, but not as cheap as a powered usb hub.
If you have another machine, you can use it to enable wireless debugging on your Android phone. See https://developer.android.com/studio/command-line/adb#wireless. Once wireless debugging is enabled, you can connect to it from your Mac without using USB. You still need USB for enabling wireless debugging though, but you can do it from a different machine. This should work on all Android phones, root is not required.
Update [2021]:
Things have developed since this question was asked. WiFi Debugging is a first class option now on newer devices. See https://developer.android.com/studio/run/device.html#wireless for details.

How to create a pppoe connection for wired ethernet (ieee 802.3) in android?

I have an android 2.3 tablet featuring a host usb port. I also have a ethernet adapter that connects to usb.
My device supports ethernet facility as it is visible from settings menu.
Only problem is there is no way I can " create a connection" to my ISP using login details.
I dont have a router to translate wan to lan. Neither do i have a desktop/laptop/netbook.
I am not a geek but from the little knowledge I have I figure out it is only a matter of few lines of code or an app, till now I dont seem to have found.
It is far from trivial. Android doesn't natively support PPPoE, so you will need to build relevant code yourself, which is only doable on a rooted device. Additionally stock Android 2.3 doesn't support USB host mode. Does your tablet see the ethernet port when you connect it to USB? If so, you might have a chance. Otherwise invest in a cheap wireless router, all of them should support PPPoE.

Android App and Communications via USB

Ok, so I have researched this somewhat and am not encouraged, but I'm going to ask anyway, and be specific about what I'm trying to do. Maybe it will help!
I have a custom board with DaVinci processor with USB 2.0 OTG controller on it. I have it configured as a host with an attached hub and various peripherals. This processor runs Monta Vista Linux (MVL) 4.0 with 2.6.18 based kernel. This custom board some video processing and streaming.
I also have a Moto Droid. I can attach the phone as a USB device to my DaVinci system and MVL will enumerate the phone, but obviously doesn't know which driver to use. That I can fix.
So what I would ideally like to do is be able to have a data connection between my board and the phone, and use the phone with a custom app, as a configuration tool (initially). I'm thinking RNDIS would be wonderful, but I don't know if Android supports that on the USB port. Then my custom app would establish a connection over the USB to a server on my custom board.
Can anyone attest to what Android DOES support over USB, besides adb and flash file system?
Any other suggestions are welcome, although please don't tell me "Bluetooth", it doesn't have bandwidth for video, which is a future goal.
Thanks!
For small amounts of data, you could look at Working Android with Arduino, which points at Microbridge (http://code.google.com/p/microbridge/) or you could also look at IOIO (http://ytai-mer.blogspot.com/2011/04/meet-ioio-io-for-android.html).
For things like video, adb port forward (http://developer.android.com/guide/developing/tools/adb.html#forwardports) could be you friend (assuming you have the networking stack on MVL all setup and adb configured). You can basically set up port tunnels for TCP over USB and shift reasonably large amounts of data over the link. One end of the connection (probably the android device) runs a TCP/HTTP server, and the custom board opens connections to communicate. This works reasonably well, you set up a thread running adb devices to detect the plugging in of the Droid device, run adb port forward to set up the port forward, then open your sockets and you're good to go.
Is using 802.11 an option for you on the Davinci board? E.g. either via a Wifi USB dongle or through wired ethernet to an AP? If so, that would seem to be an easier route to communicate with Android than trying to go through USB. Or are your video resolution and compression requirements more than what you'd expect to realistically get through 802.11?

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)

Data collection with Android via USB

What would be the best way to access the USB as a serial port on an Android device (HTC Magic)?
I am thinking about an OBD-II interface. Can I do this on a standard phone or more likely will I need a modified firmware?
According to this post, Matt Porter presented a review of Android at the Embedded Linux Conference Europe. I mention this mostly because of the example used to describe the current state of Android.
"Just one more practical example: You cannot even plug a USB drive to an android system, since /dev/sd* is not an expected device name in their hardcoded hotplug management.
Executive summary: Android is a screwed, hard-coded, non-portable abomination."
I'm sure someone's working on it, but I'm afraid for now you're out of luck unless you're willing to go low-level and edit the OS.
PSFreedom (project to jailbrack Playstation 3) has list of controllers which support usb host mode which then translate to supported Android devices.
My own expirience is that usb host works on HTC Dream/G1 without problems.
For OBD-II I would suggest bluetooth ODB-II dongle which side-stepps problem with usb host adapter.
Depending on the USB chip in your particular phone, it may be possible to rebuild the kernel to support USB Host mode or USB On-The-Go (Host + Gadget modes) instead of the normal USB Gadget mode. I've found some people speculating that it could be possible on the HTC Dream. Assuming you could reconfigure the USB port in Host mode a USB to serial, ODB-II, or CAN should be doable.
From what I can tell Android is Linux of some sort, to have USB device which would apear as serial port, you should write a driver for that device. I don't know much about OBD-II interface but i am guesing they use some sort of USB driver for windows, same is for android, not mentioning the application to handle the driver.
I don't think the current Android devices can act as a USB host only as a USB device when attached to a host. So using the USB port as a serial port is not likely.
Get a hostmode kernel for your device and you can use python for android and the pyserial library to talk to the serial over USB. I did this with Huawei Ideos U8150 (here is the post) for a loopback test.

Categories

Resources