You are not logged in.

#1 2007-06-28 11:37:01

perost
Member
Registered: 2007-01-23
Posts: 52

Stop mouse from changing device

Hi!

I have a Logitech G7 mouse that I've set up to use evdev, to be able to use the extra buttons on it. In my xorg.conf I have

Section "InputDevice"
    Identifier     "Mouse0"
    Driver         "evdev"
    Option        "Protocol"    "evdev"
    Option        "Name"         "Logitech USB Receiver"
    Option         "Dev Name"    "Logitech USB Receiver"
    Option        "Dev Phys"    "usb-0000:00:1a.0-2/input0"
    Option        "Device"    "/dev/input/event4"
    Option        "Buttons"    "8"
    Option        "ZAxisMapping"    "4 5 7 8"
EndSection

This works fine for me, I can use the sidebutton and can also tilt the mousewheel. However, the device keeps changing between event4 and event5, which means I have to change xorg.conf all the time. I assume it's somehow possible to get udev to assign the same device everytime, but I can't figure out how. I would really appreciate some help with this, cause I'm starting to get tired of this. I run Arch64 in case that matters. Here's my input devices:

I: Bus=0017 Vendor=0001 Product=0001 Version=0100
N: Name="Macintosh mouse button emulation"
P: Phys=
S: Sysfs=/class/input/input0
H: Handlers=mouse0 event0 ts0 
B: EV=7
B: KEY=70000 0 0 0 0
B: REL=3

#This is the mouse
I: Bus=0003 Vendor=046d Product=c51a Version=0111
N: Name="Logitech USB Receiver"
P: Phys=usb-0000:00:1d.2-1/input0
S: Sysfs=/class/input/input4
H: Handlers=mouse1 event4 ts1 
B: EV=7
B: KEY=ffff0000 0 0 0 0
B: REL=143

#I don't know what this is. I don't have logitech keyboard.
I: Bus=0003 Vendor=046d Product=c51a Version=0111
N: Name="Logitech USB Receiver"
P: Phys=usb-0000:00:1d.2-1/input1
S: Sysfs=/class/input/input5
H: Handlers=kbd event5 
B: EV=f
B: KEY=7fff002c3027 bf00444000000000 1 f808807c000 667bfad9415fed 8e000000000000 0
B: REL=40
B: ABS=100000000

#This is my PS/2 keyboard.
I: Bus=0011 Vendor=0001 Product=0001 Version=ab41
N: Name="AT Translated Set 2 keyboard"
P: Phys=isa0060/serio0/input0
S: Sysfs=/class/input/input6
H: Handlers=kbd event6 
B: EV=120013
B: KEY=402000000 3802078f840d001 feffffdfffefffff fffffffffffffffe
B: MSC=10
B: LED=7

Offline

#2 2007-06-28 12:17:34

Asaru
Member
Registered: 2006-05-06
Posts: 14

Re: Stop mouse from changing device

you could write a udev rule for that

BUS=="usb", SYSFS{manufacturer}=="logitech", SYSFS{product}=="blabla", SYMLINK+="input/my_mouse"

you have to look for these or similiar atomar things

udevinfo -a -p /sys/class/input/mouse1 or mouse0

after that you have to restart udev

now you can use this in your xorg.conf

 Option        "Device"    "/dev/input/my_mouse"

a good howto to udev rules:
http://reactivated.net/writing_udev_rules.html

Offline

#3 2007-06-28 17:39:24

perost
Member
Registered: 2007-01-23
Posts: 52

Re: Stop mouse from changing device

Thanks! I'll try that.

Offline

#4 2007-06-28 18:13:06

ndlarsen
Member
From: Denmark
Registered: 2005-11-02
Posts: 157

Re: Stop mouse from changing device

Don't bother with udev. Rather use 'Name' of the appropiate device you'll find in the output from 'devices'. It's presistent.


I made it long
as I lacked the time to make it short...

Offline

#5 2007-06-28 19:25:58

perost
Member
Registered: 2007-01-23
Posts: 52

Re: Stop mouse from changing device

Well, I've tried with udev now, and it seems like evdev refuse to have anything to do with symlinks. I tried to rename the device to event9 instead, but evdev didn't like that either.

And ndlarsren, I know you can use Name instead. But the problem is that while it's persistent, the devices that keeps changing place has the same name sad If you see my dump above there's two devices with the name "Logitech USB Receiver". One of them is the mouse, and the other one is apparently there in case the USB receiver wants to be a keyboard too.

Perhaps I should write a script that parses the output of /proc/bus/input/devices and changes xorg.conf everytime I start linux. It feels like there should be some easier solution, but it's at least less annoying than having to edit xorg.conf all the time.

Offline

#6 2007-06-28 21:07:13

ndlarsen
Member
From: Denmark
Registered: 2005-11-02
Posts: 157

Re: Stop mouse from changing device

Sorry about that, guess I was a little fast on replying. The USB keyboard thing might be due to some sort of search button thing . Evdev ought to handle symlinks, it did for me a while back. Might have been changed, though. Anyway, try using

Option "Phys" "usb-0000:00:1d.2-1/input0"

in your xorg.conf or

KERNEL=="event[0-9]*", SYSFS{../name}=="Logitech USB Receiver", SYSFS{../phys}=="usb-0000:00:1d.2-1/input0", NAME="input/event9"

as an udev rule.

Last edited by ndlarsen (2007-06-28 21:14:15)


I made it long
as I lacked the time to make it short...

Offline

#7 2007-06-29 08:34:58

perost
Member
Registered: 2007-01-23
Posts: 52

Re: Stop mouse from changing device

Well, I did manage to write a udev rule that assigned the mouse to event9, but for some odd reason it didn't work with evdev. The man page for evdev says that evdev only uses event*, but I don't understand why event9 doesn't work then. But the phys-thing worked. My mouse-section in xorg.conf now looks like

Section "InputDevice"
    Identifier     "Mouse0"
    Driver         "evdev"
    Option        "Protocol"         "evdev"
    Option         "Name"     "Logitech USB Receiver"
    Option        "Phys"                 "usb-0000:00:1d.2-1/input0"
    Option        "Buttons"        "8"
    Option        "ZAxisMapping"    "4 5 7 8"
EndSection

At a first glance this seems to work as I want. However, if I understand correctly, the phys is tied to a specific usb port? Which means that it will change if I plug the mouse into another port. But since I rarely unplug the mouse anyway, this is a much better solution than having to change xorg.conf all the time.

Last edited by perost (2007-06-29 08:35:36)

Offline

Board footer

Powered by FluxBB