Skip to content

frifox/ds5

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published