В Mon, 24 Oct 2011 16:10:14 +0200
Daniel Golle <dgo...@allnet.de> пишет:

> Not particularly beautiful but doing the trick...
> 
> Signed-off-by: Daniel Golle <dgo...@allnet.de>
> 
> diff --git a/utils/usb-modeswitch/files/modeswitch.hotplug 
> b/utils/usb-modeswitch/files/modeswitch.hotplug
> index 1aecb1f..7f9ce94 100644
> --- a/utils/usb-modeswitch/files/modeswitch.hotplug
> +++ b/utils/usb-modeswitch/files/modeswitch.hotplug
> @@ -120,7 +120,20 @@ if [ "$ACTION" = add ]; then
>               # If a candidate is remaining, start usb-modeswitch
>               [ -n "$configs" ] && {
>                       log "$DEVICENAME: Selecting ${configs%% *} for mode 
> switching"
> -                     $modeswitch -c "${configs%% *}"
> +                     # ugly workaround, but working for all hw we got for 
> testing
> +                     switching_done=0
> +                     switching_tries=0
> +                     local usb_dir="/sys/$DEVPATH"       
> +                     [ -f "$usb_dir/idVendor" ] || usb_dir="${usb_dir%/*}"
> +                     while [ $switching_done -lt 1 -a $switching_tries -le 6 
> ]; do
> +                             $modeswitch -I -D -n -s 30 -c "${configs%% *}"
> +                             if [ $(sanitize "$usb_dir/idProduct") -eq $uPid 
> ]; then
> +                                     log "switching seemingly failed"
> +                             else
> +                                     switching_done=1
> +                             fi
> +                             switching_tries=$(( $switching_tries + 1 ))
> +                     done
>               }
>       }
>  fi

Can you please send the log of usb_modeswitch and dmesg when the
problem occurs?
Probably it can be fixed easier and much more reliable in the
usb_modeswitch code. Also other platforms will benefit from it.

-- 
  Alexander
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to