modulepackage
0.0.0-20240329191845-6aed4a0a4652
Repository: https://github.com/frifox/ds5.git
Documentation: pkg.go.dev
# README
DualSense in Go
Heavily based on the official hid-playstation linux kernel driver.
Linux / MacOS
- This package uses sstallion/go-hid which provides Go bindings for hidapi.
- hidapi is a multi-platform C library for interfacing with USB/BT HID-Class devices.
- Linux:
apt-get install libhidapi-dev libudev-dev
- MacOS:
brew install hidapi
- on arm64 you may need to manually symlink headers/libs:
sudo ln -s /opt/homebrew/include/hidapi /usr/local/include/
sudo ln -s /opt/homebrew/lib/libhidapi* /usr/local/lib/
- Windows: I don't have one to test...
Usage
For working examples, check examples folder.
package main
import (
"fmt"
"github.com/frifox/ds5"
)
func main() {
dev := ds5.Device{}
if err := dev.Find(); err != nil {
fmt.Printf("Couldn't find DS5: %v\n", err)
return
}
dev.Buttons.Square.OnKeyDown = func() {
fmt.Printf("Square pressed\n")
dev.LightBar.SetRed()
dev.ApplyProps()
}
dev.Buttons.Square.OnKeyUp = func() {
fmt.Printf("Square released\n")
dev.LightBar.SetGreen()
dev.ApplyProps()
}
fmt.Printf("Watching DS5 for events\n")
go dev.Run()
<- dev.Done()
fmt.Printf("DS5 disappeared\n")
}
More info?
See docs/input.md & docs/output.md
# Packages
No description provided by the author
# Functions
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
ref: https://github.com/torvalds/linux/blob/master/drivers/hid/hid-playstation.c# ref:L445.
# Constants
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
hid-playstation.c doesn't use this constant?.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Structs
Accel is how much gravity is pulling on an axis, axis in-line with gravity = 1 or -1 axis perpendicular with gravity = 0.
No description provided by the author
Axis values -1 to 1.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
LightBar values 0 to 255.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Rumble values are 0 to 255.
No description provided by the author
No description provided by the author
Touchpad points are across 1920 x 1080 plane.
No description provided by the author
# Interfaces
No description provided by the author