[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Enable adb port in tramp adb

From: Ashi
Subject: Re: Enable adb port in tramp adb
Date: Mon, 3 Nov 2014 19:04:38 +0800

Hi, Michael,

On Mon, Nov 3, 2014 at 4:55 PM, Michael Albinus <address@hidden> wrote:
Ashi <address@hidden> writes:

> Hi, Michael,

Hi Zhongwei,

> adb has 2 kinds of connection:
> - connected by USB, and adb devices will list a serial No., like in
> your case:
> 3335F075A13600EC device
> - connected by TCPIP, and adb devices will list IP address + PORT,
> e.g.:
> device
> you can switch to this by running "adb tcpip" if your device have a
> network interface, and then run "adb connect IP_ADDRESS" to connect to
> your device. There are more details in this page:
> So in your case, there is no need to add port number in the path. It
> should be "/adb:3335F075A13600EC:". The port number is only needed
> when connected by TCPIP.

I'm not an adb expert, as you might have discovered already. However,
reading all the instructions I would conclude:

- If adb is in usb mode, port numbers are not applicable. Shouldn't we
  discover this? Or should we switch to tcpip mode, whenever a port
  number is specified in the remote file name?
 Yes, agree. I think we can make tramp inform user that if it is in USB mode, user should not add port number and if it is in TCPIP mode, user should not specify port number. What do you think?

 And switching to tcpip mode may not available in some case, e.g. the device has not enable wifi. And in my experience,  USB mode is more reliable compared with TCPIP mode. TCPIP mode is not very stable especially it is connected by weak wifi signal. So when possible, I always prefer USB mode.

- If adb is in tcpip mode, a user *must* specify the port number
  according to your patch. Otherwise, the ip address wouldn't be
  detected by `tramp-adb-parse-device-names', because "adb devices"
  lists all devices with their respective port number. This sounds
Should we add a default port number here, such as 5555?

> diff --git a/test/tramp-tests.el b/test/tramp-tests.el
> index 864a43d..5ea0291 100644
> --- a/test/tramp-tests.el
> +++ b/test/tramp-tests.el
> @@ -1165,7 +1165,8 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
>         (skip-unless (set-file-times tmp-name1 '(0 1)))
>         ;; Dumb remote shells without perl(1) or stat(1) are not
>         ;; able to return the date correctly.  They say "don't know".
> -       (unless (equal (nth 5 (file-attributes tmp-name1)) '(0 0))
> +       (unless (or (equal (nth 5 (file-attributes tmp-name1)) '(0 0))
> +                      (equal (nth 4 (file-attributes tmp-name1)) '(0 0)))
>           (should (equal (nth 5 (file-attributes tmp-name1)) '(0 1)))
>           (write-region "bla" nil tmp-name2)
>           (should (file-exists-p tmp-name2))

I'm thinking about whether this is the best solution. In fact, this
masks only a problem, I believe.

You have said, that after applying

(set-file-times "/adb:" '(0 1))

you get

(file-attributes "/adb:")

=> (nil 1 0 0 (0 0) (-948638 13211) (0 0) 3 "-rw-rw-rw-" t 1 (-1 . 6))

which is obviously wrong. And on adb shell level, there is

-rw-rw-rw- root root 3 -001-12-01 00:00 tramp-test12242_Hq

Shouldn't it be better that we investigate, why `set-file-times' behaves that
strange? It doesn't happen, when I test with my Nexus S (running Android 4.1).
Agree, I will try to take a deep look at it.

Best regards,

> Best regards,
> Zhongwei

Best regards, Michael.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]