Configuring Device Support

This chapter describes how to configure the MME to detect media devices.

Mediastore detection overview

The Media Content Detector (MCD) monitors the appearance and disappearance of paths on your system, and you must have it configured correctly to inform the MME of the insertion, availability, and removal of mediastores. The paths that the MCD monitors are specified in its configuration file (the default file is etc/mcd.conf).

You must also configure the MME's slots table to associate mediastores with the devices that provide them.

For example, for the MME to find USB mediastores, you need to add an entry to the MCD configuration file and add a corresponding entry for every USB device to the slots table. You must have an entry like the following in the MCD configuration file:

[/fs/hdumass*]
Callout= PATH_MEDIA_PROCMGR
Argument= /proc/mount
Priority= 11,10
Start Rule= INSERTED
Stop Rule= EJECTED

The above example tells the MCD to monitor all /fs/hdmass* paths, which include /fs/hdumass10-dos-1 and /fs/hdumass20-dos-1.

For the MME to treat these paths as mediastores, you must add to the slots table an entry with the exact path for each device:

INSERT INTO slots(path,zoneid, name, slottype)
    VALUES('/fs/hdumass10-dos-1', 1, 'USB', 1);
INSERT INTO slots(path,zoneid, name, slottype)
    VALUES('/fs/hdumass20-dos-1', 1, 'USB', 1);

Note: The MCD can use wildcards, but the slots table requires an entry for every device.

Device configuration elements

The table below lists device configuration elements. Device configuration elements are under the elements <Configuration>/<Devices>.

Element Attributes Default Description
<ExternalChanger> enabled false Determine if the MME supports external changers. Set to true to enable external CD changer support.
<InternalChanger> enabled false Determine if the MME supports internal CD changers. Set to true to enable internal CD changer support.
priority 0 Set the absolute priority for the CD changer monitor thread. Its default value is 0: do not set the priority.
<MCD> root /dev/mcd/ See Mediastore detection path below.
insert_active INSERTED
insert_available AVAILABLE
ejection EJECTED
hostpath ""

Note: The configuration element <DeviceDetection> is under the elements <Configuration>/<Database>/<Synchronization>.

Mediastore detection path

The MME monitors the file descriptors provided by the Media Content Detector (mcd) utility for mediastore (device) availability. It needs to know when a mediastore is:

The paths for these file descriptors are defined by the <MCD> element. You can change this element to set:

For example:

<MCD root="/dev/mcd/"
    insert_active="INSERTED"
    insert_available="AVAILABLE"
    ejection="EJECTED"
    hostpath=""/>

Device paths and filesystem mountpaths

The MME can accept the path of a device, a filesystem mountpath or a node path for device detection. The MME resolves the device path to a mountpath and uses that as the path to the media store.

This capability simplifies MCD configuration for the MME, and allows more options for system configuration. The MCD configuration options for the MCD include:

Configuring mediastore monitoring paths

If you have not otherwise configured the MME's mediastore path monitoring, the MME expects to monitor files at the default locations:

If you have configured the mcd utility for other than the default paths, you must configure <MCD> elements in the <Devices> element of the MME's configuration file, where the optional attributes root, insertion, and ejection specify the root path of the three files, the insertion file, the ejection file, and the available file respectively. If any of these optional attributes is missing, the MME uses the default.

To configure mediastore monitoring paths, provide one <MCD> element for each mcd process to be monitored. For example:

<Devices>
    <MCD root="/dev/mcd/" insert_active="INSERTED"
    insert_available="AVAILABLE" ejection="EJECTED"/>

    <MCD root="/dev/mcd2/" insert_active="incoming"
    insert_available="available" ejection="outgoing"/>
	...
</Devices>

Note: File names in the QNX 4 filesystem used by the MME are case sensitive, but you can use upper-case or lower-case letters for your file names: “INSERTED”, “Inserted” and “inserted” are all valid but different file names.

Configuring multi-node support

The MCD offers multi-node support. To enable multi-node support, for each MCD instance on each node on which you want to access mediastores (including the local node running the MME), add an <MCD> element, with the attribute hostpath set to the path for the node you want to access.

Examples 1 to 4 assume that all MCD instances are using the default configuration. To use another MCD configuration, add the appropriate attributes to the <MCD> element for the MCD instance for which you want to change the configuration, as shown in Example 5.

Example 1

To enable access to mediastores only on the remote node “yournode.yourdomain”:

<MCD hostpath="/net/yournode.yourdomain"/>

Example 2

To enable access to mediastores on the remote node “yournode.yourdomain”, and on the local node with the MME:

<MCD hostpath="/net/yournode.yourdomain"/>
<MCD/>

Example 3

To enable access to mediastores on the remote node “yournode.yourdomain”, on “someothernode.otherdomain” with two instances of the MCD, and on the local node with the MME:

