Fix max buttons
This commit is contained in:
parent
a2226b302d
commit
9a01087c73
4 changed files with 11 additions and 9 deletions
|
@ -82,9 +82,9 @@ func (parser *ConfigParser) ConnectPhysicalDevices() map[string]*evdev.InputDevi
|
|||
}
|
||||
|
||||
func makeButtons(numButtons int) []evdev.EvCode {
|
||||
if numButtons > 56 {
|
||||
numButtons = 56
|
||||
logger.Log("Limiting virtual device buttons to 56")
|
||||
if numButtons > VirtualDeviceMaxButtons {
|
||||
numButtons = VirtualDeviceMaxButtons
|
||||
logger.Logf("Limiting virtual device buttons to %d", VirtualDeviceMaxButtons)
|
||||
}
|
||||
|
||||
buttons := make([]evdev.EvCode, numButtons)
|
||||
|
|
|
@ -26,7 +26,7 @@ func makeRuleTargetButton(targetConfig RuleTargetConfig, devs map[string]*evdev.
|
|||
}
|
||||
|
||||
case strings.HasPrefix(buttonConfig, "0X"):
|
||||
codeInt, err := strconv.ParseUint(buttonConfig[2:], 16, 32)
|
||||
codeInt, err := strconv.ParseUint(buttonConfig[2:], 16, 0)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -147,6 +147,6 @@ func makeRuleTargetModeSelect(targetConfig RuleTargetConfig, allModes []string)
|
|||
}
|
||||
|
||||
// hasError exists solely to switch on errors in case statements
|
||||
func hasError(_ interface{}, err error) bool {
|
||||
func hasError(_ any, err error) bool {
|
||||
return err != nil
|
||||
}
|
||||
|
|
|
@ -15,6 +15,8 @@ const (
|
|||
RuleTypeModeSelect = "mode-select"
|
||||
RuleTypeAxisToButton = "axis-to-button"
|
||||
RuleTypeAxisToRelaxis = "axis-to-relaxis"
|
||||
|
||||
VirtualDeviceMaxButtons = 74
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -31,9 +33,9 @@ var (
|
|||
evdev.BTN_BASE4,
|
||||
evdev.BTN_BASE5,
|
||||
evdev.BTN_BASE6,
|
||||
evdev.EvCode(0x12c),
|
||||
evdev.EvCode(0x12d),
|
||||
evdev.EvCode(0x12e),
|
||||
evdev.EvCode(0x12c), // decimal 300
|
||||
evdev.EvCode(0x12d), // decimal 301
|
||||
evdev.EvCode(0x12e), // decimal 302
|
||||
evdev.BTN_DEAD,
|
||||
evdev.BTN_TRIGGER_HAPPY1,
|
||||
evdev.BTN_TRIGGER_HAPPY2,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue