dfaa87994a
- USB-Input via evdev wird nur auf Linux gebaut (build tag linux) - Windows bekommt USB-Stub (build tag !linux) - Binaries: sportscore-linux-amd64 (ELF 64-bit), sportscore-windows-amd64.exe (PE32+) - Alle Tests bestanden
33 lines
788 B
Go
33 lines
788 B
Go
//go:build !linux
|
|
|
|
package usb
|
|
|
|
import (
|
|
"fmt"
|
|
)
|
|
|
|
// Keyboard represents an input device (keyboard).
|
|
// Non-Linux stub.
|
|
type Keyboard struct{}
|
|
|
|
// OpenFirstKeyboard opens the first available keyboard device.
|
|
// On non-Linux platforms, it always returns an error.
|
|
func OpenFirstKeyboard() (*Keyboard, error) {
|
|
return nil, fmt.Errorf("usb keyboard input is only supported on Linux")
|
|
}
|
|
|
|
// Close releases the keyboard device.
|
|
func (kb *Keyboard) Close() error {
|
|
return nil
|
|
}
|
|
|
|
// ReadKey reads the next key event from the keyboard.
|
|
func (kb *Keyboard) ReadKey() (*Key, error) {
|
|
return nil, fmt.Errorf("usb keyboard input is only supported on Linux")
|
|
}
|
|
|
|
// GetDeviceInfo returns information about the connected keyboard.
|
|
func (kb *Keyboard) GetDeviceInfo() string {
|
|
return "linux-only"
|
|
}
|