Tak więc pomijając fakt, że trzeba robić zmiany w pliku gdy nie ma zamontowanego exroot'a (bo ten co edytujemy nie jest przeglądany tylko ten przed włączeniem exroot'a - we flashu) to swithmode wypluwa info:
Looking for target devices ...
No devices in target mode or class found
Looking for default devices ...
No devices in default mode found. Nothing to do. Bye.
root@Gargoyle:/tmp$ cat /proc/bus/usb/devices
T: Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=480 MxCh= 1
B: Alloc= 0/800 us ( 0%), #Int= 0, #Iso= 0
D: Ver= 2.00 Cls=09(hub ) Sub=00 Prot=01 MxPS=64 #Cfgs= 1
P: Vendor=1d6b ProdID=0002 Rev= 2.06
S: Manufacturer=Linux 2.6.32.27 ehci_hcd
S: Product=Atheros AR91xx built-in EHCI controller
S: SerialNumber=ar71xx-ehci
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr= 0mA
I:* If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub
E: Ad=81(I) Atr=03(Int.) MxPS= 4 Ivl=256ms
T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=480 MxCh= 0
D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1
P: Vendor=12d1 ProdID=14fe Rev= 1.02
S: Manufacturer=HUAWEI
S: Product=HUAWEI Mobile
C:* #Ifs= 2 Cfg#= 1 Atr=80 MxPwr=500mA
I:* If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage
E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 1 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage
E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
root@Gargoyle:~$ cat /lib/preinit/50_determine_usb_root
#!/bin/sh
# Copyright (C) 2010 Vertical Communications
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
determine_external_root() {
pi_include /lib/functions/extmount.sh
pi_include /lib/functions/mount.sh
local OLD_UCI_CONFIG_DIR="$UCI_CONFIG_DIR"
set_jffs_mp
determine_root_device
# extroot requires extroot and fstab config files, therefore
# we assume configuration is incomplete and not to be used if either of them
# is missing (for jffs versions of these files on squashfs image)
if [ "$jffs" = "/tmp/overlay" ] && [ -r "/tmp/overlay/etc/config/fstab" ]; then
UCI_CONFIG_DIR="/tmp/overlay/etc/config"
ER_IS_SQUASHFS=true
ER_OVERLAY_PREFIX="/tmp/overlay"
fi
# For squashfs on firstboot root_device will be tmpfs for the ramoverlay,
# unless there is a saved config, in which case it will be /dev/root,
# however in the case of a saved config, it won't be restored until after
# this script, so there won't be a config on the first boot after
# flashing a squashfs-based filesystem
# For ext2, ramdisk, or jffs2 root filesystems root_device is /dev/root
# For squashfs after firstboot, root filesystem is /dev/root
# We only use the config from the root or jffs if the root_device is
# /dev/root
[ "$root_device" = "/dev/root" ] && {
er_load_modules
/usr/bin/usb_modeswitch -v 12d1 -p 14fe -c /etc/usb_modeswitch.d/12d1:14fe > /tmp/plik2.txt
[ -n "$extroot_settle_time" ] && [ "$extroot_settle_time" -gt 0 ] && {
sleep $extroot_settle_time
}
config_load fstab
config_foreach config_mount_by_section mount 1
[ "$rootfs_found" = "1" ] && grep -q ' /overlay ' /proc/mounts && {
pi_extroot_mount_success=true
pi_mount_skip_next=false
}
}
UCI_CONFIG_DIR="$OLD_UCI_CONFIG_DIR"
}
boot_hook_add preinit_mount_root determine_external_root
root@Gargoyle:~$