USB HID Support

From FlightGear wiki
Jump to navigation Jump to search
This article has been nominated for deletion. To discuss it, please visit the talk page.

Do not remove this tag until the discussion is closed.


Reason for the nomination: USB HID is now in the pipeline, so this can probably be deleted


See [1]

Cquote1.png Does FlightGear support Saitek devices like the Switchpanel, Radio Panel, or Multipanel?

If so, do they work out-of-the-box, or what is required to get them running with FlightGear? If not, how difficult would it be to add out-of-the-box support for such devices?


— dg-505 (Fri May 08). Support for Saitek Hardware.
(powered by Instant-Cquotes)
Cquote2.png
Cquote1.png I was wondering if Jetmax would be compatible with flightgear. I know that FSX works with Jetmax, but I was curious to know if flightgear would work too!

http://www.flightdecksolutions.com/jetmax


— Oakview (Wed Jun 17). Jetmax by Flightdeck Solutions.
(powered by Instant-Cquotes)
Cquote2.png

Issue #619

For the full discussion, see: ticket #619

Background

There is a large amount of flight simulation hardware from consumer grade (like Saitek) up to high end. Lately, flight simulation hardware such as avionics replicas have become very affordable, and usage to this systems is not limited to professional users and extreme enthusiasts any more. It is now easy to have e.g. a radio or autopilot module screwed to your yoke jut to make flying a little bit more comfortable and realistic. Additionally, there are many joysticks with additional functions, like dispLays or LEDs. The FG developer community promotes Nasal as opposed to a binary plugin interface for extensions.

An alternative to building a dedicated nasal interface would be to map the USB HID stuff into the property tree using a custom SGSubsystem. Then nasal would have automatic access to the values, as would any 3d object animation, instrument panel animation, data export, etc. See: How to map an API onto the property tree.

The reason for integrating it into the core is because it makes it easier for the developers because they only have to write Nasal code once instead of having to develop a cross-platform middleware with all the impacts, such as actually having to have all platforms available to test on, etc.

At least for Linux and OSX, there is the event-input interface which is capable of accessing many of the HID devices. This interface is (still) experimental but I have been using it for a long time now with all of my home-brew equipment. There is one configuration example in FGDATA/Input/Event/3dconnexion/SpaceNavigator.xml.

Melchior had another idea, please check Input/Joysticks/ThrustMaster/Warthog


Status 07/2013

Cquote1.png At the last FSWeekend, I got a sample radio panel from the Saitek Guys. IIRC, James Turner is/has been working on providing some of the groundwork and we agreed that while he was doing that, I'd put my efforts on getting the device working on hold.[1]
— Durk Talsma
Cquote2.png
Cquote1.png I've done some work on it, and will return to it once 2.12 is shipped.

(My interest is in supporting the GoFlight hardware, which I've purchased several modules of, but it's all USB-HID in the end)

The issue is basically about finishing Torsten Dreyer's event-input code, but also about potentially making that use hidapi (which would greatly simplify the code on the FG side), /if/ I can get the hidapi author to accept a patch adding HID descriptor parsing to the library as an extra.

I've also separately had my GoFlight hardware working on Mac using the existing Mac event-input code, but encountered some issues, to do with the rate we pull data out of IOKit; essentially it's too easy to miss events which for certain inputs on the GoFlight panels (rotary encoders) causes odd behaviours.

So yes, lots of these pieces exist, it needs some integration work and further development after 2.12. Torsten's current code is also incompatible with the

current joystick config XML, which I think probably needs to be addressed in an adapter layer.[2]
— James Turner
Cquote2.png
Cquote1.png I've been in contact with Martin Crompton, who kindly provided me with their Cessna line of controllers to write configuration files for FG with.[3]
— Stuart Buchanan
Cquote2.png
Cquote1.png I've not done any more than write XML config for their Cessna yoke, pedals, trim wheel and throttle quadrant, so we're definitely not

duplicating work.

