1#!/bin/sh
2#
3# Script to output BSD compatible pci ids file
4#  - Copyright Dave Airlie 2004 (airlied@linux.ie)
5#
6OUTFILE=drm_pciids.h
7
8finished=0
9
10cat > $OUTFILE <<EOF
11/*
12   This file is auto-generated from the drm_pciids.txt in the DRM CVS
13   Please contact dri-devel@lists.sf.net to add new cards to this list
14*/
15EOF
16
17while read pcivend pcidev attribs pciname
18do
19          if [ "x$pcivend" = "x" ]; then
20                    if [ "$finished" = "0" ]; then
21                              finished=1
22                              echo "    {0, 0, 0, NULL}" >> $OUTFILE
23                              echo >> $OUTFILE
24                    fi
25          else
26
27                    cardtype=`echo "$pcivend" | cut -s -f2 -d'[' | cut -s -f1 -d']'`
28                    if [ "x$cardtype" = "x" ];
29                    then
30                              echo "    {$pcivend, $pcidev, $attribs, $pciname}, \\" >> $OUTFILE
31                    else
32                              echo "#define "$cardtype"_PCI_IDS \\" >> $OUTFILE
33                              finished=0
34                    fi
35          fi
36done
37
38if [ "$finished" = "0" ]; then
39          echo "    {0, 0, 0, NULL}" >> $OUTFILE
40fi
41