Phone connected to adb via Wi-Fi disconnects immediately when USB cable is pulled [duplicate] - usb

I develop on my tablet using android studio.
The tablet is connected to the computer by wifi using
adb connect <ip_andress>:5555
My application contains listeners for USB devices attached/detached.
But unfourtunately, when I connect/disconnect usb device to/from the tablet, the adb connection is getting killed, and I can no longer see the device under "adb devices".

It is not a adb-connection-by-wifi what gets killed. It is just that USB enumerations affect the sys.usb.* system properties which on many devices is causing restart of adbd regardless whether it's being used over USB or tcpip.
Do grep "stop adbd" /init*rc to see what I mean.
You could either comment out those stop adbd lines or just disconnect the USB cable before running your adb connect command.

I was never able to connect my cellphone with my computar through wi-fi.
I had already given up. I followed all the instructions and tips, and nothing worked.
Finally, I did what no one said to do.
I've connected the phone to the WiFi network provided by the cable modem itself and not to some (not all) additional networks that are included in the router.
At home I use one of these networks, because I use a Deco Tp-Link router, which propagates the signal to my entire house, but this network is NOT compatible with ADB. It does not identify it as belonging to the same network.
After this, I use the normal procedure described here.
a) Connect cellphone with a USB cable
b) Find the IP_Phone depends on system in the cell phone. Here I use Settings, About Phone, Status and IP address.
c) Run the following adb commands in Command Prompt (Windows) or Terminal (Linux), where IP_Phone is the IP above mentioned. Normally adb.exe is an executable stored in computer path. adb is already included in Android Studio package.
adb tcpip 5555
adb connect IP_Phone
d) Now disconnect USB cable and it's ready. The cellphone model continues to appear in the status line in the top of Android Studio.
-/-
The best wifi is that defined in Cable Modem. It, unlike an any account defined in my router, answers to a ping command.
ping IP_Phone

Disconnect the usb cable just before running adb connect <*ip_address_of_your_phone*>

Related

Physical device on wi-fi disconnects from metro and I can't reconnect through wi-fi

I use the VS-Code terminal to open metro using 'npx react-native start' and then connect my device through USB and install the app and run it using 'npx react-native run-android'. I then remove the USB cable because it is disconnecting and connecting constantly so I work through wi-fi, but sometimes the device disconnects from the dev-server and I cannot reconnect without using a USB cable again and repeating the steps above. I have set my ip and port in the dev menu in-app. Any tips would be greatly appreciated!
I have tried using adb reverse or adb connect commands, but to no avail.
When you connect your device by USB follow next commands
adb tcpip 5555
disconnect from usb
adb connect 192.168.1.35:5555 - your device local IP
adb devices check only one device connected by USB exists

ToupTek XCAM4K8MPA camera connection to Linux computer

I'm trying to connect a ToupTek XCAM4K8MPA camera to a Linux Ubuntu 20.04 64-bit computer to use with their provided ToupLite software for microscopy image capturing. The camera comes with a USB 3.0 cable, HDMI cable and USB WLAN adapter.
I have managed to set up the ToupTek ToupLite software (Link to manual, Link to download page) which, as far as I understand, comes with the SDK included. I have then connected the camera via USB 3.0 and HDMI cable to the computer, but ToupLite shows No device as in, the camera is not recognized or connected. I have tested the camera by simply connecting it to a computer monitor via HDMI cable and it works, but for capture I would like it to be connected to a computer and the WLAN or Wi-Fi connection solution is not really a good option.
Perhaps someone has some ideas of what I am missing.
Note: Relevant tags include touptek, touplite, microscopy
I ended up using the WLAN connection. Made a non-changing IP address for the camera and the ToupLite software recognizes that it is on the local network.

Cannot access USB UART in VirtualBox Guest on macos Host

