Project

General

Profile

Actions

Bug #92

closed

Make ums(4) present the mouse as a sysmouse type device by default

Added by lsartran over 18 years ago. Updated over 17 years ago.

Status:
Closed
Priority:
Low
Assignee:
-
Category:
-
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:

Description

Hello,

I've ran into problems trying to get all the buttons of my Logitech MX 310 USB
mouse to work on DragonFly 1.4-RELEASE with Xorg 6.9.

I had the following lines in my xorg.conf:
Option "Protocol" "auto"
Option "Device" "/dev/ums0"

and these are the relevant lines of my dmesg:
ums0: Logitech USB-PS/2 Optical Mouse, rev 2.00/18.00, addr 2, iclass 3/1
ums0: 6 buttons and Z dir.

I could only use the first 3 buttons (left, middle and right click). The wheel,
and 3 other buttons didn't work. xev showed that Xorg was receiving no events
when I clicked these buttons or moved the wheel.

Indeed, hexdump /dev/ums0 revealed that the actions performed on the extra
buttons didn't appear correctly in the mouse protocol:

Left-click:
0000000 0083 0000 8700 0000 0000 0083 0000 8700
0000010 0000 0000
0000014

Click with button #4 (left thumb-button, which doesn't work under X):
0000000 0087 0000 8700 0000 0000 0087 0000 8700
0000010 0000 0000
0000014

This protocol uses 5 bytes for one event (so it must be mousesystems ?), and
pressing the button #4 looks like a button release... strange.

The solution I found is to force ums(4) to use the 8-byte SysMouse protocol,
which is able to express the actions on the extra buttons. This is the patch to
apply to /usr/src/sys/dev/usbmisc/ums/ums.c:

diff uw ums.c.old ums.c
--
ums.c.old 2005-12-11 02:54:09.000000000 0100
++ ums.c 2006-02-10 18:33:33.000000000 +0100
@ -323,22 +323,22 @
DPRINTF);
#endif

- if (sc->nbuttons > MOUSE_MSC_MAXBUTTON)
- sc->hw.buttons = MOUSE_MSC_MAXBUTTON;
+ if (sc->nbuttons > MOUSE_SYS_MAXBUTTON)
+ sc->hw.buttons = MOUSE_SYS_MAXBUTTON;
else
sc->hw.buttons = sc->nbuttons;
sc->hw.iftype = MOUSE_IF_USB;
sc->hw.type = MOUSE_MOUSE;
sc->hw.model = MOUSE_MODEL_GENERIC;
sc->hw.hwid = 0;
- sc->mode.protocol = MOUSE_PROTO_MSC;
+ sc->mode.protocol = MOUSE_PROTO_SYSMOUSE;
sc->mode.rate = 1;
sc
>mode.resolution = MOUSE_RES_UNKNOWN;
sc->mode.accelfactor = 0;
- sc->mode.level = 0;
- sc->mode.packetsize = MOUSE_MSC_PACKETSIZE;
- sc->mode.syncmask0 = MOUSE_MSC_SYNCMASK;
- sc->mode.syncmask1 = MOUSE_MSC_SYNC;
+ sc->mode.level = 1;
+ sc->mode.packetsize = MOUSE_SYS_PACKETSIZE;
+ sc->mode.syncmask0 = MOUSE_SYS_SYNCMASK;
+ sc->mode.syncmask1 = MOUSE_SYS_SYNC;

sc->status.flags = 0;
sc->status.button = sc->status.obutton = 0;

Of course, xorg.conf needs to be modified to use this protocol:
Option "Protocol" "sysmouse"
Option "Device" "/dev/ums0"

Now the wheel and the extra buttons (to go back/forward in a browser) all work,
which makes me a happy DFBSD user !
I don't know if this patch is the right way to fix the problem (IIRC, I didn't
manage to fix it using moused), but it works for me, so it may be useful to
someone else.

Regards,

Laurent Sartran

Actions #1

Updated by dillon over 18 years ago

:Hello,
:
:I've ran into problems trying to get all the buttons of my Logitech MX 310 USB
:mouse to work on DragonFly 1.4-RELEASE with Xorg 6.9.
:
:I had the following lines in my xorg.conf:
: Option "Protocol" "auto"
: Option "Device" "/dev/ums0"
:...
:
:Of course, xorg.conf needs to be modified to use this protocol:
: Option "Protocol" "sysmouse"
: Option "Device" "/dev/ums0"
:
:Now the wheel and the extra buttons (to go back/forward in a browser) all work,
:which makes me a happy DFBSD user !
:I don't know if this patch is the right way to fix the problem (IIRC, I didn't
:manage to fix it using moused), but it works for me, so it may be useful to
:someone else.
:
:Regards,
:
:Laurent Sartran

I don't know if changing the default mode for ums would break other
things or not. Could sysmouse be modified to change UMS's default mode
instead? It's probably an ioctl() of some sot.
-Matt
Matthew Dillon
<>
Actions #2

Updated by lsartran over 18 years ago

On Mon, Feb 13, 2006 at 08:02:38AM -0800, Matthew Dillon wrote:

I don't know if changing the default mode for ums would break other
things or not. Could sysmouse be modified to change UMS's default mode
instead? It's probably an ioctl() of some sot.

-Matt
Matthew Dillon
<>

Indeed, ums provides a MOUSE_SETMODE ioctl for that.

