Device tracking and media information management

The mm-detect service tracks which devices are attached to the QNX CAR system, coordinates the extraction of media information from those devices, and publishes that information for client applications to read.

These tasks are performed in an automated, ongoing procedure. Understanding this procedure is essential if you wish to write a replacement utility for detecting and synchronizing devices or to customize the configuration of mm-detect in your car system.

The mm-detect process performs the following steps:

  1. Command-line parsing

    At startup, mm-detect parses its command-line options, which may define:
    • •  the location of the PPS object used for sending synchronization status updates to the car's HMI
    • •  process metrics (e.g., priority level) and user and group IDs
    • •  the paths of the SQL files defining the schemas and initial data for the multimedia databases
    • •  the directory for storing the multimedia databases
  2. PPS setup

    The mm-detect process creates one PPS object for storing synchronization status updates from all devices. By default, this object's full path is /pps/services/mm-detect/status. If the -p command option was provided to mm-detect, a PPS object named status is created in the directory named by this option's value.

    The device listings directory, which stores the PPS objects that hold device information, is a fixed location (/pps/qnx/mount/) that can't be changed through command options. During startup, mm-detect begins monitoring this directory's contents by issuing an open() call on the special .all object in this directory. By opening the .all object, mm-detect receives notification of any changes to any PPS objects in this directory. We refer to this special object as the PPS devices information object (see PPS devices information object for further details).

    The open() call is executed with the blocking flag set, meaning that the call doesn't return until there's new data from PPS.
  3. Device insertion handling

    When a media device is inserted into the car system, mm-detect reads the new contents of the PPS devices information object to obtain the unique ID and mountpoint of the newly inserted device. The former field is specified as the name of the device's database to the QDB service, which loads that database. The latter field is passed as an argument to a new thread that is created to synchronize the device's media metadata with the device's database.

    For the full details of the actions done by mm-detect in response to device insertions, see Device insertion handling.

    After handling a device insertion, mm-detect issues another open() call to resume monitoring the device listings directory.
  4. Device removal handling

    When a media device is removed from the car system, mm-detect notices the device's information is deleted from the PPS devices information object. The mm-detect service stops any active synchronization of the device's media contents, sends notification of the device's removal to the car's HMI through PPS, and deletes the device's database configuration file, forcing QDB to unload the database.

    For the full details of the actions done by mm-detect in response to device removals, see Device removal handling.

    After handling a device removal, mm-detect issues another open() call to resume monitoring the device listings directory.

The mm-detect service runs continuously, so automated device monitoring and media synchronization will continue until the car system is shut down.