server fix

This commit is contained in:
Brad Stein 2025-06-18 23:46:32 -05:00
parent d8bbf40f38
commit 1212d9b1c1
2 changed files with 38 additions and 32 deletions

View File

@ -55,38 +55,43 @@ echo 0 > "$G/functions/hid.usb1/subclass"
echo 4 > "$G/functions/hid.usb1/report_length"
# 3 buttons, X, Y, Wheel → total 4 bytes
printf '\x05\x01' # Usage Page (Generic Desktop)
printf '\x09\x02' # Usage (Mouse)
printf '\xA1\x01' # Collection (Application)
printf '\x09\x01' # Usage (Pointer)
printf '\xA1\x00' # Collection (Physical)
printf '\x05\x09' # Usage Page (Button)
printf '\x19\x01' # Usage Min (1)
printf '\x29\x03' # Usage Max (3)
printf '\x15\x00' # Logical Min (0)
printf '\x25\x01' # Logical Max (1)
printf '\x95\x03' # Report Count (3)
printf '\x75\x01' # Report Size (1)
printf '\x81\x02' # Input (Data,Var,Abs) 3 button bits
printf '\x95\x01' # Report Count (1)
printf '\x75\x05' # Report Size (5)
printf '\x81\x03' # Input (Cnst,Var,Abs) 5 pad bits
printf '\x05\x01' # Usage Page (Generic Desktop)
printf '\x09\x30' # Usage (X)
printf '\x09\x31' # Usage (Y)
printf '\x15\x81' # Logical Min (-127)
printf '\x25\x7F' # Logical Max (127)
printf '\x75\x08' # Report Size (8)
printf '\x95\x02' # Report Count (2)
printf '\x81\x06' # Input (Data,Var,Rel) X, Y
printf '\x09\x38' # Usage (Wheel)
printf '\x15\x81' # Logical Min (-127)
printf '\x25\x7F' # Logical Max (127)
printf '\x75\x08' # Report Size (8)
printf '\x95\x01' # Report Count (1)
printf '\x81\x06' # Input (Data,Var,Rel) Wheel
printf '\xC0\xC0' # End collections
>"$G/functions/hid.usb1/report_desc"
# printf '\x05\x01' # Usage Page (Generic Desktop)
# printf '\x09\x02' # Usage (Mouse)
# printf '\xA1\x01' # Collection (Application)
# printf '\x09\x01' # Usage (Pointer)
# printf '\xA1\x00' # Collection (Physical)
# printf '\x05\x09' # Usage Page (Button)
# printf '\x19\x01' # Usage Min (1)
# printf '\x29\x03' # Usage Max (3)
# printf '\x15\x00' # Logical Min (0)
# printf '\x25\x01' # Logical Max (1)
# printf '\x95\x03' # Report Count (3)
# printf '\x75\x01' # Report Size (1)
# printf '\x81\x02' # Input (Data,Var,Abs) 3 button bits
# printf '\x95\x01' # Report Count (1)
# printf '\x75\x05' # Report Size (5)
# printf '\x81\x03' # Input (Cnst,Var,Abs) 5 pad bits
# printf '\x05\x01' # Usage Page (Generic Desktop)
# printf '\x09\x30' # Usage (X)
# printf '\x09\x31' # Usage (Y)
# printf '\x15\x81' # Logical Min (-127)
# printf '\x25\x7F' # Logical Max (127)
# printf '\x75\x08' # Report Size (8)
# printf '\x95\x02' # Report Count (2)
# printf '\x81\x06' # Input (Data,Var,Rel) X, Y
# printf '\x09\x38' # Usage (Wheel)
# printf '\x15\x81' # Logical Min (-127)
# printf '\x25\x7F' # Logical Max (127)
# printf '\x75\x08' # Report Size (8)
# printf '\x95\x01' # Report Count (1)
# printf '\x81\x06' # Input (Data,Var,Rel) Wheel
# printf '\xC0\xC0' # End collections
# >"$G/functions/hid.usb1/report_desc"
printf '\x05\x01\x09\x02\xa1\x01\x09\x01\xa1\x00'\
'\x05\x09\x19\x01\x29\x03\x15\x00\x25\x01\x95\x03\x75\x01\x81\x02'\
'\x95\x01\x75\x05\x81\x03'\
'\x05\x01\x09\x30\x09\x31\x09\x38\x15\x81\x25\x7f\x75\x08\x95\x03\x81\x06'\
'\xc0\xc0' >"$G/functions/hid.usb1/report_desc"
# # -- UAC2 Audio
# mkdir -p $G/functions/uac2.usb0

View File

@ -3,6 +3,7 @@
#![forbid(unsafe_code)]
use std::{io::ErrorKind, pin::Pin, sync::Arc, panic::AssertUnwindSafe};
use std::time::Duration;
use tokio::{fs::{File, OpenOptions}, io::AsyncWriteExt, sync::Mutex};
use tokio_stream::{wrappers::ReceiverStream, Stream, StreamExt};
use tonic::{transport::Server, Request, Response, Status};