Started CLI implementation of USB gadget settings

This commit is contained in:
mame82
2018-05-04 13:44:04 +00:00
parent 796a5e5ba8
commit 064ac0edb7
6 changed files with 202 additions and 58 deletions
+7 -9
View File
@@ -19,6 +19,13 @@ var ledCmd = &cobra.Command{
var ledGetCmd = &cobra.Command{
Use: "get",
Short: "Get LED blink count",
Run: func(cmd *cobra.Command, args []string) {
if ls, err := ClientGetLED(StrRemoteHost, StrRemotePort); err == nil {
fmt.Printf("LED blink count %v\n", ls.BlinkCount)
} else {
log.Println(err)
}
},
}
var ledSetCmd = &cobra.Command{
@@ -44,14 +51,5 @@ func init() {
ledCmd.AddCommand(ledGetCmd)
ledCmd.AddCommand(ledSetCmd)
// Here you will define your flags and configuration settings.
// Cobra supports Persistent Flags which will work for this command
// and all subcommands, e.g.:
// usbCmd.PersistentFlags().String("foo", "", "A help for foo")
// Cobra supports local flags which will only run when this command
// is called directly, e.g.:
// usbCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
ledSetCmd.Flags().Uint32Var(&blink_count,"blink", 0,"Set blink count (0: Off, 1..254: blink n times, >254: On)")
}