Browse Source

Use /dev/input/by-id paths for gamepad so other USB input devices do not interfere

Douglas Thrift 10 months ago
parent
commit
97eaed9fed
1 changed files with 2 additions and 2 deletions
  1. 2 2
      rover/main.go

+ 2 - 2
rover/main.go

@@ -23,7 +23,7 @@ func main() {
 		systemd     bool
 	)
 
-	flag.StringVar(&device, "gamepad", "/dev/input/event0", "the gamepad device path")
+	flag.StringVar(&device, "gamepad", "usb-Logitech_Wireless_Gamepad_F710_9B0692E6-event-joystick", "the gamepad device id")
 	flag.StringVar(&listen, "listen", "localhost:8080", "the HTTP listen address and port")
 	flag.StringVar(&leftPort, "motor-left-port", "spi0.1:MC", "the left motor port")
 	flag.StringVar(&leftDriver, "motor-left-driver", "lego-nxt-motor", "the left motor driver")
@@ -37,7 +37,7 @@ func main() {
 		log.SetFlags(0)
 	}
 
-	g, err := gamepad.NewGamepad(device, gamepad.All)
+	g, err := gamepad.NewGamepad("/dev/input/by-id/"+device, gamepad.All)
 	if err != nil {
 		log.Fatalf("error creating gamepad: %v", err)
 	}