diff options
author | Antonio Gallo <tonicucoz@gmail.com> | 2012-04-17 21:02:56 +0000 |
---|---|---|
committer | Antonio Gallo <tonicucoz@gmail.com> | 2012-04-17 21:02:56 +0000 |
commit | 18aa21f2aadf1d5bfbf1d28bd5f32643ab3fbab1 (patch) | |
tree | b875fe42e293736bec6ff2b89a9e6e9a933d5e75 /scripts/vendorid/insert_vendors.php | |
parent | 891d0f86a6b3c17e5625979a5030727a73412e8d (diff) |
added usb.ids
Diffstat (limited to 'scripts/vendorid/insert_vendors.php')
-rw-r--r-- | scripts/vendorid/insert_vendors.php | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/scripts/vendorid/insert_vendors.php b/scripts/vendorid/insert_vendors.php index 14f2235..27b8307 100644 --- a/scripts/vendorid/insert_vendors.php +++ b/scripts/vendorid/insert_vendors.php @@ -7,6 +7,7 @@ include("connect.php"); include("functions.php"); +//insert the PCI vendors $ids_fp = fopen('pci.ids', 'r'); while (($line = fgets($ids_fp)) !== false) { @@ -21,4 +22,21 @@ while (($line = fgets($ids_fp)) !== false) { } } +fclose($ids_fp); + +//insert the USB vendors +$ids_fp = fopen('usb.ids', 'r'); + +while (($line = fgets($ids_fp)) !== false) { + if (preg_match('/^([0-9a-f]{4})\s+(.*)\s*$/', + $line, $matches) == 1) { + $vendorid = $matches[1]; + $full_name = sanitizeDb(decode_soft($matches[2])); + $clean_name = sanitizeDb(decode($matches[2])); +// echo "$vendorid $full_name $clean_name".PHP_EOL; + $query = "INSERT INTO vendors (bus,vendorid,clean_name,full_name) VALUES ('usb','$vendorid','$clean_name','$full_name');"; + DB::$instance->query($query); + } +} + fclose($ids_fp);
\ No newline at end of file |