From 8dc666d4b3b64814dc3a27e476350b94fcdfb232 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sat, 14 Apr 2007 15:09:59 -0300 Subject: Use a better format to represent usbvision supported boards From: Mauro Carvalho Chehab Changed usbvision cards table to allow: 1) Not repeat USB ID on two structs; 2) Not need to specify both usb and card description tables at the same order, removing some magic; Some cards had duplicated names. Fixed. A test for an specific board were doing by using a string comparation. The comparation were wrong. Also, it is not a good practice to recognize a board based on his string name. Acked-by: Thierry MERLE Signed-off-by: Mauro Carvalho Chehab --- v4l/scripts/usbvision.pl | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) (limited to 'v4l/scripts/usbvision.pl') diff --git a/v4l/scripts/usbvision.pl b/v4l/scripts/usbvision.pl index 5aae512c5..3976e8bd1 100755 --- a/v4l/scripts/usbvision.pl +++ b/v4l/scripts/usbvision.pl @@ -6,26 +6,29 @@ my $nr = 0; my ($id,$subvendor,$subdevice); my %data; -my $cap=0; - while (<>) { - if (m/usbvision_device_data/) { - $cap=1; - next; - } - if (m/usbvision_table/) { - $cap=0; + # defines in header file + if (/#define\s*(\w+)\s*(\d+)/) { + $data{$1}->{nr} = $2; next; } - if ($cap==0) { - next; + # boards + if (/^\s*\[([\w\d_]+)\]\s*=\s*{/) { + $id = $1; + $data{$id}->{id} = $id; + }; + + next unless defined($id); + + if (/USB_DEVICE.*0x([0-9a-fA-F]*).*0x([0-9a-fA-F]*).*driver_info\s*=\s*([\w\d_]+)/) +{ + $subvendor=$1; + $subdevice=$2; + push @{$data{$3}->{subid}}, "$subvendor:$subdevice"; } - if (m/\{0x([0-9a-z]...)\s*\,\s*0x([0-9a-z]...).*\"(.*)\"/) { - $data{$nr}->{nr} = $nr; - $data{$nr}->{name} = $3; - push @{$data{$nr}->{subid}}, "$1:$2"; - $nr++; + if (!defined($data{$id}) || !defined($data{$id}->{name})) { + $data{$id}->{name} = $1 if (/\.ModelString\s*=\s*\"([^\"]+)\"/); } } -- cgit v1.2.3