hidraw

package module
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 2, 2025 License: 0BSD Imports: 4 Imported by: 0

README

hidraw

A Go library for discovering and interacting with HID (Human Interface Device) raw devices on Linux systems.

Overview

This library provides a simple interface to discover and access HID raw devices on Linux systems. It reads device information from /sys/class/hidraw and provides structured access to device properties.

Features

  • Discover all HID raw devices on the system
  • Access device properties including:
    • Driver information
    • HID ID
    • Device name
    • Physical location
    • Unique identifier
    • Modalias

Usage

package main

import (
    "fmt"
    "github.com/taigrr/hidraw"
)

func main() {
    // Get all HID raw devices
    devices := hidraw.Walk()
    
    // Print device information
    for _, device := range devices {
        fmt.Printf("Device: %s\n", device.PathName)
        fmt.Printf("  Driver: %s\n", device.DRIVER)
        fmt.Printf("  Name: %s\n", device.HID_NAME)
        fmt.Printf("  Physical: %s\n", device.HID_PHYS)
        fmt.Printf("  Unique ID: %s\n", device.HID_UNIQ)
    }
}

Device Information

The Hidraw struct provides the following fields:

  • PathName: Full device path (e.g., "/dev/hidraw0")
  • Path: Device name (e.g., "hidraw0")
  • DRIVER: Device driver name
  • HID_ID: HID device identifier
  • HID_NAME: Human-readable device name
  • HID_PHYS: Physical location of the device
  • HID_UNIQ: Unique device identifier
  • MODALIAS: Device modalias string

Requirements

  • Linux operating system
  • Go 1.16 or later
  • Access to /sys/class/hidraw directory

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Hidraw

type Hidraw struct {
	PathName string
	Path     string
	DRIVER   string
	HID_ID   string
	HID_NAME string
	HID_PHYS string
	HID_UNIQ string
	MODALIAS string
}

func Walk

func Walk() []Hidraw

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL