tramp-devel
[Top][All Lists]
Advanced

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

Re: Enable adb port in tramp adb


From: Michael Albinus
Subject: Re: Enable adb port in tramp adb
Date: Fri, 16 Jan 2015 16:50:35 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Zhongwei Yao <address@hidden> writes:

> Hi, Michael,

Hi Zhongwei,

>     - I have rewritten tramp-adb-get-host-for-execution (new name is
>     tramp-adb-get-device) in order to simplify it. Works for me, but
>     I'm
>     not sure whether it is OK for all use cases. Please check!
>
> I've checked the "try connect" feature, by visit:
> /adb:192.168.1.127#5555:, and find tramp will try to connect:
> 192.168.1.127#5555:5555, and end with failure. Do you have similar
> issue? 

Well, likely we shall do (untested):

    ...
    (let* ((method (tramp-file-name-method vec))
           (host (tramp-file-name-host vec))
           (real-host (tramp-file-name-real-host vec))
           (port (tramp-file-name-port vec))
           (devices (mapcar 'cadr (tramp-adb-parse-device-names nil))))
      (replace-regexp-in-string
       tramp-prefix-port-format ":"
       (cond ((member host devices) host)
             ;; This is the case when the host is connected to the default port.
             ((member (format "%s%s%d" real-host tramp-prefix-port-format port)
                      devices)
              (format "%s:%d" real-host port))
             ;; An empty host name shall be mapped as well, when there
             ;; is exactly one entry in `devices'.
             ((and (zerop (length real-host)) (= (length devices) 1))
              (car devices))
             ;; Try to connect device.
             ((and tramp-adb-connect-if-not-connected
                   (not (zerop (length real-host)))
                   (tramp-adb-execute-adb-command
                    vec "connect" (format "%s:%d" real-host port)))
              (format "%s:%d" real-host port))
             (t (tramp-error
                 vec 'file-error "Could not find device %s" host)))))))

> And the comment in tramp-adb-get-device function is not correct now, I
> think we can just remove them:

Of course. Remove it, or write something else. I was too lazy doing this.

>     I would need ChangeLog entries from you.
>
> What kind of ChangeLog should I provide? Is it similar like the commit
> message? Like:
> Enable adb access with port format, e.g. /adb:164.2.168.1#5555:/

See lisp/ChangeLog.

> Thanks!
> Zhongwei

Best regards, Michael.



reply via email to

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