Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to programmatically identify if any broken USB cable is connected to the Android charging port?

Is it possible to identify if any USB cable is connected to the charging port of android phone with another end of cable as loosely connected?

I'm able to find when device is connected or disconnected from AC/USB power or if any media is mounted or unmounted but in all those cases, there is always a signal from another end which tells android about what type of connection it is.

But what if another end is not giving any signal? What if its a broken cable and hence don't have anything on the other end but yet connected into android charging port? Is it possible to find out such cases by some hardware level monitoring or something?

like image 648
Prakash Avatar asked Jan 31 '26 18:01

Prakash


1 Answers

I should think not. I'm assuming you are using usb micro-b, and if there's just a cord dangling from your phone socket none of the five pins are connected to anything at the other and the fuse connecting the data cables d+ and d- is not live. Thus, your phone has no way of knowing if anything is connected. the VDD (+5V) is also dead and you wont even get recognition that the device is charging (because its not). OTG is also dead, so no recognition there either. Good Luck.

like image 74
sh7411usa Avatar answered Feb 02 '26 12:02

sh7411usa



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!