I've created a virtualbox via docker-machine:
$ docker-machine create --driver virtualbox default
Within the Guest-OS I'd like to access my USB-Serial device, which is a Nordic nRF52840 DevKit, which is listed in macos as /dev/tty.usbmodem144241.
However, this device is not listed as USB device by virtualbox. I've also tried adding the devices as a Serial Port with the Port Mode "Host-Device" as described in this link, but without any success:
If I add the Serial Port as .tty-usbmodem the virtualbox will hang in 'Starting', I have to kill all virtualbox processes or disconnect the serial cable in order to start again. If I use .cu-usbmodem the virtualbox starts up but immediately crashes.
I'm running out of ideas here. I'm stuck at this issues since docker for mac does not support the --devices mapping without virtual machine, and for the virtual machine I somehow can't manage to add the port.
Any ideas on what else I could try?
So as it turns out virtualbox is quite picky about when a device is actually connected and does not work as seamlessly as I'm used from using VMWare:
The device I was using really just shows up as SEGGER J-Link in the USB menu
It must be added as filter (filter is really confusing > first I thought it would ignore the device)
The device cannot be added to the virtualbox 'on the fly' (using the USB-icon in the 'Show' window, see screenshot), it must not be connected before the virtualbox starts up.
The serial-tab is irrelevant > it's all handled via the USB tab.
The important fact is that the device must not be connected wenn the virtualbox fires up. So the steps to add a device are the following:
Power down the virtualbox
Make sure the USB controller is enabled
Connect the USB/serial device to the computer (host)
Add it to the filter in the virtual box
Now every time you want to use the device with the virtualbox:
Make sure the virtualbox is down (e.g. docker-machine stop default)
Disconnect the USB/serial device from the computer
Start up the virtualbox (e.g., docker-machine start default)
Virtualbox should now be able to "intercept" the device and list it under /dev, e.g., as /dev/ttyACM0
Un-/Plugging a filtered device once the box is up also works (you don't have to power down the virtualbox again if you forgot to disconnect the device before starting it up. Just wait for the box to be up, unplug, plug in, should be good).

Android Things: ADB over USB on Raspberry Pi

I'm playing with Raspberry Pi 3 Model B and Android Things. I was able to configure everything (connect Pi over Ethernet, then reconnect over Wi-Fi with Android.local) and debug the app. However it's not convenient sometimes to debug over Wi-Fi when I travel and I have to change Wi-Fi networks or don't have Wi-Fi connection at all.
I know there is serial debug console, but it seems to be for getting logs and shell commands, not for debugging.
Any chance to have direct debugging over USB cable just like any other Android device like smartphone/tablet?
How to debug Android Things device over USB?
Briefly: you can't do it with Raspberry Pi.
Why not?
Let's look at the pin specification of Raspberry Pi micro USB (J1):
where
1: power
2: D- (data out), not connected
3: D+ (data in), not connected
4: NC, not connected
5: GND (ground)
So summing up the above said: no data pin connection - no adb. You can only power your RPi over micro USB.
Any chance to have direct debugging over USB cable just like any other Android device like smartphone/tablet?
Use another board. In fact, any board that has USB OTG and is supported by Android Things would allow debugging over USB, just as a "regular" smartphone/tablet.
And ironically, by the time of this writing, all the supported hardware platforms would fit except for Raspberry Pi :)
The NXP i.MX7D development board has the same pins as the Raspberry Pi for development, however it uses USB-C for power and ADB.
Highly recommend it over the Raspberry Pi
https://developer.android.com/things/hardware/imx7d.html
(source: android.com)
Another option is to setup Wi-Fi access point on your laptop and allow the Pi to connect to it. I have not tested it but it should work.

adb ppp over usb whitout tethering and rooting

I'm developing a client/server app for my Android phone (server side is Java based), and what I need now is an UDP connection over USB.
I tried adb forward, but it give me only TCP protocol with ridiculous latency (6~800ms), so I need UDP.
I found adb ppp command, but I'm not able to get it working on my Linux machine (updated Debian). I tried tons of examples found looking for adb ppp connection like
adb ppp "shell:pppd nodetach noauth noipdefault /dev/tty" nodetach noauth noipdefault notty 192.168.254.2:192.168.254.1
no lucky.
So, how can I give UDP power to my app?? There is some possibility without Android tether and root permission both side (Android and desktop)? I'm not interested in internet, BT or WiFi solutions. Even because Android tether request me desktop root permission to keep adb working, and I need TCP forward too.
Thank for help
The solution to your problem might be the USB Tethering. Go to the Settings then Wireless then Tethering & portable hotspot. after that turn on the USB Tethering. This option only shows when USB cable is plugged in your device and its connected to your notebook. Recent android versions place this option in Settings -> Tethering & portable hotspot..