Compare commits

..

3 Commits

Author SHA1 Message Date
Marc Brooks 80e2881fe8
Merge a916a1629f into 8e27cd6b60 2025-08-22 23:19:37 +02:00
Marc Brooks a916a1629f
Add ability to track modifier state on the device
Remove LED sync source option and add keypress reporting while still working with devices that haven't been upgraded
We return the modifiers as the valid bitmask so that the VirtualKeyboard and InfoBar can represent the correct keys as down. This is important when we have strokes like Left-Control + Right-Control + Keypad-1 (used in switching KVMs and such).
Fix handling of modifier keys in client and also removed the extraneous resetKeyboardState.
Manage state to eliminate rerenders by judicious use of useMemo.
Centralized keyboard layout and localized display maps
Move keyboardOptions to useKeyboardLayouts
Added translations for display maps.
Add documentation on the legacy support.

Return the KeysDownState from keyboardReport
Clear out the hidErrorRollOver once sent to reset the keyboard to nothing down.
Handles the returned KeysDownState from keyboardReport
Now passes all logic through handleKeyPress.
If we get a state back from a keyboardReport, use it and also enable keypressReport because we now know it's an upgraded device.
Added exposition on isoCode management

Fix de-DE chars to reflect German E2 keyboard.
https://kbdlayout.info/kbdgre2/overview+virtualkeys

Ran go modernize
Morphs Interface{} to any
Ranges over SplitSeq and FieldSeq for iterating splits
Used min for end calculation remote_mount.Read
Used range 16 in wol.createMagicPacket
DID NOT apply the Omitempty cleanup.

Strong typed in the typescript realm.
Cleanup react state management to enable upgrading Zustand
2025-08-22 16:17:47 -05:00
Alex Ballas 8e27cd6b60
chore: ensure that rpc messages get processed sequentially and avoid phantom and repeated key presses (#744) 2025-08-22 20:15:46 +02:00
2 changed files with 14 additions and 13 deletions

View File

@ -284,10 +284,6 @@ function KeyboardWrapper() {
preventMouseUpDefault={true}
stopMouseDownPropagation={true}
stopMouseUpPropagation={true}
physicalKeyboardHighlight={true}
physicalKeyboardHighlightPreventDefault={true}
physicalKeyboardHighlightTextColor="black"
physicalKeyboardHighlightBgColor="lightblue"
/>
<div className="controlArrows">
@ -305,10 +301,6 @@ function KeyboardWrapper() {
preventMouseUpDefault={true}
stopMouseDownPropagation={true}
stopMouseUpPropagation={true}
physicalKeyboardHighlight={true}
physicalKeyboardHighlightPreventDefault={true}
physicalKeyboardHighlightTextColor="black"
physicalKeyboardHighlightBgColor="lightblue"
/>
<Keyboard
baseClass="simple-keyboard-arrows"
@ -323,10 +315,6 @@ function KeyboardWrapper() {
preventMouseUpDefault={true}
stopMouseDownPropagation={true}
stopMouseUpPropagation={true}
physicalKeyboardHighlight={true}
physicalKeyboardHighlightPreventDefault={true}
physicalKeyboardHighlightTextColor="black"
physicalKeyboardHighlightBgColor="lightblue"
/>
</div>
{ /* TODO add optional number pad */ }

View File

@ -23,6 +23,7 @@ type Session struct {
HidChannel *webrtc.DataChannel
DiskChannel *webrtc.DataChannel
shouldUmountVirtualMedia bool
rpcQueue chan webrtc.DataChannelMessage
}
type SessionConfig struct {
@ -106,6 +107,12 @@ func newSession(config SessionConfig) (*Session, error) {
return nil, err
}
session := &Session{peerConnection: peerConnection}
session.rpcQueue = make(chan webrtc.DataChannelMessage, 256)
go func() {
for msg := range session.rpcQueue {
onRPCMessage(msg, session)
}
}()
peerConnection.OnDataChannel(func(d *webrtc.DataChannel) {
scopedLogger.Info().Str("label", d.Label()).Uint16("id", *d.ID()).Msg("New DataChannel")
@ -113,7 +120,8 @@ func newSession(config SessionConfig) (*Session, error) {
case "rpc":
session.RPCChannel = d
d.OnMessage(func(msg webrtc.DataChannelMessage) {
go onRPCMessage(msg, session)
// Enqueue to ensure ordered processing
session.rpcQueue <- msg
})
triggerOTAStateUpdate()
triggerVideoStateUpdate()
@ -189,6 +197,11 @@ func newSession(config SessionConfig) (*Session, error) {
if session == currentSession {
currentSession = nil
}
// Stop RPC processor
if session.rpcQueue != nil {
close(session.rpcQueue)
session.rpcQueue = nil
}
if session.shouldUmountVirtualMedia {
if err := rpcUnmountImage(); err != nil {
scopedLogger.Warn().Err(err).Msg("unmount image failed on connection close")