Marson MT606-1 USBLink Daemon
=============================

What is it?
-----------

marsond is a daemon for Linux that fixes an issue with a particular
model of PS/2 => USB 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, which is about 10x as fast as a human could press
and release a key.

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".

marsond uses the Linux uinput layer, so it's not portable to other
operating systems. If you're looking for a non-Linux solution, see:

https://slackware.uk/~urchlay/sdl-usblink-hack/


Prerequisites
-------------

Build time:

- Recent-ish Linux kernel. Anything from 4.x up should be fine.
- glibc and kernel headers.
- gcc or clang.
- make.
- perl.
- sed.
- rst2man.
- python (since rst2man requires it).
- The usual Linux development stuff (shell, coreutils, binutils, etc).

Runtime:

- uinput support in the kernel. Most distros should have this.
  If your kernel has uinput as a module, you'll have to make sure
  it's loaded on boot (how you do this is distro-specific).
- udevd. This is standard on all (?) Linux distros these days. Actually
  this is optional: you could manually run the daemon, if you really
  are using a distro that doesn't have udevd.

Building
--------

The usual "make" and "make install". See the Makefile for variables
you can adjust.

If you want to build a static binary, you can't do it with glibc,
due to it needing libnss_compat at runtime (for the getpwnam() and
getgrnam() calls). You'll have to use something like musl-libc.

After installation, or any time you edit the udev .rules file,
run this:

# udevadm control --reload

If you're packaging this for a Linux distro, you can run the
above command from your package system's post-install hook (e.g.
doinst.sh on Slackware). See also the variables at the top of
the Makefile.


Running the daemon
------------------

After "make install", it will run via udev when the device is plugged
in. See /etc/udev/rules.s/99-marsond.rules to change the options,
if needed. If it doesn't start automatically, check the vendor and
product IDs in dmesg against the ones in the .rules file. If you have
a different vendor/product ID that has the Enter key problem, please
contact me so I can add them to the udev rule.

When the device is unplugged, the daemon will exit.

For testing purposes, you can start it manually. Usually when you do
this, you'll want the -v and -f options (verbose, foreground).


Contact
-------

Email: B. Watson, <urchlay@slackware.uk>
IRC: Urchlay on irc.libera.chat
