install features - usb fix
This commit is contained in:
parent
927a776d13
commit
3aca228498
@ -163,6 +163,9 @@ mkdir -p "$F/control/header"
|
||||
# ln -sf "$header_h" "$F/control/class/$s/h"
|
||||
# done
|
||||
|
||||
echo 0x0 >"$F/control/terminal/camera/default/bmControls" 2>/dev/null || true
|
||||
echo 0x0 >"$F/control/processing/default/bmControls" 2>/dev/null || true
|
||||
|
||||
# friendly label
|
||||
# mkdir -p "$F/control/header/strings/0x409"
|
||||
# echo "Lesavka UVC" >"$F/control/header/strings/0x409/label"
|
||||
|
||||
@ -124,6 +124,14 @@ impl Handler {
|
||||
did_cycle: AtomicBool::new(false),
|
||||
})
|
||||
}
|
||||
|
||||
async fn reopen_hid(&self) -> anyhow::Result<()> {
|
||||
let kb_new = open_with_retry("/dev/hidg0").await?;
|
||||
let ms_new = open_with_retry("/dev/hidg1").await?;
|
||||
*self.kb.lock().await = kb_new;
|
||||
*self.ms.lock().await = ms_new;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
/*──────────────── gRPC service ─────────────*/
|
||||
@ -280,7 +288,13 @@ impl Relay for Handler {
|
||||
) -> Result<Response<ResetUsbReply>, Status> {
|
||||
info!("🔴 explicit ResetUsb() called");
|
||||
match self.gadget.cycle() {
|
||||
Ok(_) => Ok(Response::new(ResetUsbReply { ok: true })),
|
||||
Ok(_) => {
|
||||
if let Err(e) = self.reopen_hid().await {
|
||||
error!("💥 reopen HID failed: {e:#}");
|
||||
return Err(Status::internal(e.to_string()));
|
||||
}
|
||||
Ok(Response::new(ResetUsbReply { ok: true }))
|
||||
}
|
||||
Err(e) => {
|
||||
error!("💥 cycle failed: {e:#}");
|
||||
Err(Status::internal(e.to_string()))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user