From a7b271677cac573bea00ad9667f4503375604e8b Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Mon, 19 Nov 2007 16:53:13 +0000 Subject: - use /dev/input/by-id/xxx device instead of vendor+product for evdev mice (vendor+product support is dropped in x11-driver-input-evdev-1.2.0) --- lib/mouse.pm | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) (limited to 'lib/mouse.pm') diff --git a/lib/mouse.pm b/lib/mouse.pm index 1c776ba..8df14c1 100644 --- a/lib/mouse.pm +++ b/lib/mouse.pm @@ -242,22 +242,26 @@ sub write { } } +sub input_entry_to_device_by_id { + my ($input) = @_; + + my $ID_SERIAL = chomp_(run_program::get_stdout('/lib/udev/usb_id', $input->{sysfs_path})); + $ID_SERIAL =~ s/[^\w#+\-.:=@_]/_/g; #- udev do a further cleanup, eg: "Wacom_Co.,Ltd._MTE-450" => "Wacom_Co._Ltd._MTE-450". cf ALLOWED_CHARS udev.h + my $sysfs_device = "input/by-id/usb-$ID_SERIAL-event-mouse"; #- from /etc/udev/rules.d/60-persistent-input.rules + if ($::isInstall || -e "/dev/$sysfs_device") { + $sysfs_device; + } else { + log::l("$sysfs_device missing"); + (); + } +} + sub probe_usb_wacom_devices() { detect_devices::hasWacom() or return; eval { modules::load("wacom", "evdev") }; - map { - my $ID_SERIAL = chomp_(run_program::get_stdout('/lib/udev/usb_id', $_->{sysfs_path})); - $ID_SERIAL =~ s/[^\w#+\-.:=@_]/_/g; #- udev do a further cleanup, eg: "Wacom_Co.,Ltd._MTE-450" => "Wacom_Co._Ltd._MTE-450". cf ALLOWED_CHARS udev.h - my $sysfs_device = "input/by-id/usb-$ID_SERIAL-event-mouse"; #- from /etc/udev/rules.d/60-persistent-input.rules - if ($::isInstall || -e "/dev/$sysfs_device") { - $sysfs_device; - } else { - log::l("$sysfs_device missing"); - (); - } - } detect_devices::usbWacom(); + map { input_entry_to_device_by_id($_) } detect_devices::usbWacom(); } sub detect_serial() { @@ -293,9 +297,8 @@ sub mice2evdev { #- we always use HWheelRelativeAxisButtons for evdev, it tells mice with no horizontal wheel to skip those buttons #- that way we ensure 6 & 7 is always horizontal wheel #- (cf patch skip-HWheelRelativeAxisButtons-even-if-unused in x11-driver-input-evdev) - { bustype => "0x$_->{bustype}", vendor => "0x$_->{vendor}", product => "0x$_->{id}", - relBits => "+0+1+2", HWheelRelativeAxisButtons => "7 6" }; - } @mice ] + { device => "/dev/$_", HWheelRelativeAxisButtons => "7 6" }; + } map { input_entry_to_device_by_id($_) } @mice ]; } sub detect_evdev_mice { -- cgit v1.2.1