Device control object

Applications can perform actions on USB hardware by writing commands to device control objects. Each usblauncher process creates one of these server PPS objects. By default, the object's path is /pps/qnx/device/usb_ctrl but you can change this path through usblauncher command options.

The stack number is appended to the object name if you run usblauncher with the -S option. For instance, if you issue the command usblauncher -S 1, the service creates a PPS object named usb_ctrl1. You must use this command option to distinguish between control objects if you want to run multiple usblauncher instances and use the same PPS directory for their device control objects.

When usblauncher receives updates (i.e., data from the object), it executes the specified commands. Commands must be written in the following format:


For details on publishing data to PPS objects, refer to the Persistent Publish/Subscribe Developer's Guide. Applications can publish the following to the control object:

Command Description Parameter type and purpose
port_power Set the power state on a port of a USB hub. This command is useful to repower the port if the upstream hub has disabled it (e.g., as a result of an overcurrent condition and you wish to see if the overcurrent condition still applies). A set of integers identifying the device and the desired power state, in the following format: busno,devno,power_state[,portno]

If the optional portno is omitted, then all ports on that hub are controlled by the power level. The power_state can be either 0 ("off") or 1 ("on").

start_stack Start a specific version of the USB stack. There are two versions: the host stack (io-usb) and the device stack (io-usb-dcd). Any current USB stack instance is stopped (if necessary) before the other stack version is started. You can specify none to slay the stack without restarting either version of it. A string identifying the version of the USB stack to start. Can be one of: "host", "device,n", or "none", where n is a one-based index into the descriptors list in the main configuration file.
toggle_port_power Turn a USB port's power off and back on after a fixed delay. This command works only for ports on a USB hub capable of power switching on individual ports. A set of integers identifying the device, in the following format: busno,devno,port
Note: The port_power and toggle_port_power commands aren't meant to be used in cases when the start_stack command is being issued.

When usblauncher executes commands, it publishes device information and command outcomes to the device control object. The usblauncher service can output the following attributes:

Attribute Description Type Example
cmd_status Outcome of the command

An error string in the following format: errno (str_error(errno)).

If the command wasn't recognized, usblauncher doesn't publish a status to this object but instead writes an error message to stdout or sloginfo.

When the command was successful, this field contains: 0 (No error)

If you tried to toggle the port power on a USB device that isn't a hub, this field contains: 48 (Not supported)

port_power Latest power setting for the port whose power is being toggled Integer with one of the following values: 1 (for "on"), 0 (for "off"), or -1 (for "unknown", which means usblauncher couldn't read the power setting). 1