<MCD hostpath="/net/yournode.yourdomain"/>
<MCD hostpath="/net/othernode.otherdomain"/>
<MCD root="dev/mcd2/" hostpath="/net/othernode.otherdomain"/>
<MCD/>

Example 4

If you access only local mediastores with one instance of the MCD, you can either omit the <MCD> element, or use one tag with the hostpath attribute set to blank:

<MCD hostpath=""/>

Example 5

To enable access to a mediastores on the remote node “yournode.yourdomain” and on the local node with the MME, and change the configurations for these MCD instances, you might use something like:

<MCD root="/dev/mcd/"
    insert_active="present"
    insert_available="usable"
    ejection="not_present"
    hostpath=""/>

<MCD root="/dev/mcd/"
    insert_active="present"
    insert_available="usable"
    ejection="not_present"
    hostpath="/net/yournode.yourdomain"/>

Configuring the slots table for multi-node support

If you enable multi-node support, to access mediastores you must update the information in the slots table path field to include the full path to all the mediastores (including those on the node with the MME), as this path is resolved by the MCD. For example:

INSERT INTO slots(
    path,zoneid, name, slottype)
    VALUES('/net/yournode.yourdomain/media/drive', 1, 'HardDrive', 3);
INSERT INTO slots(
    path,zoneid, name, slottype)
    VALUES('/net/yournode.yourdomain/fs/usb0', 1, 'USB', 1);
INSERT INTO slots(
    path,zoneid, name, slottype)
    VALUES('/net/yournode.yourdomain/fs/usb1', 1, 'USB', 1);
INSERT INTO slots(
    path,zoneid, name, slottype)
    VALUES('/net/yournode.yourdomain/fs/cd0', 1, 'CD/DVD', 2);
INSERT INTO slots(
    path,zoneid, name, slottype)
    VALUES('/net/yournode.yourdomain/fs/ipod0', 1, 'iPod', 4);
INSERT INTO slots(
    path,zoneid, name, slottype)
    VALUES('/net/yournode.yourdomain/fs/pfs1', 1, 'PlaysForSure', 4);
INSERT INTO slots(
    path,zoneid, name, slottype)
    VALUES('/net/yournode.yourdomain/fs/upnp0', 1, 'UPnP', 4);
INSERT INTO slots(
    path,zoneid, name, slottype)
    VALUES('/dev/wms/player1', 1, 'Bluetooth', 9);

Note: The path assigned to the hostpath attribute does not have a trailing slash (“/”):

Correct: <MCD hostpath="/net/yournode.yourdomain"/>

Incorrect: <MCD hostpath="/net/yournode.yourdomain/"/>


Configuring the mcd utility

Mediastore path monitoring requires that you configure the mcd utility. A default configuration file, mcd.conf, is provided as a starting point. You may make copies of these files and change their contents to meet your system's requirements. Use the mcd config_file option to point the mcd to your configuration file.


Note: The MME Quickstart Guide in Introduction to the MME provides an example of how to use the MCD configuration files.

The rules provided below are examples of rules to include in your MCD configuration file in order to handle different types of mediastore devices.

HDD insertion and removal

This rule may be used to provide insertion and removal events for a hard drive. The name of the folder on the filesystem that is the root of the media storage location for the hard drive should be between the square brackets.

[/media/drive]
Callout     = PATH_MEDIA_SCAN
Argument    = 2000
Priority    = 11,10
Start Rule  = INSERTED
Stop Rule   = EJECTED

Note: The argument is the polling time, in milliseconds. For “permanent” mediastores, you may wish to increase this value.

USB device insertion

This rule may be used to detect USB device insertion and removal.

[/fs/usb*]
Callout		= PATH_MEDIA_PROCMGR
Argument	= /proc/mount
Priority	= 11,10
Start Rule	= INSERTED
Stop Rule	= EJECTED

iPod device insertion

This rule may be used to detect iPod device insertion and removal.

[/fs/ipod*]
Callout     = PATH_MEDIA_PROCMGR
Argument    = /proc/mount
Priority    = 11,10
Start Rule  = INSERTED
Stop Rule   = EJECTED

Internet connection

This rule may be used to detect an internet connection.

[/dev/socket]
Callout     = PATH_MEDIA_PROCMGR
Argument    = /proc/mount
Priority    = 11,10
Start Rule  = INSERTED
Stop Rule   = EJECTED

CD mediastores

For CDs, there are a number of options, depending on system configuration. Two options are shown below.

CD Option 1

This rule is used if the CD's filesystem is mounted by a mechanism other than the MCD. This rule uses the MME's ability to be told about the device path, rather than the mountpath of a media store.

[/dev/cd*]
Callout     = CD_MEDIA_IOBLK
Argument    = 1000,2000
Priority    = 11,9
Start Rule  = INSERTED
Stop Rule   = EJECTED

CD Option 2

These rules are used for a CD if the MCD is needed for mounting and unmounting the CD's filesystem. Note that the MOUNT_FSYS callout requires a configuration file as well.

