Skip to content

Commit

Permalink
Merge pull request #9 from avilella/master
Browse files Browse the repository at this point in the history
multiple additions
  • Loading branch information
mkottman committed Jun 25, 2011
2 parents 3a8b6f6 + 9c5dc8f commit 07a2e89
Show file tree
Hide file tree
Showing 4 changed files with 465 additions and 29 deletions.
67 changes: 67 additions & 0 deletions query_dsdt.pl
@@ -0,0 +1,67 @@
#!/usr/bin/perl
use strict;
use Getopt::Long;
use Data::Dumper;

my ($dir,$debug,$mytokens);
$dir = '.';
GetOptions(
'd|dir:s' => \$dir,
'debug:s' => \$debug,
't|tokens:s' => \$mytokens,
);

my $models;

my @tokens = (
'MXMX','MXDS','_DSM',
'0xA6, 0xFA, 0xDD, 0x3D, 0x1B, 0x36, 0xB4, 0x4E',
'0xA4, 0x24, 0x8D, 0x10, 0x08, 0x9D, 0x16, 0x53');

if (defined $mytokens) {
@tokens = ();
foreach my $mytoken (split(":",$mytokens)) {
push @tokens, $mytoken;
}
}

opendir DIR,$dir or die $!;
my $file;
my $count = 0;
while (( defined($file = readdir(DIR)) )) {
if ($file =~ /\.dsl$/) {
analyse_file($dir,$file);
}
last if ($count++ > $debug && defined($debug));
}

foreach my $file (sort keys %$models) {
my $num = scalar keys %{$models->{$file}}; $num = sprintf("%02d",$num);
print "$num $file \{";
foreach my $token (sort keys %{$models->{$file}}) {
my $value = $models->{$file}{$token};
print "\t$token => $value ";
}
print "\}\n";
}
$DB::single=1;1;
print STDERR Dumper($models) if ($debug);

########################################

sub analyse_file {
my $dir = shift;
my $file = shift;
my $param = shift;

open FILE, "$dir/$file" or die $!;
while (<FILE>) {
foreach my $token (@tokens) {
my $regexp = qr/${token}/;
if ($_ =~ /$regexp/g) {
$models->{$file}{$token}++;
}
}
}
close FILE;
}
59 changes: 30 additions & 29 deletions test_off.sh 100755 → 100644
@@ -1,35 +1,36 @@
#!/bin/bash

if lsmod | grep -q acpi_call; then
methods="
\_SB.PCI0.P0P1.VGA._OFF
\_SB.PCI0.P0P2.VGA._OFF
\_SB_.PC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.DSM._T_0
\_SB.PCI0.LPC.EC.PUBS._OFF
\_SB.PCI0.P0P2.NVID._OFF
\_SB.PCI0.P0P2.VGA.PX02
"

for m in $methods; do
echo -n "Trying $m: "
echo -n "Trying $m: "
echo $m > /proc/acpi/call
result=$(cat /proc/acpi/call)
case "$result" in
Expand All @@ -41,8 +42,8 @@ if lsmod | grep -q acpi_call; then
break
;;
esac
done
done
else
echo 'The acpi_call module is not loaded'
echo 'The acpi_call module is not loaded'
exit 1
fi

0 comments on commit 07a2e89

Please sign in to comment.