Serial mouse: Difference between revisions
m (→References: Changed all urls in this section to https. + changed gentoo stuff to canonical url and spelling.) |
m (→Solution: Inform the Linux input subsystem: Link to linuxconsole tools and change "testing" repo reference to "community". Correct command to start service . . .) |
||
(4 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
=Introduction= | =Introduction= | ||
A mouse connected to the serial port will not be recognized by an | A mouse connected to the serial port will not be recognized by an Xorg server automatically. In {{path|/var/log/Xorg.0.log}} there may be a message: | ||
<pre> | <pre> | ||
(II) The server relies on udev to provide the list of input devices. | (II) The server relies on udev to provide the list of input devices. | ||
If no devices become available, reconfigure udev or disable AutoAddDevices. | If no devices become available, reconfigure udev or disable AutoAddDevices. | ||
</pre> | </pre> | ||
We will describe two ways of getting an usable serial mouse under X.org. In our example we have a | We will describe two ways of getting an usable serial mouse under X.org. In our example we have a Logitech serial mouse of the model M/N: M-M30 associated to the device {{path|/dev/ttyS0}}. | ||
=Getting information about the mouse= | =Getting information about the mouse= | ||
If the protocol for the serial mouse is unkown, the command {{cmd|mouse-test /dev/ttyS0}} from the package | If the protocol for the serial mouse is unkown, the command {{cmd|mouse-test /dev/ttyS0}} from the package {{pkg|gpm|arch=}} can be used to get the necessary information. The program is interactive and will print at the end a message like: | ||
<pre> | <pre> | ||
Your mouse seems to be a 'mman' one on "/dev/ttyS0" (24 matches) | Your mouse seems to be a 'mman' one on "/dev/ttyS0" (24 matches) | ||
Line 30: | Line 26: | ||
</pre> | </pre> | ||
gives us more information about the protocol. We can test the mouse in a virtual console by running: | gives us more information about the protocol. We can test the mouse in a virtual console by running: | ||
{{cmd|gpm -m /dev/ttyS0 -t mman}} | {{cmd|gpm -m {{path|/dev/ttyS0}} -t mman}} | ||
=Solution: Inform the Linux input subsystem= | =Solution: Inform the Linux input subsystem= | ||
Line 37: | Line 33: | ||
{{Cmd|udevadm info --name=/dev/ttyS0 --query=path}} | {{Cmd|udevadm info --name=/dev/ttyS0 --query=path}} | ||
<pre>/devices/platform/serial8250/tty/ttyS0</pre> | <pre>/devices/platform/serial8250/tty/ttyS0</pre> | ||
But in the output of {{cmd|cat /proc/bus/input/devices}} there is no hint of its existence. Installing the package | But in the output of {{cmd|cat {{path|/proc/bus/input/devices}}}} there is no hint of its existence. Installing the package {{pkg|linuxconsoletools|arch=}} from the community repository and executing | ||
{{cmd|inputattach --mouseman /dev/ttyS0}} | {{cmd|inputattach --mouseman /dev/ttyS0}} | ||
should give us a working mouse for the X server. | should give us a working mouse for the X server. | ||
Line 43: | Line 39: | ||
{{cmd|inputattach --help}} prints a list of the available protocols. In our case the line | {{cmd|inputattach --help}} prints a list of the available protocols. In our case the line | ||
<pre> --mouseman -mman 3-button Logitech / Genius mouse</pre> | <pre> --mouseman -mman 3-button Logitech / Genius mouse</pre> | ||
tells us which one to use. Now the output of {{cmd|cat /proc/bus/input/devices}} should contain a section like: | tells us which one to use. Now the output of {{cmd|cat {{path|/proc/bus/input/devices}}}} should contain a section like: | ||
<pre> | <pre> | ||
I: Bus=0013 Vendor=0004 Product=0001 Version=0100 | I: Bus=0013 Vendor=0004 Product=0001 Version=0100 | ||
Line 57: | Line 53: | ||
</pre> | </pre> | ||
To start the <code>inputattach</code> command automatically create a file | To start the <code>inputattach</code> command automatically create a file {{path|/etc/local.d/sermouse.start}} with the content: | ||
<pre> | <pre> | ||
#!/bin/sh | #!/bin/sh | ||
Line 65: | Line 61: | ||
{{cmd|rc-update add local default}} | {{cmd|rc-update add local default}} | ||
Then the command | Then the command | ||
{{cmd|rc}} should start the new service. If you want to stop <code>inputattach</code> when stopping the <code>local</code> service, create an executable file | {{cmd|rc-service local start}} should start the new service. If you want to stop <code>inputattach</code> when stopping the <code>local</code> service, create an executable file {{path|/etc/local.d/sermouse.stop}} with content | ||
<pre> | <pre> | ||
#!/bin/sh | #!/bin/sh | ||
killall inputattach | killall inputattach | ||
</pre> | </pre> | ||
Alternatively you can create a script in | Alternatively you can create a script in {{path|/etc/init.d}} to define a service for the serial mouse. | ||
=Solution: Configure the X.org server= | =Solution: Configure the X.org server= | ||
{{obsolete|Using Xorg -configure causes issues on many modern systems and is totally unnecessary. If the below configuration can be made to work, it should be placed in its own config file as opposed to generating a full-blown xorg.conf (perhaps try making an {{path|/etc/X11/xorg.conf.d/serial_mouse.conf}}?)}} | |||
If you don't have a <code>/etc/X11/xorg.conf</code>, then generate one with the command | If you don't have a <code>/etc/X11/xorg.conf</code>, then generate one with the command | ||
{{cmd|Xorg -configure}} | {{cmd|Xorg -configure}} | ||
Line 94: | Line 90: | ||
*[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]] |
Latest revision as of 05:03, 19 January 2024
Introduction
A mouse connected to the serial port will not be recognized by an Xorg server automatically. In /var/log/Xorg.0.log there may 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.
We will describe two ways of getting an usable serial mouse under X.org. In our example we have a Logitech 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 community 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-service local start
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
This material is obsolete ... Using Xorg -configure causes issues on many modern systems and is totally unnecessary. If the below configuration can be made to work, it should be placed in its own config file as opposed to generating a full-blown xorg.conf (perhaps try making an /etc/X11/xorg.conf.d/serial_mouse.conf?) (Discuss) |
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