################################################################################
# How to merge the pcitable with various sources:
#


# AMD graphics card IDs
#
# - from the proprietary driver:
convert/merge2pcitable.pl fglrxko_pci_ids_h /path/to/fglrxko_pci_ids.h lst/pcitable > lst/pcitable.new
#   fglrxko_pci_ids.h can be found in /usr/src/fglrx-$dkmsversion or in
#   common/lib/modules/fglrx/build_mod inside the AMD installer package.
# - from the free ATI driver:
convert/merge2pcitable.pl ati_pciids_csv /path/to/ati_pciids.csv lst/pcitable > lst/pcitable.new
#   ati_pciids.csv can be found in src/pcidb subdirectory of xf86-video-ati
#   tarball
#
# merge2pcitable.pl contains hacks that automatically switch entries between
# radeon/fglrx/vesa when support is added/removed in the above drivers.
# The hacks need to be updated when Cards+ is modified regarding the AMD
# cards.


# NVIDIA graphics card IDs
#
# - from the proprietary nvidia390 driver:
NVIDIA_CARD="NVIDIA GeForce 420 series to GeForce 630" convert/merge2pcitable.pl nvidia_readme \
	/path/to/README.txt lst/pcitable > lst/pcitable.new
#
# - from the proprietary nvidia-current driver:
NVIDIA_CARD="NVIDIA GeForce 635 series and later" convert/merge2pcitable.pl nvidia_readme \
	/path/to/README.txt lst/pcitable.x86_64 > lst/pcitable.x86_64.new
#   README.txt is found in /usr/share/doc/x11-driver-video-nvidia-current/README.txt and
#   in the NVIDIA installer archive.
#   The newly added entries will be assigned to "Card:$NVIDIA_CARD",
#   defaulting to "Card:NVIDIA_UNKNOWN" which is an invalid assignment
#   and shouldn't be committed as-is.
#
# The driver can actually unofficially support more (newer) cards than those
# that are in README.txt, and this list can be extracted from nvidia_drv.so
# (but not currently by merge2pcitable.pl).
#
# nouveau driver doesn't have ID lists, instead it uses a NVIDIA-specific
# PMC.ID for detecting if a card is supported or not. Currently we use the
# IDs from the proprietary driver for it as well.
#
# You can use option "-f=" (sic) to force all already-existing entries
# (only those supported by the imported driver, of course) to be set to
# $NVIDIA_CARD instead of just unexisting entries (the default).
# This is useful when e.g. branching a legacy driver (first use sed etc.
# to have everything assigned to the legacy driver, then use -f= to
# force-assign everything still supported by the current driver to it.
#

# Intel graphics card IDs
#
# - from the i915 kernel module:
grep '^i915\s' /lib/modules/$version/modules.pcimap | convert/merge2pcitable.pl kernel_pcimap \
	/dev/stdin lst/pcitable | sed 's,i915,Card:Intel 810 and later,' > lst/pcitable.new
#


# update pciutils
./merge2pcitable.pl pciids /usr/share/pci.ids pcitable > pcitable.new

# update usbutils
./merge2pcitable.pl pciids /usr/share/usb.ids usbtable > usbtable.new

#  A pciids with more accurate information are available from
#  was moved into http://www.pcidatabase.com/reports.php?type=tab-delimeted
rm -f vendors.txt ; wget http://www.yourvote.com/pci/vendors.txt
./merge2pcitable.pl pciids vendors.txt pcitable > pcitable.new

# Another one
rm -f pcids.htm ; wget http://www.begent.co.uk/pcids.htm
./merge2pcitable.pl begent_pcids_htm pcids.htm pcitable > pcitable.new
# you can also try the following. BUT be careful when choosing cards needing subids. Ask pixel@mandriva.com first!
./merge2pcitable.pl --keep-subids begent_pcids_htm pcids.htm pcitable > pcitable.new

# http://members.hyperlink.net.au/~chart/download/pcidevs.txt


# with redhat's pcitable in /tmp/rh_pcitable (from kudzu or anaconda)
./merge2pcitable.pl pcitable /tmp/rh_pcitable pcitable > pcitable.new

# with redhat's pcitable in /tmp/rh_pcitable (from hwdata)
./merge2pcitable.pl rhpcitable /tmp/rh_pcitable pcitable > pcitable.new

# with SuSE hwinfo 
# (srpm in ftp://ftp.suse.com/pub/suse/i386/current/suse/src)
./merge2pcitable.pl hwinfo_x11 /tmp/hwinfo-9.31/src/ids/src/x11.i386 pcitable > pcitable.new


# with a new kernel
(cd ~/tmp ; rm -rf lib ; rpm2cpio /RPMS/kernel-2.4.*.rpm |cpio -id './lib/modules/*/modules.*map')
cp -f ~/tmp/lib/modules/*/modules.{pci,usb}map .
rm -rf ~/tmp/lib
./merge2pcitable.pl kernel_pcimap modules.pcimap pcitable > pcitable.new
./merge2pcitable.pl kernel_usbmap modules.usbmap usbtable > usbtable.new


# checking the pcitable
./merge2pcitable.pl pcitable pcitable pcitable > /dev/null

## do "ln -s ../lst/pcitable" first
