mirror of https://github.com/jetkvm/kvm.git
refactor: revert unrelated USB gadget type changes
Remove int→int16 type signature changes from internal/usbgadget/ that were not essential to multi-session functionality. These changes should be part of a separate USB improvement PR. Changes: - Revert AbsMouseReport signature to use int instead of int16 - Remove int16 casts in hidrpc.go calling code - Update usb.go wrapper functions to match This keeps the multi-session PR focused on session management without coupling unrelated USB gadget refactoring.
This commit is contained in:
parent
846caf77ce
commit
9a10d3ed38
|
|
@ -69,7 +69,7 @@ func handleHidRPCMessage(message hidrpc.Message, session *Session) {
|
||||||
logger.Warn().Err(err).Msg("failed to get pointer report")
|
logger.Warn().Err(err).Msg("failed to get pointer report")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
rpcErr = rpcAbsMouseReport(int16(pointerReport.X), int16(pointerReport.Y), pointerReport.Button)
|
rpcErr = rpcAbsMouseReport(pointerReport.X, pointerReport.Y, pointerReport.Button)
|
||||||
case hidrpc.TypeMouseReport:
|
case hidrpc.TypeMouseReport:
|
||||||
if !session.HasPermission(PermissionMouseInput) {
|
if !session.HasPermission(PermissionMouseInput) {
|
||||||
logger.Debug().
|
logger.Debug().
|
||||||
|
|
|
||||||
|
|
@ -354,7 +354,7 @@ func (u *UsbGadget) UpdateKeysDown(modifier byte, keys []byte) KeysDownState {
|
||||||
u.keyboardStateLock.Unlock()
|
u.keyboardStateLock.Unlock()
|
||||||
|
|
||||||
if u.onKeysDownChange != nil {
|
if u.onKeysDownChange != nil {
|
||||||
(*u.onKeysDownChange)(state)
|
(*u.onKeysDownChange)(state) // this enques to the outgoing hidrpc queue via usb.go → currentSession.enqueueKeysDownState(...)
|
||||||
}
|
}
|
||||||
return state
|
return state
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@ func (u *UsbGadget) absMouseWriteHidFile(data []byte) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u *UsbGadget) AbsMouseReport(x int16, y int16, buttons uint8) error {
|
func (u *UsbGadget) AbsMouseReport(x int, y int, buttons uint8) error {
|
||||||
u.absMouseLock.Lock()
|
u.absMouseLock.Lock()
|
||||||
defer u.absMouseLock.Unlock()
|
defer u.absMouseLock.Unlock()
|
||||||
|
|
||||||
|
|
|
||||||
4
usb.go
4
usb.go
|
|
@ -89,7 +89,7 @@ func (s *Session) rpcKeypressReport(key byte, press bool) error {
|
||||||
return gadget.KeypressReport(key, press)
|
return gadget.KeypressReport(key, press)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Session) rpcAbsMouseReport(x int16, y int16, buttons uint8) error {
|
func (s *Session) rpcAbsMouseReport(x int, y int, buttons uint8) error {
|
||||||
if s == nil || !s.HasPermission(PermissionMouseInput) {
|
if s == nil || !s.HasPermission(PermissionMouseInput) {
|
||||||
return ErrPermissionDeniedMouse
|
return ErrPermissionDeniedMouse
|
||||||
}
|
}
|
||||||
|
|
@ -128,7 +128,7 @@ func rpcKeypressReport(key byte, press bool) error {
|
||||||
return ErrNotPrimarySession
|
return ErrNotPrimarySession
|
||||||
}
|
}
|
||||||
|
|
||||||
func rpcAbsMouseReport(x int16, y int16, buttons uint8) error {
|
func rpcAbsMouseReport(x int, y int, buttons uint8) error {
|
||||||
if primary := sessionManager.GetPrimarySession(); primary != nil {
|
if primary := sessionManager.GetPrimarySession(); primary != nil {
|
||||||
return primary.rpcAbsMouseReport(x, y, buttons)
|
return primary.rpcAbsMouseReport(x, y, buttons)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue