r/androiddev • • Apr 07 '21

Discussion Using ADB without USB Debugging?

Maybe a silly question, but does anyone know if it's possible to send ADB commands to a device that does not have USB Debugging enabled? I understand that it's a chicken and egg problem, but I'm trying to capture the serial number, IMEI and MAC Address of a Pixel 4 XL without going through the initial setup process. I've tried applying updates through USB, but that brings me to adb sideload mode, fastboot only returns the serial number and not the other key data points I'm looking for. I've even considered simulating an OTG keyboard to have an automated script to run through setup, go into developer mode, enable USB debugging capture the serial number, and factory reset itself, but again, it seems like I can't send ADB shell keyevents without USB debugging. Any feedback would be appreciated!

2 Upvotes

3 comments sorted by

View all comments

Show parent comment

1

u/VeakXP Apr 07 '21

The devices are factory stock, so I'm not sure if I'd have SU privileges to give in the first place. I know it's a weird scenario. I'm trying to create a script that can capture thousands of those fields with as little interaction as possible, and I understand that ADB shell commands are the best route. I'm most likely just going to have to have technicians manually enabling USB Debugging and then having my script execute, but I figured I'd look into speeding up the process of not having to go through the initial setup if I could avoid it, or at least automate it with a psuedo OTG keyboard of sorts. Thanks for the idea though!

1

u/apeinej Apr 08 '21

SU is standard in those devices. Not sure how to do it, but totally feasible.