diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/mouse.pm | 10 |
1 files changed, 8 insertions, 2 deletions
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; |