# Read-only: find the G903 LIGHTSPEED receiver (046D:C539) and read a few registers. Add-Type -Path (Join-Path $PSScriptRoot 'Hidpp.cs') $cols = [HidppReceiver]::Find('vid_046d&pid_c539') "Collections on 046D:C539:" $cols | ForEach-Object { " {0} page 0x{1:X4} usage 0x{2:X2} in {3} out {4}" -f $_.Path, $_.UsagePage, $_.Usage, $_.InLen, $_.OutLen } $rx = New-Object HidppReceiver (, $cols) try { "Opened:"; $rx.Describe() function Ask([byte[]]$req, [string]$label) { while ($rx.Next(0)) {} # drain $rx.Send($req) $deadline = (Get-Date).AddSeconds(2) while ((Get-Date) -lt $deadline) { $r = $rx.Next(200) if ($r -and $r[1] -eq 0xFF -and ($r[2] -eq $req[2] -or $r[2] -eq 0x8F)) { "{0,-28} -> {1}" -f $label, [HidppReceiver]::Hex($r); return } if ($r) { " (other) {0}" -f [HidppReceiver]::Hex($r) } } "{0,-28} -> no reply" -f $label } Ask ([byte[]](0x10,0xFF,0x81,0x00,0,0,0)) 'reg 0x00 notif flags' Ask ([byte[]](0x10,0xFF,0x81,0x02,0,0,0)) 'reg 0x02 connection state' Ask ([byte[]](0x10,0xFF,0x83,0xB5,0x03,0,0)) 'reg 0xB5/03 receiver info' Ask ([byte[]](0x10,0xFF,0x83,0xB5,0x20,0,0)) 'reg 0xB5/20 slot 1 pairing' Ask ([byte[]](0x10,0xFF,0x83,0xB5,0x40,0,0)) 'reg 0xB5/40 slot 1 name' } finally { $rx.Dispose() }