|
|
|
@ -15,7 +15,7 @@ const bufferLength = 32 |
|
|
|
|
func main() { |
|
|
|
|
device := flag.String("dev", "", "Keyboard device") |
|
|
|
|
vendor := flag.String("vendor", "", "Device vendor") |
|
|
|
|
serial := flag.String("serial", "", "Device id serial") |
|
|
|
|
model := flag.String("model", "", "Device id model") |
|
|
|
|
list := flag.Bool("list", false, "List input devices") |
|
|
|
|
connectorId := flag.Uint("connector", 0, "Connector id") |
|
|
|
|
timeout := flag.Int("timeout", 5, "Http timeout, sec") |
|
|
|
@ -32,7 +32,7 @@ func main() { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if len(*vendor) == 0 && len(*device) == 0 && len(*serial) == 0 && !*list { |
|
|
|
|
if len(*vendor) == 0 && len(*device) == 0 && len(*model) == 0 && !*list { |
|
|
|
|
flag.Usage() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -40,8 +40,8 @@ func main() { |
|
|
|
|
device = getDevByProperty(*vendor, "ID_VENDOR") |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if len(*serial) > 0 { |
|
|
|
|
device = getDevByProperty(*serial, "ID_SERIAL") |
|
|
|
|
if len(*model) > 0 { |
|
|
|
|
device = getDevByProperty(*model, "ID_MODEL") |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if device == nil || len(*device) == 0 { |
|
|
|
@ -87,9 +87,7 @@ func main() { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if sb.Len() > 0 { |
|
|
|
|
id := sb.String() |
|
|
|
|
log.Printf("Send '%s'", id) |
|
|
|
|
client.Send(id) |
|
|
|
|
client.Send(sb.String()) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|