Digital Finds

joseph dot reeves at thehumanjourney dot net
@iknowjoseph

USB mode button 0.3

Dec 09, 2008 by Joseph Reeves

Jo had emailed me saying that she was having trouble with USB host mode but had solved the problem by adding lsusb to the script packaged up within the USB mode application. Elsewhere, in the comments for this blog, Bryan DeLuca mentioned the same thing. How bizarre, I thought; I've never had such problems, but it seems I never let my phone suspend.

This ticket says that USB host mode is somehow broken after a suspend/resume operation, but it seems to be fixed if you run lsusb after coming into host mode. I've packaged up a new version that does just that:

http://blogs.thehumanjourney.net/finds/resource/usbmode-button_0.3_armv4t.ipk



The actual meat of which looks something like:


#!/bin/sh
grep -q 'host' /sys/devices/platform/s3c2410-ohci/usb_mode
if [ $? -eq 0 ]
then
echo "0" > /sys/devices/platform/neo1973-pm-host.0/hostmode
echo "device" > /sys/devices/platform/s3c2410-ohci/usb_mode
echo "0" > /sys/devices/platform/gta02-led.0/leds/gta02-power\:blue/brightness
ifconfig usb0 up
echo USB-Port is in device-mode now.
else
ifconfig usb0 down
echo "host" > /sys/devices/platform/s3c2410-ohci/usb_mode
echo "1" > /sys/devices/platform/neo1973-pm-host.0/hostmode
echo "1" > /sys/devices/platform/gta02-led.0/leds/gta02-power\:blue/brightness
lsusb
echo USB-Port is in host-mode now.
fi



If you're in host mode when you go into suspend, you'll need to click the button once to go back to device, then again to get back into a working host mode. I'm sure there must be a better way of doing it, but this works for now.

USB host mode is going to be important for us, as is being able to suspend the FreeRunner; hopefully this bug will be resolved soon.



Comments:

How is this different from http://techiem2.net/index.php?/archives/10-Freerunner-USB-Mode-Control-Program.html ?

Posted by risto h. kurppa on January 10, 2009 at 12:26 AM GMT #

That application has five available modes of USBness. My script has two; either host with power or device with networking.

Oh, and mine lights an LED too ;-)

Posted by Joseph Reeves on January 13, 2009 at 01:03 PM GMT #

Post a Comment:
Comments are closed for this entry.