Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please add an ability to set a fixed port #8

Open
RichardBeisser opened this issue Dec 17, 2023 · 10 comments
Open

Please add an ability to set a fixed port #8

RichardBeisser opened this issue Dec 17, 2023 · 10 comments
Labels
feature request Requesting a feature

Comments

@RichardBeisser
Copy link

RichardBeisser commented Dec 17, 2023

Hello,

today I installed your WADS.
It would be great if you add 2 Features:

  • Autostart while Boot (comment by @Smooth-E: This was added in 1.2)
  • set a fixed Port for ADB

Thanks.

@RichardBeisser RichardBeisser added the feature request Requesting a feature label Dec 17, 2023
@Smooth-E
Copy link
Owner

Hello. Got to say that I find your suggestions pretty reasonable. However, I should say that starting wireless debugging on boot will only be possible in the root mode, because you need to manually activate Shizuku on every boot by connecting your device to the PC. Assigning a static port may be not possible (unlikely), but I will investigate this when I get to work on the next release (in a couple of months).

@RichardBeisser
Copy link
Author

... starting wireless debugging on boot will only be possible in the root mode...

yes, i know that. all my devices are rooted with magisk.

by the way, there is already with the mentioned features, but the project seems to be maintained.
https://github.com/RikkaApps/WADB
this App doesnt work on all of my devices, but your's does.

@Smooth-E
Copy link
Owner

... set a fixed Port for ADB

I am back to working on this application for some time. Am currently a bit puzzled on whether it is even possible to set the port to some fixed value. The process of enabling wireless adb goes as follows as far as I understand by now:

  1. AdbDebuggingManager.setAdbEnabled(...) is called.
  2. Then the manager sends a message with AdbDebuggingHandler.MSG_ADBDWIFI_DISABLE.
  3. AdbDebuggingHandler catches the message to actually enable wireless debugging.
  4. After checking that you are connected to a valid network, it starts the ConnectionPoller which monitors the system property that should contain a port for a maximum of 10 seconds and fires back the listener with what it read from the property.

So for now it looks like the port is set internally when you connect to the network. I will dig deeper a bit later, but it is possible that I will abandon this idea.

@yochananmarqos
Copy link

@Smooth-E

...manually activate Shizuku on every boot by connecting your device to the PC.

There's a Wireless debugging toggle in Developer Options in recent versions of Android. I'm not sure when it was actually added, but it's been there officially since at least Android 12 on my Pixel 6. I had a OnePlus 6T and 7 Pro just before that. I think OnePlus added it at some point while I had my 7 Pro before it was available officially.

Either way, I don't believe there's any way to enable it on boot without root. I know I've seen Tasker users request the same thing.

@Smooth-E
Copy link
Owner

Smooth-E commented Jul 7, 2024

Hello @yochananmarqos!

There's a Wireless debugging toggle in Developer Options in recent versions of Android. I'm not sure when it was actually added...

I know this. It was added in Android 11 with addition of the wireless debugging feature itself.

There's a Wireless debugging toggle in Developer Options in recent versions of Android. I'm not sure when it was actually added, but it's been there officially since at least Android 12 on my Pixel 6. I had a OnePlus 6T and 7 Pro just before that. I think OnePlus added it at some point while I had my 7 Pro before it was available officially.

What is the point of this statement exactly? Excuse me, but I don't understand what you are trying to imply here. Be reminded that WADBS (my app) is just a widget provider for a system feature. I am not implementing wireless debugging myself.

Either way, I don't believe there's any way to enable it on boot without root. I know I've seen Tasker users request the same thing.

Yeah, and it's fine. I actually mentioned this here as you said.

Thanks for being interested in WADBS!

@yochananmarqos
Copy link

@Smooth-E Nevermind, I guess I misunderstood.

@Smooth-E Smooth-E changed the title Please add Autostart and set Port fixed Please add an ability to set a fixed port Jul 20, 2024
@madhuraj0
Copy link

Yes if possible please add ability to set a fixed port using Shizuku, currently the apps that are able to achieve it use root.

@Smooth-E
Copy link
Owner

Smooth-E commented Jan 4, 2025

Yes if possible please add ability to set a fixed port using Shizuku, currently the apps that are able to achieve it use root.

Since I've taken a long break from developing WADBS for personal reasons, could you please provide example of such apps? I remember when I was researching the topic, I didn't quite get how to set a specific port even with root. Those apps will serve as a good example to start from

@madhuraj0
Copy link

madhuraj0 commented Jan 4, 2025

This app always starts wireless debugging at 5555. However it doesn't have any option to manually set the fixed port.
https://www.apkmirror.com/apk/metactrl/wifi-adb-debug-over-air/

Edit:
This xposed module even lets you manually set the port: https://github.com/Xposed-Modules-Repo/com.luckyzyx.luckytool

@Smooth-E
Copy link
Owner

Smooth-E commented Jan 4, 2025

This app always starts wireless debugging at 5555. However it doesn't have any option to manually set the fixed port. https://www.apkmirror.com/apk/metactrl/wifi-adb-debug-over-air/

I think this is because apps like this use the protocol of wireless adb, but start and manage the daemon themselves. Here's a similar app by the developer of Shizuku:

https://github.com/RikkaApps/WADB

It enables wireless debugging on devices running older versions of Android, by manually implementing the wireless protocol. Since the implementation is their own, they are free to start it on whatever port they wish to.

My application, on the other hand, is just a shortcut, that triggers system properties and switches to start and manage the system-provided wireless adb implementation. This approach is much more limiting, but it is the intent of the app - to be just a handy shortcut.

As far as I remember, when the option to start wireless adb is triggered, the adb manager class refers to the system to allocate a port. Thus, the only thing I can do is hook into the system process somehow, but this will require a much stronger integration and will be much more vendor-dependent. So, ever if WADBS will someday gain such ability, it will most likely require root, because the only thing Shizuku allows is to use system protected APIs, not to hook into how they behave.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Requesting a feature
Projects
None yet
Development

No branches or pull requests

4 participants