USB host

From Openmoko

(Difference between revisions)
Jump to: navigation, search
Line 2: Line 2:
 
The Neo1973's mini-usb port can be configured to act as a usb host instead of a usb device. This opens up a range of possibilities, such as usb cameras and usb input devices.
 
The Neo1973's mini-usb port can be configured to act as a usb host instead of a usb device. This opens up a range of possibilities, such as usb cameras and usb input devices.
  
In order to get this working, you need the proper patch. For now, that patch is available [http://bugzilla.openmoko.org/cgi-bin/bugzilla/show_bug.cgi?id=876 as an attachment in Bugzilla].
+
This used to require a kernel patch [http://bugzilla.openmoko.org/cgi-bin/bugzilla/show_bug.cgi?id=876 as an attachment in Bugzilla], but that same page now details how to do this <i>without</i> any kernel hacking:
  
Once you've managed to get a patched kernel onto your openmoko, you just need to tweak a /sys knob to switch to host mode:
+
 
 +
Tell the device that it is logically a host:
  
 
<code>echo "host" > /sys/devices/platform/s3c2410-ohci/usb_mode</code>
 
<code>echo "host" > /sys/devices/platform/s3c2410-ohci/usb_mode</code>
  
Note that you may want to run
 
  
<code>ifconfig usb0 down</code> prior to switching to usb host mode, as the Neo's usb networking may not like having it's usb port disappear. You'll probably want to ssh into your Neo over bluetooth before starting all of this.
+
Instruct the device to provide 5 volts:
 +
 
 +
<code>echo 1 > /sys/devices/platform/neo1973-pm-host.0/hostmode </code>
 +
 
 +
 
 +
Note: This second command failed for me and I was unable to use <code>echo</code> to change the 0 to a 1. Using <code>vi</code>, however, worked as expected.
 +
 
 +
Note: You may want to run <code>ifconfig usb0 down</code> prior to switching to usb host mode, as the Neo's usb networking may not like having it's usb port disappear. You'll probably want to ssh into your Neo over WiFi or Bluetooth before starting all of this, alternatively use an on screen keyboard.
  
 
=== Three-Headed Cable ===
 
=== Three-Headed Cable ===
Line 33: Line 40:
  
 
=== Power Concerns ===
 
=== Power Concerns ===
You'll need to force the Neo to go into fast charge mode, since it can't do its usual power negotation over USB.
+
You'll need to force the Neo to go into fast charge mode, since it can't do its usual power negotiation over USB.
  
 
<code>echo -n "fast_cccv" >  /sys/devices/platform/s3c2410-i2c/i2c-adapter/i2c-0/0-0008/chgmode</code>
 
<code>echo -n "fast_cccv" >  /sys/devices/platform/s3c2410-i2c/i2c-adapter/i2c-0/0-0008/chgmode</code>

Revision as of 15:24, 16 July 2008

Contents

The Neo1973 as a USB host

The Neo1973's mini-usb port can be configured to act as a usb host instead of a usb device. This opens up a range of possibilities, such as usb cameras and usb input devices.

This used to require a kernel patch as an attachment in Bugzilla, but that same page now details how to do this without any kernel hacking:


Tell the device that it is logically a host:

echo "host" > /sys/devices/platform/s3c2410-ohci/usb_mode


Instruct the device to provide 5 volts:

echo 1 > /sys/devices/platform/neo1973-pm-host.0/hostmode


Note: This second command failed for me and I was unable to use echo to change the 0 to a 1. Using vi, however, worked as expected.

Note: You may want to run ifconfig usb0 down prior to switching to usb host mode, as the Neo's usb networking may not like having it's usb port disappear. You'll probably want to ssh into your Neo over WiFi or Bluetooth before starting all of this, alternatively use an on screen keyboard.

Three-Headed Cable

At the moment, you'll have to manufacture this one yourself. You need to make a cable with three ends:

  • A mini-usb type B cable for the Neo itself
  • A cable of whatever type to go to your usb device.
  • A cable going to a +5V voltage source with enough power for your device and to charge the Neo. This could be a wall charger or even another usb plug.

You just connect the Data+ and Data- wires of the Neo and the device, and connect all of the ground wires together and all of the +5V wires together. This powers the Neo and the device, while letting the neo talk to the device.

Just for reference, the USB wires from left to right are:

  • Black: Power -
  • Green: Data -
  • White: Data +
  • Red: Power +

Console

Although you could use a USB keyboard, you may want to have a console while you're doing all of this. You'll probably want to use bluetooth in conjunction with pand to set up bluetooth networking.

See Manually_using_Bluetooth

Power Concerns

You'll need to force the Neo to go into fast charge mode, since it can't do its usual power negotiation over USB.

echo -n "fast_cccv" > /sys/devices/platform/s3c2410-i2c/i2c-adapter/i2c-0/0-0008/chgmode

Personal tools

The Neo1973 as a USB host

The Neo1973's mini-usb port can be configured to act as a usb host instead of a usb device. This opens up a range of possibilities, such as usb cameras and usb input devices.

In order to get this working, you need the proper patch. For now, that patch is available as an attachment in Bugzilla.

Once you've managed to get a patched kernel onto your openmoko, you just need to tweak a /sys knob to switch to host mode:

echo "host" > /sys/devices/platform/s3c2410-ohci/usb_mode

Note that you may want to run

ifconfig usb0 down prior to switching to usb host mode, as the Neo's usb networking may not like having it's usb port disappear. You'll probably want to ssh into your Neo over bluetooth before starting all of this.

Three-Headed Cable

At the moment, you'll have to manufacture this one yourself. You need to make a cable with three ends:

  • A mini-usb type B cable for the Neo itself
  • A cable of whatever type to go to your usb device.
  • A cable going to a +5V voltage source with enough power for your device and to charge the Neo. This could be a wall charger or even another usb plug.

You just connect the Data+ and Data- wires of the Neo and the device, and connect all of the ground wires together and all of the +5V wires together. This powers the Neo and the device, while letting the neo talk to the device.

Just for reference, the USB wires from left to right are:

  • Black: Power -
  • Green: Data -
  • White: Data +
  • Red: Power +

Console

Although you could use a USB keyboard, you may want to have a console while you're doing all of this. You'll probably want to use bluetooth in conjunction with pand to set up bluetooth networking.

See Manually_using_Bluetooth

Power Concerns

You'll need to force the Neo to go into fast charge mode, since it can't do its usual power negotation over USB.

echo -n "fast_cccv" > /sys/devices/platform/s3c2410-i2c/i2c-adapter/i2c-0/0-0008/chgmode