From b3f612a055a426af38c35b8d03e23c698399a67c Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Fri, 9 May 2025 04:29:32 -0400 Subject: rearrange man page (move options closer to the top) --- marsond.8 | 110 +++++++++++++++++++++++++++++++----------------------------- marsond.c | 2 +- marsond.rst | 100 ++++++++++++++++++++++++++++-------------------------- 3 files changed, 109 insertions(+), 103 deletions(-) diff --git a/marsond.8 b/marsond.8 index ecd7145..48d3eaf 100644 --- a/marsond.8 +++ b/marsond.8 @@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. -.TH "MARSOND" 8 "2025-05-08" "0.3.0" "Urchlay's Stuff" +.TH "MARSOND" 8 "2025-05-09" "0.3.0" "Urchlay's Stuff" .SH NAME marsond \- Fix Enter key timing on Marson/USBLink/MT606-1 PS/2-USB adaptors .SH SYNOPSIS @@ -39,38 +39,7 @@ marsond [\fB\-d\fP \fIdelay\-ms*\fP] [\fB\-f\fP] [\fB\-k\fP \fIkeyboard\-device\ keyboard adaptor. The symptom: 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. -.sp -The 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. -.sp -The specific hardware that has the Enter key problem 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 -I\(aqm not sure if any other USB keyboard adaptors are affected. If you -have the problem on some other adaptor, and \fBmarsond\fP fixes it, -please contact me so I can add the model number to this man page. -.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 -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). I don\(aqt use Wayland, so I haven\(aqt tested it there. If you do, -please contact me and let me know if it works for you. +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 @@ -83,27 +52,6 @@ connected). The udev rule is found in: .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 -\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). -.sp -While \fBmarsond\fP is running, "xinput \-\-list" will show an input -device called "marson virtual keyboard". .SH OPTIONS .sp Options can be "bundled": \fB\-vf\fP is the same as \fB\-v\fP \fB\-f\fP\&. @@ -177,6 +125,60 @@ 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 +.sp +The 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. +.sp +The specific hardware that has the Enter key problem 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 +I\(aqm not sure if any other USB keyboard adaptors are affected. If you +have the problem on some other adaptor, and \fBmarsond\fP fixes it, +please contact me so I can add support for it in the future. +.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 +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). I don\(aqt use Wayland, so I haven\(aqt tested it there. If you do, +please contact me and let me know if it works for you. +.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). +.sp +While \fBmarsond\fP is running, "xinput \-\-list" will show an input +device called "marson virtual keyboard". .SH LIMITATIONS .sp Only one MT\-606\-1 device is supported, out of the box. This shouldn\(aqt diff --git a/marsond.c b/marsond.c index 18016d5..2bc65f0 100644 --- a/marsond.c +++ b/marsond.c @@ -313,7 +313,7 @@ int main(int argc, char **argv) { if(ioctl(outfd, UI_SET_KEYBIT, i) >= 0) { /* we don't wanna be *that* verbose */ } else { - die("UI_SET_EVBIT failed: %s", strerror(errno)); + die("UI_SET_KEYBIT failed: %s", strerror(errno)); } } debug("UI_SET_KEYBIT OK"); diff --git a/marsond.rst b/marsond.rst index 2a95b71..ce0e102 100644 --- a/marsond.rst +++ b/marsond.rst @@ -27,35 +27,7 @@ DESCRIPTION keyboard adaptor. The symptom: 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. - -The 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 specific hardware that has the Enter key problem 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: - - https://slackware.uk/~urchlay/sdl-usblink-hack/marson-front.jpg - - https://slackware.uk/~urchlay/sdl-usblink-hack/marson-back.jpg - -I'm not sure if any other USB keyboard adaptors are affected. If you -have the problem on some other adaptor, and **marsond** fixes it, -please contact me so I can add the model number to this man page. - -**marsond** uses the Linux kernel's **uinput** 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. - -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). I don't use Wayland, so I haven't tested it there. If you do, -please contact me and let me know if it works for you. +See the **NOTES** section for full details. For normal use, **marsond** will be started by a **udev**\(7) rule when the adaptor is plugged in (including booting with the adaptor @@ -66,25 +38,6 @@ connected). The udev rule is found in: ...which can be edited to change the options it's run with, if needed. The defaults work well on the author's system. -**marsond** must be run as root. At startup, it does these -things as root: - -- Grab the physical keyboard. - -- Create the virtual keyboard device. - -- Lock its pages into physical memory, to avoid being swapped out. - -- Set its priority (nice value) to -20 (highest priority), to - avoid slow response on a loaded system. - -After doing the above, root access is no longer needed, so it will -drop privileges and run as the *nobody* user by default (but see -**ENVIRONMENT** if you need a different user). - -While **marsond** is running, "xinput --list" will show an input -device called "marson virtual keyboard". - OPTIONS ======= @@ -146,6 +99,57 @@ MARSOND_GROUP the primary group of the user it's running as. Normally you won't have to set this. +NOTES +===== + +The 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 specific hardware that has the Enter key problem 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: + + https://slackware.uk/~urchlay/sdl-usblink-hack/marson-front.jpg + + https://slackware.uk/~urchlay/sdl-usblink-hack/marson-back.jpg + +I'm not sure if any other USB keyboard adaptors are affected. If you +have the problem on some other adaptor, and **marsond** fixes it, +please contact me so I can add support for it in the future. + +**marsond** uses the Linux kernel's **uinput** 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. + +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). I don't use Wayland, so I haven't tested it there. If you do, +please contact me and let me know if it works for you. + +**marsond** must be run as root. At startup, it does these +things as root: + +- Grab the physical keyboard. + +- Create the virtual keyboard device. + +- Lock its pages into physical memory, to avoid being swapped out. + +- Set its priority (nice value) to -20 (highest priority), to + avoid slow response on a loaded system. + +After doing the above, root access is no longer needed, so it will +drop privileges and run as the *nobody* user by default (but see +**ENVIRONMENT** if you need a different user). + +While **marsond** is running, "xinput --list" will show an input +device called "marson virtual keyboard". + LIMITATIONS =========== -- cgit v1.2.3