Documentation Home Page RT-LAB Home Page
Pour la documentation en FRANÇAIS, utilisez l'outil de traduction de votre navigateur Chrome, Edge ou Safari. Voir un exemple.

OpJoystick

Library

rtlab/Miscellaneous

Block

This block allows a user to monitor the movements of a given joystick connected to a target computer.

OpJoystick block

Mask


OpJoystick mask

Description

This block allows the user to monitor the movements of a given joystick connected to a target computer. The OpJoystick block supports the features of a specific list of joysticks which can be easily browsed from the mask. The outputs of the block are dynamically modified depending on the actual joystick selection and its features.

The first item of the Joystick device type mask parameter is Generic joystick. When selected, this joystick allows the user to have access to a minimal set of information from an unspecific joystick connected to the target computer. The actual joystick device can therefore be easily changed without having to modifiy the corresponding joystick selection to mimic this modification. This feature does not work under QNX.

Only one joystick per-subsystem is supported.



Note:

  • QNX: Be sure to enable the USB support in the BIOS prior to use the OpJoystick block. The USB device server must be started prior to loading the model on your QNX target. Use the 'devu-uhci' QNX command.
  • Redhawk: Be sure to enable the USB support in the BIOS prior to use the OpJoystick block. The appropriate joystick device driver modules must be 'started' (modprobe) prior to loading the model on your Redhawk target. Please refer to the Concurrent documentation below.


Parameters

Joystick device typeThe list of joystick device type that are supported by this block.
SynchronizeRead joystick value at the beginning of the step.

Inputs

This block has no inputs.

Outputs

The outputs are dynamically created depending on the current joystick selection in the Joystick device type parameter.

A basic set of outputs is supported and available when the Generic joystick device type is selected:

  • the values of the X, Y and Z axis,
  • an array of 4 boolean values corresponding to 4 buttons,

Since the range of the joystick devices output values changes depending on the target Operating System (QNX, Redhawk or Microsoft Windows), the block output values have been standardized to stay in specific ranges.

Output name

Range

X

[-1024, 1023]

Y

[-1024, 1023]

Z

[-32, 31]

Characteristics and Limitations


Direct Feedthrough

No

Discrete sample time

Yes

XHP support

No

Work offline

Yes

Enabling the Joydev Kernel Module

1. As root, change to the RedHawk kernel source tree directory:
# cd /usr/src/linux-2.6.6RedHawk2.2

2. Run the ccur-config script.

Note: a GUI based configuration tool will be invoked by ccur-config - make sure to run under a X11 based session. See the ccur-config(8) for more information. This GUI will be used to enable the joystick driver module. Details on running the GUI session are provided on the next page.

# ./ccur-config -c

Note: Do not use the -c option for building a new kernel; it should only be used for building driver modules.
Autodetected currently running kernel flavor: trace-static
Using configuration: configs/trace-static.config
Make invocation arguments: 'REDHAWKFLAVOR=-trace' <- note this line
Configuring version: 2.6.6-RedHawk-2.2-trace
Backing up existing .config to .config.bak...
Cleaning source tree...
Starting graphical configuration tool... <- See next section for details
Linking vmlinux to /boot/vmlinux-2.6.6-RedHawk-2.2-trace

Note: Be sure to supply 'REDHAWKFLAVOR=-trace' on all subsequent make invocations to build modules for the running kernel.

Configuration complete.

3. Build the newly enabled "joydev.ko" kernel module.
Note: you must include the correct REDHAWKFLAVOR setting on this command - the one specified by the previous ccur-config step. For example, if you had booted the debug kernel, you would specify -debug instead of -trace.

# make REDHAWKFLAVOR=-trace modules
** many lines of output not shown
CC drivers/input/joydev.mod.o
LD [M] drivers/input/joydev.ko
** additional lines of output not shown

4. Install the newly created joystick driver, tell the system about it, and test load it with modprobe.
# cp -rp --parents drivers/input/joydev.ko /lib/modules/`uname -r`/kernel
# depmod -a
# modprobe joydev

5. If there were no problems, create a /etc/rc.modules file to load the module at boot time.

# cat << EOF >> /etc/rc.modules
#! /bin/bash
modprobe joydev
EOF
# chmod +x /etc/rc.modules

Using the Graphical Configuration Tool

When the configuration tool screen displays, select (click) “Input device support” in the left options col­umn. Then select the “Joystick interface” entry in the right column, and press the ‘m’ key to specify building a module - a circle will be painted in the selection box immediately to the left of the Joystick interface text.



Note: You want to select Joystick interface and not the Joysticks entry that occurs later in the column. Also, insure a circle is displayed in the box, and not a checkmark, which specifies joystick support will instead be statically linked into the kernel.



Finally, select the File > Save pulldown to save your changes, followed by File > Exit to exit the configuration tool.

Additional information on RedHawk Linux kernel joystick support may be found in:

  • /usr/src/linux-2.6.6RedHawk2.2/Documentation/input/joystick.txt



OPAL-RT TECHNOLOGIES, Inc. | 1751, rue Richardson, bureau 1060 | Montréal, Québec Canada H3K 1G6 | opal-rt.com | +1 514-935-2323
Follow OPAL-RT: LinkedIn | Facebook | YouTube | X/Twitter