Skip to content

Commit

Permalink
add small application which enumerates the hid devices
Browse files Browse the repository at this point in the history
  • Loading branch information
bearsh committed Sep 2, 2024
1 parent d869d37 commit dbd6f0d
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cmd/hid-enum/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/hid-enum
/hid-enum.exe
33 changes: 33 additions & 0 deletions cmd/hid-enum/hid_enum.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package main

import (
"flag"
"fmt"

"github.com/bearsh/hid"
)

var (
vid = flag.Int("vid", 0, "USB VID")
pid = flag.Int("pid", 0, "USB PID")
)

func main() {
flag.Parse()

d := hid.Enumerate(uint16(*vid), uint16(*pid))

for _, i := range d {
fmt.Printf("- Path: %v\n", i.Path)
fmt.Printf(" VendorID: %v\n", i.VendorID)
fmt.Printf(" ProductID: %v\n", i.ProductID)
fmt.Printf(" Release: %v\n", i.Release)
fmt.Printf(" Serial: %v\n", i.Serial)
fmt.Printf(" Manufacturer: %v\n", i.Manufacturer)
fmt.Printf(" Product: %v\n", i.Product)
fmt.Printf(" UsagePage: %v\n", i.UsagePage)
fmt.Printf(" Usage: %v\n", i.Usage)
fmt.Printf(" Interface: %v\n", i.Interface)
fmt.Printf(" BusType: %v\n", i.BusType)
}
}

0 comments on commit dbd6f0d

Please sign in to comment.