|
@@ -152,7 +152,6 @@ func ReadRune(d *Door, runeread *bufio.Reader, timeout bool) {
|
|
}
|
|
}
|
|
|
|
|
|
func process(d *Door, newRune bool) {
|
|
func process(d *Door, newRune bool) {
|
|
- // This is like GetKey
|
|
|
|
var rlen int
|
|
var rlen int
|
|
var r, r2 rune
|
|
var r, r2 rune
|
|
var has2 bool
|
|
var has2 bool
|
|
@@ -236,56 +235,89 @@ func process(d *Door, newRune bool) {
|
|
}
|
|
}
|
|
|
|
|
|
if has2 {
|
|
if has2 {
|
|
|
|
+ doorwayMap := map[rune]Extended{'\x50': DOWN_ARROW,
|
|
|
|
+ '\x48': UP_ARROW,
|
|
|
|
+ '\x4b': LEFT_ARROW,
|
|
|
|
+ '\x4d': RIGHT_ARROW,
|
|
|
|
+ '\x47': HOME,
|
|
|
|
+ '\x4f': END,
|
|
|
|
+ '\x49': PAGE_UP,
|
|
|
|
+ '\x51': PAGE_DOWN,
|
|
|
|
+ '\x3b': F1,
|
|
|
|
+ '\x3c': F2,
|
|
|
|
+ '\x3d': F3,
|
|
|
|
+ '\x3e': F4,
|
|
|
|
+ '\x3f': F5,
|
|
|
|
+ '\x40': F6,
|
|
|
|
+ '\x41': F7,
|
|
|
|
+ '\x42': F8,
|
|
|
|
+ '\x43': F9,
|
|
|
|
+ '\x44': F10,
|
|
|
|
+ '\x45': F11,
|
|
|
|
+ '\x46': F12,
|
|
|
|
+ '\x52': INSERT,
|
|
|
|
+ '\x53': DELETE,
|
|
|
|
+ }
|
|
|
|
+
|
|
ArrayPop(&readerBuffer, 2)
|
|
ArrayPop(&readerBuffer, 2)
|
|
- switch r2 {
|
|
|
|
- case '\x50':
|
|
|
|
- d.readerChannel <- ReaderData{0, DOWN_ARROW, nil}
|
|
|
|
- case '\x48':
|
|
|
|
- d.readerChannel <- ReaderData{0, UP_ARROW, nil}
|
|
|
|
- case '\x4b':
|
|
|
|
- d.readerChannel <- ReaderData{0, LEFT_ARROW, nil}
|
|
|
|
- case 0x4d:
|
|
|
|
- d.readerChannel <- ReaderData{0, RIGHT_ARROW, nil}
|
|
|
|
- case 0x47:
|
|
|
|
- d.readerChannel <- ReaderData{0, HOME, nil}
|
|
|
|
- case 0x4f:
|
|
|
|
- d.readerChannel <- ReaderData{0, END, nil}
|
|
|
|
- case 0x49:
|
|
|
|
- d.readerChannel <- ReaderData{0, PAGE_UP, nil}
|
|
|
|
- case 0x51:
|
|
|
|
- d.readerChannel <- ReaderData{0, PAGE_DOWN, nil}
|
|
|
|
- case 0x3b:
|
|
|
|
- d.readerChannel <- ReaderData{0, F1, nil}
|
|
|
|
- case 0x3c:
|
|
|
|
- d.readerChannel <- ReaderData{0, F2, nil}
|
|
|
|
- case 0x3d:
|
|
|
|
- d.readerChannel <- ReaderData{0, F3, nil}
|
|
|
|
- case 0x3e:
|
|
|
|
- d.readerChannel <- ReaderData{0, F4, nil}
|
|
|
|
- case 0x3f:
|
|
|
|
- d.readerChannel <- ReaderData{0, F5, nil}
|
|
|
|
- case 0x40:
|
|
|
|
- d.readerChannel <- ReaderData{0, F6, nil}
|
|
|
|
- case 0x41:
|
|
|
|
- d.readerChannel <- ReaderData{0, F7, nil}
|
|
|
|
- case 0x42:
|
|
|
|
- d.readerChannel <- ReaderData{0, F8, nil}
|
|
|
|
- case 0x43:
|
|
|
|
- d.readerChannel <- ReaderData{0, F9, nil}
|
|
|
|
- case 0x44:
|
|
|
|
- d.readerChannel <- ReaderData{0, F10, nil}
|
|
|
|
- case 0x45:
|
|
|
|
- d.readerChannel <- ReaderData{0, F11, nil}
|
|
|
|
- case 0x46:
|
|
|
|
- d.readerChannel <- ReaderData{0, F12, nil}
|
|
|
|
- case 0x52:
|
|
|
|
- d.readerChannel <- ReaderData{0, INSERT, nil}
|
|
|
|
- case 0x53:
|
|
|
|
- d.readerChannel <- ReaderData{0, DELETE, nil}
|
|
|
|
- default:
|
|
|
|
|
|
+ ext, has := doorwayMap[r2]
|
|
|
|
+ if has {
|
|
|
|
+ d.readerChannel <- ReaderData{0, ext, nil}
|
|
|
|
+ } else {
|
|
log.Printf("ERROR Doorway mode: 0x00 %x\n", r2)
|
|
log.Printf("ERROR Doorway mode: 0x00 %x\n", r2)
|
|
d.readerChannel <- ReaderData{0, UNKNOWN, nil}
|
|
d.readerChannel <- ReaderData{0, UNKNOWN, nil}
|
|
}
|
|
}
|
|
|
|
+ /*
|
|
|
|
+ switch r2 {
|
|
|
|
+ case '\x50':
|
|
|
|
+ d.readerChannel <- ReaderData{0, DOWN_ARROW, nil}
|
|
|
|
+ case '\x48':
|
|
|
|
+ d.readerChannel <- ReaderData{0, UP_ARROW, nil}
|
|
|
|
+ case '\x4b':
|
|
|
|
+ d.readerChannel <- ReaderData{0, LEFT_ARROW, nil}
|
|
|
|
+ case 0x4d:
|
|
|
|
+ d.readerChannel <- ReaderData{0, RIGHT_ARROW, nil}
|
|
|
|
+ case 0x47:
|
|
|
|
+ d.readerChannel <- ReaderData{0, HOME, nil}
|
|
|
|
+ case 0x4f:
|
|
|
|
+ d.readerChannel <- ReaderData{0, END, nil}
|
|
|
|
+ case 0x49:
|
|
|
|
+ d.readerChannel <- ReaderData{0, PAGE_UP, nil}
|
|
|
|
+ case 0x51:
|
|
|
|
+ d.readerChannel <- ReaderData{0, PAGE_DOWN, nil}
|
|
|
|
+ case 0x3b:
|
|
|
|
+ d.readerChannel <- ReaderData{0, F1, nil}
|
|
|
|
+ case 0x3c:
|
|
|
|
+ d.readerChannel <- ReaderData{0, F2, nil}
|
|
|
|
+ case 0x3d:
|
|
|
|
+ d.readerChannel <- ReaderData{0, F3, nil}
|
|
|
|
+ case 0x3e:
|
|
|
|
+ d.readerChannel <- ReaderData{0, F4, nil}
|
|
|
|
+ case 0x3f:
|
|
|
|
+ d.readerChannel <- ReaderData{0, F5, nil}
|
|
|
|
+ case 0x40:
|
|
|
|
+ d.readerChannel <- ReaderData{0, F6, nil}
|
|
|
|
+ case 0x41:
|
|
|
|
+ d.readerChannel <- ReaderData{0, F7, nil}
|
|
|
|
+ case 0x42:
|
|
|
|
+ d.readerChannel <- ReaderData{0, F8, nil}
|
|
|
|
+ case 0x43:
|
|
|
|
+ d.readerChannel <- ReaderData{0, F9, nil}
|
|
|
|
+ case 0x44:
|
|
|
|
+ d.readerChannel <- ReaderData{0, F10, nil}
|
|
|
|
+ case 0x45:
|
|
|
|
+ d.readerChannel <- ReaderData{0, F11, nil}
|
|
|
|
+ case 0x46:
|
|
|
|
+ d.readerChannel <- ReaderData{0, F12, nil}
|
|
|
|
+ case 0x52:
|
|
|
|
+ d.readerChannel <- ReaderData{0, INSERT, nil}
|
|
|
|
+ case 0x53:
|
|
|
|
+ d.readerChannel <- ReaderData{0, DELETE, nil}
|
|
|
|
+ default:
|
|
|
|
+ log.Printf("ERROR Doorway mode: 0x00 %x\n", r2)
|
|
|
|
+ d.readerChannel <- ReaderData{0, UNKNOWN, nil}
|
|
|
|
+ }
|
|
|
|
+ */
|
|
} else {
|
|
} else {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
@@ -437,6 +469,7 @@ func process(d *Door, newRune bool) {
|
|
if !newRune {
|
|
if !newRune {
|
|
// Yes, this is invalid.
|
|
// Yes, this is invalid.
|
|
ArrayPop(&readerBuffer, extlen)
|
|
ArrayPop(&readerBuffer, extlen)
|
|
|
|
+ // TODO: Save this somewhere.
|
|
log.Println("ERROR Extended:", extended)
|
|
log.Println("ERROR Extended:", extended)
|
|
d.readerChannel <- ReaderData{0, UNKNOWN, nil}
|
|
d.readerChannel <- ReaderData{0, UNKNOWN, nil}
|
|
} else {
|
|
} else {
|