Use WiFi and an USB charger
None of the other solutions worked for me.
The trick was:
- Plug the cable, which is connected to the device, in a charger
- Charge the device to 30% (YMMV)
- Plug it in the computer
- Even when the device has USB-C, you must use an USB2 port on the computer
- If your computer only has USB3, see below
adb tcpip 5555
- Plug it back into the charger
adb connect $IP 5555
- You can find
$IP
usually in the WiFi settings of the device
Apparently adb
on my device automatically powers down if the battery level drops to 25%. (At my side it then stayed there. Apparently the power conserving functionality worked as intended.)
With everything else (reboot, unplug and replug, change developer mode, change cable, change computer) I can see it in adb
, but it goes offline
as soon as I try to connect to the adb
daemon on the device (perhaps because the adb
daemon in the device is stopped when battery gets too low).
As my device refuses to operate with USB3 (keyboard, mouse and other USB3 equipment works perfectly on those ports, and the same cable even offers 5 Gbit/s), I can only use USB2 ports. USB2 only offers 500mA (2.5W) max while the device needs more when it is not sleeping (3W when if display on, up to 18W while charging).
Usually one has activated the option "stay alive when debugging", so with an adb
connection the device never sleeps and tries to draw more than the allowed 500mA - which also can result in USB instabilities.
So even if the device shows "charging", the battery may drain slowly
If you happen to have some powered USB2 hub which is completely outside of the USB spec (read: buy cheap) it might work that the device gets enough power out of an USB2 port (a cheap 4 port hub may wrongly and dangerously offer the full 2A on a single port. This is dangerous, as spec conforming cables may start to burn if they are exposed 4 times the allowed current. This then is not the cable's fault!). However do not count on that, so do not buy something with some expectation. Instead try everything you already have (look if the battery drains).
See next.
USB3 to USB2
My device has USB-C. My computer has USB-C 3.2 Gen 2, USB3 and USB2.
- Plugging in the device into USB2 with a cheap USB3 to USB-C cable works
- Plugging in the device into USB3 with a cheap USB3 to USB-C cable does not work
- Plugging in the device into USB3 with an expensive power measuring USB-C to USB-C PD charge and data cable works
- This works, because the expensive cable only offers USB2 data transport
- You can read this in the spec of the cable (if you find it. It likely can be found in the sub-notes of the sub-notes of the notes in a well hidden page of the manufacturer, which you can only find after contacting the manufacturer and waiting 6 months for some reply. YKWIM).
- "Full speed" is 12 Mbit/s AKA USB1 speed
- "Hispeed" is 480 Mbit/s data transfer AKA USB2 speed. This is what we need for
adb
.
- "SuperSpeed" is 5 Gbit/s (and above). However there are so many different and incomatible modes in that category, that "SuperSpeed" is unequal to "SuperSpeed" usually.
- For SuperSpeed to work, all 3 components must support the same mode:
- Device (which most often only supports 1 mode)
- Cable (it has a chip in it for this which often only support another single mode)
- Host (AKA Computer, which most time offers many but not all modes)
- Note that USB2 cables do not need an active chip. They only had some special wiring with some passive pullup resistor, which many cheap cables out there of the first generation got wrong. But this got much better in the last years, so even the cheapest USB2 cable should work.
The good thing with the chip is, that conforming cables can no more create some danger if some other component cheats, like the USB hub.
If you are in USB3 mode and try to transfer more power over such a cable than the cable allows, the power transfer will simply fail, because the non-cheating parts will not do it. So no more burning cables due to use outside of the spec.
This is needed, as USB offers PD up to 240W (and in future likely more). So without such safety, cables would go up in flames all too often.
Note that 10W from usual USB2 chargers already is dangerous enough. My soldering iron for SMD has 5W, and soldering irons can reach temperatures where paper and wood already start to burn on themself. So a wrong cable used with some USB2 charger can reach that temperature, too (which is unlikely only because the insulation of the cables starts to melt before so they get a shortcut, which most chargers can detect and shut off the power).
So if you have trouble to connect to the device in USB mode for adb
:
- Be sure the device is charged
- Be sure to use USB2 for data transfer
- Perhaps newer devices offer real USB-C, but none of mine do this
- You can try to use an USB2 hub plugged into your computer's USB3 port
- Or you can use some USB2-only cable
- Which is difficult today if it needs to have USB-C
- There are many USB-C charge only cables out there which offer no data transfer
- Most cheap USB-C data cables allow some USB-C speed which makes
adb
fail
- Perhaps use some Micro-USB to USB-C adaptor with some Micro-USB cable
- Many expensive USB-C PD charging cables with data transfer offer 480 Mbit/s only, which is USB2 and which is what we need here!
- I have quite some PD charging cables with USB-C to USB-C which only offer 480 Mbit/s!
- FYI
- 12 Mbit/s is USB1
- 480 Mbit/s is USB2
- 5000 Mbit/s is USB3
- 10000 Mbit/s is USB3.1
- 20000 Mbit/s is USB3.2
Please bear with me if I am not 100% accurate here. There probably is not much on earth which is more complicated than the USB spec. Even the bible looks much more readable and more precise to me.
Warning!
- Many expensive USB-C to USB-C cables sold as being compatible with USB3.2 Gen 2 with 20 Gbit/s and/or Thunderbolt effectively only offer 480 Mbit/s data transfer!
- This is due to the shitty USB spec, which does not mandate that a conforming cable must fully conform to all modes
- Physically these cables may offer 20 Gbit/s
- But they often only implement a single mode
- There are (at least) 4 USB modes to chose from, plus one Thunderbolt mode
- These cables often only support 1 USB mode (and perhaps Thunderbolt)
- The mode supported usually is unsuitable for real data transfer to things like external drives. But if you are lucky it happens to work with your display
- Hence all these expensive cables most times fall back to USB2 speed. You only note this, if you measure your speed. (Often 480 Mbit/s is more than the an Android Device is able to handle anyway. So most users do not see the difference.)
- Which means, these expensive cables are very likely to work with
adb
on your Android USB-C device.
In contrast, cheap USB3/USB-C to USB-C cables (those which are not charge-only) often support most USB3.0 modes and hence allow data transfer up to 5 Gbit/s. They do not offer video and Thunderbolt modes (these came with USB-C 3.1), though, so they do not work with your display.
These cheap cables then fail to connect to adb
on the device, as all components detect, that the device is USB3 capable, so they do not fall back to USB2 which is needed to connect to adb
.
So it is the other way round.
Cheap cables do it right, and hence fail with adb
on an USB3 port.
OTOH the expensive cables cheat on you and are not even slightest worth the price!
However, due to the cheating, they accidentally work with adb
.
Some measurements with my device (all with the same USB-C to USB-C cable using some 1€ passive USB-C to USB3 adapter if needed):
- 4.8V, 0.5A, 2.4W on USB2 on the Computer
- 4.9V, 0.5A, 2.4W on USB3 on the Computer
- 5.0V, 0.5A, 2.5W on USBC 3.2 Gen 2 on the Computer
- 4.9V, 1.8A, 8.8W on my old USB2 charger
- 5.8V, 3.0A, 17.7W on some unbranded cheap 20W USB-C PD charger
With the latter the USB charger gets hand-warm (40°C) but the device starts to boil (60°C).
My device is old. It was bought a long time before cheap PD chargers were available. So I think the manufacturer never tested a full charging cycle with more than 10W. Or they used some cryogenic environment, as in normal circumstances, a full charging cycle with 18W will likely melt or explode my device.
A final note:
Some mainboards offer USB-C PD with data transfer already. These boards can power your screen and even other computers with a single cable while transferring video and other USB connections (Mouse etc.) over this single cable, too. On such devices you may succeed to:
- Power your Android device enough so it stays charged
- and get (only) 480 Mbit/s data transfer at the same time
with some expensive PD charging and data cable (which only offers USB2 speed for data transfer), such that adb
works.
This is a theory. As I do not own such a mainboard yet, I cannot check this.
adb shell input text XXXX && adb shell input keyevent 66
I open the phone an access all the contents. – Tricyclic