anchor.diff:               (if str
                    (progn
                      (format t "wait shell success~%")
  +                   (sleep 1)
                      (return str))
                    (progn
                      (setq timeout (- timeout 1))
  
positive.code:         (format t "no shell found~%")
          (return-from run nil)))))
  
  (defun power-callback (serial str result fail-result)
    (format t "Machine shut down~%"))
  
  
negative.code:     (setq *wdt-reset* t)
      (format t "wdt reset found~%")))
  
  (defun bootfinish-callback (serial str result fail-result)
    (format t "Machine shell start~%")
    (serial-run serial "su" "shell@gladiator:/ #" "shell@gladiator:/ $" 60)
    (serial-run serial "getprop | grep dev.bootcomplete" result fail-result 60)
    (format t "Now do reboot machine~%")
    (serial-run-wait serial "svc power shutdown" "" "shell@gladiator:/ #"))
  
  (defun mboot-callback (serial str result fail-result)
    (serial-force-output serial "reset"))
  
  (defvar *list-command*
    (list
     (cons (list "Power down" "Power down" nil) 'power-callback)
     (cons (list "<< MStar >>#" "<< MStar >>#" nil) 'mboot-callback)
     (cons (list "Booting Linux" "Booting Linux" nil) 'startup-callback)
     (cons (list "wdt_reset = "  "wdt_reset = 0" "wdt_reset = 1") 'wdt-detect)
     (cons (list "shell@gladiator:/ " "[dev.bootcomplete]: [1]" "1|shell@gladiator:/ #") 'bootfinish-callback)
     ))
  
  ;; (setq *list-command* (list
  ;;    (cons (list "Power down" "Power down" nil) 'power-callback)
  ;;    (cons (list "<< MStar >>#" "<< MStar >>#" nil) 'mboot-callback)
  ;;    (cons (list "Booting Linux" "Booting Linux" nil) 'startup-callback)
  ;;    (cons (list "wdt_reset = "  "wdt_reset = 0" "wdt_reset = 1") 'wdt-detect)
  ;;    (cons (list "shell@gladiator:/ " "[dev.bootcomplete]: [1]" "1|shell@gladiator:/ #") 'bootfinish-callback)
  ;;    ))
  (defvar *list-string*
    (list "<< MStar >>#" "Emergency Remount" "Restarting system" "Power down" "Booting Linux" "wdt_reset = " "shell@gladiator:/ $"
           "shell@gladiator:/ #" "[dev.bootcomplete]: [1]" "1|shell@gladiator:/ #"))
  
  ;; (setq *list-string* (list "<< MStar >>#" "Emergency Remount" "Restarting system" "Power down" "Booting Linux" "wdt_reset = " "shell@gladiator:/ $"
  ;;          "shell@gladiator:/ #" "[dev.bootcomplete]: [1]" "1|shell@gladiator:/ #"))
  
  (defvar *filter-string*
    (list "su" "getprop" "grep" "svc power"))
  
  (defun serial-loop (serial)
    (let ((str (serial-log-get -1)))
  