Skip to content

Instantly share code, notes, and snippets.

@bdashore3
Last active November 9, 2022 21:19
Show Gist options
  • Save bdashore3/c759f3057de6826e92426261b7e51bc2 to your computer and use it in GitHub Desktop.
Save bdashore3/c759f3057de6826e92426261b7e51bc2 to your computer and use it in GitHub Desktop.
My method to run ADB commands on the Quest 2 without a headset

Quest 2 ADB without the PC

The Quest 2 can run many ADB commands which enhance the overall experience of the VR world, but there's a catch.

Every time the Quest 2 is rebooted, all adb settings are reset to provide a clean slate. This is similar to how iOS relinks everything with a simple reboot. Doing this makes sure the user isn't impacted and has to factory reset as a result.

Therefore, users need to be connected to a PC and run ADB commands every time the headset reboots. My goal is to take the PC out of the equation and do everything on the headset.

Dependencies

This goal is accomplished through the use of:

  • LADB - to create a local ADB server for issuing commands (costs money on play store, but you can build it from Draco's GitHub)

  • SetEdit - a settings database editor

  • Logcat Reader - reads the android system logcat to get a wireless ADB port

Current workarounds

The current method of "wireless" debugging involves using the adb tcpip <port> command which involves a USB connection. Once that's finished, the USB can be severed and adb connect <IP:port> is used to wirelessly connect to the headset.

This method is used by SideQuest to run adb commands wirelessly on the headset. This is why changing settings directly on the headset is not supported by the SideQuest application on the Quest headset.

Method

  1. Enable developer mode from the Meta Quest app for ADB

  2. Enable secure settings access for SetEdit and log access for Logcat Reader

  • adb shell pm grant by4a.setedit22 com.android.permissions.WRITE_SECURE_SETTINGS

  • adb shell pm grant com.dp.logcatapp android.permission.READ_LOGS

  1. Create a logcat filter in Logcat Reader that looks for adb wifi started

  2. Head to the global settings table on your quest and change adb_wifi_enabled to 1

  3. A dialog should pop up for enabling wireless debugging. Select, allow and a port should show up on Logcat Reader. Write that port down or memorize it.

  4. Inside LADB, turn off the pair and shell setting and force close/reopen the app

  5. In LADB, type adb connect localhost:<port> where port is the port you wrote down from step 5. A prompt for USB debugging should show up

  6. ADB commands galore!

Conclusion and Acknowledgements

With this method, many hidden Oculus settings can be toggled without the use of a PC cable or using old wireless debugging methods.

Thanks to:

  • lmore377 for providing me the missing piece for grabbing the wireless debugging port Reddit post here

  • Draco for LADB

  • Darshan Parajuli for Logcat Reader

  • 4A for Settings Database Editor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment