/pps/qnx/device/<device>_ctrl

Control object for devices

Publishers
Any app
Subscribers
Device publishers (mmcsdpub, usbpub, etc.)

Overview

Applications can send certain commands to a device via its control object, which is named after the raw device (e.g., cd0_ctrl). The command format is as follows:

command::value

You can use a newline character (\n) to separate multiple commands.

Commands for CD control object

Command Values
eject Slot number
enable
  • 0 (stop the disc)
  • 1 (start the disc and read the TOC)
  • 2 (stop the disc and eject, if possible)
  • 3 (load the disc)
initialize Slot number
load Slot number
power_condition
  • 0 (no change)
  • 1 (reserved)
  • 2 (idle; reload standby timer)
  • 3 (standby)
  • 4 (reserved)
  • 5 (sleep)
prevent_media_removal
  • 0 (allow removal)
  • 1 (prevent removal)
reload Slot number
speed
  • 0 (normal)
  • 1 (high)
Note: When the disc is ejected, the drive resumes normal speed.
temperature_simulation
  • 0 (turn off simulation)
  • 1 (turn on simulation)
temperature_state
  • 0 (unknown)
  • 1 (normal)
  • 2 (overtemp)
  • 4 (undertemp)
temperature_value Number of degrees C
unload Slot number

CD control examples

Eject the disk from slot number 1:
echo "eject::1" >> /pps/qnx/device/cd0_ctrl
Turn on temperature simulation, then set the temperature to 80o and the state to normal:
echo "temperature_simulation::1\ntemperature_value::80\n
temperature_state::1"  >> /pps/qnx/device/cd0_ctrl

Command for USB control object

The /pps/device/usb_ctrl object accepts this command:

toggle_port_power::x,y,z

where:
x
Bus number.
y
Device number.
z
Port number.
The numbers for x,y,z can be decimal, hex, or mixed. For example, all three of these forms are valid:
toggle_port_power::0,10,3
toggle_port_power::0x0,0xa,0x3
toggle_port_power::0x0,0xa,15

USB control examples

After starting the usbpub process as usual, enter this command from a terminal:
cat /pps/device/usb_ctrl?wait
Then from a second terminal, enter these commands:
sloginfo -w &
echo toggle_port_power::xx,y,z >> /ramdisk/pps/device/usb_ctrl

The first terminal (cat usb_ctrl?wait) will show the command status and the power result (port_power::on|off) of the command for the specified bus, device, and port.

For example:
# cat usb_ctrl?wait,delta 
@usb_ctrl
port_power::off
@usb_ctrl
port_power::on
@usb_ctrl
cmd_status::0 

A value of 0 for cmd_status means no errors.

Possible error conditions

Here is a subset of possible errors:

Command status Meaning
cmd_status::19 No such device.
port_power::unknown Could not get status of device.
cmd_status::5 Could not set feature. For example, the specified port number is greater than the maximum number of available ports.
cmd_status::48 Not supported. For example, the specified hub doesn't support individual power switching.