320
edits
Line 529: | Line 529: | ||
[[Writing_Joystick_Code:_Part_1|Writing Joystick Code]] | [[Writing_Joystick_Code:_Part_1|Writing Joystick Code]] | ||
===HID=== | |||
Below is an example of how to build FlightGear, using download_and_compile.sh, with standard joystick disabled and HID enabled: | |||
<syntaxhighlight> | |||
FG_CMAKEARGS='-DENABLE_PLIB_JOYSTICK=OFF -DENABLE_HID_INPUT=ON' ../fgmeta/download_and_compile.sh -j3 FGFS | |||
</syntaxhighlight> | |||
Below is an example of FlightGear (as reported in the Terminal) not being able to read a HID device because of a lack of permissions: | |||
<syntaxhighlight> | |||
27.14 [WARN]:input Can't get abs-axes for /dev/input/js0 | |||
27.14 [WARN]:input Can't get keys for /dev/input/js0 | |||
27.14 [WARN]:input Can't get switches for /dev/input/js0 | |||
27.15 [INFO]:input HID event input starting up | |||
27.16 [WARN]:input Honeycomb Aeronautical Alpha Flight Controls_0: HID: Failed to open:/dev/hidraw0 | |||
27.16 [WARN]:input note on Linux you may need to adjust permissions of the device using UDev rules. | |||
</syntaxhighlight> | |||
Pass the below command to FlightGear in order to enable the above logging. | |||
<syntaxhighlight lang="bash">--log-level=info</syntaxhighlight> | |||
User rules are located at <code>/etc/udev/rules.d</code> Within the folder rules.d, a file can be created with a new rule. We will name it <code>50-hid.rules</code>. Root will be needed in order to create this file, use your favorite method. This new file <code>50-hid.rules</code> will contain the rule below: | |||
<syntaxhighlight lang="bash"> | |||
KERNEL=="hidraw*", GROUP="input", MODE="0660" | |||
</syntaxhighlight> | |||
If the above rule is successful, FlightGear terminal will report something similar to the below: | |||
<syntaxhighlight> | |||
> 155.07 [INFO]:input bytes: 7F 7F 00 00 A0 AA 6A 00 | |||
> 155.07 [INFO]:input Honeycomb Aeronautical Alpha Flight Controls | |||
> FGHIDDeivce received input report:0, len=8 | |||
</syntaxhighlight> | |||
==Compiling == | ==Compiling == |
edits