From da4293191914420d37335ab26949161781311318 Mon Sep 17 00:00:00 2001 From: Colin Guthrie Date: Sun, 18 Dec 2011 20:57:14 +0000 Subject: Convert mouse helper to use udevadm in order to work with udev 175+ --- NEWS | 1 + lib/mouse.pm | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index ecb43db..f7eec2f 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,7 @@ - do not offer to try KMS drivers during installation (mga#3711) - display_driver_helper: use the new modprobe --resolve-alias instead of manually parsing --dry-run output +- convert mouse helper to use udevadm in order to work with udev 175+ Version 0.98 - 07 November 2011 - display_driver_helper: allow automatic loading of the implicit driver diff --git a/lib/mouse.pm b/lib/mouse.pm index 307a5b3..11cb30f 100644 --- a/lib/mouse.pm +++ b/lib/mouse.pm @@ -193,8 +193,14 @@ sub write { sub _input_entry_to_device_by_id { my ($input) = @_; - my $ID_SERIAL = chomp_(run_program::get_stdout('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 $ID_SERIAL = ""; + for (split /^/, run_program::get_stdout('udevadm', 'info', '--query', 'env', '--path', $input->{sysfs_path})) { + if (/^ID_SERIAL=(.*)/) { + $ID_SERIAL = $1; + $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 + break; + } + } 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; -- cgit v1.2.1