Serial mouse: Difference between revisions
m (→References: Changed all urls in this section to https. + changed gentoo stuff to canonical url and spelling.) |
m (→References: Rescued a dead link) |
||
Line 94: | Line 94: | ||
*[https://wiki.archlinux.org/index.php/serial_input_device_to_kernel_input Serial input device to kernel input - ArchWiki] | *[https://wiki.archlinux.org/index.php/serial_input_device_to_kernel_input Serial input device to kernel input - ArchWiki] | ||
*[https://bugs.alpinelinux.org/issues/2532 Feature #2532: Request for package: linuxconsoletools] | *[https://bugs.alpinelinux.org/issues/2532 Feature #2532: Request for package: linuxconsoletools] | ||
*[https://lists.alpinelinux.org/alpine-devel/1891.html How to run script at startup (alpine-devel Archives)] | *[https://web.archive.org/web/20171125125124/https://lists.alpinelinux.org/alpine-devel/1891.html How to run script at startup (alpine-devel Archives)] | ||
*[https://wiki.gentoo.org/wiki//etc/local.d local.d Gentoo Wiki] | *[https://wiki.gentoo.org/wiki//etc/local.d local.d Gentoo Wiki] | ||
[[Category:Hardware]] | [[Category:Hardware]] |
Revision as of 21:35, 26 July 2023
Introduction
A mouse connected to the serial port will not be recognized by an X.Org server automatically. In /var/log/Xorg.0.log
there will be a message:
(II) The server relies on udev to provide the list of input devices. If no devices become available, reconfigure udev or disable AutoAddDevices.
An existing /etc/X11/xorg.conf
with AutoAddDevices
enabled will result in
(WW) Hotplugging is on, devices using drivers 'kbd', 'mouse' or 'vmmouse' will be disabled.
We will describe two ways of getting an usable serial mouse under X.org. In our example we have a Logitec serial mouse of the model M/N: M-M30 associated to the device /dev/ttyS0
.
Getting information about the mouse
If the protocol for the serial mouse is unkown, the command
mouse-test /dev/ttyS0
from the package gpm
can be used to get the necessary information. The program is interactive and will print at the end a message like:
Your mouse seems to be a 'mman' one on "/dev/ttyS0" (24 matches)
The man
page gpm-types
contain a list of the protocols. In our case the lines
mman Mouseman The protocol used by the new Logitech devices with three but- tons. It is backward compatible with the Microsoft protocol, so if your mouse has three buttons and works with -t ms or similar decoders you may try -t mman instead to use the middle button. This mouse decoder accepts standard serial options, although they should not be needed.
gives us more information about the protocol. We can test the mouse in a virtual console by running:
gpm -m /dev/ttyS0 -t mman
Solution: Inform the Linux input subsystem
The serial port should already be known to udev:
udevadm info --name=/dev/ttyS0 --query=path
/devices/platform/serial8250/tty/ttyS0
But in the output of
cat /proc/bus/input/devices
there is no hint of its existence. Installing the package linuxconsoletools
from the testing repository and executing
inputattach --mouseman /dev/ttyS0
should give us a working mouse for the X server. The command
inputattach --help
prints a list of the available protocols. In our case the line
--mouseman -mman 3-button Logitech / Genius mouse
tells us which one to use. Now the output of
cat /proc/bus/input/devices
should contain a section like:
I: Bus=0013 Vendor=0004 Product=0001 Version=0100 N: Name="Logitech M+ Mouse" P: Phys=ttyS0/serio0/input0 S: Sysfs=/devices/platform/serial8250/tty/ttyS0/serio8/input/input9 U: Uniq= H: Handlers=event2 mouse0 B: PROP=0 B: EV=7 B: KEY=70000 0 0 0 0 0 0 0 0 B: REL=3
To start the inputattach
command automatically create a file /etc/local.d/sermouse.start
with the content:
#!/bin/sh inputattach --daemon --mouseman /dev/ttyS0
Make it executable and add the service local
to the default
runlevel:
rc-update add local default
Then the command
rc
should start the new service. If you want to stop inputattach
when stopping the local
service, create an executable file /etc/local.d/sermouse.stop
with content
#!/bin/sh killall inputattach
Alternatively you can create a script in /etc/init.d
to define a service for the serial mouse.
Solution: Configure the X.org server
If you don't have a /etc/X11/xorg.conf
, then generate one with the command
Xorg -configure
and modify (and move) the resulting file /root/xorg.conf.new
to get a running X server. For instance you might have to know the correct driver for the "InputDevice"
section for your graphics card. Include the section
Section "ServerFlags" Option "AutoAddDevices" "False" EndSection
to disable hotplugging and set the "Device"
and "Protocol"
options in the "InputDevice"
section for your mouse. In our case we have:
Option "Protocol" "MouseMan" Option "Device" "/dev/ttyS0"
Then restart the X server. For instance:
rc-service lxdm restart