Please see the MCD documentation for more information on the format of the MOUNT_FSYS configuration file.

[/dev/cd*]
Callout     = CD_MEDIA_IOBLK
Argument    = 1000,2000
Priority    = 11,9
Start Rule  = MOUNT
Stop Rule   = UNMOUNT

[/fs/cd*]
Callout     = PATH_MEDIA_PROCMGR
Argument	= /proc/mount
Priority    = 11,9
Start Rule  = INSERTED
Stop Rule   = EJECTED

[MOUNT]
Callout     = MOUNT_FSYS
Argument    = /dev/shmem/mcd.mnt

[UNMOUNT]
Callout     = UNMOUNT_FSYS

Creating the MCD file for active device insertions

This rule is required in order to create the MCD file that is used for device insertions when the device is active. The default name is shown here; if the default name is not used, the MME's configuration file must be used to tell the MME the correct name.

[INSERTED]

Creating the MCD file for device removals

This rule is required in order to create the MCD file that is used for device ejections. The default name is shown here; if the default name is not used, the MME's configuration file must be used to tell the MME the correct name and path.

[EJECTED]

Creating the MCD file for available (but not active) device insertions

This rule is required in order to create the MCD file that is used for device insertions when the device is available, but not active. The default name is shown here; if the default name is not used, you must use the MME's configuration file to tell the MME the correct name.


Note: Even if this rule is not used, the MME requires that it appear in the MCD configuration file.

[AVAILABLE]

Sample mcd configuration

Below is a sample mcd configuration file. You can copy the contents of this file into a configuration file, then point the mcd utility when you start it. This configuration assumes that /fs/cd* is already mounted.

[/dev/umass*]
Callout     = PATH_MEDIA_PROCMGR
Argument    = /proc/mount
Priority    = 11,10
Start Rule  = MOUNT
Stop Rule   = UNMOUNT

[MOUNT]
Callout     = MOUNT_FSYS
Argument    = /etc/mcd.mnt

[UNMOUNT]
Callout     = UNMOUNT_FSYS

[/media/drive]
Callout     = PATH_MEDIA_SCAN
Argument    = 5000
Priority    = 11,10
Start Rule  = INSERTED
Stop Rule   = EJECTED

[/dev/cd*]
Callout     = CD_MEDIA_IOBLK
Argument    = 1000,2000
Priority    = 11,9
Start Rule  = INSERTED
Stop Rule  = EJECTED

[/fs/usb*]
Callout     = PATH_MEDIA_PROCMGR
Argument    = /proc/mount
Priority    = 11,10
Start Rule  = INSERTED
Stop Rule   = EJECTED

[/fs/ipod*]
Callout     = PATH_MEDIA_PROCMGR
Argument    = /proc/mount
Priority    = 11,10
Start Rule  = INSERTED
Stop Rule   = EJECTED

[/fs/pfs*]
Callout     = PATH_MEDIA_PROCMGR
Argument    = /proc/mount
Priority    = 11,10
Start Rule  = INSERTED
Stop Rule   = EJECTED

[INSERTED]

[EJECTED]

[AVAILABLE]

For more examples, see the MME sample configuration file mcd.conf for the MCD. For more information about the MCD, see mcd in the MME Utilities Reference.


Note: The sample configuration file 2phase.cfg delivered with the MCD does not work for the MME.

Device constants

The table below lists the default settings for the MME's device management constants.

Constant Value Description
CONFIG_DEF_DEVS_INT_CHANGER_ENABLED false Enable internal CD changer support.
CONFIG_DEF_DEVS_EXT_CHANGER_ENABLED false Enable external CD changer support.
CONFIG_DEF_DEVICE_DETECTION true Enable automatic device detection.
CONFIG_DEF_DEVICE_MONITOR_PRIORITY 0 Priority for MCD monitor thread (to detect new devices and mediastores). Set to 0 (zero) to use inherited default priority.
CONFIG_MAX_OUTPUTNAME_LENGTH 1024 Maximum length for name (including path) of output device.

Configuring the slots table for supported devices

You can customize the slots table in the schema (mme.sql) to associate the mediastores in your MME system with the devices that provide them. By default, the hard drive location is defined as:

INSERT INTO slots(path,zoneid, name, concurrency, slottype)
   VALUES('/media/drive', 1, 'HardDrive', 0, 3);

There are similar entries for CD/DVD, USB, PFS, UPnP, and iPod devices, and internet connections. As required, you can change the path or name of a device, or remove a device altogether. To add or modify entries for devices, insert a row with the device information into the slots table, using the example above as a template. To remove a device so that the MME no longer recognizes it, delete the relevant row from the slots table.

Using output devices accessible over Qnet

You can use an audio output device that is accessible over Qnet by specifying the full path to the device in your client application, or by setting the device path in the mme_data.sql. For example, by changing /dev/snd/pcmC0D1p to /net...full path .../dev/snd/pcmC0D1p.