]> git.eshelyaron.com Git - emacs.git/commitdiff
* net/tramp-adb.el (tramp-adb-maybe-open-connection): Check
authorMichael Albinus <michael.albinus@gmx.de>
Sat, 22 Dec 2012 13:44:06 +0000 (14:44 +0100)
committerMichael Albinus <michael.albinus@gmx.de>
Sat, 22 Dec 2012 13:44:06 +0000 (14:44 +0100)
properties of remote device.  Restart connection, if there is a
change.

lisp/ChangeLog
lisp/net/tramp-adb.el

index 5e26ee1fca15ec1a0ee2c93d88cbfbd361444d15..c256c7f817998d4b9fa1bdf750e690249d1409ff 100644 (file)
@@ -1,3 +1,9 @@
+2012-12-22  Michael Albinus  <michael.albinus@gmx.de>
+
+       * net/tramp-adb.el (tramp-adb-maybe-open-connection): Check
+       properties of remote device.  Restart connection, if there is a
+       change.
+
 2012-12-21  Chong Yidong  <cyd@gnu.org>
 
        * sort.el (sort-subr): Doc fix (Bug#13056).
index 261c65ffdae75f914865e1e49add4a23c2ec2e30..b500b1bba613e3208068d5be4e54d71f580a9ef0 100644 (file)
@@ -982,7 +982,31 @@ connection if a previous connection has died for some reason."
            (tramp-adb-wait-for-output p)
            (unless (eq 'run (process-status p))
              (tramp-error  vec 'file-error "Terminated!"))
-           (set-process-query-on-exit-flag p nil)))))))
+           (set-process-query-on-exit-flag p nil)
+
+           ;; Check whether the properties have been changed.  If
+           ;; yes, this is a strong indication that we must expire all
+           ;; connection properties.  We start again.
+           (tramp-message vec 5 "Checking system information")
+           (tramp-adb-send-command
+            vec "echo \\\"`getprop ro.product.model` `getprop ro.product.version` `getprop ro.build.version.release`\\\"")
+           (let ((old-getprop
+                  (tramp-get-connection-property vec "getprop" nil))
+                 (new-getprop
+                  (tramp-set-connection-property
+                   vec "getprop"
+                   (with-current-buffer (tramp-get-connection-buffer vec)
+                     ;; Read the expression.
+                     (goto-char (point-min))
+                     (read (current-buffer))))))
+             (when (and (stringp old-getprop)
+                        (not (string-equal old-getprop new-getprop)))
+               (tramp-cleanup vec)
+               (tramp-message
+                vec 3
+                "Connection reset, because remote host changed from `%s' to `%s'"
+                old-getprop new-getprop)
+               (tramp-adb-maybe-open-connection vec)))))))))
 
 (provide 'tramp-adb)
 ;;; tramp-adb.el ends here