It would be great if we can support this sort of hardware out-of-the-box, and a good thing for Saitek too I think.[4]
— Stuart Buchanan
Cquote2.png
Cquote1.png we established contact with the folks at Saitek, which may hopefully result in full FlightGear support for their "Pro" line of products. We're still working out the details, but they gave me a copy of their radio stack for play with, and if we get that to work, more stuff may follow. [5]
— Durk Talsma
Cquote2.png
Cquote1.png I also talked to Martin Crompton. James told me later on that you had been in touch with him. My action was rather spontaneous, so I asked him whether we could try to support Saitek products, without me knowing that you were also working on it. I hope we can join forces. I got their radiostack to try, and this looks like it's going to be a little more involved, since it may need its own USB driver.[6]
— Durk Talsma
Cquote2.png
Cquote1.png I had a quick look, and it's going to be tricky to support the part without some docs, since on Windows everything happens through a custom driver. On the other hand, if they support X-plane (they don't mention if they do) they will need something else - their current driver is really an MSFS plug-in I think.[7]
— James Turner
Cquote2.png
Cquote1.png You might want to check out the event input system, I have implemented some time ago. It's much more flexible than our joystick input system as

it handles more events (relative axies e.g.) and is able to send events _to_ the device, too (switching LED's e.g.). Tat implemented this for the OSX, so it should be working there, too. The Windows implementation is still missing, unfortunately. Also, Melchior implemented raw HID communication using Nasal for the Thrustmaster Warthog, but limited to Linux use.

If the Saitek devices don't use HID at all, things will become _very_ tricky and probably impossible to get them running cross platform.[8]
— Torsten Dreyer
Cquote2.png
Cquote1.png for windows, the Saitek products have their own USB driver, so that shouldn't be a problem. Only trick is how to read/write to/from them. [9]
— Durk Talsma
Cquote2.png
Cquote1.png I just plugged in the device, linked the USB device to my virtual Windows 8 box, where it showed up as using two devices. One of them was HID, so I think we're good. [10]
— Durk Talsma
Cquote2.png
Cquote1.png Martin Crompton, my contact at Saitek appears to be very forthcoming in providing me with documentation, etc. We haven't talked about licensing issues jet, but he was very helpful in providing either documentation, additional hardware to test, or even do some work on the more lower level stuff.[11]
— Durk Talsma
Cquote2.png
Cquote1.png It's worth pointing out, whatever work you do, probably also helps support of X-Plane on Linux and Mac, if that is not already supported.[12]
— James Turner
Cquote2.png
Cquote1.png I had wondered whether Saitek might want to bundle FG with their controllers as a matter of course. The cost to them would simply be DVD.[13]
— Stuart Buchanan
Cquote2.png
Cquote1.png I really like the idea of getting Saitek to include a copy of FlightGear with their products. [14]
— geneb
Cquote2.png

Discussions

  1. Durk Talsma (Tue, 09 Jul 2013 12:55:15 -0700). Re: [Flightgear-devel] Saitek radio and multifunction panels.
  2. James Turner (Tue, 09 Jul 2013 15:27:19 -0700). Re: [Flightgear-devel] Saitek radio and multifunction panels.
  3. Stuart Buchanan (Tue, 06 Nov 2012 05:01:11 -0800). Re: [Flightgear-devel] FSWeekend 2012....
  4. Stuart Buchanan (Tue, 06 Nov 2012 15:19:10 -0800). Re: [Flightgear-devel] FSWeekend 2012....
  5. Durk Talsma (Mon, 05 Nov 2012 22:58:57 -0800). Re: [Flightgear-devel] FSWeekend 2012....
  6. Durk Talsma (Tue, 06 Nov 2012 13:17:25 -0800). Re: [Flightgear-devel] FSWeekend 2012....
  7. James Turner (Tue, 06 Nov 2012 14:45:18 -0800). Re: [Flightgear-devel] FSWeekend 2012....
  8. Torsten Dreyer (Thu, 08 Nov 2012 00:55:13 -0800). Re: [Flightgear-devel] FSWeekend 2012....
  9. Durk Talsma (Thu, 08 Nov 2012 01:04:47 -0800). Re: [Flightgear-devel] FSWeekend 2012....
  10. Durk Talsma (Thu, 08 Nov 2012 01:04:47 -0800). Re: [Flightgear-devel] FSWeekend 2012....
  11. Durk Talsma (Thu, 08 Nov 2012 01:04:47 -0800). Re: [Flightgear-devel] FSWeekend 2012....
  12. James Turner (Thu, 08 Nov 2012 01:09:31 -0800). Re: [Flightgear-devel] FSWeekend 2012....
  13. Stuart Buchanan (Tue, 06 Nov 2012 15:19:10 -0800). Re: [Flightgear-devel] FSWeekend 2012....
  14. geneb (Wed, 07 Nov 2012 06:29:04 -0800). Re: [Flightgear-devel] FSWeekend 2012....