View Single Post
Posts: 2,152 | Thanked: 1,490 times | Joined on Jan 2006 @ Czech Republic
#21
Originally Posted by desiv View Post
If you enable USB hose mode, does the 770 no longer work as a USB client?
yes, until you switch back
Originally Posted by desiv View Post

I found this searching (see, I did search!)
(As root)
command to put it into host mode:
echo host > /sys/devices/platform/tahvo-usb/otg_mode
command to put it into peripheral mode:
echo peripheral > /sys/devices/platform/tahvo-usb/otg_mode
you also need
/etc/init.d/ke-recv stop before and start after to let maemo platform notice the change

here is my dirty and unfinished script, it adds just usb storage functionality, for other (hid,network,serial,..) add additional modules from beginning of /mnt/inifs/linuxrc. the script currently does not remove any modules (they need to be removed in reverse order)
Code:
#!/bin/sh
# use gainroot to become root and relaunch itself
if [ `id -u` != 0 ] ; then
#if not already root, call itself as root
        exec sudo gainroot <<EOF
exec $0 $*
EOF
        exit $?
fi
# real script follows

HOST_MODULES="ohci-hcd scsi_mod sd_mod usb-storage"
MODULE_PATH=/mnt/initfs/lib/modules/current
insert_modules(){
        for mod in $* ; do
                if [ -f $MODULE_PATH/${mod}.ko ]; then
                        insmod $MODULE_PATH/${mod}.ko
                fi
        done
}
remove_modules(){
echo
}

OTG_MODE="/sys/devices/platform/tahvo-usb/otg_mode"

enable_host(){
insert_modules $HOST_MODULES
echo host >${OTG_MODE}
}
disable_host(){
echo peripheral >${OTG_MODE}
remove_modules
}

/etc/init.d/ke-recv stop
mode=$(cat $OTG_MODE)
case $mode in
        host)
                echo "switching host -> client"
                disable_host
                ;;
        peripheral)
                echo "switching client -> host"
                enable_host
                ;;
esac
/etc/init.d/ke-recv start
Originally Posted by desiv View Post
So, do I need to flash (--enable-usb-host-mode) it AND do this, or does the flashing just do that?
No, you don't need to set the flag. It is detected at boot time and linuxrc script just the same switch as above, no other magic involved.

Originally Posted by desiv View Post
Do I use to flasher to enable it so it will boot with support and load drivers and then I can toggle it off and on with the above?
If you want usb host mode as a default and don't want to mess with inserting modules the yes. Otherwise setting the host mode flag is not needed at all.
Originally Posted by desiv View Post
Can I just enable usb host without RD mode?
Yes.


BTW I tried USB host mode only recently when I got external USB enclosure for 2.5" disk. It comes with mini-USB cable with Y-power splitter i.e. one extra usb plug to provide additional power. This cable is enough to have usb host mode working on n770, no other hacking needed. You just need to insert the extra cable to something powered. I have 5V travel charger with usb female socket and it worked just fine. For mobile usage I plan to make pack of 4xAA rechargeables (4*1.2V=~4.8V) with usb female socket.
__________________
Newbies click here before posting. Thanks.

If you really need to PM me with troubleshooting question please consider posting it to the forum instead. It is OK to PM me a link to such post then. Thank you.
 

The Following User Says Thank You to fanoush For This Useful Post: