NetBSD Problem Report #53049
From bernward.pub@arcor.de Fri Feb 23 21:45:40 2018
Return-Path: <bernward.pub@arcor.de>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id F2E367A1CE
for <gnats-bugs@gnats.NetBSD.org>; Fri, 23 Feb 2018 21:45:39 +0000 (UTC)
Message-Id: <20180223202841.A4FBF273FDF@Brix.localdomain>
Date: Fri, 23 Feb 2018 20:28:41 +0000 (UTC)
From: bernward.pub@arcor.de
Reply-To: bernward.pub@arcor.de
To: gnats-bugs@NetBSD.org
Subject: wsmoused not working: ioctl(WSDISPLAYIO_PUTWSCHAR) failed
X-Send-Pr-Version: 3.95
>Number: 53049
>Category: bin
>Synopsis: usb-mouse is not useable, lots of wsmoused ioctl failures
>Confidential: no
>Severity: critical
>Priority: medium
>Responsible: bin-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Feb 23 21:50:00 +0000 2018
>Last-Modified: Sun Feb 25 14:50:01 +0000 2018
>Originator: bernward.pub@arcor.de
>Release: NetBSD 8.0_BETA
>Organization:
>Environment:
System: NetBSD Brix 8.0_BETA NetBSD 8.0_BETA (GENERIC.201802030140Z) amd64
Architecture: x86_64
Machine: amd64
>Description:
The USB mouse is not usable neither in textconsole nor in X.
top shows higher activity of wsmoused and syslogd, when I move the mouse
(cpu load goes from below 0.01% up to over 10%, for both).
In the blue screen of mc, I can draw lines of black boxes (size 1 letter).
On the normal black text screen, there is no reaction on mouse movements.
X works, but the mouse curser does not react on mouse movement or mouse keys,
so X is not really useable. X wants to use /dev/mouse, but it does not exist.
In /var/log/messages I find some hundreds of the following lines:
Feb 12 22:30:20 Brix wsmoused: ioctl(WSDISPLAYIO_PUTWSCHAR) failed
Feb 12 22:30:20 Brix wsmoused: Invalid argument
After stopping with /etc/rc.d/wsmoused stop
and restarting with wsmoused -n nothing seems to happen.
But as soon as I move the mouse, the screen is filled with lines as below:
Brix# /etc/rc.d/wsmoused status
wsmoused is running as pid 380.
Brix# /etc/rc.d/wsmoused stop
Stopping wsmoused.
Brix# wsmoused -n
wsmoused: ioctl(WSDISPLAYIO_PUTWSCHAR) failed: Invalid argument
wsmoused: ioctl(WSDISPLAYIO_PUTWSCHAR) failed: Invalid argument
...
(more than 1 line per second)
With NetBSD 8, my USB-keyboard and my USB-mouse are recognised
during kernel initialisation, so I hope it will work in near future.
With NetBSD 7 they were not recognised,
even the USB installation stick was not recognised by the kernel.
Mouse recognition from dmesg:
---
uhid0 at uhidev1: input=2, output=0, feature=0
uhidev2 at uhub1 port 4 configuration 1 interface 0
uhidev2: SIGMACH1P (0x1c4f) U+P Mouse (0x03), rev 1.10/1.10, addr 3, iclass 3/1
ums0 at uhidev2: 3 buttons and Z dir
wsmouse0 at ums0 mux 0
---
>How-To-Repeat:
Start with wsmoused -n, move usb-mouse:
the screen is filled with lines as below:
wsmoused: ioctl(WSDISPLAYIO_PUTWSCHAR) failed: Invalid argument
>Fix:
>Audit-Trail:
From: mlelstv@serpens.de (Michael van Elst)
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: bin/53049: wsmoused not working: ioctl(WSDISPLAYIO_PUTWSCHAR) failed
Date: Sat, 24 Feb 2018 11:07:35 -0000 (UTC)
bernward.pub@arcor.de writes:
>top shows higher activity of wsmoused and syslogd, when I move the mouse
>(cpu load goes from below 0.01% up to over 10%, for both).
>In the blue screen of mc, I can draw lines of black boxes (size 1 letter).
>On the normal black text screen, there is no reaction on mouse movements.
>X works, but the mouse curser does not react on mouse movement or mouse keys,
>so X is not really useable. X wants to use /dev/mouse, but it does not exist.
>In /var/log/messages I find some hundreds of the following lines:
> Feb 12 22:30:20 Brix wsmoused: ioctl(WSDISPLAYIO_PUTWSCHAR) failed
> Feb 12 22:30:20 Brix wsmoused: Invalid argument
X doesn't use /dev/mouse. On wscons use the wsmouse driver, e.g.:
Section "InputDevice"
Identifier "Mouse0"
Driver "wsmouse"
EndSection
wsmoused on the other hand seems to be broken...
--
--
Michael van Elst
Internet: mlelstv@serpens.de
"A potential Snark may lurk in every tree."
From: Michael van Elst <mlelstv@serpens.de>
To: bernward.pub@arcor.de
Cc: gnats-bugs@NetBSD.org
Subject: Re: bin/53049: wsmoused not working: ioctl(WSDISPLAYIO_PUTWSCHAR)
fail
Date: Sun, 25 Feb 2018 10:44:48 +0100
On Sun, Feb 25, 2018 at 09:19:04AM +0000, bernward.pub@arcor.de wrote:
> Hello Michael,
>
> thank you, that helped me a lot, now I have a useable mouse in X.
> But I found the module "ws", which is able to handle the mouse
> directly from the input /dev/wsmouse, without an intermediate layer
> from wsmoused.
wsmoused is mostly unrelated to X. It provides mouse-like functionality
for the text console and is definitely no intermediate layer for X.
> /etc/rc.d/wsmoused start
>
> the window, in which I run tail -f /var/log/messages, is filled with
> hundreds of lines:
>
> Feb 24 16:03:35 Brix wsmoused: ioctl(WSDISPLAYIO_PUTWSCHAR) failed
> Feb 24 16:03:35 Brix wsmoused: Invalid argument
> ...
I checked the wsconsole code. wsmoused uses functions (like
WSDISPLAYIO_PUTWSCHAR and more important WSDISPLAYIO_GETWSCHAR)
that only work on a real text console, e.g. a VGA display in
text mode. It is defintely broken for graphical consoles that
use a framebuffer, which is currently everything you get with
netbsd-8 and a DRM supported graphics card.
> Although the scope of this PR is now reduced to the text console, I think
> that the classification should remain unchainged, because the intended
> function of wsmoused is not working at all, quite opposite, it disturbs
> other parts of the system.
wsmoused is supposed to co-exist with the X server by releasing mouse
control when you switch to the X display and regaining mouse control
when you switch back to a text console. There is a configuration file
/etc/wsmoused.conf that can be used to tell it which display is used
by X. It is supposed to handle only one X display and I don't know if
that actually works.
From: bernward.pub@arcor.de
To: gnats-bugs@NetBSD.org
Cc: mlelstv@serpens.de
Subject: Re: bin/53049: wsmoused not working: ioctl(WSDISPLAYIO_PUTWSCHAR) fail
Date: Sun, 25 Feb 2018 09:19:04 +0000 (UTC)
Hello Michael,
thank you, that helped me a lot, now I have a useable mouse in X.
But I had to make changes, the error messages in /var/log/Xorg.0.log
helped me:
(EE) Failed to load module "wsmouse" (module does not exist, 0)
It is true, nowhere in /usr/X11R7/ exists a module "wsmouse".
But I found the module "ws", which is able to handle the mouse
directly from the input /dev/wsmouse, without an intermediate layer
from wsmoused. Contrary, as soon as I start wsmoused with
/etc/rc.d/wsmoused start
the window, in which I run tail -f /var/log/messages, is filled with
hundreds of lines:
Feb 24 16:03:35 Brix wsmoused: ioctl(WSDISPLAYIO_PUTWSCHAR) failed
Feb 24 16:03:35 Brix wsmoused: Invalid argument
...
and the mouse cursor stops moving. I then must switch off wsmoused and
restart X. I also have to tell X to use /dev/wsmouse as input, so my
recipe to get the mouse working in X now is:
1) /etc/rc.d/wsmoused stop (or in /etc/rc.conf: wsmoused=NO)
2) edit /etc/X11/xorg.conf as follows:
---
Section "ServerLayout"
Identifier "X.org Configured"
InputDevice "Mouse0" "CorePointer"
InputDevice "Keyboard0" "CoreKeyboard"
EndSection
Section "InputDevice"
Identifier "Mouse0"
Driver "ws"
Option "Device" "/dev/wsmouse"
EndSection
Section "InputDevice"
Identifier "Keyboard0"
...
---
Although the scope of this PR is now reduced to the text console, I think
that the classification should remain unchainged, because the intended
function of wsmoused is not working at all, quite opposite, it disturbs
other parts of the system.
Best regards, Bernward.
On 2018-02-24 11:10, Michael van Elst wrote:
> X doesn't use /dev/mouse. On wscons use the wsmouse driver, e.g.:
>
> Section "InputDevice"
> Identifier "Mouse0"
> Driver "wsmouse"
> EndSection
From: bernward.pub@arcor.de
To: gnats-bugs@NetBSD.org
Cc: mlelstv@serpens.de
Subject: Re: bin/53049: wsmoused not working: ioctl(WSDISPLAYIO_PUTWSCHAR) fail
Date: Sun, 25 Feb 2018 12:49:40 +0000 (UTC)
Hello Michael,
I tested this and can confirm that setting the right X console in
/etc/wsmoused.conf makes wsmoused quiet, when I switch to X.
So, with the right set configuration file /etc/wsmoused.conf,
there are no more disturbances to the use of X.
Again, the classification of this PR should be unchanged, because
the intended function of wsmoused is still not given at all,
while it disturbs the text console by unnecessarily using cpu time.
A possibly interesting observation aubout the used cpu time of wsmoused
and syslogd via top, now with the right setting only on text console:
Heavy mouse movements for about 5 seconds let both values go up over 40% cpu usage.
While then I do not touch the mouse any more, I can see an exponential-like
fall of both usages, which needs over 30 seconds to fall below 1.00%
and after 1min ist at 0.00% for both.
Best regards, Bernward.
On 2018-02-25 10:44, Michael van Elst wrote:
> wsmoused is supposed to co-exist with the X server by releasing mouse
> control when you switch to the X display and regaining mouse control
> when you switch back to a text console. There is a configuration file
> /etc/wsmoused.conf that can be used to tell it which display is used
> by X. It is supposed to handle only one X display and I don't know if
> that actually works.
From: Michael van Elst <mlelstv@serpens.de>
To: bernward.pub@arcor.de
Cc: gnats-bugs@NetBSD.org
Subject: Re: bin/53049: wsmoused not working: ioctl(WSDISPLAYIO_PUTWSCHAR)
fail
Date: Sun, 25 Feb 2018 15:45:21 +0100
On Sun, Feb 25, 2018 at 12:49:40PM +0000, bernward.pub@arcor.de wrote:
> Hello Michael,
>
> I tested this and can confirm that setting the right X console in
> /etc/wsmoused.conf makes wsmoused quiet, when I switch to X.
> So, with the right set configuration file /etc/wsmoused.conf,
> there are no more disturbances to the use of X.
>
> Again, the classification of this PR should be unchanged, because
> the intended function of wsmoused is still not given at all,
> while it disturbs the text console by unnecessarily using cpu time.
>
> A possibly interesting observation aubout the used cpu time of wsmoused
> and syslogd via top, now with the right setting only on text console:
> Heavy mouse movements for about 5 seconds let both values go up over 40% cpu usage.
Sure, the mouse sends movement events at 100-400 Hz. Each movement
triggers wsmoused which logs an error to syslog. That's a huge overhead.
As I said, wsmoused does not work on framebuffer consoles. It works on
the assumption that the console has a transparent character / attribute
memory which isn't necessarily true for graphical consoles.
Greetings,
--
Michael van Elst
Internet: mlelstv@serpens.de
"A potential Snark may lurk in every tree."
(Contact us)
$NetBSD: query-full-pr,v 1.49 2026/05/14 01:52:41 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.