Closed Bug 848957 Opened 11 years ago Closed 6 years ago

"remote debugging" checkbox doesn't always enable remote debugging connections

Categories

(Firefox OS Graveyard :: Developer Tools, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: myk, Unassigned)

Details

Sometimes, after checking the "remote debugging" checkbox, I can't establish a remote debugging connection to a device.  Toggling the checkbox several times, or possibly just waiting for a while, then causes the problem to be resolved.

Unfortunately I don't have a good sense of what triggers this.  But it has happened to both devices on which I have tested remote debugging (via the FxOS Simulator's Push To Device feature in its latest preview build), one of which is an Unagi, the other of which is a device that bmaggs gave me for testing.

In fact, on bmaggs' device, when it started working, the "remote debugging" checkbox was unchecked!  I had left it like that and only accidentally discovered that remote debugging had started working when I mistakenly pressed a Push button in the Simulator and saw the app install notification on the device out of the corner of my eye!

While troubleshooting that device, I also noticed that checking the checkbox and then restarting the Settings app didn't persist the checked state of the setting, which might be another manifestation of the underlying problem or a related issue.

In any case, checking the checkbox should reliably enable remote debugging, and unchecking it should reliably disable it.

Bug 836103 hooked up ADB to that setting, and its patch dumps exceptions configuring ADB, so logcat might help track down this problem.
I seem to remember someone reporting that after bug 799151, the persisted pref is no longer consulted during B2G startup, but I can't find a bug right now. Maybe if you restart b2g with the pref/setting in the non-default state, when it comes back up the pref is correct, but the setting has the default value?

It's too late over here to try this out, or to feel confident that I'm thinking straight.
I had filed bug 843846... but then I can't reproduce the issue anymore.  I think it has to do with settings not always sticking, but I can't get that to occur always.
I've also seen problems where the USB port gets into a hooped state and the phone also doesn't show up when you do adb devices. Plugging/unplugging the USB cable from the phone doesn't seem to help, and neither does toggling the remote debugging connection on/off.

What did help, was moving the USB cable on a host side to a different port.

The times I've seen this issue is when I plug the phone in when the battery is dead. It seems to try to boot and often reboots itself because the battery isn't charged enough. I think that this may be what puts the host side port into a weird state.
Dave Hylands thanks, moving the USB cable to a different port solved the issue, i was having the same issue i think.
Myk,  restonjd@gmail.com, I just remembered there is a change that occurred due to security reasons to have remote debugging turned off if the phone sleeps/is in lockscreen for production builds.

If you flash a dev build, DEBUG=1 as a variable; I think you maintain the remote debug through the lockscreen/device sleeping.
Component: Gaia::Settings → Developer Tools
This bug is getting old, and I'd like to close it. I see two bugs reported here:

Myk and Dave, do you still see remote debugging {flaki,weird}ness with the new "Debugging via USB" setting?

I've never experiences the hooped USB problem, but the "Debugging via USB" setting (mapped to "debugger.remote-mode" pref) does have some caveats, as explained in bug 998328 comment 26. TL;DR:
- Marionette can enable remote debugging even if the pref says "disabled".
- USB debugging can be blocked by lock screen in userbuild even if the pref says OK.
Flags: needinfo?(myk)
Flags: needinfo?(dhylands)
In eng and userdebug builds, adb is always on and ignores any settings in the settings app.

In user builds, it is honored, but only when the phone is unlocked. When the phone is locked, then adb gets turned off. There is also a 12 hour timer. Once adb is enabled, it will automatically turn the setting to OFF when a 12-hour timer expires.

There is a quirk, that if mass storage (either UMS or MTP) is enabled, and adb is enabled and the phone becomes locked, that we'll leave adb enabled. This is because disabling adb will disturb the UMS/MTP session.

DEBUG=0/1 has no impact on adb.

It just occurred to me that with UMS & MTP, once they're enabled (which requires the phone being unlocked), then we'll leave them enabled until the USB cable is pulled, even if the phone becomes locked. I think it makes sense to have adb behave the same way, but I think that's another bug.

I also heard it discussed to have an "adb always on" setting, which I also think is a good idea.
Flags: needinfo?(dhylands)
> Myk and Dave, do you still see remote debugging {flaki,weird}ness with the new "Debugging via USB" setting?

No, I no longer see that strange behavior!
Flags: needinfo?(myk)
Firefox OS is not being worked on
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.