dwaan / homebridge-adb

Homebridge script to control remote ADB enabled Android device
MIT License
74 stars 14 forks source link

ADB plug in is installed but can't run it. Why? #19

Closed bartolini9 closed 3 years ago

bartolini9 commented 3 years ago

Hi there, I have a Homebridge (Orange PI platform), with plugin support web configuration Homebridge UI X on Windows 10 via Chrome. I have installed the plugin from you, but nothing is happening actually. I want to connect nVidia Shield TV BOX to Homebridge. In the log I can see: [12/16/2020, 7:08:24 PM] [HomebridgeADB] Can't connect to "nVidia Shield", with IP address: 192.168.1.160. Please check you ADB connection, or make sure your device is on and connected to the same network.

If I go to Terminal command and put "adb version then I see : homebridge@homebridge:/var/lib/homebridge$ adb version bash: adb: command not found

Is is something wrongly installed? Could pls help me? In the plugins I can see that the ADB plugin is installed. I am actually new one to this and still learning.

dwaan commented 3 years ago

Hey. You need to install ADB tools inside your homebridge server, there’s a handy how to in README.md that you can check in here. You can jump to the Prerequisite part. https://github.com/dwaan/homebridge-adb

bartolini9 commented 3 years ago

When I use the terminal and input the command:

sudo apt-get install android-tools-adb android-tools-fastboot

then it gives me: [sudo] password for homebridge:

I put my homebridge password (the correct one), and if press ENTER it is said:

Sorry, try again.

Here is my config: "platforms": [ { "name": "Config", "port": 8581, "auth": "form", "theme": "auto", "sudo": true, "tempUnits": "c", "lang": "en", "platform": "config"

Anything more I shall do?

dwaan commented 3 years ago

First, the homebridge run on top of Linux . The ADB tools installation is not part of the homebridge, it installed outside the homebridge, into the Linux. So the sudo command required you to enter your linux root password.

For example in raspberry pi, the root have default password “pi”, it’s different then your homebridge password. You can check your Linux distribution documentation for default root password.

bartolini9 commented 3 years ago

Ok I found it now and properly installed ADB.

But now when connecting there is said in the log: [12/17/2020, 1:16:53 PM] [HomebridgeADB] 192.168.1.160 - No response, please check your ADB connection [12/17/2020, 1:16:53 PM] [HomebridgeADB] 192.168.1.160 - NVIDIA SHIELD power is set to false

In the terminal I used some ADB commands and this is how it looks: homebridge@homebridge:/var/lib/homebridge$ adb connect 192.168.1.160 connected to 192.168.1.160:5555 homebridge@homebridge:/var/lib/homebridge$ adb kill-server homebridge@homebridge:/var/lib/homebridge$ adb connect 192.168.1.160 connected to 192.168.1.160:5555 homebridge@homebridge:/var/lib/homebridge$ adb -s 192.168.1.160:5555 shell "getprop ro.product.model" SHIELD Android TV

I had a pop-up on my Shield BOX about to allow a debug mode.

What I should do now? Many thanks.

dwaan commented 3 years ago

It should be all good now. Perhaps you can try to restart your Orange Pi first and see if it's working after that.

bartolini9 commented 3 years ago

Of course I tried that. Very strange. Still showing the same message.

dwaan commented 3 years ago

The only possible problem right now are:

  1. The ADB tools is not installed in the same machine as the Homebridge. If the homebridge was installed in virtual machine, make sure the ADB tools is inside the virtual machine also.
  2. The the device IP is incorrect or the device unreachable because various network problem. Make sure it's not network related problem.
  3. The popup dialog to allow debug mode inside the device haven't been accepted. Make sure to accept it. To make the dialog reappear again, go to Settings -> Device Preferences -> Developer options -> Revoke USB debugging authorizations, press OK, then restart your Homebridge. The popup dialog should reapear again now.
bartolini9 commented 3 years ago

ADB tools are installed on the same machine as Homebridge. IP is correct, I can access SHIELD from my PC by inputting the IP in the Network. All is accessible can copy to and from SHIELD the files. The debug mode in popup dialog has been accepted as well. Homebridge restarted.

I can't find the answer what happens.

dwaan commented 3 years ago

Please check the new version and see if working now or not.

bartolini9 commented 3 years ago

Hi there,

It's getting better but still some small issue is there. I have managed to add SHIELD to my Homekit app, there was a code displayed in Homebridge log, but in the Homekit app it says "device doesn't respond". I am getting this message in the log:

Problem when getting device power status. [12/29/2020, 3:44:56 PM] [HomebridgeADB] If your network works fine, please report this output. [12/29/2020, 3:44:56 PM] [HomebridgeADB] 1. When running this command [12/29/2020, 3:44:56 PM] [HomebridgeADB] adb -s 192.168.1.160 shell "dumpsys power | grep mHoldingDisplay" [12/29/2020, 3:44:56 PM] [HomebridgeADB] 2. Output: [12/29/2020, 3:44:56 PM] [HomebridgeADB] [12/29/2020, 3:44:56 PM] [HomebridgeADB] 3. Error output: [12/29/2020, 3:44:56 PM] [HomebridgeADB] error: device not found

When I run the commands in the terminal it says as below: homebridge@homebridge:/var/lib/homebridge$ adb -s 192.168.1.160 shell "dumpsys power | grep mHoldingDisplay" error: device not found homebridge@homebridge:/var/lib/homebridge$ adb -s 192.168.1.160:5555 shell "dumpsys power | grep mHoldingDisplay" mHoldingDisplaySuspendBlocker=true

Anything more?

dotWee commented 3 years ago

@bartolini9 looks like the missing port :5555 makes adb unable to find the device.

since calling adb with the pure ip doesn't work

homebridge@homebridge:/var/lib/homebridge$ adb -s 192.168.1.160 shell "dumpsys power | grep mHoldingDisplay"
error: device not found

but including the port seems to work

homebridge@homebridge:/var/lib/homebridge$ adb -s 192.168.1.160:5555 shell "dumpsys power | grep mHoldingDisplay"
mHoldingDisplaySuspendBlocker=true

maybe add :5555 when referencing your device ip.

also telling adb to always use port 5555 could also help. test it by executing adb tcpip 5555 and running your command above without naming the port (adb -s 192.168.1.160 shell "dumpsys power | grep mHoldingDisplay").

dwaan commented 3 years ago

Does the answer from @dotWee work for you, @bartolini9 ?