.\" Man page generated from reStructuredText. . . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .TH "MARSOND" 8 "2026-01-06" "0.4.0" "Urchlay's Stuff" .SH NAME marsond \- Fix Enter/Shift key timings on Marson/USBLink/MT606-1 PS/2-USB adaptors .SH SYNOPSIS .sp marsond [\fB\-d\fP \fIdelay\-ms\fP] [\fB\-f\fP] [\fB\-k\fP \fIkeyboard\-device\fP] [\fB\-p\fP \fIpause\-ms\fP [\fB\-s\fP \fIshift\-ms\fP] [\fB\-v\fP] | [\fB\-\-help\fP] | [\fB\-\-version\fP] | [\fB\-V\fP] .SH DESCRIPTION .sp \fBmarsond\fP fixes two issues with a particular model of PS/2 => USB keyboard adaptor. The symptoms: .INDENT 0.0 .IP \(bu 2 In games and emulators, the Enter key only works sometimes. This is caused by the firmware in the adaptor sending the keypress and release events only 8 milliseconds apart. .IP \(bu 2 In normal use, pressing either Shift key and Enter key simultaneously causes the shift key to get "stuck" and act like it\(aqs still being held down. You have to press and release Shift again to get it to "unstick". .UNINDENT .sp See the \fBNOTES\fP section for full details. .sp For normal use, \fBmarsond\fP will be started by a \fBudev\fP(7) rule when the adaptor is plugged in (including booting with the adaptor connected). The udev rule is found in: .INDENT 0.0 .INDENT 3.5 /etc/udev/rules.d/99\-marsond.rules .UNINDENT .UNINDENT .sp \&...which can be edited to change the options it\(aqs run with, if needed. The defaults work well on the author\(aqs system. .sp Note that \fBmarsond\fP doesn\(aqt affect the PS/2 mouse port on the adaptor at all. .SH OPTIONS .sp Options can be "bundled": \fB\-vf\fP is the same as \fB\-v\fP \fB\-f\fP\&. .INDENT 0.0 .TP .BI \-d \ delay\-ms Amount of time in milliseconds to delay the Enter key release events. Also, the Shift key threshold is this times 4, unless set with the \fB\-s\fP option. Minimum 1, default 30 (unless changed at compile time; see \fB\-\-help\fP). .UNINDENT .\" delay time for Enter key release. . .INDENT 0.0 .TP .B \-f Run in the foreground; do not detach from the terminal or become a daemon. In this mode, \fBmarsond\fP can be killed with \fI^C\fP\&. .UNINDENT .\" run in foreground, not as a daemon. . .INDENT 0.0 .TP .BI \-k \ keyboard\-device Input device for the keyboard adaptor. Default: .INDENT 7.0 .INDENT 3.5 .sp .nf .ft C /dev/input/by\-id/usb\-Marson_Marson_Keyboard_and_Mouse_Link_Ver:ps2120L\-event\-kbd .ft P .fi .UNINDENT .UNINDENT .sp \&...unless changed at compile time; see \fB\-\-help\fP\&. .UNINDENT .\" keyboard device (usually under /dev/input/by-id/). . .INDENT 0.0 .TP .BI \-p \ pause\-ms Amount of time in milliseconds to pause at startup, before opening the keyboard and uinput devices. May be useful on slow systems, if \fBmarsond\fP won\(aqt consistently start from udev, but works fine if started manually. Minimum 0, default 0. .UNINDENT .\" pause before opening keyboard/uinput devs (default 0). . .INDENT 0.0 .TP .BI \-s \ thresh\-ms Threshold for Shift key. If Enter is pressed within \fBthresh\-ms\fP of either Shift key, a Shift key release will be sent before the Enter keypress. This avoids the "stuck shift key" problem. Default is 120, or 4 times the \fB\-d\fP delay if set. .UNINDENT .\" threshold in ms for shift key followed by enter (default 30 or -d * 3). . .INDENT 0.0 .TP .B \-v Verbose debugging mode. Prints copious trace information to \fBstderr\fP\&. Debugging mode is turned off when \fBmarsond\fP forks itself into the background as a daemon. If you want to debug the event loop, combine \fB\-v\fP and \fB\-f\fP\&. .UNINDENT .\" verbose debugging. . .INDENT 0.0 .TP .B \-h\fP,\fB \-\-help Shows built\-in usage message and exits. This includes the compiled\-in defaults for the \fB\-d\fP and \fB\-k\fP options. .UNINDENT .\" this help text. . .INDENT 0.0 .TP .B \-V\fP,\fB \-\-version Shows version number and exits. .UNINDENT .\" show version number. . .SH ENVIRONMENT .INDENT 0.0 .TP .B MARSOND_USER After initialization, \fBmarsond\fP will drop privileges by setting its user ID to this user\(aqs. Default: \fInobody\fP .TP .B MARSOND_GROUP Group to run as, after dropping privileges. Default: the primary group of the user it\(aqs running as. Normally you won\(aqt have to set this. .UNINDENT .SH NOTES .SS Hardware .sp The Enter key dropped keystroke problem happens with any SDL application (SDL1 or SDL2), as well as other graphics libraries. It happens regardless of what PS/2 keyboard you have plugged in, what computer you have the adaptor plugged into, or what OS that computer is running. The firmware in the adaptor sends an Enter keypress, then 8 microseconds later sends an Enter key release. There is no way to change this. .sp The problem where Shift/Enter causes the Shift key to act "stuck" happens in any application. It\(aqs particularly annoying because I\(aqm an inaccurate typist, and I hit right Shift+Enter about 5% of the time when I\(aqm just trying to press Enter. .sp The specific hardware that has the problems for me is USB vendor ID 04b4, product ID 0101, "Marson Keyboard and Mouse Link Ver:ps2120L". It has a label on the front that says "USBLink", and on the back, the model number is "MT606\-1". It looks like: .INDENT 0.0 .INDENT 3.5 \fI\%https://slackware.uk/~urchlay/sdl\-usblink\-hack/marson\-front.jpg\fP .sp \fI\%https://slackware.uk/~urchlay/sdl\-usblink\-hack/marson\-back.jpg\fP .UNINDENT .UNINDENT .sp Confusingly enough, in \fBlsusb\fP(8) output, it shows up as: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C $ lsusb | grep 04b4:0101 Bus 003 Device 006: ID 04b4:0101 Cypress Semiconductor Corp. Keyboard/Hub .ft P .fi .UNINDENT .UNINDENT .sp The Bus and Device numbers may be different for you, it\(aqs the ID and name that are important. .sp I\(aqm not sure if any other USB keyboard adaptors are affected. If you have the problem on some other adaptor, try it with \fBmarsond\fP\&. Use the \fB\-k\fP option to set the \fI/dev/input/by\-id\fP name of the device, and run the daemon manually. If this fixes it, please contact me so I can add support for your adaptor in the future. In the meantime, you can compile \fBmarsond\fP with your device\(aqs info on the make command line: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C make DEFAULT_KBD=/dev/input/by\-id/ VENDOR_ID= PRODUCT_ID= .ft P .fi .UNINDENT .UNINDENT .SS Implementation .sp \fBmarsond\fP uses the Linux kernel\(aqs \fBuinput\fP layer to "grab" the keyboard, create a new virtual keyboard device, and pass events from the real keyboard to the virtual one. When it sees the key release event for the Enter key, it simply pauses for a few milliseconds before delivering it. .sp It also keeps track of the last timestamp of the left and right Shift keys, and if Enter is pressed too soon after Shift, it sends a key release for the Shift key(s). It\(aqs still possible to type Shift+Enter on purpose, but there must be a delay (default 120ms) between the two keypresses. Most people, even fast typists, won\(aqt press them that close together. .sp This should work with everything that uses the keyboard. It definitely does, with SDL 1 and 2 running under X (and SDL 1 on the console, too). It should also work with Wayland, though I don\(aqt use Wayland, so I haven\(aqt tested it there. If you do, please contact me and let me know whether or not it works for you. .SS Startup .sp \fBmarsond\fP must be run as root. At startup, it does these things as root: .INDENT 0.0 .IP \(bu 2 Grab the physical keyboard. .IP \(bu 2 Create the virtual keyboard device. .IP \(bu 2 Lock its pages into physical memory, to avoid being swapped out. .IP \(bu 2 Set its priority (nice value) to \-20 (highest priority), to avoid slow response on a loaded system. .UNINDENT .sp After doing the above, root access is no longer needed, so it will drop privileges and run as the \fInobody\fP user by default (but see \fBENVIRONMENT\fP if you need a different user). .SS Misc .sp While \fBmarsond\fP is running, "xinput \-\-list" will show an input device called "marson virtual keyboard", listed as a keyboard. .SH LIMITATIONS .sp Only one MT\-606\-1 device is supported, out of the box. This shouldn\(aqt really be a problem (do you really need 2 keyboards?) but it\(aqs worth mentioning. If you really do own two of these adaptors and want to use them on the same PC, you could add a second udev rule (with \fB\-k\fP option for the daemon). .sp This isn\(aqt really a \fBmarsond\fP problem per se, but when Xorg detects a new keyboard, it resets your keyboard repeat rate (\fBxset r\fP) and custom keymap (\fBxmodmap\fP(1)). If you use a \(aqdesktop\(aq such as KDE, GNOME, or XFCE, it should re\-apply your settings. For a traditional window manager (WindowMaker, FVWM2, etc), this can be very annoying. .\" EXIT STATUS . .\" =========== . .\" BUGS . .\" ==== . .\" EXAMPLES . .\" ======== . .SH COPYRIGHT .sp WTFPL. Short version: do WTF you want. Full version: .INDENT 0.0 .INDENT 3.5 \fI\%http://www.wtfpl.net/txt/copying/\fP .UNINDENT .UNINDENT .SH AUTHORS .INDENT 0.0 .IP B. 3 Watson <\fI\%urchlay@slackware.uk\fP> .UNINDENT .SH SEE ALSO .sp The homepage: \fI\%https://slackware.uk/~urchlay/repos/marsond\fP .sp Another solution to the problem, less complete, but should be portable to non\-Linux OSes: \fI\%https://slackware.uk/~urchlay/sdl\-usblink\-hack/\fP .\" Generated by docutils manpage writer. .