mirror of https://github.com/jetkvm/kvm.git
Use harcoded timer reset value for now
This commit is contained in:
parent
6892eeba42
commit
b1f345db70
|
@ -168,14 +168,10 @@ func (u *UsbGadget) scheduleAutoRelease(key byte) {
|
|||
u.kbdAutoReleaseTimers[key].Stop()
|
||||
}
|
||||
|
||||
duration := u.kbdAutoReleaseTimerExtension
|
||||
if duration == 0 {
|
||||
duration = DefaultAutoReleaseDuration
|
||||
}
|
||||
|
||||
u.log.Debug().Dur("duration", duration).Msg("autoRelease scheduled with duration")
|
||||
|
||||
u.kbdAutoReleaseTimers[key] = time.AfterFunc(duration, func() {
|
||||
// TODO: make this configurable
|
||||
// We currently hardcode the duration to 100ms
|
||||
// However, it should be the same as the duration of the keep-alive reset called baseExtension.
|
||||
u.kbdAutoReleaseTimers[key] = time.AfterFunc(100*time.Millisecond, func() {
|
||||
u.performAutoRelease(key)
|
||||
})
|
||||
}
|
||||
|
@ -204,8 +200,6 @@ func (u *UsbGadget) DelayAutoReleaseWithDuration(resetDuration time.Duration) {
|
|||
return
|
||||
}
|
||||
|
||||
u.kbdAutoReleaseTimerExtension = resetDuration
|
||||
|
||||
u.log.Debug().Dur("reset_duration", resetDuration).Msg("delaying auto-release with dynamic duration")
|
||||
|
||||
for _, timer := range u.kbdAutoReleaseTimers {
|
||||
|
|
|
@ -70,7 +70,6 @@ type UsbGadget struct {
|
|||
|
||||
kbdAutoReleaseLock sync.Mutex
|
||||
kbdAutoReleaseTimers map[byte]*time.Timer
|
||||
kbdAutoReleaseTimerExtension time.Duration
|
||||
|
||||
keyboardStateLock sync.Mutex
|
||||
keyboardStateCtx context.Context
|
||||
|
@ -138,7 +137,6 @@ func newUsbGadget(name string, configMap map[string]gadgetConfigItem, enabledDev
|
|||
keyboardState: 0,
|
||||
keysDownState: KeysDownState{Modifier: 0, Keys: []byte{0, 0, 0, 0, 0, 0}}, // must be initialized to hidKeyBufferSize (6) zero bytes
|
||||
kbdAutoReleaseTimers: make(map[byte]*time.Timer),
|
||||
kbdAutoReleaseTimerExtension: 0,
|
||||
enabledDevices: *enabledDevices,
|
||||
lastUserInput: time.Now(),
|
||||
log: logger,
|
||||
|
|
Loading…
Reference in New Issue