Echo output when its used

This commit is contained in:
Taliesin Sisson 2015-11-07 17:07:40 +00:00
parent f8e3970d87
commit d1961b7c8e
2 changed files with 8 additions and 5 deletions

View File

@ -154,19 +154,19 @@ func scancodes(message string) []string {
var scancode []string var scancode []string
if strings.HasPrefix(message, "<wait>") { if strings.HasPrefix(message, "<wait>") {
log.Printf("Special code <wait> found, will sleep 1 second at this point.") //log.Printf("Special code <wait> found, will sleep 1 second at this point.")
scancode = []string{"wait"} scancode = []string{"wait"}
message = message[len("<wait>"):] message = message[len("<wait>"):]
} }
if strings.HasPrefix(message, "<wait5>") { if strings.HasPrefix(message, "<wait5>") {
log.Printf("Special code <wait5> found, will sleep 5 seconds at this point.") //log.Printf("Special code <wait5> found, will sleep 5 seconds at this point.")
scancode = []string{"wait5"} scancode = []string{"wait5"}
message = message[len("<wait5>"):] message = message[len("<wait5>"):]
} }
if strings.HasPrefix(message, "<wait10>") { if strings.HasPrefix(message, "<wait10>") {
log.Printf("Special code <wait10> found, will sleep 10 seconds at this point.") //log.Printf("Special code <wait10> found, will sleep 10 seconds at this point.")
scancode = []string{"wait10"} scancode = []string{"wait10"}
message = message[len("<wait10>"):] message = message[len("<wait10>"):]
} }
@ -174,7 +174,7 @@ func scancodes(message string) []string {
if scancode == nil { if scancode == nil {
for specialCode, specialValue := range special { for specialCode, specialValue := range special {
if strings.HasPrefix(message, specialCode) { if strings.HasPrefix(message, specialCode) {
log.Printf("Special code '%s' found, replacing with: %s", specialCode, specialValue) //log.Printf("Special code '%s' found, replacing with: %s", specialCode, specialValue)
scancode = specialValue scancode = specialValue
message = message[len(specialCode):] message = message[len(specialCode):]
break break
@ -200,7 +200,7 @@ func scancodes(message string) []string {
} }
scancode = append(scancode, fmt.Sprintf("%02x", scancodeInt+0x80)) scancode = append(scancode, fmt.Sprintf("%02x", scancodeInt+0x80))
log.Printf("Sending char '%c', code '%v', shift %v", r, scancode, keyShift) //log.Printf("Sending char '%c', code '%v', shift %v", r, scancode, keyShift)
} }
result = append(result, scancode...) result = append(result, scancode...)

View File

@ -783,6 +783,7 @@ param([string]$vmName, [string]$scanCodes)
$timeToWait = "1" $timeToWait = "1"
} }
write-host "Special code <wait> found, will sleep $timeToWait second(s) at this point."
Start-Sleep -s $timeToWait Start-Sleep -s $timeToWait
if ($scanCodesToSend){ if ($scanCodesToSend){
@ -796,8 +797,10 @@ param([string]$vmName, [string]$scanCodes)
$scanCodesToSend = '' $scanCodesToSend = ''
} else { } else {
if ($scanCodesToSend){ if ($scanCodesToSend){
write-host "Sending special code '$scanCodesToSend' '$scanCode'"
$scanCodesToSend = "$scanCodesToSend $scanCode" $scanCodesToSend = "$scanCodesToSend $scanCode"
} else { } else {
write-host "Sending char '$scanCode'"
$scanCodesToSend = "$scanCode" $scanCodesToSend = "$scanCode"
} }
} }