controller_linux_test.go 546 B

12345678910111213141516171819202122232425
  1. package controller
  2. import "testing"
  3. import "os"
  4. import "syscall"
  5. // import "fmt"
  6. const IN = "/dev/input/by-id/usb-0583_USB_2-axis_8-button_gamepad-event-joystick"
  7. func Test1(t * testing.T) {
  8. file , err := os.OpenFile(IN, syscall.O_RDWR, 0666)
  9. if err != nil {
  10. t.Errorf("Error OpenFile: %s\n", err)
  11. return
  12. }
  13. defer file.Close()
  14. version, err := GetDriverVersion(file)
  15. if err != nil {
  16. t.Errorf("Error GetDriverVersion: %s\n", err)
  17. return
  18. }
  19. t.Logf("GetDriverVersion: %d", version)
  20. }