e85b0dd
#!/usr/bin/perl
e85b0dd
#
e85b0dd
# Copyright 2007 Red Hat Inc.
e85b0dd
# This crappy script written by Dave Airlie to avoid hassle of adding
e85b0dd
# ids in every place.
e85b0dd
#
e85b0dd
# use perl gen_radeon.xinf xf86-video-ati-6.9.0/src/pcidb/ati_pciids.csv
e85b0dd
use strict;
e85b0dd
use warnings;
e85b0dd
use Text::CSV_XS;
e85b0dd
e85b0dd
my $file = $ARGV[0];
e85b0dd
e85b0dd
my $atioutfile = 'radeon.xinf';
e85b0dd
e85b0dd
my $csv = Text::CSV_XS->new();
e85b0dd
e85b0dd
open (CSV, "<", $file) or die $!;
e85b0dd
e85b0dd
open (ATIOUT, ">", $atioutfile) or die;
e85b0dd
e85b0dd
while (<CSV>) {
e85b0dd
  if ($csv->parse($_)) {
e85b0dd
    my @columns = $csv->fields();
e85b0dd
e85b0dd
    if ((substr($columns[0], 0, 1) ne "#")) {
e85b0dd
e85b0dd
e85b0dd
      if (($columns[2] ne "R128") && ($columns[2] ne "MACH64") && ($columns[2] ne "MACH32")) {
e85b0dd
	my $val = substr($columns[0], 2);
e85b0dd
        print ATIOUT "alias pcivideo:v00001002d0000".$val."sv*sd*bc*sc*i* radeon # $columns[8]\n"
e85b0dd
      }
e85b0dd
    }
e85b0dd
  } else {
e85b0dd
    my $err = $csv->error_input;
e85b0dd
    print "Failed to parse line: $err";
e85b0dd
  }
e85b0dd
}
e85b0dd
e85b0dd
close CSV;
e85b0dd
close ATIOUT;