Imported Upstream version 2.6.2
This commit is contained in:
parent
a367d9bc54
commit
45043b58d0
246 changed files with 18228 additions and 1415 deletions
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env perl
|
||||
# Current Version : 1.0
|
||||
# Copyright (C) 2008 - 2010
|
||||
# Current Version : 1.1
|
||||
# Copyright (C) 2008 - 2011
|
||||
# Arnaud Quette <arnaud.quette@gmail.com>
|
||||
# dloic (loic.dardant AT gmail DOT com)
|
||||
#
|
||||
|
|
@ -43,6 +43,26 @@ my $tmpOutputUPower;
|
|||
# mfr header flag
|
||||
my $upowerMfrHeaderDone = 0;
|
||||
|
||||
# NUT device scanner - C header
|
||||
my $outputDevScanner = "./nut-scanner/nutscan-usb.h";
|
||||
|
||||
my $GPL_header = "\
|
||||
* Copyright (C) 2011 - Arnaud Quette <arnaud.quette\@free.fr>\
|
||||
*\
|
||||
* This program is free software; you can redistribute it and/or modify\
|
||||
* it under the terms of the GNU General Public License as published by\
|
||||
* the Free Software Foundation; either version 2 of the License, or\
|
||||
* (at your option) any later version.\
|
||||
*\
|
||||
* This program is distributed in the hope that it will be useful,\
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of\
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\
|
||||
* GNU General Public License for more details.\
|
||||
*\
|
||||
* You should have received a copy of the GNU General Public License\
|
||||
* along with this program; if not, write to the Free Software\
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA";
|
||||
|
||||
# array of products indexed by vendorID
|
||||
my %vendor;
|
||||
|
||||
|
|
@ -94,6 +114,16 @@ sub gen_usb_files
|
|||
print $outputUPower '# if usbraw device, ignore'."\n".'KERNEL!="hiddev*", GOTO="up_hid_end"'."\n\n";
|
||||
print $outputUPower '# if an interface, ignore'."\n".'ENV{DEVTYPE}=="usb_interface", GOTO="up_hid_end"'."\n\n";
|
||||
|
||||
# Device scanner header
|
||||
open my $outputDevScanner, ">$outputDevScanner" || die "error $outputDevScanner : $!";
|
||||
print $outputDevScanner '/* nutscan-usb'.$GPL_header."\n */\n\n";
|
||||
print $outputDevScanner "#ifndef DEVSCAN_USB_H\n#define DEVSCAN_USB_H\n\n";
|
||||
print $outputDevScanner "#include <usb.h>\n";
|
||||
print $outputDevScanner "#include \"nut_stdint.h\"\t/* for uint16_t */\n\n";
|
||||
# vid, pid, driver
|
||||
print $outputDevScanner "typedef struct {\n\tuint16_t\tvendorID;\n\tuint16_t\tproductID;\n\tchar*\tdriver_name;\n} usb_device_id_t;\n\n";
|
||||
print $outputDevScanner "/* USB IDs device table */\nstatic usb_device_id_t usb_device_table[] = {\n\n";
|
||||
|
||||
# generate the file in alphabetical order (first for VendorID, then for ProductID)
|
||||
foreach my $vendorId (sort { lc $a cmp lc $b } keys %vendorName)
|
||||
{
|
||||
|
|
@ -154,6 +184,9 @@ sub gen_usb_files
|
|||
$tmpOutputUPower = $tmpOutputUPower."\", ATTRS{idProduct}==\"".removeHexPrefix($productId)."\",";
|
||||
$tmpOutputUPower = $tmpOutputUPower.' ENV{UPOWER_BATTERY_TYPE}="ups"'."\n";
|
||||
}
|
||||
|
||||
# Device scanner entry
|
||||
print $outputDevScanner "\t{ ".$vendorId.', '.$productId.", \"".$vendor{$vendorId}{$productId}{"driver"}."\" },\n";
|
||||
}
|
||||
# HAL vendor footer
|
||||
print $outHAL " </match>\n";
|
||||
|
|
@ -171,6 +204,9 @@ sub gen_usb_files
|
|||
print $outputUPower $tmpOutputUPower;
|
||||
# ...and print footer
|
||||
print $outputUPower "\n".'LABEL="up_hid_end"'."\n";
|
||||
|
||||
# Device scanner footer
|
||||
print $outputDevScanner "\t/* Terminating entry */\n\t{ -1, -1, NULL }\n};\n#endif /* DEVSCAN_USB_H */\n\n";
|
||||
}
|
||||
|
||||
sub find_usbdevs
|
||||
|
|
@ -231,8 +267,9 @@ sub find_usbdevs
|
|||
}
|
||||
}
|
||||
|
||||
# store data (to be optimized)
|
||||
if (($vendorName{$VendorID} eq "") && ($VendorName))
|
||||
# store date (to be optimized)
|
||||
# and don't overwritte actual vendor names with empty values
|
||||
if( (!$vendorName{$VendorID}) or (($vendorName{$VendorID} eq "") and ($VendorName ne "")) )
|
||||
{
|
||||
$vendorName{$VendorID}=trim($VendorName);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue