Category PS4 CFW and Hacks       Thread starter PSXHAX       Start date Feb 23, 2020 at 12:26 PM       1,820       2            
Since covering the PyPS4Controller Linux Module in development, this weekend mrasband made available a Golang Library based on the Go Programming Language designed at Google to read PS4 DualShock 4 (DS4) Controller evdev events for Linux developers. 🤓

Download: ps4-master.zip / GIT

From the README.md to quote: A golang library to read from a PlayStation 4 controller. This uses evdev, so it is Linux only.

Usage
Code:
pacakge main

import (
    "context"
    "fmt"

    "github.com/mrasband/ps4"
)

func main() {
    inputs, err := ps4.Discover()
    if err != nil {
        fmt.Printf("Error discovering controller: %s\n", err)
        os.Exit(1)
    }

    var device *ps4.Input
    for _, input := range inputs {
        if input.Type == ps4.Controller {
            device = input
            break
        }
    }

    ctx, cancel := context.WithCancel(context.Background())
    defer cancel()

    events, _ := ps4.Watch(ctx, device)
    for e := range events {
        fmt.Printf("%+v\n", e)
    }
}
Development

Any of the _string.go files are generated by go generate.
Download: PS4 PSXIta Arch Linux Theme.rar (12.1 MB)
Golang Library to Read PS4 Controller Evdev Events by Mrasband.jpg
 

Comments

Recent Articles
Windbound Sails to PlayStation 4 on August 28th, PS4 Trailer Video
The forbidden islands are calling survival adventure fans eager to unravel the mystery as Windbound from 5 Lives Studios sets sail on PlayStation 4 this August 28th. 🌊 ⛵ 🔎 Prepare to explore...
PS Store Spring Sale Offers Savings Up to Half Off Select PSN Titles
The latest PlayStation Store sale is here featuring savings of up to 50% off select PS4 games and movies including Death Stranding, NBA 2K20, Dragon Ball Z: Kakarot and more! 🤩 PlayStation...
Rebug 4.86.1 LITE PS3 CFW with Cobra 8.2 and Toolbox 2.03.04
A few days back Sony released PS3 Firmware 4.86, and following their previous release today the Rebug Team made available Rebug 4.86.1 LITE (CEX) PS3 CFW with Cobra 8.2 and Toolbox 2.03.04 for...
Sony Unveils PlayStation Plus Free Games for April 2020
It's officially 4/20 all month, and today Sony officially unveiled the free PlayStation Plus games for April 2020 alongside a PS Plus preview trailer video below! 🌺🌼🌸 Headlining the free...
Top