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