Skip to content

Commit

Permalink
Update the documentation
Browse files Browse the repository at this point in the history
Signed-off-by: Philippe De Swert <philippe.deswert@jollamobile.com>
  • Loading branch information
philippedeswert committed Aug 29, 2013
1 parent 63df18e commit feec661
Showing 1 changed file with 58 additions and 27 deletions.
85 changes: 58 additions & 27 deletions docs/usb_moded-doc.txt
Expand Up @@ -175,6 +175,7 @@ In case you need some program to be started along some mode the appsync option
provides this option.
Only condition is that it can be activated by dbus and that (preferably) it will
notify usb_moded that it is ready by ready_method call on the session bus.
Systemd and upstart are also supported.
This ready method call is just calling the regular usb_moded interface, but now
on the session bus, with as argument the program name as defined in the config file.

Expand All @@ -184,12 +185,28 @@ Best practice would be giving it a descriptive name followed by .ini
For example:
/etc/usb-moded/run/foo.ini

Where foo.ini would be:
Where foo.ini would be for dbus:
[info]
name = foo
mode = foo_mode
launch = com.meego.foo

For systemd it would be as follows:
[info]
name = foo.service
mode = foo_mode
systemd = 1

The name here is the service name used when launching it for example with systemctl

For upstart:
[info]
name = foo
mode = foo_mode
upstart = 1

Here the name is service name used by upstart.

Those files will be read on start and usb_moded will keep a list of apps to launch
for a certain mode. This also means that if you change the files or add/remove some
you need to restart usb_moded. Later when the mode is activated, usb_moded will start
Expand All @@ -200,25 +217,31 @@ that will need kernel support. (Nokia only atm)
Dynamic modes
-------------

Dynamic modes will only work if the appsync feature is enabled, since it is expected
that this will need some special userspace programs. These will be started
through the appsync part and thus need their own config files in the normal appsync dir.

Dynamic modes need to be defined with an ini file also but this time in
Apart from ask and charging_only modes, all modes for usb_moded are defined
within configuration files. These are to be defined with an ini file alsoi, but this time in
/etc/usb-moded/dyn-modes.

The format would be for example for : /etc/usb-moded/dyn-modes/dyn-mode-1.ini

[mode]
name = dyn-mode-1
module = h_dyn-mode
module = dyn-mode-module
appsync = 1
network = 1
network_interface = usb0

Only the mode name and module are mandatory.
[options]
sysfs_path = /* in case you need to echo parameters somewhere in a sysfs path */
sysfs_value = /* the values */
sysfs_reset_value = /* in case a reset value needs to be written */
softconnect_path = /* a path in case the module needs activation with a softconnect option */
softconnect = /* value to be written to enable */
softconneci_disconnect = /* value to be written for disable */

If appsync is not defined or explicitly set to 0 it will not be used.
Only the mode name and module are mandatory. In case you do not use modules, use none as the value
for module (as for the android gadget for example. See the android section for more info)

If appsync or network is not defined, or explicitly set to 0, it will not be used.

Trigger support
---------------
Expand All @@ -238,36 +261,44 @@ udev_subsystem = platform
mode = mass_storage
property = TRIGGER_CMD

Android gadget driver support
-----------------------------

Softconnect support
-------------------
A number of configurations are already supported out of the box for android. They
just need to be installed in the right spot to work.

In some cases gadget drivers are not active by default. (for example with the android gadget driver)
As there is no standard softconnect path, to use this feature it will have to be enabled
in the config file.
In the main configuration file a few extras can be configured for all modes.

[soft_connect]
soft_connect_path = /path/where/softconnect/is
An android extra section in the main configuration file would look like this:

NOTE: It is expected that the value to connect is "connect", and "disconnect" to disconnect.
[android]
iManufacturer = foo-factory
idVendor = 0666 /* this is the vendor id code in hex */
iProduct = awesome-device
idProduct = 0001 /* If you decide to use one Product id for all the supported modes. Not recommended if you will connect it to Windows machines */

Android gadget driver support
-----------------------------

This will need usb_moded to be compiled after being configured with --enable-android
The regular gadget support will not work anymore as the android gadget driver is
supposed to be used built-in. A thusly build usb_moded will be usable on stock
android kernels.
A mode configuration would look like this:

atm only networking mode is fully supported, mass-storage partly.
[mode]
name = developer_mode
module = none
network = 1
network_interface = rndis0

Also note that the softconnect has to be configured!!!
[options]
sysfs_path = /sys/class/android_usb/android0/functions
sysfs_value = rndis
sysfs_reset_value = none
softconnect_path = /sys/class/android_usb/android0/enable
softconnect = 1
softconnec_disconnect = 0
idProduct = 0002

rescue mode
-----------

When started with -r usb_moded will always enable developer mode (networking)
if it can. This is a debug feature and should not be used in a final image.
if it can. This is a debug feature and should not be used in production software.

Turning it off when the device is booted completely can easily be done over dbus.

Expand Down

0 comments on commit feec661

Please sign in to comment.