diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2011-07-25 13:18:04 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2011-07-27 12:22:33 +1000 |
commit | 36c5ab2a8b20bbd43a94acb23c81c3835077e3ca (patch) | |
tree | edc81437917ca0bb1fb3e0c3e95bca7ac987c46c /XOrg | |
parent | e96b8ba5e703af0ccde30ecf86dc1674f7654ae7 (diff) |
XOrg: Parse some input driver information.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'XOrg')
-rwxr-xr-x | XOrg/InputDevice.pm | 47 | ||||
-rwxr-xr-x | XOrg/xorglog.pm | 31 |
2 files changed, 77 insertions, 1 deletions
diff --git a/XOrg/InputDevice.pm b/XOrg/InputDevice.pm index 33d62be..f75df3d 100755 --- a/XOrg/InputDevice.pm +++ b/XOrg/InputDevice.pm @@ -37,6 +37,9 @@ sub new { my $class = shift; my $self = {@_}; bless ($self, $class); + + $self->{inputclasses} = [()] if not $self->{inputclasses}; + return $self; } @@ -61,6 +64,50 @@ sub attachment { return $self->{attachment}; } +# Input driver module +sub module { + my $self = shift; + my $module = shift; + $self->{module} = $module if defined $module; + return $self->{module}; +} + +# Source is "hal", "udev", "implicit" or "xorg.conf" +sub source { + my $self = shift; + my $source = shift; + $self->{source} = $source if defined $source; + return $self->{source}; +} + +# /dev/input/... device node +sub devicenode { + my $self = shift; + my $devicenode = shift; + $self->{devicenode} = $devicenode if defined $devicenode; + return $self->{devicenode}; +} + +# The list of input classes that apply to this device. +# Arguments: +# - ref to list of input classes +# Returns: +# - The list of input classes +sub inputclasses { + my $self = shift; + my $inputclasses = shift; + + $self->{inputclasses} = [@{$inputclasses}] if defined $inputclasses; + + return @{$self->{inputclasses}}; +} + +sub add_inputclass { + my $self = shift; + my $cls = shift; + push @{$self->{inputclasses}}, $cls; +} + 1; # vim: set noexpandtab shiftwidth=8 tabstop=8: diff --git a/XOrg/xorglog.pm b/XOrg/xorglog.pm index f3f2c54..77f9438 100755 --- a/XOrg/xorglog.pm +++ b/XOrg/xorglog.pm @@ -24,6 +24,7 @@ package xorglog; use Module; +use InputDevice; use warnings; use strict; use Carp; @@ -181,6 +182,32 @@ sub _parse_modules { } } +sub _parse_input_drivers { + my $self = shift; + my $log = shift; + my $dev; + + for (@{$log}) { + if ($_ =~ m|$time_regex \(II\) config/(\w+): Adding input device (.*) \((/.*)\)|) { + $dev = InputDevice->new( + name => $2, + source => $1, + devicenode => $3 + + ); + push @{$self->{devices}}, $dev; + } + + next if not defined $dev; + + if ($_ =~ /$time_regex \(\*\*\) $dev->{name}: Applying InputClass "(.*)"/) { + $dev->add_inputclass($1) + } elsif ($_ =~ /$time_regex \(II\) Using input driver '(.*)' for '$dev->{name}'/) { + $dev->module($self->modules->{$1}); + } + } +} + sub _parse { my $self = shift; my $file = shift; @@ -205,8 +232,10 @@ sub _parse { # Stuff that _may_ be in the log, need to search the whole log for it. $self->_parse_config_backend(\@log); $self->_parse_modules(\@log); -} + # extract input driver output + $self->_parse_input_drivers(\@log); +} my $xlog = xorglog->new(file => "/var/log/Xorg.0.log"); print Dumper($xlog); |