Formatting and changelog updates. (#14)
Reviewed-on: https://codeberg.org/annabunches/joyful/pulls/14
This commit is contained in:
parent
7e4d4f3c20
commit
b80c5e3032
4 changed files with 24 additions and 19 deletions
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
- Add `hold` parameter for button-to-axis mappings.
|
- Add `hold` parameter for button-to-axis mappings.
|
||||||
|
- Add ability to set VendorId and ProductId on virtual devices.
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- Fixed possible crash when TTS is disabled. (thanks [Tsudico](https://codeberg.org/Tsudico))
|
- Fixed possible crash when TTS is disabled. (thanks [Tsudico](https://codeberg.org/Tsudico))
|
||||||
|
|
@ -11,7 +11,9 @@ type Config struct {
|
||||||
// TODO: configure custom unmarshaling so we can overload Buttons, Axes, and RelativeAxes...
|
// TODO: configure custom unmarshaling so we can overload Buttons, Axes, and RelativeAxes...
|
||||||
type DeviceConfigVirtual struct {
|
type DeviceConfigVirtual struct {
|
||||||
Name string
|
Name string
|
||||||
|
// VendorId is the uint16 vendor id, for default see internal/virtualdevice/variables.go
|
||||||
VendorId string `yaml:"vendor_id,omitempty"`
|
VendorId string `yaml:"vendor_id,omitempty"`
|
||||||
|
// DeviceId is the uint16 device id, for default see internal/virtualdevice/variables.go
|
||||||
DeviceId string `yaml:"device_id,omitempty"`
|
DeviceId string `yaml:"device_id,omitempty"`
|
||||||
Preset string
|
Preset string
|
||||||
NumButtons int `yaml:"num_buttons,omitempty"`
|
NumButtons int `yaml:"num_buttons,omitempty"`
|
||||||
|
|
|
||||||
|
|
@ -3,11 +3,12 @@ package virtualdevice
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
|
"strconv"
|
||||||
|
|
||||||
"git.annabunches.net/annabunches/joyful/internal/configparser"
|
"git.annabunches.net/annabunches/joyful/internal/configparser"
|
||||||
"git.annabunches.net/annabunches/joyful/internal/eventcodes"
|
"git.annabunches.net/annabunches/joyful/internal/eventcodes"
|
||||||
"git.annabunches.net/annabunches/joyful/internal/logger"
|
"git.annabunches.net/annabunches/joyful/internal/logger"
|
||||||
"github.com/holoplot/go-evdev"
|
"github.com/holoplot/go-evdev"
|
||||||
"strconv"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func ParseUInt16(s string, def uint16) uint16 {
|
func ParseUInt16(s string, def uint16) uint16 {
|
||||||
|
|
@ -50,11 +51,11 @@ func NewEventBuffer(config configparser.DeviceConfigVirtual) (*EventBuffer, erro
|
||||||
|
|
||||||
device, err := evdev.CreateDevice(
|
device, err := evdev.CreateDevice(
|
||||||
name,
|
name,
|
||||||
// TODO: placeholders. BusType = differentiate between input bus (3 = usb), Vendor = uint16 vendor id, Product: uint16 devoce id, Version = device version (differentiate between differing versions of exact same device)
|
|
||||||
evdev.InputID{
|
evdev.InputID{
|
||||||
|
// 3 specifies USB bus type
|
||||||
BusType: 0x03,
|
BusType: 0x03,
|
||||||
Vendor: ParseUInt16(config.VendorId, VirtualDeviceVendorId),
|
Vendor: ParseUInt16(config.VendorId, VirtualDeviceDefaultVendorId),
|
||||||
Product: ParseUInt16(config.DeviceId, VirtualDeviceDeviceId),
|
Product: ParseUInt16(config.DeviceId, VirtualDeviceDefaultDeviceId),
|
||||||
Version: 1,
|
Version: 1,
|
||||||
},
|
},
|
||||||
capabilities,
|
capabilities,
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,9 @@ const (
|
||||||
DevicePresetJoystick = "joystick"
|
DevicePresetJoystick = "joystick"
|
||||||
DevicePresetMouse = "mouse"
|
DevicePresetMouse = "mouse"
|
||||||
|
|
||||||
VirtualDeviceVendorId = 0x4711
|
// These defaults are taken or inferred from the go-evdev library
|
||||||
VirtualDeviceDeviceId = 0x0816
|
VirtualDeviceDefaultVendorId = 0x4711
|
||||||
|
VirtualDeviceDefaultDeviceId = 0x0816
|
||||||
VirtualDeviceMaxButtons = 74
|
VirtualDeviceMaxButtons = 74
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue