X-Git-Url: http://git.openwrt.org/?a=blobdiff_plain;f=convert-modeswitch.pl;fp=convert-modeswitch.pl;h=b1530bd7b529bacbdcf0ff5811c9f6af62a92084;hb=f40f84c27534159066c94dadc0c08e0b255c3e26;hp=48d0fd43bfce39cbd041f6baebc5fd8d5365deeb;hpb=d8dc33512453fa73264a1990b25496da6cfd2a4a;p=project%2Fusbmode.git diff --git a/convert-modeswitch.pl b/convert-modeswitch.pl index 48d0fd4..b1530bd 100755 --- a/convert-modeswitch.pl +++ b/convert-modeswitch.pl @@ -46,9 +46,15 @@ sub add_mode { return $_[1]; } +sub add_modeval { + return unless ($_[1] && $_[1] =~ /^\d+$/); + $_[0]->{"ModeValue"} = $_[1]; +} + my $hex_option = [ undef, \&add_hex ]; my $msg_option = [ undef, \&add_message ]; my $mode_option = [ "Mode", \&add_mode ]; +my $value_mode_option = [ "Mode", \&add_mode, \&add_modeval ]; my %options = ( TargetVendor => $hex_option, TargetProductList => [ "TargetProduct", sub { return [ map(hex,split(/,/, $_[0])) ]; } ], @@ -64,6 +70,7 @@ my %options = ( HuaweiNewMode => $mode_option, QuantaMode => $mode_option, BlackberryMode => $mode_option, + PantechMode => $value_mode_option, OptionMode => $mode_option, SierraMode => $mode_option, SonyMode => $mode_option, @@ -116,6 +123,7 @@ sub parse_file($) { next; }; + $opt->[2] and &{$opt->[2]}($dev, $val, $var); $opt->[1] and $val = &{$opt->[1]}($val, $var); $opt->[0] and $var = $opt->[0]; $dev->{$var} = $val; @@ -210,6 +218,7 @@ foreach my $devid (sort keys %devices) { dev_opt($cur->{TargetClass}, "t_class", "int", \$sep); dev_opt($cur->{DetachStorageOnly}, "detach_storage", "bool", \$sep); dev_opt($cur->{Mode}, "mode", "string", \$sep); + dev_opt($cur->{ModeValue}, "modeval", "int", \$sep); dev_opt($cur->{NoDriverLoading}, "no_driver", "bool", \$sep); dev_opt($cur->{MessageEndpoint}, "msg_endpoint", "int", \$sep); my $msg = [