Comments inline.

On 3/12/12 2:22 PM, Cezary Jackiewicz wrote:
> Some 3G modem requires switch from storage to modem before use it as extroot. 
> This enhance block-mount.
> 
> Tested on Huawei E173/E353 
> 
> Signed-off-by: Cezary Jackiewicz <[email protected]>
> 
> 
> Index: feeds/packages/utils/usb-modeswitch/files/modeswitch.preinit
> ===================================================================
> --- feeds/packages/utils/usb-modeswitch/files/modeswitch.preinit      (wersja 
> 0)
> +++ feeds/packages/utils/usb-modeswitch/files/modeswitch.preinit      (wersja 
> 0)
> @@ -0,0 +1,17 @@
> +#!/bin/sh
> +
> +usb_modeswitch () {
> +     DEV=$(awk -F[=\ ] '/P:/ {print $4":"$6}' /proc/bus/usb/devices)

Minor gripe... Just put quotes here instead of backslashes.  Also, where does 
the pattern /P:/ occur? Should it be positionally anchored?


> +     for i in $DEV; do
> +             P="/etc/usb_modeswitch.d/$i"
> +             if [ -f "$P" ]; then

Do we need quotes around $P? Is it likely to contain funky characters?


> +                     VEN=${i:0:4}
> +                     PRO=${i:5}

If anything, I'd be inclined to quote $VEN and $PRO instead.

> +                     /usr/bin/usb_modeswitch -v $VEN -p $PRO -c "$P"
> +             fi
> +     done
> +
> +     blkid > /dev/null 2>&1
> +}
> +
> +boot_hook_add preinit_mount_root usb_modeswitch
> Index: feeds/packages/utils/usb-modeswitch/Makefile
> ===================================================================
> --- feeds/packages/utils/usb-modeswitch/Makefile      (wersja 30909)
> +++ feeds/packages/utils/usb-modeswitch/Makefile      (kopia robocza)
> @@ -9,7 +9,7 @@
>  
>  PKG_NAME:=usb-modeswitch
>  PKG_VERSION:=1.2.3
> -PKG_RELEASE:=1
> +PKG_RELEASE:=2
>  
>  PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
>  PKG_SOURCE_URL:=http://www.draisberghof.de/usb_modeswitch
> @@ -42,6 +42,8 @@
>       $(INSTALL_BIN) $(PKG_BUILD_DIR)/usb_modeswitch-OpenWrt 
> $(1)/usr/bin/usb_modeswitch
>       $(INSTALL_DIR) $(1)/etc/hotplug.d/usb
>       $(INSTALL_DATA) ./files/modeswitch.hotplug 
> $(1)/etc/hotplug.d/usb/20-modeswitch
> +     $(INSTALL_DIR) $(1)/lib/preinit
> +     $(INSTALL_DATA) ./files/modeswitch.preinit 
> $(1)/lib/preinit/49_usb_modeswitch
>  endef
>  
>  $(eval $(call BuildPackage,usb-modeswitch))
> 
> 

_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to