mirror of https://github.com/jetkvm/kvm.git
Compare commits
3 Commits
20a23de227
...
b4b1b56fff
| Author | SHA1 | Date |
|---|---|---|
|
|
b4b1b56fff | |
|
|
b925dcf061 | |
|
|
da3e951394 |
|
|
@ -29,7 +29,7 @@ var keyboardConfig = gadgetConfigItem{
|
||||||
// macOS default: 15 * 15 = 225ms https://discussions.apple.com/thread/1316947?sortBy=rank
|
// macOS default: 15 * 15 = 225ms https://discussions.apple.com/thread/1316947?sortBy=rank
|
||||||
// Linux default: 250ms https://man.archlinux.org/man/kbdrate.8.en
|
// Linux default: 250ms https://man.archlinux.org/man/kbdrate.8.en
|
||||||
// Windows default: 1s `HKEY_CURRENT_USER\Control Panel\Accessibility\Keyboard Response\AutoRepeatDelay`
|
// Windows default: 1s `HKEY_CURRENT_USER\Control Panel\Accessibility\Keyboard Response\AutoRepeatDelay`
|
||||||
const autoReleaseKeyboardInterval = time.Millisecond * 100
|
const autoReleaseKeyboardInterval = time.Millisecond * 225
|
||||||
|
|
||||||
// Source: https://www.kernel.org/doc/Documentation/usb/gadget_hid.txt
|
// Source: https://www.kernel.org/doc/Documentation/usb/gadget_hid.txt
|
||||||
var keyboardReportDesc = []byte{
|
var keyboardReportDesc = []byte{
|
||||||
|
|
@ -226,7 +226,10 @@ func (u *UsbGadget) performAutoRelease(key byte) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
u.keypressReport(key, false)
|
_, err := u.keypressReport(key, false)
|
||||||
|
if err != nil {
|
||||||
|
u.log.Warn().Uint8("key", key).Msg("failed to release key")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u *UsbGadget) listenKeyboardEvents() {
|
func (u *UsbGadget) listenKeyboardEvents() {
|
||||||
|
|
@ -478,6 +481,9 @@ func (u *UsbGadget) keypressReport(key byte, press bool) (KeysDownState, error)
|
||||||
|
|
||||||
func (u *UsbGadget) KeypressReport(key byte, press bool) error {
|
func (u *UsbGadget) KeypressReport(key byte, press bool) error {
|
||||||
state, err := u.keypressReport(key, press)
|
state, err := u.keypressReport(key, press)
|
||||||
|
if err != nil {
|
||||||
|
u.log.Warn().Uint8("key", key).Bool("press", press).Msg("failed to report key")
|
||||||
|
}
|
||||||
isRolledOver := state.Keys[0] == hidErrorRollOver
|
isRolledOver := state.Keys[0] == hidErrorRollOver
|
||||||
|
|
||||||
if isRolledOver {
|
if isRolledOver {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue