mirror of
https://github.com/sipeed/NanoKVM.git
synced 2026-09-11 00:22:56 -05:00
Add an MCP Streamable HTTP server with token authentication, screenshot capture, keyboard, and mouse tools. Introduce shared control-mode and input-control coordination so MCP, PicoClaw, and local HID paths serialize ownership safely. Integrate PicoClaw gateway/runtime control handoff with PID-managed startup and focused unit coverage.
31 lines
595 B
Go
31 lines
595 B
Go
package hid
|
|
|
|
type QueuedReport struct {
|
|
Data []byte
|
|
Execute func(func() error) error
|
|
Complete func(bool)
|
|
ResetKeyboard func()
|
|
ResetRelativeMouse func()
|
|
ResetAbsoluteMouse func()
|
|
}
|
|
|
|
func (r QueuedReport) run(write func() error) error {
|
|
if r.Execute != nil {
|
|
return r.Execute(write)
|
|
}
|
|
return write()
|
|
}
|
|
|
|
func (r QueuedReport) complete(success bool) {
|
|
if r.Complete != nil {
|
|
r.Complete(success)
|
|
}
|
|
}
|
|
|
|
func runCleanup(execute func(func() error) error, write func() error) error {
|
|
if execute != nil {
|
|
return execute(write)
|
|
}
|
|
return write()
|
|
}
|