Capitalization

This commit is contained in:
lordwelch 2017-11-06 23:35:49 -07:00
parent ce7d8221cd
commit ae2e3acb41

14
main.go
View File

@ -15,8 +15,8 @@ import (
) )
type Key struct { type Key struct {
Modifier string // `json:"modifier"` Modifier string `json:"modifier"`
Decimal int // `json:"decimal"` Decimal int `json:"decimal"`
} }
type Keys map[string]Key type Keys map[string]Key
@ -53,7 +53,7 @@ func changeKeymap(r rune, keys map[string]Keys, args Args, hidg0 *os.File, curre
fmt.Println(args) fmt.Println(args)
kmap := args.ORDER[(*currentKeyMap)] kmap := args.ORDER[(*currentKeyMap)]
fmt.Println(kmap) fmt.Println(kmap)
for keys[kmap][string(r)].decimal != 0 { for keys[kmap][string(r)].Decimal != 0 {
Press([8]byte{LCTRL, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00}, hidg0) Press([8]byte{LCTRL, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00}, hidg0)
*currentKeyMap++ *currentKeyMap++
if *currentKeyMap == len(keys) { if *currentKeyMap == len(keys) {
@ -68,7 +68,7 @@ func main() {
hidg0 *os.File hidg0 *os.File
err error err error
keymapsF []os.FileInfo keymapsF []os.FileInfo
keys = interface{} //make(map[string]Keys) keys = make(map[string]Keys)
cfgPath = "./" //path.Join(os.Getenv("XDG_CONFIG_HOME"), "hid") cfgPath = "./" //path.Join(os.Getenv("XDG_CONFIG_HOME"), "hid")
stdin = bufio.NewReader(os.Stdin) stdin = bufio.NewReader(os.Stdin)
currentKeyMap int currentKeyMap int
@ -111,7 +111,6 @@ func main() {
} }
err = json.Unmarshal(content, &tmp) err = json.Unmarshal(content, &tmp)
fmt.Println(tmp)
if err != nil { if err != nil {
panic(err) panic(err)
} }
@ -121,6 +120,7 @@ func main() {
T.Close() T.Close()
} }
} }
fmt.Println(keys)
for { for {
var ( var (
r rune r rune
@ -134,8 +134,8 @@ func main() {
panic(err) panic(err)
} }
changeKeymap(r, keys, args, hidg0, &currentKeyMap) changeKeymap(r, keys, args, hidg0, &currentKeyMap)
_, err = fmt.Sscanf(keys[args.ORDER[currentKeyMap]][string(r)].modifier, "%b", flag) _, err = fmt.Sscanf(keys[args.ORDER[currentKeyMap]][string(r)].Modifier, "%b", flag)
binary.PutVarint(report[:], int64(keys[args.ORDER[currentKeyMap]][string(r)].decimal)) binary.PutVarint(report[:], int64(keys[args.ORDER[currentKeyMap]][string(r)].Decimal))
Press([8]byte{flag, 0, report[0], report[1], report[2], report[3], report[4], report[5]}, hidg0) Press([8]byte{flag, 0, report[0], report[1], report[2], report[3], report[4], report[5]}, hidg0)
} }