Subject: Merging usbdevs files from others BSD
To: None <tech-kern@netbsd.org>
From: Arnaud Lacombe <lacombar@gmail.com>
List: tech-kern
Date: 07/03/2007 23:18:04
Hi,

Following a discussion on sources-changes@ about merging usbdevs file from the
*BSD, I made a small ruby script to handle this more or less automatically.
Warner Losh already told me he merged freebsd and netbsd one by hand, and tried
to figure out where things did differ, but I think this script could still be
usefull for the future (and for merging more than 2 two usbdevs files).

The script is available here:
http://www.netbsd.org/~alc/scripts/merge_usbdevs.rb

Here are the result I have after merging usbdevs from {Open|Free|Net}BSD:

% wc -l  usbdevs usbdevs.freebsd usbdevs.netbsd usbdevs.openbsd
    3561 usbdevs
    2062 usbdevs.freebsd
    2310 usbdevs.netbsd
    2413 usbdevs.openbsd

% grep ^vendor usbdevs | awk '{print $3}' | sort -u | wc -l
     578
% grep ^vendor usbdevs | awk '{print $3}' | wc -l
     735

As you can see, there is about 160 duplicates in the vendor part (in most case, 
only the last string differ), but as the list is sorted, they could be easyly
merged by hand.

The only caveat of this script is the comment above products which is currently
the symbolic name of the vendor in place of its associated string. This could be
solved without problem provided to have a unique string for a given vendor ID.

any comments ?

 - Arnaud