Control object for devices
When you start usblauncher, the following PPS object is created:
/pps/qnx/device/usb_ctrl
The control object's name also includes the stackno if the usblauncher service is started with the -S option (which allows for multiple server objects, one for each instance of usblauncher). For example, if you issue the following command:
usblauncher –S 1
the USB service creates a PPS object named /pps/qnx/device/usb-1_ctrl.
Applications can send the following commands to the /pps/qnx/device/usb_ctrl object:
Command | Description |
---|---|
port_power | Set a hub's power state. The command takes the form:
port_power::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 one of 0 ("off") or 1 ("on"). |
toggle_port_power | Turn a port's power off and back on after a fixed delay. The command takes the form:
toggle_port_power::busno,devno,portno
The numbers for
busno,devno,portno 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 |
Attribute | Description |
---|---|
port_power | Latest power setting for the port. Values:
|
cmd_status | String giving the errno_number and error condition (see below). |
cat /pps/qnx/device/usb_ctrl?wait
sloginfo -w & echo toggle_port_power::xx,y,z >> /ramdisk/pps/qnx/device/usb_ctrl
The first terminal (cat usb_ctrl?wait) will show the command status and the power result of the command for the specified bus, device, and port.
# cat usb_ctrl?wait,delta @usb_ctrl port_power::0 @usb_ctrl port_power::1 @usb_ctrl cmd_status::0
A value of 0 for cmd_status means no errors.
Here is a subset of possible errors:
Command status | Meaning |
---|---|
cmd_status::19 | No such 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 device isn't a hub. |
If a command isn't recognized, an error message such as the following will be published to stdout or to sloginfo (if usblauncher was started with the -l option):
CMD: unknown cmd_name