cwwang2 / androidscreencast

Automatically exported from code.google.com/p/androidscreencast
0 stars 1 forks source link

ADB over Wifi: view mode only (mouse & keyboard does not work) #83

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Device name                         : Samsung Transform Ultra (SPH-M930BST)
Device rooted (yes/no)              : YES
Device OS version (1.5/1.6/2.0,...) : Gingerbread.EG29
Linux localhost 2.6.35.7-perf #2 PREEMPT Fri Jul 29 2011 armv7l GNU/Linux

Computer OS and version (Mac,Win,Linux,...)    : Windows Professional 64-bit
Computer CPU/Memory                            : Intel i5 / 8GB
Java version (java -version from command line) : java version "1.7.0_01"
ADB version (adb version from command line)    : ADB version 1.0.26
AndroidScreencast version                      : Revision 41

Since the current version of AndroidScreencast I have, works through USB, this 
signifies /data/dalvik-cache has been chmod'ed.

What steps will reproduce the problem?
1.  Install adbWireless through Android Market
2.  Turn on Wifi
3.  Start adbWireless
4.  Tap green button in adbWireless.
5.  adbWireless returns IP:port for the connection
6.  Command-line steps on PC:
    adb kill-server
    adb connect IP:port 
7.  Connection successful.
8.  Test adb connection via command-line step on PC:
    adb shell
9.  ADB is successfully running
10. Command-line step on PC:
    javaws androidscreencast.jnlp
11. Screencast connects and displays phone screen. It also displays updated 
screen normally.
12. Click "Home" button.
13. Null Exception dialog opens up and displays error:

java.lang.NullPointerException 
at 
net.srcz.android.screencast.api.injector.Injector.connectToAgent(Injector.java:1
95)
at net.srcz.android.screencast.api.injector.Injector.init(Injector.java:175)
at net.srcz.android.screencast.api.injector.Injector.access$0(Injector.java:155)
at net.srcz.android.screencast.api.injector.Injector$1.run(Injector.java:26)

14. See attached jpg for snapshot of error.
15. Screencast is totally unresponsive to any mouse click or keyboard entry.

Resolving this issue would make AndroidScreencast even more useful and popular.

Thank you,
Edward P.

Original issue reported on code.google.com by aiprag...@gmail.com on 30 Oct 2011 at 12:18

Attachments:

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
In order to eliminate this error, I would suggest this one line change, but it 
might expose others afterwards:

ORIGINAL CODE:

    private void connectToAgent() {
        for (int i = 0; i < 10; i++) {
            try {
                s = new Socket("127.0.0.1", PORT);
                break;
            } catch (Exception s) {
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    return;
                }
            }
        }
        System.out.println("Desktop => device socket connected");
        screencapture.start();
        try {
            os = s.getOutputStream();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

MODIFIED CODE:

    private void connectToAgent() {
        for (int i = 0; i < 10; i++) {
            try {
                s = new Socket("127.0.0.1", PORT);
                break;
            } catch (Exception s) {
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    return;
                }
            }
        }
        System.out.println("Desktop => device socket connected");
        screencapture.start();
        try {
            // Eliminate null exception
            if (s != null)
               os = s.getOutputStream();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

Original comment by aiprag...@gmail.com on 1 Nov 2011 at 8:25

GoogleCodeExporter commented 9 years ago
Downloaded source through git;
Installed Eclipse Classic;
Added ADT plugin;
Imported AndroidScreencast project;
Ran it debug mode;
It generated the following error which the standalone app does not generate the 
top four lines;

53:40 E/adb-forward: Device rejected command: unknown host service
java.io.IOException: Device rejected command: unknown host service
    at com.android.ddmlib.AdbHelper.createForward(AdbHelper.java:513)
    at com.android.ddmlib.Device.createForward(Device.java:302)
    at net.srcz.android.screencast.api.injector.Injector.init(Injector.java:157)
    at net.srcz.android.screencast.api.injector.Injector.access$0(Injector.java:155)
    at net.srcz.android.screencast.api.injector.Injector$1.run(Injector.java:26)

I searched the web for "Device rejected command: unknown host service" and 
found the following website:
https://wiki.linaro.org/Platform/Android/AndroidScreencast

It talked about using adb through USB and ethernet, but ethernet you have to 
set the environment variable ADBHOST=IP  (Ethernet's DHCP IP)
I did the same thing for "ADB over wireless", and it worked.

The code changes I suggested in the previous comment...I would not follow 
through with, because what happens is that the exception (error) is not 
generated, and what it comes back with in debug mode is "Injector is not 
running yet...". 

As far as I'm concerned this is no longer an issue.

Original comment by aiprag...@gmail.com on 1 Nov 2011 at 8:27