I've just stumbled upon an undocumented switch of moused, -l, which should let
the user force the level (mode) of the device. It appears neither in the man
page, nor in usage. Anyway, I couldn't get it to work without problems: in
level 0, moused displays an error about an unappropriate ioctl(), and in level
1, the mouse is painfully slow in X.org.

I'm a little bit lost with all that: I can't get moused to work correctly with
my mouse, and I have to modify ums(4) to use the right mode by default.
I guess I'll try to write a little oneliner to set it using ioctl(), which will
be loaded at startup...

Regards,

Laurent Sartran

Actions #3

Updated by dillon over 18 years ago

:
:Indeed, ums provides a MOUSE_SETMODE ioctl for that.
:
:I've just stumbled upon an undocumented switch of moused, -l, which should let
:the user force the level (mode) of the device. It appears neither in the man
:page, nor in usage. Anyway, I couldn't get it to work without problems: in
:level 0, moused displays an error about an unappropriate ioctl(), and in level
:1, the mouse is painfully slow in X.org.
:
:I'm a little bit lost with all that: I can't get moused to work correctly with
:my mouse, and I have to modify ums(4) to use the right mode by default.
:I guess I'll try to write a little oneliner to set it using ioctl(), which will
:be loaded at startup...
:
:Regards,
:
:Laurent Sartran

See if that works and if it does and there is no equivalent moused
option, we can add a new option to moused to do the ioctl. Or, rather,
if you make the modification to moused and submit the patch we'll commit
it. I'd prefer that over changing the device driver's default mode.
-Matt
Matthew Dillon
&lt;&gt;
Actions #4

Updated by corecode over 18 years ago

Matthew Dillon wrote:

:
:Indeed, ums provides a MOUSE_SETMODE ioctl for that.
:
:I've just stumbled upon an undocumented switch of moused, -l, which should let
:the user force the level (mode) of the device. It appears neither in the man
:page, nor in usage. Anyway, I couldn't get it to work without problems: in
:level 0, moused displays an error about an unappropriate ioctl(), and in level
:1, the mouse is painfully slow in X.org.

are you sure that you are using the latest Xorg version from pkgsrc?
There recently was a fix concerning moused.

:I'm a little bit lost with all that: I can't get moused to work correctly with
:my mouse, and I have to modify ums(4) to use the right mode by default.
:I guess I'll try to write a little oneliner to set it using ioctl(), which will
:be loaded at startup...

moused works perfectly with my 3 button/wheel usb mouse here. what does

moused -d -f -p /dev/ums0

output?

See if that works and if it does and there is no equivalent moused
option, we can add a new option to moused to do the ioctl. Or, rather,
if you make the modification to moused and submit the patch we'll commit
it. I'd prefer that over changing the device driver's default mode.

definitely. but i think moused should already support the best mode
possible.

cheers
simon

Actions #5

Updated by lsartran over 18 years ago

On Fri, Feb 17, 2006 at 10:19:24AM +0100, Simon 'corecode' Schubert wrote:

are you sure that you are using the latest Xorg version from pkgsrc? There
recently was a fix concerning moused.

Well actually, I've just upgraded to the very latest version of xorg-server,
6.9.0nb5 (I was using 6.9.0nb3), and the problem have disappeared... I'm
sincerely sorry for making Matt and you lose your time with this.

I did read Joerg's message of Feb 1st about a "sysmouse issue" fixed in the
current package set, which I was using, but since I still experienced a problem,
I thought this issue was unrelated... Next time, I'll check the version more
carefully.

:I'm a little bit lost with all that: I can't get moused to work correctly

with :my mouse, and I have to modify ums(4) to use the right mode by default.

:I guess I'll try to write a little oneliner to set it using ioctl(), which

will

:be loaded at startup...

moused works perfectly with my 3 button/wheel usb mouse here. what does

moused -d -f -p /dev/ums0

output?

The output was always perfectly correct, but the mouse behavior under X.org
wasn't until the upgrade...

moused: received char 0x87
moused: received char 0x0
moused: received char 0x0
moused: received char 0x0
moused: received char 0x0
moused: received char 0x0
moused: received char 0x0
moused: received char 0x7f
moused: assembled full packet (len 8) 87,0,0,0,0,0,0,7f
moused: tv: 1140198616 381342
moused: flags:00000010 buttons:00000000 obuttons:00000010
moused: activity : buttons 0x00000000 dx 0 dy 0 dz 0
moused: mstate4->count:1
moused: button 5 count 0

Just in case someone is bugged by moused for some reason, here is the little
piece of code I was using to make full use of my mouse.

8<-------------------------------------------------------------------------
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <machine/mouse.h>

void fail(char *s) {
printf("%s\n",s);
exit(-1);
}

int main() {
int fd, level;
if ((fd = open("/dev/ums0", O_RDONLY))==-1)
fail("unable to open mouse device");
if (ioctl(fd, MOUSE_GETLEVEL, &level)==-1)
fail("unable to get mouse device level");
level = level ? 0 : 1;
if (ioctl(fd, MOUSE_SETLEVEL, &level)==-1)
fail("unable to set mouse device level");
printf("mouse device level set to: %d\n",level);
close(fd);
return 0;
}
-------------------------------------------------------------------------8<

Regards,

Laurent Sartran

Actions #6

Updated by corecode over 18 years ago

bug in xorg

Actions

Also available in: Atom PDF